Skip to content

Commit

Permalink
Add ForbiddenException test
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasDostalDS committed Jul 15, 2024
1 parent 4271cde commit 268ba5c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/DigiSignClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use DateTime;
use DigitalCz\DigiSign\Exception\BadRequestException;
use DigitalCz\DigiSign\Exception\ClientException;
use DigitalCz\DigiSign\Exception\ForbiddenException;
use DigitalCz\DigiSign\Exception\NotFoundException;
use DigitalCz\DigiSign\Exception\RuntimeException;
use DigitalCz\DigiSign\Exception\ServerException;
Expand Down Expand Up @@ -339,6 +340,21 @@ public function testRequestClientException(): void
$client->request('GET', 'https://example.com/api');
}

public function testRequestForbiddenClientException(): void
{
$response = new Response(403);

$httpClient = new Client();
$httpClient->addResponse($response);

$client = new DigiSignClient($httpClient);

$this->expectException(ForbiddenException::class);
$this->expectExceptionMessage('403 Forbidden');

$client->request('GET', 'https://example.com/api');
}

public function testNormalizeJson(): void
{
$httpClient = new Client();
Expand Down

0 comments on commit 268ba5c

Please sign in to comment.