You are here

public function RouteTest::testPath in Zircon Profile 8.0

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

File

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

Class

RouteTest

Namespace

Symfony\Component\Routing\Tests

Code

public function testPath() {
  $route = new Route('/{foo}');
  $route
    ->setPath('/{bar}');
  $this
    ->assertEquals('/{bar}', $route
    ->getPath(), '->setPath() sets the path');
  $route
    ->setPath('');
  $this
    ->assertEquals('/', $route
    ->getPath(), '->setPath() adds a / at the beginning of the path if needed');
  $route
    ->setPath('bar');
  $this
    ->assertEquals('/bar', $route
    ->getPath(), '->setPath() adds a / at the beginning of the path if needed');
  $this
    ->assertEquals($route, $route
    ->setPath(''), '->setPath() implements a fluent interface');
  $route
    ->setPath('//path');
  $this
    ->assertEquals('/path', $route
    ->getPath(), '->setPath() does not allow two slashes "//" at the beginning of the path as it would be confused with a network path when generating the path from the route');
}