You are here

public function RouteCollectionTest::testAddCollection 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::testAddCollection()

File

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

Class

RouteCollectionTest

Namespace

Symfony\Component\Routing\Tests

Code

public function testAddCollection() {
  $collection = new RouteCollection();
  $collection
    ->add('foo', new Route('/foo'));
  $collection1 = new RouteCollection();
  $collection1
    ->add('bar', $bar = new Route('/bar'));
  $collection1
    ->add('foo', $foo = new Route('/foo-new'));
  $collection2 = new RouteCollection();
  $collection2
    ->add('grandchild', $grandchild = new Route('/grandchild'));
  $collection1
    ->addCollection($collection2);
  $collection
    ->addCollection($collection1);
  $collection
    ->add('last', $last = new Route('/last'));
  $this
    ->assertSame(array(
    'bar' => $bar,
    'foo' => $foo,
    'grandchild' => $grandchild,
    'last' => $last,
  ), $collection
    ->all(), '->addCollection() imports routes of another collection, overrides if necessary and adds them at the end');
}