function ValidUrlTestCase::testValidRelative in SimpleTest 7
Test valid relative urls.
File
- tests/
common.test, line 1364 - 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, t('@url is a valid url.', array(
'@url' => $test_url,
)));
}
}
}