Scheb\TwoFactorBundle\Tests\Security\TwoFactor\Backup\BackupCodeValidatorTest::checkBackupCode_codeValid_invalidateCode PHP Метод

checkBackupCode_codeValid_invalidateCode() публичный Метод

    public function checkBackupCode_codeValid_invalidateCode()
    {
        //Stub the user
        $user = $this->createUser();
        $user->expects($this->any())->method('isBackupCode')->willReturn(true);
        //Mock code being invalidated
        $user->expects($this->any())->method('invalidateBackupCode')->with('c0de');
        //Mock the persister
        $this->persister->expects($this->any())->method('persist')->with($user);
        $returnValue = $this->validator->checkCode($user, 'c0de');
        $this->assertTrue($returnValue);
    }