function TelephoneItemTest::setUp

Same name in other branches
  1. 8.9.x core/modules/telephone/tests/src/Kernel/TelephoneItemTest.php \Drupal\Tests\telephone\Kernel\TelephoneItemTest::setUp()
  2. 10 core/modules/telephone/tests/src/Kernel/TelephoneItemTest.php \Drupal\Tests\telephone\Kernel\TelephoneItemTest::setUp()
  3. 11.x core/modules/telephone/tests/src/Kernel/TelephoneItemTest.php \Drupal\Tests\telephone\Kernel\TelephoneItemTest::setUp()

Overrides FieldKernelTestBase::setUp

File

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

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

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