public function testCookiePath()
{
/** @var HttpKernelInterface $kernel */
$kernel = $this->getMockForAbstractClass('Symfony\\Component\\HttpKernel\\Kernel', ['test', false]);
$request = new Request(['toggle_view' => 'desktop']);
$request->attributes->set('_route', 'dummy');
$request->attributes->set('_scope', ContaoCoreBundle::SCOPE_FRONTEND);
$event = new GetResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST);
// Set the base path to /foo/bar
$reflection = new \ReflectionClass($request);
$basePath = $reflection->getProperty('basePath');
$basePath->setAccessible(true);
$basePath->setValue($request, '/foo/bar');
$listener = new ToggleViewListener($this->framework);
$listener->setContainer($this->mockContainerWithContaoScopes(ContaoCoreBundle::SCOPE_FRONTEND));
$listener->onKernelRequest($event);
$this->assertTrue($event->hasResponse());
$cookie = $this->getCookie($event->getResponse());
$this->assertEquals('/foo/bar', $cookie->getPath());
}