public function testRemoveWithAlreadyBuilderRouteMap() { $route1 = new Route('/route1'); $route2 = new Route('/route2'); $this->collection->add('route1', $route1); $this->collection->add('route2', $route2); // force the route map building $this->assertSame($route1, $this->accessor->getByPath('/route1', [])); $this->accessor->remove('route1'); $this->assertEquals(['route2'], array_keys($this->collection->all())); $this->assertNull($this->accessor->getByPath('/route1', [])); }
/** * Gets the name of the given route. * * @param Route $route * * @return string|null The route name or null when not found */ public function getName(Route $route) { $found = array_search($route, $this->collection->all(), true); return false !== $found ? $found : null; }