You are here

protected function MeasurementItemTest::setUp in Physical Fields 8

Overrides EntityKernelTestBase::setUp

File

tests/src/Kernel/MeasurementItemTest.php, line 30

Class

MeasurementItemTest
Tests the 'physical_measurement' field type.

Namespace

Drupal\Tests\physical\Kernel

Code

protected function setUp() {
  parent::setUp();
  $factory = PhpUnitComparatorFactory::getInstance();
  $factory
    ->register(new MeasurementComparator());
  $field_storage = FieldStorageConfig::create([
    'field_name' => 'test_weight',
    'entity_type' => 'entity_test',
    'type' => 'physical_measurement',
    'settings' => [
      'measurement_type' => 'weight',
    ],
  ]);
  $field_storage
    ->save();
  $field = FieldConfig::create([
    'field_name' => 'test_weight',
    'entity_type' => 'entity_test',
    'bundle' => 'entity_test',
  ]);
  $field
    ->save();
}