SampleRouteCollection example

/** * Confirms RouteProvider::getAllRoutes() extracts information correctly from the database. */
  public function testGetAllRoutes() {
    $connection = Database::getConnection();
    $provider = new RouteProvider($connection$this->state, $this->currentPath, $this->cache, $this->pathProcessor, $this->cacheTagsInvalidator, 'test_routes');

    $this->fixtures->createTables($connection);

    $dumper = new MatcherDumper($connection$this->state, $this->logger, 'test_routes');
    $dumper->addRoutes($this->fixtures->SampleRouteCollection());
    $dumper->dump();

    $sample_routes = $this->fixtures->staticSampleRouteCollection();

    $returned_routes = $provider->getAllRoutes();

    $this->assertInstanceOf(\Iterator::class$returned_routes);
    $this->assertSameSize($sample_routes$returned_routes);

    foreach ($returned_routes as $route_name => $route) {
      $this->assertArrayHasKey($route_name$sample_routes);
      
Home | Imprint | This part of the site doesn't use cookies.