You are here

public function ReCaptchaTest::testVerifyReturnsResponse in reCAPTCHA 6.2

Same name and namespace in other branches
  1. 7.2 recaptcha-php/tests/ReCaptcha/ReCaptchaTest.php \ReCaptcha\ReCaptchaTest::testVerifyReturnsResponse()

File

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

Class

ReCaptchaTest

Namespace

ReCaptcha

Code

public function testVerifyReturnsResponse() {
  $method = $this
    ->getMock('\\ReCaptcha\\RequestMethod', array(
    'submit',
  ));
  $method
    ->expects($this
    ->once())
    ->method('submit')
    ->with($this
    ->callback(function ($params) {
    return true;
  }))
    ->will($this
    ->returnValue('{"success": true}'));
  $rc = new ReCaptcha('secret', $method);
  $response = $rc
    ->verify('response');
  $this
    ->assertTrue($response
    ->isSuccess());
}