Here is a list of commonly used filters for PHPUnit tests for quick lookups:
phpunit ./app | No filter applied, run all test files under the directory ‘./app’ |
phpunit –filter {TestMethodName} | Run all tests with a specific method name |
phpunit –filter {TestMethodName} {FilePath} | A safer approach, run all tests with a specific method name within a particular file |
phpunit –group {TestGroupName} | Run all tests with a specific group name |
How to Create PHPUnit Test Groups?
/**
* @group doggy
*/
public function testSomeDoggyFunctionality() {
$this->assertEquals(xyz(' .a1#2 3f4!', true), ' 12 34');
}
/**
* @group doggy
* @group kitty
* Multiple groups are supported.
*/
public function testSomeKittyFunctionality() {
$this->assertEquals(xyz(' .a1#2 3f4!', true), ' 12 34');
}
JavaScriptReferences
https://stackoverflow.com/questions/26095051/how-to-run-single-test-method-with-phpunit