public function testListenerSkipIfNoUserOnKernelResponse(AnonymousToken $noUserReturn = null)
{
$responseEvent = new FilterResponseEvent($this->mockKernel(), new Request(), HttpKernelInterface::MASTER_REQUEST, new Response());
$session = $this->getMock('Symfony\\Component\\HttpFoundation\\Session\\SessionInterface');
$session->expects($this->never())->method('getBag');
$tokenStorage = $this->getMock('Symfony\\Component\\Security\\Core\\Authentication\\Token\\Storage\\TokenStorageInterface');
$tokenStorage->expects($this->once())->method('getToken')->willReturn($noUserReturn);
$connection = $this->getMock('Doctrine\\DBAL\\Connection', [], [], '', false);
$connection->expects($this->never())->method('prepare');
$connection->expects($this->never())->method('execute');
$listener = $this->getListener($session, $connection, $tokenStorage);
$listener->setContainer($this->mockContainerWithContaoScopes(ContaoCoreBundle::SCOPE_BACKEND));
$listener->onKernelResponse($responseEvent);
}