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