public function beginAuthentication(AuthenticationContextInterface $context) { // Check if user can do email authentication $user = $context->getUser(); return $user instanceof TwoFactorInterface && $user->getGoogleAuthenticatorSecret(); }
/** * @test */ public function beginAuthentication_interfaceNotImplemented_returnFalse() { $user = new \stdClass(); //Any class without TwoFactorInterface $context = $this->getAuthenticationContext($user); $returnValue = $this->provider->beginAuthentication($context); $this->assertFalse($returnValue); }