You may run single test cases or single test classes from your suites using the --filter cli option:
--filter <pattern> Filter which tests to run.
--filter
runs tests whose name matches the given pattern. The pattern can be either the name of a single test or a regular expression that matches multiple test names.
Example
Take the following example test class BlaTest
containing test cases testSame
and testElse
in file BlaTest.php
:
// BlaTest.php
<?php
class BlaTest extends PHPUnit_Framework_TestCase {
public function testSame() { $this->assertSame(1,1); }
public function testElse() { $this->assertSame(1,1); }
}
Running all test cases within BlaTest
This filter matches the test class name.
$ phpunit --filter BlaTest
Running a single test case within BlaTest
This filter matches the test case name, then indicates to run this filter across file BlaTest.php.
$ phpunit --filter testSame BlaTest.php