You are here

protected function TelephoneItemTest::setUp in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/telephone/tests/src/Kernel/TelephoneItemTest.php \Drupal\Tests\telephone\Kernel\TelephoneItemTest::setUp()

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

Overrides FieldKernelTestBase::setUp

File

core/modules/telephone/tests/src/Kernel/TelephoneItemTest.php, line 26

Class

TelephoneItemTest
Tests the new entity API for the telephone field type.

Namespace

Drupal\Tests\telephone\Kernel

Code

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

  // Create a telephone field storage and field for validation.
  FieldStorageConfig::create([
    'field_name' => 'field_test',
    'entity_type' => 'entity_test',
    'type' => 'telephone',
  ])
    ->save();
  FieldConfig::create([
    'entity_type' => 'entity_test',
    'field_name' => 'field_test',
    'bundle' => 'entity_test',
    'default_value' => [
      0 => [
        'value' => '+012345678',
      ],
    ],
  ])
    ->save();
}