function PathMatcherTest::testMatchPath

Same name and namespace in other branches
  1. 9 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()

Test that standard paths works with multiple patterns.

@dataProvider getMatchPathData

File

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

Class

PathMatcherTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Path%21PathMatcher.php/class/PathMatcher/8.9.x" title="Provides a path matcher." class="local">\Drupal\Core\Path\PathMatcher</a> @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.