public function beginAuthentication(AuthenticationContextInterface $context) { /** @var TwoFactorProviderInterface $provider */ foreach ($this->providers as $providerName => $provider) { if ($provider->beginAuthentication($context)) { $this->flagManager->setBegin($providerName, $context->getToken()); } } }
/** * @test */ public function beginAuthentication_authenticationNotStarted_notSetSessionFlag() { $token = $this->getToken(); $context = $this->getAuthenticationContext($token); //Stub the provider $this->provider->expects($this->any())->method("beginAuthentication")->will($this->returnValue(false)); //Mock the SessionFlagManager $this->flagManager->expects($this->never())->method("setBegin"); $this->registry->beginAuthentication($context); }