Skip to content

Commit

Permalink
Only run isBeforeClassMethod(), isBeforeMethod(), isAfterMethod(), an…
Browse files Browse the repository at this point in the history
…d isAfterClassMethod() on likely candidates
  • Loading branch information
sebastianbergmann committed Nov 8, 2018
1 parent 6d4aa0d commit 9bba2c9
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Util/Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
namespace PHPUnit\Util;

use PharIo\Version\VersionConstraintParser;
use PHPUnit\Framework\Assert;
use PHPUnit\Framework\CodeCoverageException;
use PHPUnit\Framework\Exception;
use PHPUnit\Framework\InvalidCoversTargetException;
Expand Down Expand Up @@ -706,6 +707,14 @@ public static function getHookMethods(string $className): array
$class = new ReflectionClass($className);

foreach ($class->getMethods() as $method) {
if ($method->getDeclaringClass()->getName() === Assert::class) {
continue;
}

if ($method->getDeclaringClass()->getName() === TestCase::class) {
continue;
}

if (self::isBeforeClassMethod($method)) {
\array_unshift(
self::$hookMethods[$className]['beforeClass'],
Expand Down

0 comments on commit 9bba2c9

Please sign in to comment.