function 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\FormCode
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.