You are here

public function RequestTest::providerRequestTypes in OpenAPI 8

Dataprovider for testRequests.

File

tests/src/Functional/RequestTest.php, line 176

Class

RequestTest
Tests requests OpenAPI routes.

Namespace

Drupal\Tests\openapi\Functional

Code

public function providerRequestTypes() {
  $data = [];
  foreach ([
    'rest',
    'jsonapi',
  ] as $api_module) {
    foreach (static::ENTITY_TEST_BUNDLES as $entity_type => $bundles) {
      foreach ($bundles as $bundle) {
        $data[$api_module . ':' . $entity_type . '_' . $bundle] = [
          $api_module,
          [
            'entity_type_id' => $entity_type,
            'bundle_name' => $bundle,
          ],
        ];
      }

      // Test all bundles for entity type.
      $data[$api_module . ':' . $entity_type] = [
        $api_module,
        [
          'entity_type_id' => $entity_type,
        ],
      ];
    }

    // Test all entity types and bundle for module.
    $data[$api_module] = [
      $api_module,
    ];
  }
  return $data;
}