public function testFailedAuthenticationWithTolerance() { $this->generator->expects($this->exactly(5))->method('generateCode')->with('fookey', 7, $this->isInstanceOf('DateTime'))->will($this->returnValue('bazcode')); $authenticator = new TimeBasedAuthenticator(2, $this->generator); $this->assertFalse($authenticator->authenticate('fookey', 'barcode', $this->now)); }
/** * @param int $lookAround The tolerance of acceptable time frames. * @param GoogleAuthCodeGenerator $generator The code generator for TOTP algorithm. * @param BlackListInterface $blacklist A blacklist for blocked keys and codes. * @throws \InvalidArgumentException */ public function __construct($lookAround = 1, GoogleAuthCodeGenerator $generator = null, BlackListInterface $blacklist = null) { $generator = $generator ?: new GoogleAuthCodeGenerator(); parent::__construct($lookAround, $generator, $blacklist); }