Skip to content

Commit 66144b5

Browse files
committed
- tests updated
1 parent ce70b84 commit 66144b5

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

Tests/Client/ClientTestCaseTrait.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,22 @@ protected function createResource(): \CurlHandle|bool
8686
(string)$response->getBody());
8787
}
8888

89+
public function test_on_exception()
90+
{
91+
$SUT = new class('get', 'http://example.com') extends CurlClient
92+
{
93+
protected function createResource(): \CurlHandle|bool
94+
{
95+
throw new \Exception('Exception message');
96+
}
97+
};
98+
$response = $SUT->read();
99+
100+
$this->assertSame($response->getHeaderLine('Content-type'), 'application/problem+json');
101+
$this->assertSame(StatusCode::INTERNAL_SERVER_ERROR, $response->getStatusCode());
102+
$this->assertStringContainsString('Exception message', (string)$response->getBody());
103+
}
104+
89105
protected function tearDown(): void
90106
{
91107
$this->SUT = null;

0 commit comments

Comments
 (0)