You are here

public function JsonApiSpecTest::providerTestIsValidCustomQueryParameter in JSON:API 8

Same name and namespace in other branches
  1. 8.2 tests/src/Unit/JsonApiSpecTest.php \Drupal\Tests\jsonapi\Unit\JsonApiSpecTest::providerTestIsValidCustomQueryParameter()

Data provider for testIsValidCustomQueryParameter.

File

tests/src/Unit/JsonApiSpecTest.php, line 110

Class

JsonApiSpecTest
@coversDefaultClass \Drupal\jsonapi\JsonApiSpec @group jsonapi

Namespace

Drupal\Tests\jsonapi\Unit

Code

public function providerTestIsValidCustomQueryParameter() {
  $data = $this
    ->providerTestIsValidMemberName();

  // All valid member names are also valid custom query parameters, except for
  // single-character ones.
  $data['single-character'][1] = FALSE;

  // Custom query parameter test cases.
  $data['custom-query-parameter-lowercase'] = [
    'foobar',
    FALSE,
  ];
  $data['custom-query-parameter-dash'] = [
    'foo-bar',
    TRUE,
  ];
  $data['custom-query-parameter-underscore'] = [
    'foo_bar',
    TRUE,
  ];
  $data['custom-query-parameter-camelcase'] = [
    'fooBar',
    TRUE,
  ];
  return $data;
}