protected function PHPUnit_Framework_TestResult::getHierarchy in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/phpunit/phpunit/src/Framework/TestResult.php \PHPUnit_Framework_TestResult::getHierarchy()
Returns the class hierarchy for a given class.
Parameters
string $className:
bool $asReflectionObjects:
Return value
array
1 call to PHPUnit_Framework_TestResult::getHierarchy()
- PHPUnit_Framework_TestResult::run in vendor/
phpunit/ phpunit/ src/ Framework/ TestResult.php - Runs a TestCase.
File
- vendor/
phpunit/ phpunit/ src/ Framework/ TestResult.php, line 1049
Class
- PHPUnit_Framework_TestResult
- A TestResult collects the results of executing a test case.
Code
protected function getHierarchy($className, $asReflectionObjects = false) {
if ($asReflectionObjects) {
$classes = array(
new ReflectionClass($className),
);
}
else {
$classes = array(
$className,
);
}
$done = false;
while (!$done) {
if ($asReflectionObjects) {
$class = new ReflectionClass($classes[count($classes) - 1]
->getName());
}
else {
$class = new ReflectionClass($classes[count($classes) - 1]);
}
$parent = $class
->getParentClass();
if ($parent !== false) {
if ($asReflectionObjects) {
$classes[] = $parent;
}
else {
$classes[] = $parent
->getName();
}
}
else {
$done = true;
}
}
return $classes;
}