Warning: You are browsing the documentation for Symfony 2.2, which is no longer maintained.
Read the updated version of this page for Symfony 5.3 (the current stable version).
Table of Contents
Before submitting a patch for inclusion, you need to run the Symfony2 test suite to check that you have not broken anything.
To run the Symfony2 test suite, install PHPUnit 3.6.4 or later first:
$ pear config-set auto_discover 1 $ pear install pear.phpunit.de/PHPUnit
To run the entire test suite, including tests that depend on external
dependencies, Symfony2 needs to be able to autoload them. By default, they are
vendor/ under the main root directory (see
The test suite needs the following third-party libraries:
- Swift Mailer
To install them all, use Composer:
Step 1: Get Composer
curl -s http://getcomposer.org/installer | php
Make sure you download
composer.phar in the same folder where
composer.json file is located.
Step 2: Install vendors
$ php composer.phar --dev install
Note that the script takes some time to finish.
If you don't have
curl installed, you can also just download the
file manually at http://getcomposer.org/installer. Place this file into your
project and then run:
$ php installer $ php composer.phar --dev install
After installation, you can update the vendors to their latest version with the follow command:
$ php composer.phar --dev update
First, update the vendors (see above).
Then, run the test suite from the Symfony2 root directory with the following command:
The output should display
OK. If not, you need to figure out what's going on
and if the tests are broken because of your modifications.
If you want to test a single component type its path after the
$ phpunit src/Symfony/Component/Finder/
Run the test suite before applying your modifications to check that they run fine on your configuration.
If you add a new feature, you also need to check the code coverage by using
$ phpunit --coverage-html=cov/
Check the code coverage by opening the generated
cov/index.html page in a
The code coverage only works if you have Xdebug enabled and all dependencies installed.