You are here

class RequestParametersTest in reCAPTCHA 6.2

Same name and namespace in other branches
  1. 7.2 recaptcha-php/tests/ReCaptcha/RequestParametersTest.php \ReCaptcha\RequestParametersTest

Hierarchy

Expanded class hierarchy of RequestParametersTest

File

recaptcha-php/tests/ReCaptcha/RequestParametersTest.php, line 29

Namespace

ReCaptcha
View source
class RequestParametersTest extends \PHPUnit_Framework_TestCase {
  public function provideValidData() {
    return array(
      array(
        'SECRET',
        'RESPONSE',
        'REMOTEIP',
        'VERSION',
        array(
          'secret' => 'SECRET',
          'response' => 'RESPONSE',
          'remoteip' => 'REMOTEIP',
          'version' => 'VERSION',
        ),
        'secret=SECRET&response=RESPONSE&remoteip=REMOTEIP&version=VERSION',
      ),
      array(
        'SECRET',
        'RESPONSE',
        null,
        null,
        array(
          'secret' => 'SECRET',
          'response' => 'RESPONSE',
        ),
        'secret=SECRET&response=RESPONSE',
      ),
    );
  }

  /**
   * @dataProvider provideValidData
   */
  public function testToArray($secret, $response, $remoteIp, $version, $expectedArray, $expectedQuery) {
    $params = new RequestParameters($secret, $response, $remoteIp, $version);
    $this
      ->assertEquals($params
      ->toArray(), $expectedArray);
  }

  /**
   * @dataProvider provideValidData
   */
  public function testToQueryString($secret, $response, $remoteIp, $version, $expectedArray, $expectedQuery) {
    $params = new RequestParameters($secret, $response, $remoteIp, $version);
    $this
      ->assertEquals($params
      ->toQueryString(), $expectedQuery);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
RequestParametersTest::provideValidData public function
RequestParametersTest::testToArray public function @dataProvider provideValidData
RequestParametersTest::testToQueryString public function @dataProvider provideValidData