Skip to content

Commit

Permalink
[core] fix error in error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
shish committed Jan 11, 2024
1 parent 36388aa commit acd3abc
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions core/testcase.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,12 +208,12 @@ protected function assertException(string $type, callable $function): \Exception
$exception = $e;
}

if(is_a($exception, $type)) {
self::assertThat($exception, new \PHPUnit\Framework\Constraint\Exception($type));
return $exception;
} else {
throw $exception;
}
self::assertThat(
$exception,
new \PHPUnit\Framework\Constraint\Exception($type),
"Expected exception of type $type, but got " . ($exception ? get_class($exception) : "none")
);
return $exception;
}

// user things
Expand Down

0 comments on commit acd3abc

Please sign in to comment.