function ValidUrlTestCase::testValidRelative
7.x common.test | ValidUrlTestCase::testValidRelative() |
Test valid relative URLs.
File
- drupal-7.x/
modules/ simpletest/ tests/ common.test, line 1997 - Tests for common.inc functionality.
Class
- ValidUrlTestCase
- Test for valid_url().
Code
function testValidRelative() {
$valid_relative_urls = array(
'paren(the)sis',
'index.html#pagetop',
'index.php?q=node',
'index.php?q=node¶m=false',
'login.php?do=login&style=%23#pagetop',
);
foreach (array('', '/') as $front) {
foreach ($valid_relative_urls as $url) {
$test_url = $front . $url;
$valid_url = valid_url($test_url);
$this->assertTrue($valid_url, format_string('@url is a valid url.', array('@url' => $test_url)));
}
}
}