Scheb\TwoFactorBundle\Tests\Security\TwoFactor\Provider\Google\GoogleAuthenticatorTest::checkCode_validateCode_returnBoolean PHP Method

checkCode_validateCode_returnBoolean() public method

public checkCode_validateCode_returnBoolean ( $code, $expectedReturnValue )
    public function checkCode_validateCode_returnBoolean($code, $expectedReturnValue)
    {
        //Mock the user object
        $user = $this->createMock('Scheb\\TwoFactorBundle\\Model\\Google\\TwoFactorInterface');
        $user->expects($this->once())->method('getGoogleAuthenticatorSecret')->willReturn('SECRET');
        //Mock the Google class
        $this->google->expects($this->once())->method('checkCode')->with('SECRET', $code)->willReturn($expectedReturnValue);
        $authenticator = $this->createAuthenticator();
        $returnValue = $authenticator->checkCode($user, $code);
        $this->assertEquals($expectedReturnValue, $returnValue);
    }