public function OptionsFieldUnitTestBase::setUp

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

Overrides FieldUnitTestBase::setUp

1 call to OptionsFieldUnitTestBase::setUp()
OptionsFormattersTest::setUp in drupal/core/modules/options/lib/Drupal/options/Tests/OptionsFormattersTest.php
Set the default field storage backend for fields created during tests.
1 method overrides OptionsFieldUnitTestBase::setUp()
OptionsFormattersTest::setUp in drupal/core/modules/options/lib/Drupal/options/Tests/OptionsFormattersTest.php
Set the default field storage backend for fields created during tests.

File

drupal/core/modules/options/lib/Drupal/options/Tests/OptionsFieldUnitTestBase.php, line 56
Contains \Drupal\options\Tests\OptionsFieldUnitTestBase.

Class

OptionsFieldUnitTestBase
Defines a common base test class for unit tests of the options module.

Namespace

Drupal\options\Tests

Code

public function setUp() {
  parent::setUp();
  $this
    ->installSchema('system', 'menu_router');
  $this->fieldDefinition = array(
    'field_name' => $this->fieldName,
    'type' => 'list_integer',
    'cardinality' => 1,
    'settings' => array(
      'allowed_values' => array(
        1 => 'One',
        2 => 'Two',
        3 => 'Three',
      ),
    ),
  );
  $this->field = entity_create('field_entity', $this->fieldDefinition);
  $this->field
    ->save();
  $instance = array(
    'field_name' => $this->fieldName,
    'entity_type' => 'entity_test',
    'bundle' => 'entity_test',
  );
  $this->instance = entity_create('field_instance', $instance);
  $this->instance
    ->save();
  entity_get_form_display('entity_test', 'entity_test', 'default')
    ->setComponent($this->fieldName, array(
    'type' => 'options_buttons',
  ))
    ->save();
}