You are here

protected function LinkFieldValidateTest::linkTestValidateUrl in Link 7

Takes a URL, sees if it can validate that the URL is valid.

14 calls to LinkFieldValidateTest::linkTestValidateUrl()
LinkFieldValidateTest::testCurlyBracketsInQuery in tests/LinkFieldValidateTest.test
Curly brackets in query.
LinkFieldValidateTest::testGermanEszettUrl in tests/LinkFieldValidateTest.test
Check German b in URL, aka Eszett.
LinkFieldValidateTest::testLinkExternalHttps in tests/LinkFieldValidateTest.test
Check link external https.
LinkFieldValidateTest::testLinkFrontUrl in tests/LinkFieldValidateTest.test
Validate that '<front>' is a valid url.
LinkFieldValidateTest::testLinkFtp in tests/LinkFieldValidateTest.test
Check link FTP.

... See full list

File

tests/LinkFieldValidateTest.test, line 38
Link field Validation Tests.

Class

LinkFieldValidateTest
Link field Validation Tests.

Code

protected function linkTestValidateUrl($url) {
  $field_name = $this
    ->createLinkField();
  $label = $this
    ->randomName();
  $settings = array(
    'title' => $label,
    $field_name => array(
      LANGUAGE_NONE => array(
        array(
          'title' => $label,
          'url' => $url,
        ),
      ),
    ),
  );
  $node = $this
    ->drupalCreateNode($settings);
  $this
    ->assertNotNull($node, ' has been created.', 'Node created');
  $this
    ->assertEqual($url, $node->{$field_name}[LANGUAGE_NONE][0]['url']);
}