function PasswordItemTest::setUp

Same name and namespace in other branches
  1. 10 core/tests/Drupal/KernelTests/Core/Field/FieldType/PasswordItemTest.php \Drupal\KernelTests\Core\Field\FieldType\PasswordItemTest::setUp()
  2. 11.x core/tests/Drupal/KernelTests/Core/Field/FieldType/PasswordItemTest.php \Drupal\KernelTests\Core\Field\FieldType\PasswordItemTest::setUp()

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

Overrides FieldKernelTestBase::setUp

File

core/tests/Drupal/KernelTests/Core/Field/FieldType/PasswordItemTest.php, line 35

Class

PasswordItemTest
@coversDefaultClass \Drupal\Core\Field\Plugin\Field\FieldType\PasswordItem[[api-linebreak]] @group Field

Namespace

Drupal\KernelTests\Core\Field\FieldType

Code

protected function setUp() : void {
  parent::setUp();
  $this->fieldStorage = FieldStorageConfig::create([
    'field_name' => 'test_field',
    'entity_type' => 'entity_test',
    'type' => 'password',
  ]);
  $this->fieldStorage
    ->save();
  $this->field = FieldConfig::create([
    'field_storage' => $this->fieldStorage,
    'bundle' => 'entity_test',
    'required' => TRUE,
  ]);
  $this->field
    ->save();
}

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