You are here

public function RouteCompilerTest::testCompilation in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 60
Contains \Drupal\Tests\Core\Routing\RouteCompilerTest.

Class

RouteCompilerTest
@coversDefaultClass \Drupal\Core\Routing\RouteCompiler @group Routing

Namespace

Drupal\Tests\Core\Routing

Code

public function testCompilation() {
  $route = new Route('/test/{something}/more');
  $route
    ->setOption('compiler_class', 'Drupal\\Core\\Routing\\RouteCompiler');
  $compiled = $route
    ->compile();
  $this
    ->assertEquals($compiled
    ->getFit(), 5, 'The fit was incorrect.');
  $this
    ->assertEquals($compiled
    ->getPatternOutline(), '/test/%/more', 'The pattern outline was not correct.');
}