function CKEditor5FragmentLinkTest::setUp

Same name in other branches
  1. 9 core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5FragmentLinkTest.php \Drupal\Tests\ckeditor5\FunctionalJavascript\CKEditor5FragmentLinkTest::setUp()
  2. 11.x core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5FragmentLinkTest.php \Drupal\Tests\ckeditor5\FunctionalJavascript\CKEditor5FragmentLinkTest::setUp()

Overrides BrowserTestBase::setUp

File

core/modules/ckeditor5/tests/src/FunctionalJavascript/CKEditor5FragmentLinkTest.php, line 48

Class

CKEditor5FragmentLinkTest
Tests that the fragment link points to CKEditor 5.

Namespace

Drupal\Tests\ckeditor5\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',
    ])->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();
    $this->account = $this->drupalCreateUser([
        'administer nodes',
        'create page content',
    ]);
    $this->drupalLogin($this->account);
}

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