Skip to content

Commit fb40a93

Browse files
committed
PHPLIB-656: Ensure isClientError assertions are handled (#825)
1 parent 027134d commit fb40a93

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tests/UnifiedSpecTests/ExpectedError.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use function PHPUnit\Framework\assertIsBool;
2020
use function PHPUnit\Framework\assertIsInt;
2121
use function PHPUnit\Framework\assertIsString;
22+
use function PHPUnit\Framework\assertNotInstanceOf;
2223
use function PHPUnit\Framework\assertNotNull;
2324
use function PHPUnit\Framework\assertNull;
2425
use function PHPUnit\Framework\assertObjectHasAttribute;
@@ -134,6 +135,14 @@ public function assert(Throwable $e = null)
134135

135136
assertNotNull($e);
136137

138+
if (isset($this->isClientError)) {
139+
if ($this->isClientError) {
140+
assertNotInstanceOf(ServerException::class, $e);
141+
} else {
142+
assertInstanceOf(ServerException::class, $e);
143+
}
144+
}
145+
137146
if (isset($this->messageContains)) {
138147
assertStringContainsStringIgnoringCase($this->messageContains, $e->getMessage());
139148
}

0 commit comments

Comments
 (0)