public function PostTest::httpContextOptionsCallback in reCAPTCHA 7.2
Same name and namespace in other branches
- 6.2 recaptcha-php/tests/ReCaptcha/RequestMethod/PostTest.php \ReCaptcha\RequestMethod\PostTest::httpContextOptionsCallback()
File
- recaptcha-php/
tests/ ReCaptcha/ RequestMethod/ PostTest.php, line 91
Class
Namespace
ReCaptcha\RequestMethodCode
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']);
}
}