You are here

public function ResourceTest::testUriPaths in Drupal 10

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