function RoutePathTest::testPathsStartWithSlash

Same name in other branches
  1. 3.x tests/src/Unit/RoutePathTest.php \Drupal\Tests\examples\Unit\RoutePathTest::testPathsStartWithSlash()

@dataProvider provideYamls

File

tests/src/Unit/RoutePathTest.php, line 42

Class

RoutePathTest
Validate paths for routes.

Namespace

Drupal\Tests\examples\Unit

Code

public function testPathsStartWithSlash($yaml_path) {
    $routes = Yaml::parse(file_get_contents($yaml_path));
    foreach ($routes as $name => $route) {
        if (isset($route['path'])) {
            $this->assertEquals('/', $route['path'][0], "Route {$name} does not start with a slash '/'.");
        }
    }
}