1.20.x link.test protected LinkBaseTestClass::createLinkField($node_type = 'page', $settings = array())

File

modules/link/tests/link.test, line 47
Link base test file - contains common functions for testing links.

Class

LinkBaseTestClass

Code

protected function createLinkField($node_type = 'page', $settings = array()) {
  $name = strtolower($this->randomName());
  $edit = array(
    'fields[_add_new_field][label]' => $name,
    'fields[_add_new_field][field_name]' => $name,
    'fields[_add_new_field][type]' => 'link_field',
    'fields[_add_new_field][widget_type]' => 'link_field',
  );
  $field_name = 'field_' . $name;
  $this->backdropPost('admin/structure/types/manage/' . $node_type . '/fields', $edit, t('Save'));

  // Lind does not have any field settings, so these are skipped.
  // $this->backdropPost(NULL, array(), t('Save field settings'));

  $this->backdropPost(NULL, $settings, t('Save settings'));

  // Is field created?
  $this->assertRaw(t('Saved %label configuration', array('%label' => $name)), 'Field added');

  return $field_name;
}