PathMatcher example

// Create a stub config factory with all config settings that will be     // checked during this test.     $config_factory_stub = $this->getConfigFactoryStub(
      [
        'system.site' => [
          'page.front' => '/dummy',
        ],
      ]
    );
    $route_match = $this->createMock('Drupal\Core\Routing\RouteMatchInterface');
    $this->pathMatcher = new PathMatcher($config_factory_stub$route_match);
  }

  /** * Tests that standard paths works with multiple patterns. * * @dataProvider getMatchPathData */
  public function testMatchPath($patterns$paths) {
    foreach ($paths as $path => $expected_result) {
      $actual_result = $this->pathMatcher->matchPath($path$patterns);
      $this->assertEquals($actual_result$expected_result, "Tried matching the path '$path' to the pattern '$patterns'.");
    }
Home | Imprint | This part of the site doesn't use cookies.