You are here

function DrupalMatchPathTestCase::testDrupalMatchPath in Drupal 7

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

File

modules/simpletest/tests/path.test, line 38
Tests for path.inc.

Class

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

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),
      )));
    }
  }
}