function it_passes_locale_from_request_to_translatable_listener(TranslatableListener $translatableListener, GetResponseEvent $event, Request $request) { $event->getRequest()->willReturn($request); $request->getLocale()->willReturn('some_locale'); $translatableListener->setLocale('some_locale')->shouldBeCalled(); $this->onKernelRequest($event); }
/** * @param \Symfony\Component\HttpKernel\Event\GetResponseEvent $event */ public function onKernelRequest(GetResponseEvent $event) { $this->translatableListener->setLocale($event->getRequest()->getLocale()); }
function it_sets_locale(Session $session, TranslatableListener $translatableListener) { $session->set('admin-locale', 'pl')->shouldBeCalled(); $translatableListener->setLocale('pl')->shouldBeCalled(); $this->setLocale('pl'); }