You are here

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

File

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

Class

LocaleListenerTest

Namespace

Symfony\Component\HttpKernel\Tests\EventListener

Code

public function testLocaleFromRequestAttribute() {
  $request = Request::create('/');
  session_name('foo');
  $request->cookies
    ->set('foo', 'value');
  $request->attributes
    ->set('_locale', 'es');
  $listener = new LocaleListener('fr', null, $this->requestStack);
  $event = $this
    ->getEvent($request);
  $listener
    ->onKernelRequest($event);
  $this
    ->assertEquals('es', $request
    ->getLocale());
}