I want to start unit testing my symfony 2 application with phpunit. I installed phpunit using composer (per-project dependancy).
http://www.phpunit.de/manual/current/en/installation.html
How do I now run the phpunit command on Zend Server? I don’t have pear installed.
If you followed the documentation, you have set the
phpunit/phpunitdependency as a ‘dev-dependency’.If you don’t have composer, you need to install it first. This is explained in the documentation: Installation *nix or Installation Windows.
If you already installed composer, it is a good practise to update composer to the latest version by running the
self-updatecommand:After your have done that, you need to install all dependencies, including the dev dependencies. This is done by running the
updatecommand with the--devswitch:All the dependencies are installed in the
vendordirectory. PHPunit runs from the console. Composer automatic put the console files inside thevendor/bindirectory. You need to execute thephpunitfile in there:The
-cswitch tells PHPUnit to look for the configuration file in theappdirectory, Symfony2 already set up the correct configuration to run all tests that are in the<bundle>/Testsdirectory.UPDATE (05-04-2013)
Composer has changed their update/install commands.
updatewill install dev dependencies by default and if you want to install dev dependencies, you need to use the--devoption.UPDATE (11-06-2013)
Composer has changed their commands again, the
installcommand will also install dev dependencies.