1 list.test protected ListFieldDisplayTestCase::createListField($type)

Helper function to create list field of a given type.

Parameters

string $type: 'list_integer', 'list_float', 'list_text' or 'list_boolean'

File

core/modules/field/modules/list/tests/list.test, line 465
Tests for list.module.

Class

ListFieldDisplayTestCase
Tests that formatters are working properly.

Code

protected function createListField($type) {
  // Create a test field and instance.
  $field = array(
    'field_name' => $this->field_name,
    'type' => $type,
  );
  field_create_field($field);
  $instance = array(
    'field_name' => $this->field_name,
    'entity_type' => 'node',
    'bundle' => $this->type,
  );
  field_create_instance($instance);

  $this->admin_path = 'admin/structure/types/manage/' . $this->hyphen_type . '/fields/' . $this->field_name;
}