function OptionsFieldTest::setUp

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

Overrides FieldTestBase::setUp

File

drupal/core/modules/field/modules/options/lib/Drupal/options/Tests/OptionsFieldTest.php, line 33
Definition of Drupal\options\Tests\OptionsFieldTest.

Class

OptionsFieldTest
Tests for the 'Options' field types.

Namespace

Drupal\options\Tests

Code

function setUp() {
  parent::setUp();
  $this->field_name = 'test_options';
  $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);
}