function CKEditorIntegrationTest::setUp

Same name in other branches
  1. 8.9.x core/modules/media/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php \Drupal\Tests\media\FunctionalJavascript\CKEditorIntegrationTest::setUp()
  2. 8.9.x core/modules/media_library/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php \Drupal\Tests\media_library\FunctionalJavascript\CKEditorIntegrationTest::setUp()
  3. 8.9.x core/modules/ckeditor/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php \Drupal\Tests\ckeditor\FunctionalJavascript\CKEditorIntegrationTest::setUp()

The theme to install as the default for testing.

@todo This test's reliance on classes makes Stark a bad fit as a base theme. Change the default theme to Starterkit once it is stable.

Overrides BrowserTestBase::setUp

See also

https://www.drupal.org/project/drupal/issues/3275827

File

core/modules/ckeditor/tests/src/FunctionalJavascript/CKEditorIntegrationTest.php, line 58

Class

CKEditorIntegrationTest
Tests the integration of CKEditor.

Namespace

Drupal\Tests\ckeditor\FunctionalJavascript

Code

protected function setUp() : void {
    parent::setUp();
    // Create a text format and associate CKEditor.
    $this->filterFormat = FilterFormat::create([
        'format' => 'filtered_html',
        'name' => 'Filtered HTML',
        'weight' => 0,
    ]);
    $this->filterFormat
        ->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();
    $this->account = $this->drupalCreateUser([
        'administer nodes',
        'create page content',
        'use text format filtered_html',
    ]);
    $this->drupalLogin($this->account);
}

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