public function RouteTest::testCompilation

Confirms that a route compiles properly with the necessary data.

File

drupal/core/modules/system/lib/Drupal/system/Tests/Routing/RouteTest.php, line 34
Definition of Drupal\system\Tests\Routing\RouteTest.

Class

RouteTest
Basic tests for the Route.

Namespace

Drupal\system\Tests\Routing

Code

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