complexRouteCollection example

/** * Confirms that we can find routes whose pattern would match the request. */
  public function testOutlinePathMatch() {
    $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->complexRouteCollection());
    $dumper->dump();

    $path = '/path/1/one';

    $request = Request::create($path, 'GET');

    $routes = $provider->getRouteCollectionForRequest($request);

    // All of the matching paths have the correct pattern.     foreach ($routes as $route) {
      $this->assertEquals('/path/%/one', $route->compile()->getPatternOutline(), 'Found path has correct pattern');
    }
Home | Imprint | This part of the site doesn't use cookies.