You are here

function ValidUrlTestCase::testInvalidRelative in SimpleTest 7

Test invalid relative urls.

File

tests/common.test, line 1385
Tests for common.inc functionality.

Class

ValidUrlTestCase
Test for valid_url().

Code

function testInvalidRelative() {
  $invalid_relative_urls = array(
    'ex^mple',
    'example<>',
    'ex%ample',
  );
  foreach (array(
    '',
    '/',
  ) as $front) {
    foreach ($invalid_relative_urls as $url) {
      $test_url = $front . $url;
      $valid_url = valid_url($test_url);
      $this
        ->assertFALSE($valid_url, t('@url is NOT a valid url.', array(
        '@url' => $test_url,
      )));
    }
  }
}