Skip to content

Commit

Permalink
Fix CI after bad cherrypick in 6d57173
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean85 committed Jun 1, 2018
1 parent 8a9cdfe commit af3a623
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public function __construct(
$this->authorizationChecker = $authorizationChecker;
$this->eventDispatcher = $dispatcher;
$this->client = $client;
$this->requestStack = $requestStack;
$this->skipCapture = $skipCapture;
}

Expand Down
5 changes: 3 additions & 2 deletions test/DependencyInjection/SentryExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -640,8 +640,9 @@ private function getContainer(array $options = array())
$mockEventDispatcher = $this
->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');

$mockRequestStack = $this
->createMock('Symfony\Component\HttpFoundation\RequestStack');
$mockRequestStack = $this->getMockBuilder('Symfony\Component\HttpFoundation\RequestStack')
->disableOriginalConstructor()
->getMock();

$containerBuilder->set('request_stack', $mockRequestStack);
$containerBuilder->set('event_dispatcher', $mockEventDispatcher);
Expand Down
19 changes: 13 additions & 6 deletions test/EventListener/ExceptionListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Sentry\SentryBundle\SentrySymfonyEvents;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\Security\Core\Authorization\Voter\AuthenticatedVoter;

Expand Down Expand Up @@ -35,6 +35,7 @@ class ExceptionListenerTest extends \PHPUnit_Framework_TestCase
/** @var EventDispatcherInterface|\PHPUnit_Framework_MockObject_MockObject */
private $mockEventDispatcher;

/** @var RequestStack|\PHPUnit_Framework_MockObject_MockObject */
private $mockRequestStack;

public function setUp()
Expand All @@ -59,7 +60,7 @@ public function setUp()
->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface')
;

$this->$mockRequestStack = $this
$this->mockRequestStack = $this
->getMock('Symfony\Component\HttpFoundation\RequestStack')
;

Expand Down Expand Up @@ -496,7 +497,9 @@ public function test_that_username_is_set_from_user_interface_if_token_present_a

public function test_that_ip_is_set_from_request_stack()
{
$mockToken = $this->createMock(TokenInterface::class);
$mockToken = $this->getMockBuilder('Symfony\Component\Security\Core\Authentication\Token\TokenInterface')
->disableOriginalConstructor()
->getMock();

$mockToken
->method('getUser')
Expand All @@ -506,9 +509,13 @@ public function test_that_ip_is_set_from_request_stack()
->method('isAuthenticated')
->willReturn(true);

$mockEvent = $this->createMock(GetResponseEvent::class);
$mockEvent = $this->getMockBuilder('Symfony\Component\HttpKernel\Event\GetResponseEvent')
->disableOriginalConstructor()
->getMock();

$mockRequest = $this->createMock(Request::class);
$mockRequest = $this->getMockBuilder('Symfony\Component\HttpFoundation\Request')
->disableOriginalConstructor()
->getMock();

$mockRequest
->method('getClientIp')
Expand All @@ -535,7 +542,7 @@ public function test_that_ip_is_set_from_request_stack()
$this->mockSentryClient
->expects($this->once())
->method('set_user_data')
->with($this->identicalTo('some_user'), null, ['ip_address' => '1.2.3.4']);
->with($this->identicalTo('some_user'), null, array('ip_address' => '1.2.3.4'));

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

0 comments on commit af3a623

Please sign in to comment.