Skip to content

Commit

Permalink
TestCase: list all possible TestCase class dependencies (nette#378)
Browse files Browse the repository at this point in the history
  • Loading branch information
milo authored and dg committed Mar 1, 2021
1 parent cf1d7eb commit 31db6cb
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/Framework/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,22 @@ private function sendMethodList(array $methods): void
echo "\n";
echo 'TestCase:' . static::class . "\n";
echo 'Method:' . implode("\nMethod:", $methods) . "\n";

$dependentFiles = [];
$reflections = [new \ReflectionObject($this)];
while (count($reflections)) {
$rc = array_shift($reflections);
$dependentFiles[$rc->getFileName()] = 1;

if ($rpc = $rc->getParentClass()) {
$reflections[] = $rpc;
}

foreach ($rc->getTraits() as $rt) {
$reflections[] = $rt;
}
}
echo 'Dependency:' . implode("\nDependency:", array_keys($dependentFiles)) . "\n";
}
}

Expand Down

0 comments on commit 31db6cb

Please sign in to comment.