You are here

protected function NumberItemTest::setUp in Zircon Profile 8.0

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

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

Overrides FieldUnitTestBase::setUp

File

core/modules/field/src/Tests/Number/NumberItemTest.php, line 28
Contains \Drupal\field\Tests\Number\NumberItemTest.

Class

NumberItemTest
Tests the new entity API for the number field type.

Namespace

Drupal\field\Tests\Number

Code

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

  // Create number field storages and fields for validation.
  foreach (array(
    'integer',
    'float',
    'decimal',
  ) as $type) {
    entity_create('field_storage_config', array(
      'entity_type' => 'entity_test',
      'field_name' => 'field_' . $type,
      'type' => $type,
    ))
      ->save();
    entity_create('field_config', array(
      'entity_type' => 'entity_test',
      'field_name' => 'field_' . $type,
      'bundle' => 'entity_test',
    ))
      ->save();
  }
}