public function RouteTest::testCompile

File

drupal/core/vendor/symfony/routing/Symfony/Component/Routing/Tests/RouteTest.php, line 184

Class

RouteTest

Namespace

Symfony\Component\Routing\Tests

Code

public function testCompile() {
  $route = new Route('/{foo}');
  $this
    ->assertInstanceOf('Symfony\\Component\\Routing\\CompiledRoute', $compiled = $route
    ->compile(), '->compile() returns a compiled route');
  $this
    ->assertSame($compiled, $route
    ->compile(), '->compile() only compiled the route once if unchanged');
  $route
    ->setRequirement('foo', '.*');
  $this
    ->assertNotSame($compiled, $route
    ->compile(), '->compile() recompiles if the route was modified');
}