Yaffs site version 1.1
[yaffs-website] / vendor / symfony-cmf / routing / Tests / Routing / LazyRouteCollectionTest.php
1 <?php
2
3 /*
4  * This file is part of the Symfony CMF package.
5  *
6  * (c) 2011-2015 Symfony CMF
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11
12 namespace Symfony\Cmf\Component\Routing;
13
14 use Symfony\Cmf\Component\Routing\Test\CmfUnitTestCase;
15 use Symfony\Component\Routing\Route;
16
17 /**
18  * Tests the lazy route collection.
19  *
20  * @group cmf/routing
21  */
22 class LazyRouteCollectionTest extends CmfUnitTestCase
23 {
24     /**
25      * Tests the iterator without a paged route provider.
26      */
27     public function testGetIterator()
28     {
29         $routeProvider = $this->getMock('Symfony\Cmf\Component\Routing\RouteProviderInterface');
30         $testRoutes = array(
31           'route_1' => new Route('/route-1'),
32           'route_2"' => new Route('/route-2'),
33         );
34         $routeProvider->expects($this->exactly(2))
35             ->method('getRoutesByNames')
36             ->with(null)
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());
41     }
42 }