protected function FormErrorHandlerCKEditorTest::setUp in Drupal 9
Same name and namespace in other branches
- 8 core/modules/inline_form_errors/tests/src/FunctionalJavascript/FormErrorHandlerCKEditorTest.php \Drupal\Tests\inline_form_errors\FunctionalJavascript\FormErrorHandlerCKEditorTest::setUp()
Overrides BrowserTestBase::setUp
File
- core/
modules/ inline_form_errors/ tests/ src/ FunctionalJavascript/ FormErrorHandlerCKEditorTest.php, line 38
Class
- FormErrorHandlerCKEditorTest
- Tests the inline errors fragment link to a CKEditor-enabled textarea.
Namespace
Drupal\Tests\inline_form_errors\FunctionalJavascriptCode
protected function setUp() : void {
parent::setUp();
// Create a text format and associate CKEditor.
$filtered_html_format = FilterFormat::create([
'format' => 'filtered_html',
'name' => 'Filtered HTML',
'weight' => 0,
]);
$filtered_html_format
->save();
Editor::create([
'format' => 'filtered_html',
'editor' => 'ckeditor',
])
->save();
// Create a node type for testing.
NodeType::create([
'type' => 'page',
'name' => 'page',
])
->save();
$field_storage = FieldStorageConfig::loadByName('node', 'body');
// Create a body field instance for the 'page' node type.
FieldConfig::create([
'field_storage' => $field_storage,
'bundle' => 'page',
'label' => 'Body',
'settings' => [
'display_summary' => TRUE,
],
'required' => TRUE,
])
->save();
// Assign widget settings for the 'default' form mode.
EntityFormDisplay::create([
'targetEntityType' => 'node',
'bundle' => 'page',
'mode' => 'default',
'status' => TRUE,
])
->setComponent('body', [
'type' => 'text_textarea_with_summary',
])
->save();
$account = $this
->drupalCreateUser([
'administer nodes',
'create page content',
'use text format filtered_html',
]);
$this
->drupalLogin($account);
}