You are here

public function PathMatcherTest::testMatchPath in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Path/PathMatcherTest.php \Drupal\Tests\Core\Path\PathMatcherTest::testMatchPath()
  2. 9 core/tests/Drupal/Tests/Core/Path/PathMatcherTest.php \Drupal\Tests\Core\Path\PathMatcherTest::testMatchPath()

Tests that standard paths works with multiple patterns.

@dataProvider getMatchPathData

File

core/tests/Drupal/Tests/Core/Path/PathMatcherTest.php, line 43

Class

PathMatcherTest
@coversDefaultClass \Drupal\Core\Path\PathMatcher @group Path

Namespace

Drupal\Tests\Core\Path

Code

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}'.");
  }
}