| Conditions | 2 |
| Paths | 2 |
| Total Lines | 23 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 15 | public function testPrependRoute() |
||
| 16 | { |
||
| 17 | $collection = new RouteCollection(); |
||
| 18 | foreach ([1, 2] as $key) { |
||
| 19 | $route = new Route(); |
||
| 20 | $route->setName('route' . $key); |
||
| 21 | $collection->addRoute($route); |
||
| 22 | } |
||
| 23 | self::assertCount(2, $collection); |
||
| 24 | |||
| 25 | $allRoutes = $collection->all(); |
||
| 26 | $firstRoute = reset($allRoutes); |
||
| 27 | self::assertInstanceOf(Route::class, $firstRoute); |
||
| 28 | self::assertSame('route1', $firstRoute->getName()); |
||
| 29 | |||
| 30 | $route = new Route(); |
||
| 31 | $route->setName('route3'); |
||
| 32 | $collection->prependRoute($route); |
||
| 33 | |||
| 34 | $allRoutes = $collection->all(); |
||
| 35 | $firstRoute = reset($allRoutes); |
||
| 36 | self::assertSame('route3', $firstRoute->getName()); |
||
| 37 | } |
||
| 38 | } |