You are here

public function ResourceTest::testUriPaths in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/rest/tests/src/Functional/ResourceTest.php \Drupal\Tests\rest\Functional\ResourceTest::testUriPaths()
  2. 10 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 154

Class

ResourceTest
Tests the structure of a REST resource.

Namespace

Drupal\Tests\rest\Functional

Code

public function testUriPaths() {

  /** @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.');
    }
  }
}