Contao\CoreBundle\Test\EventListener\StoreRefererListenerTest::testRefererStoredOnKernelResponse PHP Method

testRefererStoredOnKernelResponse() public method

Tests that the referer is stored upon kernel.response.
public testRefererStoredOnKernelResponse ( string $scope, Request $request, array $currentReferer, array $expectedReferer )
$scope string
$request Symfony\Component\HttpFoundation\Request
$currentReferer array
$expectedReferer array
    public function testRefererStoredOnKernelResponse($scope, Request $request, $currentReferer, $expectedReferer)
    {
        $responseEvent = new FilterResponseEvent($this->mockKernel(), $request, HttpKernelInterface::MASTER_REQUEST, new Response());
        $token = $this->getMock('Contao\\CoreBundle\\Security\\Authentication\\ContaoToken', [], [], '', false);
        $tokenStorage = $this->getMock('Symfony\\Component\\Security\\Core\\Authentication\\Token\\Storage\\TokenStorageInterface');
        $tokenStorage->expects($this->any())->method('getToken')->willReturn($token);
        $container = $this->mockContainerWithContaoScopes($scope);
        // Set the current referer URLs
        $session = $this->mockSession();
        $session->set('referer', $currentReferer);
        $listener = $this->getListener($session, $tokenStorage);
        $listener->setContainer($container);
        $listener->onKernelResponse($responseEvent);
        $this->assertSame($expectedReferer, $session->get('referer'));
    }