You are here

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

File

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

Class

RouteCollectionTest

Namespace

Symfony\Component\Routing\Tests

Code

public function testIterator() {
  $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'));
  $collection
    ->addCollection($collection1);
  $collection
    ->add('last', $last = new Route('/last'));
  $this
    ->assertInstanceOf('\\ArrayIterator', $collection
    ->getIterator());
  $this
    ->assertSame(array(
    'bar' => $bar,
    'foo' => $foo,
    'last' => $last,
  ), $collection
    ->getIterator()
    ->getArrayCopy());
}