You are here

function FieldCrudTest::setUp in Zircon Profile 8

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

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

Overrides FieldUnitTestBase::setUp

File

core/modules/field/src/Tests/FieldCrudTest.php, line 45
Contains \Drupal\field\Tests\FieldCrudTest.

Class

FieldCrudTest
Create field entities by attaching fields to entities.

Namespace

Drupal\field\Tests

Code

function setUp() {
  parent::setUp();
  $this->fieldStorageDefinition = array(
    'field_name' => Unicode::strtolower($this
      ->randomMachineName()),
    'entity_type' => 'entity_test',
    'type' => 'test_field',
  );
  $this->fieldStorage = entity_create('field_storage_config', $this->fieldStorageDefinition);
  $this->fieldStorage
    ->save();
  $this->fieldDefinition = array(
    'field_name' => $this->fieldStorage
      ->getName(),
    'entity_type' => 'entity_test',
    'bundle' => 'entity_test',
  );
}