Skip to content
This repository has been archived by the owner on Jun 23, 2021. It is now read-only.

Commit

Permalink
III-3528 Fix error handler test
Browse files Browse the repository at this point in the history
  • Loading branch information
LucWollants committed Oct 9, 2020
1 parent bf022de commit 02f00fa
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions tests/ApiErrorHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,12 @@ protected function setUp(): void
parent::setUp();

$this->sentryHub = $this->createMock(HubInterface::class);
$this->uncaughtErrorHandler = new SentryErrorHandler($this->sentryHub);
$this->uncaughtErrorHandler = new SentryErrorHandler(
$this->sentryHub,
null,
null,
false
);
}

/**
Expand All @@ -34,7 +39,7 @@ public function it_creates_api_problem_from_exception()
$this->sentryHub->expects($this->once())
->method('captureException');

$apiProblemResponse = $errorHandler->__invoke($exception);
$apiProblemResponse = $errorHandler->handle($exception);

$this->assertEquals(
'{"title":"Exception message","type":"about:blank","status":500}',
Expand All @@ -54,7 +59,7 @@ public function it_creates_api_problem_with_400_status_if_exception_has_no_statu
$this->sentryHub->expects($this->once())
->method('captureException');

$apiProblemResponse = $errorHandler->__invoke($exception);
$apiProblemResponse = $errorHandler->handle($exception);

$this->assertEquals(
'{"title":"Exception message","type":"about:blank","status":400}',
Expand All @@ -74,7 +79,7 @@ public function it_does_not_capture_404_to_sentry()
$this->sentryHub->expects($this->never())
->method('captureException');

$apiProblemResponse = $errorHandler->__invoke($exception);
$apiProblemResponse = $errorHandler->handle($exception);

$this->assertEquals(
'{"title":"Exception message","type":"about:blank","status":404}',
Expand All @@ -96,7 +101,7 @@ public function it_strips_URL_CALLED_from_api_problem_message_title()
$this->sentryHub->expects($this->once())
->method('captureException');

$apiProblemResponse = $errorHandler->__invoke($exception);
$apiProblemResponse = $errorHandler->handle($exception);

$this->assertEquals(
'{"title":"Exception message ","type":"about:blank","status":400}',
Expand Down

0 comments on commit 02f00fa

Please sign in to comment.