You are here

public function PersistedQueriesTest::persistedQueriesDataProvider in GraphQL 8.4

Data provider for testPersistedQueries().

File

tests/src/Kernel/Framework/PersistedQueriesTest.php, line 80

Class

PersistedQueriesTest
Tests the entire query result pipeline when using persisted queries.

Namespace

Drupal\Tests\graphql\Kernel\Framework

Code

public function persistedQueriesDataProvider() : array {
  return [
    // This is the most usual case, all the three plugins are enabled.
    [
      [
        'plugin_one',
        'plugin_two',
        'plugin_three',
      ],
      'query_1',
      [
        'data' => [
          'field_one' => 'this is the field one',
        ],
      ],
    ],
    // Same as previous, but with a different order.
    [
      [
        'plugin_two',
        'plugin_one',
        'plugin_three',
      ],
      'query_1',
      [
        'data' => [
          'field_two' => 'this is the field two',
        ],
      ],
    ],
    // Execute a query that actually exists only in the last plugin.
    [
      [
        'plugin_one',
        'plugin_two',
        'plugin_three',
      ],
      'query_2',
      [
        'data' => [
          'field_three' => [
            'url' => 'https://www.ecosia.org',
            'title' => 'Ecosia',
          ],
        ],
      ],
    ],
  ];
}