public function RouteTest::testCompilationDefaultValue

Confirms that a compiled route with default values has the correct outline.

File

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

Class

RouteTest
Basic tests for the Route.

Namespace

Drupal\system\Tests\Routing

Code

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}', array(
    'here' => 'there',
  ));
  $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.');
}