4 * This file is part of the Symfony CMF package.
6 * (c) 2011-2015 Symfony CMF
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Cmf\Component\Routing;
14 use Symfony\Cmf\Component\Routing\Test\CmfUnitTestCase;
15 use Symfony\Component\Routing\Route;
18 * Tests the lazy route collection.
22 class LazyRouteCollectionTest extends CmfUnitTestCase
25 * Tests the iterator without a paged route provider.
27 public function testGetIterator()
29 $routeProvider = $this->getMock('Symfony\Cmf\Component\Routing\RouteProviderInterface');
31 'route_1' => new Route('/route-1'),
32 'route_2"' => new Route('/route-2'),
34 $routeProvider->expects($this->exactly(2))
35 ->method('getRoutesByNames')
37 ->will($this->returnValue($testRoutes));
38 $lazyRouteCollection = new LazyRouteCollection($routeProvider);
39 $this->assertEquals($testRoutes, iterator_to_array($lazyRouteCollection->getIterator()));
40 $this->assertEquals($testRoutes, $lazyRouteCollection->all());