function RouteCompilerTest::testCompilationDefaultValue
Same name in other branches
- 8.9.x core/tests/Drupal/Tests/Core/Routing/RouteCompilerTest.php \Drupal\Tests\Core\Routing\RouteCompilerTest::testCompilationDefaultValue()
- 10 core/tests/Drupal/Tests/Core/Routing/RouteCompilerTest.php \Drupal\Tests\Core\Routing\RouteCompilerTest::testCompilationDefaultValue()
- 11.x core/tests/Drupal/Tests/Core/Routing/RouteCompilerTest.php \Drupal\Tests\Core\Routing\RouteCompilerTest::testCompilationDefaultValue()
Confirms that a compiled route with default values has the correct outline.
File
-
core/
tests/ Drupal/ Tests/ Core/ Routing/ RouteCompilerTest.php, line 67
Class
- RouteCompilerTest
- @coversDefaultClass \Drupal\Core\Routing\RouteCompiler @group Routing
Namespace
Drupal\Tests\Core\RoutingCode
public function testCompilationDefaultValue() {
// Because "here" has a default value, it should not factor into the outline
// or the fitness.
$route = new Route('/test/{something}/more/{here}', [
'here' => 'there',
]);
$route->setOption('compiler_class', RouteCompiler::class);
$compiled = $route->compile();
$this->assertEquals(5, $compiled->getFit(), 'The fit was not correct.');
$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.