How to separate Unit and Functional Tests in Symfony2? How to separate Unit and Functional Tests in Symfony2? symfony symfony

How to separate Unit and Functional Tests in Symfony2?


You can go for two configuration files - one for functional and one for unit tests. Then you can run your unit tests separately from functional. You want your unit tests to run as quickly as possible or otherwise nobody's gonna run them at development time, so this approach works quite well.

phpunit -c app/phpunit.xmlphpunit -c app/phpunit_functional.xml

The directory structures we used:

src/Namespace/Bundle/Tests/Unit/src/Namespace/Bundle/Tests/Functional/

The second way is to have one configuration file and run phpunit --testsuite unit.