public function ReCaptchaTest::testVerifyOverTimeout in reCAPTCHA 7.2
File
- recaptcha-php/
tests/ ReCaptcha/ ReCaptchaTest.php, line 171
Class
Namespace
ReCaptchaCode
public function testVerifyOverTimeout() {
// Responses come back like 2018-07-31T13:48:41Z
$challengeTs = date('Y-M-d\\TH:i:s\\Z', time() - 600);
$method = $this
->getMockRequestMethod('{"success": true, "challenge_ts": "' . $challengeTs . '"}');
$rc = new ReCaptcha('secret', $method);
$response = $rc
->setChallengeTimeout('60')
->verify('response');
$this
->assertFalse($response
->isSuccess());
$this
->assertEquals(array(
ReCaptcha::E_CHALLENGE_TIMEOUT,
), $response
->getErrorCodes());
}