function MatchPathTest::testDrupalMatchPath

Run through our test cases, making sure each one works as expected.

File

drupal/core/modules/system/lib/Drupal/system/Tests/Path/MatchPathTest.php, line 42
Definition of Drupal\system\Tests\Path\MatchPathTest.

Class

MatchPathTest
Unit tests for the drupal_match_path() function in path.inc.

Namespace

Drupal\system\Tests\Path

Code

function testDrupalMatchPath() {

  // Set up our test cases.
  $tests = $this
    ->drupalMatchPathTests();
  foreach ($tests as $patterns => $cases) {
    foreach ($cases as $path => $expected_result) {
      $actual_result = drupal_match_path($path, $patterns);
      $this
        ->assertIdentical($actual_result, $expected_result, format_string('Tried matching the path <code>@path</code> to the pattern <pre>@patterns</pre> - expected @expected, got @actual.', array(
        '@path' => $path,
        '@patterns' => $patterns,
        '@expected' => var_export($expected_result, TRUE),
        '@actual' => var_export($actual_result, TRUE),
      )));
    }
  }
}