function ListFieldTestCase::setUp

7.x list.test ListFieldTestCase::setUp()

Set the default field storage backend for fields created during tests.

Overrides FieldTestCase::setUp

File

drupal-7.x/modules/field/modules/list/tests/list.test, line 20
Tests for list.module.

Class

ListFieldTestCase
Tests for the 'List' field types.

Code

function setUp() {
  parent::setUp('field_test');

  $this->field_name = 'test_list';
  $this->field = array(
    'field_name' => $this->field_name,
    'type' => 'list_integer',
    'cardinality' => 1,
    'settings' => array(
      'allowed_values' => array(1 => 'One', 2 => 'Two', 3 => 'Three'),
    ),
  );
  $this->field = field_create_field($this->field);

  $this->instance = array(
    'field_name' => $this->field_name,
    'entity_type' => 'test_entity',
    'bundle' => 'test_bundle',
    'widget' => array(
      'type' => 'options_buttons',
    ),
  );
  $this->instance = field_create_instance($this->instance);
}