You are here

public function LocaleListenerTest::testRouterResetWithParentRequestOnKernelFinishRequest in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/http-kernel/Tests/EventListener/LocaleListenerTest.php \Symfony\Component\HttpKernel\Tests\EventListener\LocaleListenerTest::testRouterResetWithParentRequestOnKernelFinishRequest()

File

vendor/symfony/http-kernel/Tests/EventListener/LocaleListenerTest.php, line 68

Class

LocaleListenerTest

Namespace

Symfony\Component\HttpKernel\Tests\EventListener

Code

public function testRouterResetWithParentRequestOnKernelFinishRequest() {

  // the request context is updated
  $context = $this
    ->getMock('Symfony\\Component\\Routing\\RequestContext');
  $context
    ->expects($this
    ->once())
    ->method('setParameter')
    ->with('_locale', 'es');
  $router = $this
    ->getMock('Symfony\\Component\\Routing\\Router', array(
    'getContext',
  ), array(), '', false);
  $router
    ->expects($this
    ->once())
    ->method('getContext')
    ->will($this
    ->returnValue($context));
  $parentRequest = Request::create('/');
  $parentRequest
    ->setLocale('es');
  $this->requestStack
    ->expects($this
    ->once())
    ->method('getParentRequest')
    ->will($this
    ->returnValue($parentRequest));
  $event = $this
    ->getMock('Symfony\\Component\\HttpKernel\\Event\\FinishRequestEvent', array(), array(), '', false);
  $listener = new LocaleListener('fr', $router, $this->requestStack);
  $listener
    ->onKernelFinishRequest($event);
}