protected function MultiFormTest::setUp in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/FunctionalJavascriptTests/Ajax/MultiFormTest.php \Drupal\FunctionalJavascriptTests\Ajax\MultiFormTest::setUp()
Overrides BrowserTestBase::setUp
File
- core/
tests/ Drupal/ FunctionalJavascriptTests/ Ajax/ MultiFormTest.php, line 31
Class
- MultiFormTest
- Tests that AJAX-enabled forms work when multiple instances of the same form are on a page.
Namespace
Drupal\FunctionalJavascriptTests\AjaxCode
protected function setUp() : void {
parent::setUp();
$this
->drupalCreateContentType([
'type' => 'page',
'name' => 'Page',
]);
// Create a multi-valued field for 'page' nodes to use for Ajax testing.
$field_name = 'field_ajax_test';
FieldStorageConfig::create([
'entity_type' => 'node',
'field_name' => $field_name,
'type' => 'text',
'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED,
])
->save();
FieldConfig::create([
'field_name' => $field_name,
'entity_type' => 'node',
'bundle' => 'page',
])
->save();
\Drupal::service('entity_display.repository')
->getFormDisplay('node', 'page', 'default')
->setComponent($field_name, [
'type' => 'text_textfield',
])
->save();
// Log in a user who can create 'page' nodes.
$this
->drupalLogin($this
->drupalCreateUser([
'create page content',
]));
}