onKernelRequest() public method

Sets the default locale based on the request or session.
public onKernelRequest ( GetResponseEvent $event )
$event Symfony\Component\HttpKernel\Event\GetResponseEvent
 /**
  * Tests the onKernelRequest() method with an invalid locale.
  *
  * @expectedException \InvalidArgumentException
  */
 public function testInvalidLocale()
 {
     $kernel = $this->mockKernel();
     $kernel->getContainer()->enterScope(ContaoCoreBundle::SCOPE_FRONTEND);
     $this->listener->setContainer($kernel->getContainer());
     $request = Request::create('/');
     $request->attributes->set('_locale', 'invalid');
     $event = new GetResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST);
     $this->listener->onKernelRequest($event);
 }
 /**
  * Tests the onKernelRequest() method with an invalid locale.
  *
  * @expectedException \InvalidArgumentException
  */
 public function testInvalidLocale()
 {
     $request = Request::create('/');
     $request->attributes->set('_locale', 'invalid');
     $event = new GetResponseEvent($this->mockKernel(), $request, HttpKernelInterface::MASTER_REQUEST);
     $listener = new LocaleListener(['en']);
     $listener->setContainer($this->mockContainerWithContaoScopes(ContaoCoreBundle::SCOPE_FRONTEND));
     $listener->onKernelRequest($event);
 }