You are here

protected function ArbitraryRebuildTest::setUp in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/system/tests/src/Functional/Form/ArbitraryRebuildTest.php \Drupal\Tests\system\Functional\Form\ArbitraryRebuildTest::setUp()

Overrides BrowserTestBase::setUp

File

core/modules/system/tests/src/Functional/Form/ArbitraryRebuildTest.php, line 28

Class

ArbitraryRebuildTest
Tests altering forms to be rebuilt so there are multiple steps.

Namespace

Drupal\Tests\system\Functional\Form

Code

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

  // Auto-create a field for testing.
  FieldStorageConfig::create([
    'entity_type' => 'user',
    'field_name' => 'test_multiple',
    'type' => 'text',
    'cardinality' => -1,
    'translatable' => FALSE,
  ])
    ->save();
  FieldConfig::create([
    'entity_type' => 'user',
    'field_name' => 'test_multiple',
    'bundle' => 'user',
    'label' => 'Test a multiple valued field',
  ])
    ->save();
  \Drupal::service('entity_display.repository')
    ->getFormDisplay('user', 'user', 'register')
    ->setComponent('test_multiple', [
    'type' => 'text_textfield',
    'weight' => 0,
  ])
    ->save();
}