public function getSuiteByName($suiteName)
{
$nodes = $this->xml->xpath(sprintf('//testsuite[@name="%s"]', $suiteName));
$suites = array();
$excludedPaths = array();
while (list(, $node) = each($nodes)) {
foreach ($this->availableNodes as $nodeName) {
foreach ($node->{$nodeName} as $nodeContent) {
switch ($nodeName) {
case 'exclude':
foreach ($this->getSuitePaths((string) $nodeContent) as $excludedPath) {
$excludedPaths[$excludedPath] = $excludedPath;
}
break;
case 'testsuite':
$suites = array_merge_recursive($suites, $this->getSuiteByName((string) $nodeContent));
break;
case 'directory':
// Replicate behaviour of PHPUnit
// if a directory is included and excluded at the same time, then it is considered included
foreach ($this->getSuitePaths((string) $nodeContent) as $dir) {
if (array_key_exists($dir, $excludedPaths)) {
unset($excludedPaths[$dir]);
}
}
// not breaking on purpose
// not breaking on purpose
default:
foreach ($this->getSuitePaths((string) $nodeContent) as $path) {
$suites[(string) $node['name']][] = new SuitePath($path, $excludedPaths, $nodeContent->attributes()->suffix);
}
break;
}
}
}
}
return $suites;
}