diff --git a/tests/run-all.php b/tests/run-all.php index fc8112b5..8a7d7667 100644 --- a/tests/run-all.php +++ b/tests/run-all.php @@ -98,14 +98,19 @@ class TestRunner $testClasses = \Chibi\Util\Reflection::loadClasses($testFiles); - if ($filter !== null) + $classFilter = $filter; + $methodFilter = null; + if ($filter !== null and strpos($filter, '::') !== false) { - $testClasses = array_filter($testClasses, function($className) use ($filter) - { - return stripos($className, $filter) !== false; - }); + list ($classFilter, $methodFilter) = explode('::', $filter); } + if ($classFilter) + $testClasses = array_filter($testClasses, function($className) use ($classFilter) + { + return stripos($className, $classFilter) !== false; + }); + $testFixtures = []; foreach ($testClasses as $class) @@ -119,6 +124,9 @@ class TestRunner $testFixture->methods = []; foreach ($reflectionClass->getMethods() as $method) { + if ($methodFilter and stripos($method->name, $methodFilter) === false) + continue; + if (preg_match('/test/i', $method->name) and $method->isPublic() and $method->getNumberOfParameters() == 0) @@ -126,7 +134,9 @@ class TestRunner $testFixture->methods []= $method; } } - $testFixtures []= $testFixture; + + if (!empty($testFixture->methods)) + $testFixtures []= $testFixture; } return $testFixtures;