function ValidUrlTestCase::testInvalidAbsolute in SimpleTest 7
Test invalid absolute urls.
File
- tests/
common.test, line 1344 - Tests for common.inc functionality.
Class
- ValidUrlTestCase
- Test for valid_url().
Code
function testInvalidAbsolute() {
$url_schemes = array(
'http',
'https',
'ftp',
);
$invalid_ablosule_urls = array(
'',
'ex!ample.com',
'ex%ample.com',
);
foreach ($url_schemes as $scheme) {
foreach ($invalid_ablosule_urls as $url) {
$test_url = $scheme . '://' . $url;
$valid_url = valid_url($test_url, TRUE);
$this
->assertFalse($valid_url, t('@url is NOT a valid url.', array(
'@url' => $test_url,
)));
}
}
}