You are here

public function PostTest::httpContextOptionsCallback in reCAPTCHA 6.2

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

File

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

Class

PostTest

Namespace

ReCaptcha\RequestMethod

Code

public function httpContextOptionsCallback(array $args) {
  $this->runcount++;
  $this
    ->assertCommonOptions($args);
  $options = stream_context_get_options($args[2]);
  $this
    ->assertArrayHasKey('http', $options);
  $this
    ->assertArrayHasKey('method', $options['http']);
  $this
    ->assertEquals("POST", $options['http']['method']);
  $this
    ->assertArrayHasKey('content', $options['http']);
  $this
    ->assertEquals($this->parameters
    ->toQueryString(), $options['http']['content']);
  $this
    ->assertArrayHasKey('header', $options['http']);
  $headers = array(
    "Content-type: application/x-www-form-urlencoded",
  );
  foreach ($headers as $header) {
    $this
      ->assertContains($header, $options['http']['header']);
  }
}