LazyRouteCollection example

$name = $pair[0];
      $route = $pair[1];
      $collection->add($name$route);
    }
    return $collection;
  }

  /** * {@inheritdoc} */
  public function getRouteCollection(): RouteCollection {
    return new LazyRouteCollection($this->routeProvider);
  }

  /** * This method is intentionally not implemented. * * Use Drupal\Core\Url instead. * * @see https://www.drupal.org/node/2820197 * * @throws \BadMethodCallException */
  


  /** * @covers ::getIterator * @covers ::all */
  public function testGetIterator() {
    $this->routeProvider->expects($this->exactly(2))
      ->method('getRoutesByNames')
      ->with(NULL)
      ->willReturn($this->testRoutes);
    $lazyRouteCollection = new LazyRouteCollection($this->routeProvider);
    $this->assertEquals($this->testRoutes, (array) $lazyRouteCollection->getIterator());
    $this->assertEquals($this->testRoutes, $lazyRouteCollection->all());
  }

  /** * @covers ::count */
  public function testCount() {
    $this->routeProvider
      ->method('getRoutesByNames')
      ->with(NULL)
      
Home | Imprint | This part of the site doesn't use cookies.