You are here

public function LinkValidationApiTest::testValidateInternalLinks in Link 7

Validate Internal Links.

File

tests/LinkValidationApiTest.test, line 161
Validate the link_validate_url() validation API.

Class

LinkValidationApiTest
Validate the link_validate_url() validation API.

Code

public function testValidateInternalLinks() {
  $tempfile = drupal_tempnam('public://files', 'test');
  $links = array(
    'rss.xml',
    'foo#bar',
    file_uri_target($tempfile),
    drupal_realpath($tempfile),
  );
  foreach ($links as $link) {
    $type = link_url_type($link);
    $this
      ->assertEqual(LINK_INTERNAL, $type, 'Test ' . $link . ' is an internal link.');
    $valid = link_validate_url($link);
    $this
      ->assertTrue($valid, 'Test ' . $link . ' is valid internal link.');
  }
}