sponsor Vim development Vim logo Vim Book Ad

PHPUnit QF : Run PHPUnit tests from within vim and put the errors into the quickfix list.

 script karma  Rating 6/3, Downloaded by 1931  Comments, bugs, improvements  Vim wiki

created by
Jon Cairns
script type
PHPUnit runner for Vim

PHPUnitQf is a plugin for Vim that allows you to run PHPUnit tests easily from the Vim window. It then reads the output and puts the errors into the quickfix list, so you can easily jump to them. It's configurable too, so if you use a PHPUnit wrapper command or have a special set of arguments, then that's no problem.

How to use

In a Vim window, run:

:Test <args>
Where <args> are passed directly to the PHPUnit command. To set up a custom PHPUnit command see the configuration section below. You can also set default arguments which will always be passed.


By default, the command used to run PHPUnit is phpunit, but you can change it in your vimrc file with:

let g:phpunit_cmd = "/usr/bin/mytest"
To pass arguments to the command, use:

let g:phpunit_args = "--configuration /path/to/config"
You can also specify arguments to be placed after the "dynamic" argument (the argument passed when running from within Vim):

let g:phpunit_args_append = "--repeat"
The output is written to a temporary file. You can change the location of this (default value is /tmp/vim_phpunit.out) with:

let g:phpunit_tmpfile = "/my/new/tmp/file"


The source code is hosted at Github: https://github.com/joonty/vim-phpunitqf


This plugin is released under the MIT License.
install details
Installation is easy-peasy if you're using Vundle. Just add this to your .vimrc file:

Bundle 'joonty/vim-phpunitqf.git'
and run vim +BundleInstall +qall from a terminal.

If you aren't using vundle, you will have to extract the files in each folder to the correct folder in .vim/.

Note: your vim installation must be compiled with python for this plugin to work.

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
phpunitqf-0.3.tar.gz 0.3 2012-05-22 7.0 Jon Cairns Added support for callbacks, to allow for dynamic argument modification.
phpunitqf-0.2.tar.gz 0.2 2012-05-08 6.0 Jon Cairns Fixed a couple of nasty bugs with line matching and error log persistence
phpunitqf-0.1.tar.gz 0.1 2012-05-08 6.0 Jon Cairns Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
Vim at Github