1 link.validate.test protected LinkValidateTest::validateUrl($url)

Checks if a URL is valid through the UI.

Parameters

string $url: The URL to validate.

File

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

Class

LinkValidateTest

Code

protected function validateUrl($url) {
  $this->backdropGet('node/add/page');

  $label = $this->randomName();
  $edit = array(
    'title' => $label,
    $this->field_name . '[und][0][title]' => $label,
    $this->field_name . '[und][0][url]' => $url,
  );
  $this->backdropPost(NULL, $edit, t('Save'));
  $this->assertRaw(' has been created.', 'Node created');

  $nid = db_query("SELECT MAX(nid) FROM {node}")->fetchField();
  $node = node_load($nid);

  $this->assertEqual($url, $node->{$this->field_name}['und'][0]['url']);
}