You are here

public function PostTest::sslContextOptionsCallback in reCAPTCHA 6.2

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

File

recaptcha-php/tests/ReCaptcha/RequestMethod/PostTest.php, line 86

Class

PostTest

Namespace

ReCaptcha\RequestMethod

Code

public function sslContextOptionsCallback(array $args) {
  $this->runcount++;
  $this
    ->assertCommonOptions($args);
  $options = stream_context_get_options($args[2]);
  $this
    ->assertArrayHasKey('http', $options);
  $this
    ->assertArrayHasKey('verify_peer', $options['http']);
  $this
    ->assertTrue($options['http']['verify_peer']);
  $key = version_compare(PHP_VERSION, "5.6.0", "<") ? "CN_name" : "peer_name";
  $this
    ->assertArrayHasKey($key, $options['http']);
  $this
    ->assertEquals("www.google.com", $options['http'][$key]);
}