Skip to content

Commit

Permalink
there doesn't seem to be a way for reflection to fail here, so removi…
Browse files Browse the repository at this point in the history
…ng try catch
  • Loading branch information
Idrinth authored and sebastianbergmann committed Jul 7, 2018
1 parent 7e68764 commit 3f8c69c
Showing 1 changed file with 9 additions and 14 deletions.
23 changes: 9 additions & 14 deletions src/Framework/TestResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -814,24 +814,19 @@ public function run(Test $test): void
} elseif ($this->beStrictAboutTestsThatDoNotTestAnything &&
!$test->doesNotPerformAssertions() &&
$test->getNumAssertions() == 0) {
try {
$reflected = new \ReflectionClass($test);
$name = $test->getName(false);
$reflected = new \ReflectionClass($test);
$name = $test->getName(false);

if ($name && $reflected->hasMethod($name)) {
$reflected = $reflected->getMethod($name);
}
$message = \sprintf(
"This test did not perform any assertions\n\n%s:%d",
$reflected->getFileName(),
$reflected->getStartLine()
);
} catch (\ReflectionException $exception) {
$message = 'This test did not perform any assertions';
if ($name && $reflected->hasMethod($name)) {
$reflected = $reflected->getMethod($name);
}
$this->addFailure(
$test,
new RiskyTestError($message),
new RiskyTestError(\sprintf(
"This test did not perform any assertions\n\n%s:%d",
$reflected->getFileName(),
$reflected->getStartLine()
)),
$time
);
} elseif ($this->beStrictAboutTestsThatDoNotTestAnything &&
Expand Down

0 comments on commit 3f8c69c

Please sign in to comment.