function ArbitraryRebuildTest::setUp

Same name in other branches
  1. 9 core/modules/system/tests/src/Functional/Form/ArbitraryRebuildTest.php \Drupal\Tests\system\Functional\Form\ArbitraryRebuildTest::setUp()
  2. 8.9.x core/modules/system/tests/src/Functional/Form/ArbitraryRebuildTest.php \Drupal\Tests\system\Functional\Form\ArbitraryRebuildTest::setUp()
  3. 11.x 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 31

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

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