private TokenStorage
$tokenStorage;
private InMemoryUserProvider
$userProvider;
private MockObject&UserCheckerInterface
$userChecker;
private MockObject&AccessDecisionManagerInterface
$accessDecisionManager;
private Request
$request;
private RequestEvent
$event;
protected function setUp(): void
{ $this->tokenStorage =
new TokenStorage();
$this->userProvider =
new InMemoryUserProvider(['kuba' =>
[]]);
$this->userChecker =
$this->
createMock(UserCheckerInterface::
class);
$this->accessDecisionManager =
$this->
createMock(AccessDecisionManagerInterface::
class);
$this->request =
new Request();
$this->event =
new RequestEvent($this->
createMock(HttpKernelInterface::
class),
$this->request, HttpKernelInterface::MAIN_REQUEST
);
} public function testFirewallNameIsRequired() { $this->
expectException(\InvalidArgumentException::
class);
$this->
expectExceptionMessage('$firewallName must not be empty'
);
new SwitchUserListener($this->tokenStorage,
$this->userProvider,
$this->userChecker, '',
$this->accessDecisionManager
);
}