Contao\CoreBundle\Test\EventListener\UserSessionListenerTest::testSessionStoredOnKernelResponse PHP Method

testSessionStoredOnKernelResponse() public method

Tests that the session is stored upon kernel.response.
public testSessionStoredOnKernelResponse ( string $scope, string $userClass, string $userTable )
$scope string
$userClass string
$userTable string
    public function testSessionStoredOnKernelResponse($scope, $userClass, $userTable)
    {
        $responseEvent = new FilterResponseEvent($this->mockKernel(), new Request(), HttpKernelInterface::MASTER_REQUEST, new Response());
        $connection = $this->getMock('Doctrine\\DBAL\\Connection', ['update'], [], '', false);
        $connection->expects($this->once())->method('update');
        $user = $this->getMockBuilder($userClass)->setMethods(['__get'])->getMock();
        $user->expects($this->any())->method('getTable')->willReturn($userTable);
        $token = $this->getMock('Contao\\CoreBundle\\Security\\Authentication\\ContaoToken', [], [], '', false);
        $token->expects($this->any())->method('getUser')->willReturn($user);
        $tokenStorage = $this->getMock('Symfony\\Component\\Security\\Core\\Authentication\\Token\\Storage\\TokenStorageInterface');
        $tokenStorage->expects($this->any())->method('getToken')->willReturn($token);
        $listener = $this->getListener($this->mockSession(), $connection, $tokenStorage);
        $listener->setContainer($this->mockContainerWithContaoScopes($scope));
        $listener->onKernelResponse($responseEvent);
    }