public function CurlPostTest::testSubmit in reCAPTCHA 7.2
Same name and namespace in other branches
- 6.2 recaptcha-php/tests/ReCaptcha/RequestMethod/CurlPostTest.php \ReCaptcha\RequestMethod\CurlPostTest::testSubmit()
File
- recaptcha-php/
tests/ ReCaptcha/ RequestMethod/ CurlPostTest.php, line 44
Class
Namespace
ReCaptcha\RequestMethodCode
public function testSubmit() {
$curl = $this
->getMockBuilder(\ReCaptcha\RequestMethod\Curl::class)
->disableOriginalConstructor()
->setMethods(array(
'init',
'setoptArray',
'exec',
'close',
))
->getMock();
$curl
->expects($this
->once())
->method('init')
->willReturn(new \stdClass());
$curl
->expects($this
->once())
->method('setoptArray')
->willReturn(true);
$curl
->expects($this
->once())
->method('exec')
->willReturn('RESPONSEBODY');
$curl
->expects($this
->once())
->method('close');
$pc = new CurlPost($curl);
$response = $pc
->submit(new RequestParameters("secret", "response"));
$this
->assertEquals('RESPONSEBODY', $response);
}