public function NumberItemTest::setUp

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

Overrides FieldUnitTestBase::setUp

File

drupal/core/modules/number/lib/Drupal/number/Tests/NumberItemTest.php, line 34
Contains \Drupal\number\Tests\NumberItemTest.

Class

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

Namespace

Drupal\number\Tests

Code

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

  // Create number fields and instances for validation.
  foreach (array(
    'integer',
    'float',
    'decimal',
  ) as $type) {
    $this->field[$type] = array(
      'field_name' => 'field_' . $type,
      'type' => 'number_' . $type,
    );
    field_create_field($this->field[$type]);
    $this->instance[$type] = array(
      'entity_type' => 'entity_test',
      'field_name' => 'field_' . $type,
      'bundle' => 'entity_test',
    );
    field_create_instance($this->instance[$type]);
  }
}