function NumberItemTest::setUp

Same name in other branches
  1. 9 core/modules/field/tests/src/Kernel/Number/NumberItemTest.php \Drupal\Tests\field\Kernel\Number\NumberItemTest::setUp()
  2. 8.9.x core/modules/field/tests/src/Kernel/Number/NumberItemTest.php \Drupal\Tests\field\Kernel\Number\NumberItemTest::setUp()
  3. 10 core/modules/field/tests/src/Kernel/Number/NumberItemTest.php \Drupal\Tests\field\Kernel\Number\NumberItemTest::setUp()

Overrides FieldKernelTestBase::setUp

File

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

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();
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.