function FormErrorHandlerCKEditor5Test::setUp

Same name in other branches
  1. 9 core/modules/inline_form_errors/tests/src/FunctionalJavascript/FormErrorHandlerCKEditor5Test.php \Drupal\Tests\inline_form_errors\FunctionalJavascript\FormErrorHandlerCKEditor5Test::setUp()
  2. 10 core/modules/inline_form_errors/tests/src/FunctionalJavascript/FormErrorHandlerCKEditor5Test.php \Drupal\Tests\inline_form_errors\FunctionalJavascript\FormErrorHandlerCKEditor5Test::setUp()

Overrides BrowserTestBase::setUp

File

core/modules/inline_form_errors/tests/src/FunctionalJavascript/FormErrorHandlerCKEditor5Test.php, line 40

Class

FormErrorHandlerCKEditor5Test
Tests the inline errors fragment link to a CKEditor5-enabled textarea.

Namespace

Drupal\Tests\inline_form_errors\FunctionalJavascript

Code

protected function setUp() : void {
    parent::setUp();
    // Create a text format and associate CKEditor 5.
    FilterFormat::create([
        'format' => 'ckeditor5',
        'name' => 'CKEditor 5 with image upload',
        'roles' => [
            RoleInterface::AUTHENTICATED_ID,
        ],
    ])->save();
    Editor::create([
        'format' => 'ckeditor5',
        'editor' => 'ckeditor5',
        'image_upload' => [
            'status' => FALSE,
        ],
    ])->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',
    ]);
    $this->drupalLogin($account);
}

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