You are here

public function LazyRouteCollectionTest::testGetIterator in Drupal 9

@covers ::getIterator @covers ::all

File

core/tests/Drupal/Tests/Core/Routing/LazyRouteCollectionTest.php, line 48

Class

LazyRouteCollectionTest
@coversDefaultClass \Drupal\Core\Routing\LazyRouteCollection

Namespace

Drupal\Tests\Core\Routing

Code

public function testGetIterator() {
  $this->routeProvider
    ->expects($this
    ->exactly(2))
    ->method('getRoutesByNames')
    ->with(NULL)
    ->will($this
    ->returnValue($this->testRoutes));
  $lazyRouteCollection = new LazyRouteCollection($this->routeProvider);
  $this
    ->assertEquals($this->testRoutes, iterator_to_array($lazyRouteCollection
    ->getIterator()));
  $this
    ->assertEquals($this->testRoutes, $lazyRouteCollection
    ->all());
}