I want to separate my tests in unit and integration tests and have an abstract TestCase class for each, e.g. UnitTestCase and IntegrationTestCase.

Is there a nice way to run only those tests that extend UnitTestCase without giving a @group unit annotation to each of these test classes?

The phpunit documentation is very sparse when describing subclassing. Also a google search didn't turn up any useful results.

1 Answers

Sebastian Bergmann On Best Solutions

No. Either use the @group annotation for this or, better IMO, have a tests/unit directory for unit tests as well as a tests/integration directory for integration tests and then define two test suites in phpunit.xml. By default, both will be run. Using --testsuite you can then filter based on the test suite name.