function ResourceTest::testUriPaths

Same name and namespace in other branches
  1. 9 core/modules/rest/tests/src/Functional/ResourceTest.php \Drupal\Tests\rest\Functional\ResourceTest::testUriPaths()
  2. 8.9.x core/modules/rest/tests/src/Functional/ResourceTest.php \Drupal\Tests\rest\Functional\ResourceTest::testUriPaths()
  3. 11.x core/modules/rest/tests/src/Functional/ResourceTest.php \Drupal\Tests\rest\Functional\ResourceTest::testUriPaths()

Tests that resource URI paths are formatted properly.

File

core/modules/rest/tests/src/Functional/ResourceTest.php, line 155

Class

ResourceTest
Tests the structure of a REST resource.

Namespace

Drupal\Tests\rest\Functional

Code

public function testUriPaths() : void {
  /** @var \Drupal\rest\Plugin\Type\ResourcePluginManager $manager */
  $manager = \Drupal::service('plugin.manager.rest');
  foreach ($manager->getDefinitions() as $resource => $definition) {
    foreach ($definition['uri_paths'] as $key => $uri_path) {
      $this->assertStringNotContainsString('//', $uri_path, 'The resource URI path does not have duplicate slashes.');
    }
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.