You are here

public function CurlPostTest::testSubmit in reCAPTCHA 6.2

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

File

recaptcha-php/tests/ReCaptcha/RequestMethod/CurlPostTest.php, line 43

Class

CurlPostTest

Namespace

ReCaptcha\RequestMethod

Code

public function testSubmit() {
  $curl = $this
    ->getMock('\\ReCaptcha\\RequestMethod\\Curl', array(
    'init',
    'setoptArray',
    'exec',
    'close',
  ));
  $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);
}