1 link.validate.test LinkValidateUnitTest::testInvalidExternalLinks()

File

core/modules/link/tests/link.validate.test, line 235
Tests that exercise the validation functions in the link module.

Class

LinkValidateUnitTest
A series of tests of links, only going against the link_validate_url function in link.module.

Code

function testInvalidExternalLinks() {
  $links = array(
    'http://www.ex ample.com/',
    'http://@www.example.com/',
    'http://username:@www.example.com/',
    'http://25.0.0/', // Bad ip!
    'http://4827.0.0.2/',
    '//www.example.com/',
    'http://www.-fudge.com/', // Domains can't have sections starting with a dash.
  );
  foreach ($links as $link) {
    $valid = link_validate_url($link);
    $this->assertEqual(FALSE, $valid, 'Testing that ' . $link . ' is not a valid link.');
  }
}