function 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 29  
Class
- TelephoneItemTest
 - Tests the new entity API for the telephone field type.
 
Namespace
Drupal\Tests\telephone\KernelCode
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.