From acd3abcc7741623851acba5e07a84a6ca14283b0 Mon Sep 17 00:00:00 2001 From: Shish Date: Thu, 11 Jan 2024 10:19:38 +0000 Subject: [PATCH] [core] fix error in error handling --- core/testcase.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/testcase.php b/core/testcase.php index 5e0fcc550..146298ef1 100644 --- a/core/testcase.php +++ b/core/testcase.php @@ -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