You are here

public function LocaleListenerTest::testLocaleSetForRoutingContext 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::testLocaleSetForRoutingContext()

File

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

Class

LocaleListenerTest

Namespace

Symfony\Component\HttpKernel\Tests\EventListener

Code

public function testLocaleSetForRoutingContext() {

  // 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));
  $request = Request::create('/');
  $request->attributes
    ->set('_locale', 'es');
  $listener = new LocaleListener('fr', $router, $this->requestStack);
  $listener
    ->onKernelRequest($this
    ->getEvent($request));
}