function RouteCompilerTest::testCompilation
Same name and namespace in other branches
- 9 core/tests/Drupal/Tests/Core/Routing/RouteCompilerTest.php \Drupal\Tests\Core\Routing\RouteCompilerTest::testCompilation()
- 8.9.x core/tests/Drupal/Tests/Core/Routing/RouteCompilerTest.php \Drupal\Tests\Core\Routing\RouteCompilerTest::testCompilation()
- 10 core/tests/Drupal/Tests/Core/Routing/RouteCompilerTest.php \Drupal\Tests\Core\Routing\RouteCompilerTest::testCompilation()
Confirms that a route compiles properly with the necessary data.
File
-
core/
tests/ Drupal/ Tests/ Core/ Routing/ RouteCompilerTest.php, line 57
Class
- RouteCompilerTest
- @coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Routing%21RouteCompiler.php/class/RouteCompiler/11.x" title="Compiler to generate derived information from a Route necessary for matching." class="local">\Drupal\Core\Routing\RouteCompiler</a> @group Routing
Namespace
Drupal\Tests\Core\RoutingCode
public function testCompilation() : void {
$route = new Route('/test/{something}/more');
$route->setOption('compiler_class', RouteCompiler::class);
$compiled = $route->compile();
$this->assertEquals(5, $compiled->getFit(), 'The fit was incorrect.');
$this->assertEquals('/test/%/more', $compiled->getPatternOutline(), 'The pattern outline was not correct.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.