Skip to content

Commit 8d64f41

Browse files
author
Alexander Obuhovich
committed
Merge pull request php-annotations#104 from benesch/fail-php-exceptions
Fail test cases when a PHP error occurs after a successful check
2 parents b6a32ca + cc0defa commit 8d64f41

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

test/lib/xTest.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,6 @@ public function run(xTestRunner $testRunner)
120120

121121
}
122122

123-
if (is_null($this->result) && !(($exception instanceof xTestException) && $exception->getCode() == xTestException::FAIL)) {
124-
$this->result = (string)$exception;
125-
}
126-
127123
$count++;
128124

129125
if ($this->result === true) {
@@ -155,6 +151,9 @@ public function run(xTestRunner $testRunner)
155151
private function assertException(\Exception $e = null)
156152
{
157153
if (!is_string($this->expectedException)) {
154+
if ($e && !(($e instanceof xTestException) && $e->getCode() == xTestException::FAIL)) {
155+
$this->result = (string)$e;
156+
}
158157
return;
159158
}
160159

0 commit comments

Comments
 (0)