You are here

protected function BooleanItemTest::setUp in Zircon Profile 8.0

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

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

Overrides FieldUnitTestBase::setUp

File

core/modules/field/src/Tests/Boolean/BooleanItemTest.php, line 24
Contains \Drupal\field\Tests\Boolean\BooleanItemTest.

Class

BooleanItemTest
Tests the new entity API for the boolean field type.

Namespace

Drupal\field\Tests\Boolean

Code

protected function setUp() {
  parent::setUp();

  // Create a boolean field and storage for validation.
  entity_create('field_storage_config', array(
    'field_name' => 'field_boolean',
    'entity_type' => 'entity_test',
    'type' => 'boolean',
  ))
    ->save();
  entity_create('field_config', array(
    'entity_type' => 'entity_test',
    'field_name' => 'field_boolean',
    'bundle' => 'entity_test',
  ))
    ->save();

  // Create a form display for the default form mode.
  entity_get_form_display('entity_test', 'entity_test', 'default')
    ->setComponent('field_boolean', array(
    'type' => 'boolean_checkbox',
  ))
    ->save();
}