You are here

public function ReCaptchaTest::testVerifyWithinTimeout in reCAPTCHA 7.2

File

recaptcha-php/tests/ReCaptcha/ReCaptchaTest.php, line 161

Class

ReCaptchaTest

Namespace

ReCaptcha

Code

public function testVerifyWithinTimeout() {

  // Responses come back like 2018-07-31T13:48:41Z
  $challengeTs = date('Y-M-d\\TH:i:s\\Z', time());
  $method = $this
    ->getMockRequestMethod('{"success": true, "challenge_ts": "' . $challengeTs . '"}');
  $rc = new ReCaptcha('secret', $method);
  $response = $rc
    ->setChallengeTimeout('1000')
    ->verify('response');
  $this
    ->assertTrue($response
    ->isSuccess());
}