Skip to content

Commit

Permalink
Merge pull request #81 from getsentry/improve-pr78
Browse files Browse the repository at this point in the history
Add regression test and changelog entry about #78
  • Loading branch information
Jean85 authored Oct 24, 2017
2 parents 008479a + e538969 commit c190587
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Fixed
- Remove usage of create_function to avoid deprecations (#71)
- Fix a possible bug that could make Sentry crash if an error is triggered before loading a console command
- Fix a fatal error when the user token is not authenticated (#78)
### Removed
- Drop deprecated fields from configuration; the same options can be used (since 0.8.3) under `sentry.options`
- Dropped the third argument from the `SentrySymfonyClient` constructor; `error_types` are now fetched from the second argument, the options array
Expand Down
26 changes: 26 additions & 0 deletions test/EventListener/ExceptionListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,32 @@ public function test_that_username_is_set_from_user_interface_if_token_present_a
$listener->onKernelRequest($mockEvent);
}

public function test_regression_with_unauthenticated_user_token_PR_78()
{
$mockToken = $this->createMock(TokenInterface::class);
$mockToken
->method('isAuthenticated')
->willReturn(false)
;

$mockEvent = $this->createMock(GetResponseEvent::class);

$mockEvent
->expects($this->once())
->method('getRequestType')
->willReturn(HttpKernelInterface::MASTER_REQUEST)
;

$this->mockTokenStorage
->method('getToken')
->willReturn($mockToken)
;

$this->containerBuilder->compile();
$listener = $this->containerBuilder->get('sentry.exception_listener');
$listener->onKernelRequest($mockEvent);
}

public function test_that_it_does_not_report_http_exception_if_included_in_capture_skip()
{
$mockEvent = $this->createMock(GetResponseForExceptionEvent::class);
Expand Down

0 comments on commit c190587

Please sign in to comment.