You are here

public function RouteTest::testRequirement in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/symfony/routing/Tests/RouteTest.php \Symfony\Component\Routing\Tests\RouteTest::testRequirement()

File

vendor/symfony/routing/Tests/RouteTest.php, line 115

Class

RouteTest

Namespace

Symfony\Component\Routing\Tests

Code

public function testRequirement() {
  $route = new Route('/{foo}');
  $this
    ->assertFalse($route
    ->hasRequirement('foo'), '->hasRequirement() return false if requirement is not set');
  $route
    ->setRequirement('foo', '^\\d+$');
  $this
    ->assertEquals('\\d+', $route
    ->getRequirement('foo'), '->setRequirement() removes ^ and $ from the path');
  $this
    ->assertTrue($route
    ->hasRequirement('foo'), '->hasRequirement() return true if requirement is set');
}