function PathMatcherTest::testMatchPath

Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Path/PathMatcherTest.php \Drupal\Tests\Core\Path\PathMatcherTest::testMatchPath()
  2. 10 core/tests/Drupal/Tests/Core/Path/PathMatcherTest.php \Drupal\Tests\Core\Path\PathMatcherTest::testMatchPath()
  3. 11.x 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}'.");
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.