You are here

public function ReCaptchaTest::testVerifyHostnameMisMatch in reCAPTCHA 7.2

File

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

Class

ReCaptchaTest

Namespace

ReCaptcha

Code

public function testVerifyHostnameMisMatch() {
  $method = $this
    ->getMockRequestMethod('{"success": true, "hostname": "host.NOTname"}');
  $rc = new ReCaptcha('secret', $method);
  $response = $rc
    ->setExpectedHostname('host.name')
    ->verify('response');
  $this
    ->assertFalse($response
    ->isSuccess());
  $this
    ->assertEquals(array(
    ReCaptcha::E_HOSTNAME_MISMATCH,
  ), $response
    ->getErrorCodes());
}