1 common.test | CommonValidUrlUnitTestCase::testInvalidRelative() |
Test invalid relative URLs.
File
- core/
modules/ simpletest/ tests/ common.test, line 2451 - Tests for common.inc functionality.
Class
- CommonValidUrlUnitTestCase
- Tests URL validation by valid_url().
Code
function testInvalidRelative() {
$invalid_relative_urls = array(
// cspell:disable
'ex^mple',
'example<>',
'ex%ample',
// cspell:enable
);
foreach (array('', '/') as $front) {
foreach ($invalid_relative_urls as $url) {
$test_url = $front . $url;
$valid_url = valid_url($test_url);
$this->assertFALSE($valid_url, format_string('@url is NOT a valid url.', array('@url' => $test_url)));
}
}
}