protected function ListFieldUITestCase::createListField in Drupal 7
Helper function to create list field of a given type.
Parameters
string $type: 'list_integer', 'list_float', 'list_text' or 'list_boolean'
4 calls to ListFieldUITestCase::createListField()
- ListFieldUITestCase::testListAllowedValuesBoolean in modules/
field/ modules/ list/ tests/ list.test - List (boolen) : test 'On/Off' values input.
- ListFieldUITestCase::testListAllowedValuesFloat in modules/
field/ modules/ list/ tests/ list.test - List (float) : test 'allowed values' input.
- ListFieldUITestCase::testListAllowedValuesInteger in modules/
field/ modules/ list/ tests/ list.test - List (integer) : test 'allowed values' input.
- ListFieldUITestCase::testListAllowedValuesText in modules/
field/ modules/ list/ tests/ list.test - List (text) : test 'allowed values' input.
File
- modules/
field/ modules/ list/ tests/ list.test, line 415 - Tests for list.module.
Class
- ListFieldUITestCase
- List module UI tests.
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;
}