Skip to content

Commit af3a623

Browse files
committed
Fix CI after bad cherrypick in 6d57173
1 parent 8a9cdfe commit af3a623

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

src/Sentry/SentryBundle/EventListener/ExceptionListener.php

+1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ public function __construct(
6767
$this->authorizationChecker = $authorizationChecker;
6868
$this->eventDispatcher = $dispatcher;
6969
$this->client = $client;
70+
$this->requestStack = $requestStack;
7071
$this->skipCapture = $skipCapture;
7172
}
7273

test/DependencyInjection/SentryExtensionTest.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -640,8 +640,9 @@ private function getContainer(array $options = array())
640640
$mockEventDispatcher = $this
641641
->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
642642

643-
$mockRequestStack = $this
644-
->createMock('Symfony\Component\HttpFoundation\RequestStack');
643+
$mockRequestStack = $this->getMockBuilder('Symfony\Component\HttpFoundation\RequestStack')
644+
->disableOriginalConstructor()
645+
->getMock();
645646

646647
$containerBuilder->set('request_stack', $mockRequestStack);
647648
$containerBuilder->set('event_dispatcher', $mockEventDispatcher);

test/EventListener/ExceptionListenerTest.php

+13-6
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use Sentry\SentryBundle\SentrySymfonyEvents;
77
use Symfony\Component\DependencyInjection\ContainerBuilder;
88
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
9-
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
9+
use Symfony\Component\HttpFoundation\RequestStack;
1010
use Symfony\Component\HttpKernel\HttpKernelInterface;
1111
use Symfony\Component\Security\Core\Authorization\Voter\AuthenticatedVoter;
1212

@@ -35,6 +35,7 @@ class ExceptionListenerTest extends \PHPUnit_Framework_TestCase
3535
/** @var EventDispatcherInterface|\PHPUnit_Framework_MockObject_MockObject */
3636
private $mockEventDispatcher;
3737

38+
/** @var RequestStack|\PHPUnit_Framework_MockObject_MockObject */
3839
private $mockRequestStack;
3940

4041
public function setUp()
@@ -59,7 +60,7 @@ public function setUp()
5960
->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface')
6061
;
6162

62-
$this->$mockRequestStack = $this
63+
$this->mockRequestStack = $this
6364
->getMock('Symfony\Component\HttpFoundation\RequestStack')
6465
;
6566

@@ -496,7 +497,9 @@ public function test_that_username_is_set_from_user_interface_if_token_present_a
496497

497498
public function test_that_ip_is_set_from_request_stack()
498499
{
499-
$mockToken = $this->createMock(TokenInterface::class);
500+
$mockToken = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')
501+
->disableOriginalConstructor()
502+
->getMock();
500503

501504
$mockToken
502505
->method('getUser')
@@ -506,9 +509,13 @@ public function test_that_ip_is_set_from_request_stack()
506509
->method('isAuthenticated')
507510
->willReturn(true);
508511

509-
$mockEvent = $this->createMock(GetResponseEvent::class);
512+
$mockEvent = $this->getMockBuilder('Symfony\Component\HttpKernel\Event\GetResponseEvent')
513+
->disableOriginalConstructor()
514+
->getMock();
510515

511-
$mockRequest = $this->createMock(Request::class);
516+
$mockRequest = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')
517+
->disableOriginalConstructor()
518+
->getMock();
512519

513520
$mockRequest
514521
->method('getClientIp')
@@ -535,7 +542,7 @@ public function test_that_ip_is_set_from_request_stack()
535542
$this->mockSentryClient
536543
->expects($this->once())
537544
->method('set_user_data')
538-
->with($this->identicalTo('some_user'), null, ['ip_address' => '1.2.3.4']);
545+
->with($this->identicalTo('some_user'), null, array('ip_address' => '1.2.3.4'));
539546

540547
$this->containerBuilder->compile();
541548
$listener = $this->containerBuilder->get('sentry.exception_listener');

0 commit comments

Comments
 (0)