function it_sets_locale_to_locale_manager(GetResponseEvent $event, Request $request, LocaleManager $localeManager) { $event->getRequest()->willReturn($request); $request->get('locale')->willReturn('pl'); $localeManager->setLocale('pl')->shouldBeCalled(); $this->onKernelRequest($event); }
/** * @param GetResponseEvent $event */ public function onKernelRequest(GetResponseEvent $event) { if ($locale = $event->getRequest()->get('locale')) { $this->localeManager->setLocale($locale); } }