Find all testcases recursively from a testsuite list.
array $suite: The list of testcases contained in the PHPUnit XML.
array A list of all testcases.
function simpletest_phpunit_find_testcases($suite) {
$testcases = array();
foreach ($suite as $testcase) {
// Beside from being 'testcases', it could be also a group of testcases.
// This happens if you use a data provider in the phpunit tests.
if ($testcase
->getName() === 'testcase') {
$testcases[] = $testcase;
}
elseif (isset($testcase->testcase) && (int) $testcase
->attributes()->tests > 0) {
foreach ($testcase->testcase as $childtestcase) {
$testcases[] = $childtestcase;
}
}
}
return $testcases;
}