You are here

protected function NumberItemTest::setUp in Drupal 10

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

File

core/modules/field/tests/src/Kernel/Number/NumberItemTest.php, line 26

Class

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

Namespace

Drupal\Tests\field\Kernel\Number

Code

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

  // Create number field storages and fields for validation.
  foreach ([
    'integer',
    'float',
    'decimal',
  ] as $type) {
    FieldStorageConfig::create([
      'entity_type' => 'entity_test',
      'field_name' => 'field_' . $type,
      'type' => $type,
    ])
      ->save();
    FieldConfig::create([
      'entity_type' => 'entity_test',
      'field_name' => 'field_' . $type,
      'bundle' => 'entity_test',
    ])
      ->save();
  }
}