You are here

public function RouteCollectionTest::testGet in Zircon Profile 8

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

File

vendor/symfony/routing/Tests/RouteCollectionTest.php, line 202

Class

RouteCollectionTest

Namespace

Symfony\Component\Routing\Tests

Code

public function testGet() {
  $collection1 = new RouteCollection();
  $collection1
    ->add('a', $a = new Route('/a'));
  $collection2 = new RouteCollection();
  $collection2
    ->add('b', $b = new Route('/b'));
  $collection1
    ->addCollection($collection2);
  $collection1
    ->add('$péß^a|', $c = new Route('/special'));
  $this
    ->assertSame($b, $collection1
    ->get('b'), '->get() returns correct route in child collection');
  $this
    ->assertSame($c, $collection1
    ->get('$péß^a|'), '->get() can handle special characters');
  $this
    ->assertNull($collection2
    ->get('a'), '->get() does not return the route defined in parent collection');
  $this
    ->assertNull($collection1
    ->get('non-existent'), '->get() returns null when route does not exist');
  $this
    ->assertNull($collection1
    ->get(0), '->get() does not disclose internal child RouteCollection');
}