You are here

public function ResponseTest::provideJson in reCAPTCHA 7.2

Same name and namespace in other branches
  1. 6.2 recaptcha-php/tests/ReCaptcha/ResponseTest.php \ReCaptcha\ResponseTest::provideJson()

File

recaptcha-php/tests/ReCaptcha/ResponseTest.php, line 49

Class

ResponseTest

Namespace

ReCaptcha

Code

public function provideJson() {
  return array(
    array(
      '{"success": true}',
      true,
      array(),
      null,
      null,
      null,
      null,
      null,
    ),
    array(
      '{"success": true, "hostname": "google.com"}',
      true,
      array(),
      'google.com',
      null,
      null,
      null,
      null,
    ),
    array(
      '{"success": false, "error-codes": ["test"]}',
      false,
      array(
        'test',
      ),
      null,
      null,
      null,
      null,
      null,
    ),
    array(
      '{"success": false, "error-codes": ["test"], "hostname": "google.com"}',
      false,
      array(
        'test',
      ),
      'google.com',
      null,
      null,
      null,
      null,
    ),
    array(
      '{"success": false, "error-codes": ["test"], "hostname": "google.com", "challenge_ts": "timestamp", "apk_package_name": "apk", "score": "0.5", "action": "action"}',
      false,
      array(
        'test',
      ),
      'google.com',
      'timestamp',
      'apk',
      0.5,
      'action',
    ),
    array(
      '{"success": true, "error-codes": ["test"]}',
      true,
      array(),
      null,
      null,
      null,
      null,
      null,
    ),
    array(
      '{"success": true, "error-codes": ["test"], "hostname": "google.com"}',
      true,
      array(),
      'google.com',
      null,
      null,
      null,
      null,
    ),
    array(
      '{"success": false}',
      false,
      array(
        ReCaptcha::E_UNKNOWN_ERROR,
      ),
      null,
      null,
      null,
      null,
      null,
    ),
    array(
      '{"success": false, "hostname": "google.com"}',
      false,
      array(
        ReCaptcha::E_UNKNOWN_ERROR,
      ),
      'google.com',
      null,
      null,
      null,
      null,
    ),
    array(
      'BAD JSON',
      false,
      array(
        ReCaptcha::E_INVALID_JSON,
      ),
      null,
      null,
      null,
      null,
      null,
    ),
  );
}