You are here

protected function OptionsFieldUnitTestBase::setUp in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/options/src/Tests/OptionsFieldUnitTestBase.php \Drupal\options\Tests\OptionsFieldUnitTestBase::setUp()

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

Overrides FieldUnitTestBase::setUp

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

File

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

Class

OptionsFieldUnitTestBase
Base class for Options module integration tests.

Namespace

Drupal\options\Tests

Code

protected function setUp() {
  parent::setUp();
  $this->container
    ->get('router.builder')
    ->rebuild();
  $this->fieldStorageDefinition = array(
    'field_name' => $this->fieldName,
    'entity_type' => 'entity_test',
    'type' => 'list_integer',
    'cardinality' => 1,
    'settings' => array(
      'allowed_values' => array(
        1 => 'One',
        2 => 'Two',
        3 => 'Three',
      ),
    ),
  );
  $this->fieldStorage = entity_create('field_storage_config', $this->fieldStorageDefinition);
  $this->fieldStorage
    ->save();
  $this->field = entity_create('field_config', array(
    'field_storage' => $this->fieldStorage,
    'bundle' => 'entity_test',
  ));
  $this->field
    ->save();
  entity_get_form_display('entity_test', 'entity_test', 'default')
    ->setComponent($this->fieldName, array(
    'type' => 'options_buttons',
  ))
    ->save();
}