class LocaleAwareListenerTest extends TestCase
{ private LocaleAwareListener
$listener;
private MockObject&LocaleAwareInterface
$localeAwareService;
private RequestStack
$requestStack;
protected function setUp(): void
{ $this->localeAwareService =
$this->
createMock(LocaleAwareInterface::
class);
$this->requestStack =
new RequestStack();
$this->listener =
new LocaleAwareListener(new \
ArrayIterator([$this->localeAwareService
]),
$this->requestStack
);
} public function testLocaleIsSetInOnKernelRequest() { $this->localeAwareService
->
expects($this->
once()) ->
method('setLocale'
) ->
with($this->
equalTo('fr'
));
$event =
new RequestEvent($this->
createMock(HttpKernelInterface::
class),
$this->
createRequest('fr'
), HttpKernelInterface::MAIN_REQUEST
);
$this->listener->
onKernelRequest($event);
}