function CKEditorLoadingTest::setUp

Same name and namespace in other branches
  1. 8.9.x core/modules/ckeditor/tests/src/Functional/CKEditorLoadingTest.php \Drupal\Tests\ckeditor\Functional\CKEditorLoadingTest::setUp()

Overrides BrowserTestBase::setUp

File

core/modules/ckeditor/tests/src/Functional/CKEditorLoadingTest.php, line 46

Class

CKEditorLoadingTest
Tests loading of CKEditor.

Namespace

Drupal\Tests\ckeditor\Functional

Code

protected function setUp() : void {
  parent::setUp();
  // Create text format, associate CKEditor.
  $filtered_html_format = FilterFormat::create([
    'format' => 'filtered_html',
    'name' => 'Filtered HTML',
    'weight' => 0,
    'filters' => [],
  ]);
  $filtered_html_format->save();
  $editor = Editor::create([
    'format' => 'filtered_html',
    'editor' => 'ckeditor',
  ]);
  $editor->save();
  // Create a second format without an associated editor so a drop down select
  // list is created when selecting formats.
  $full_html_format = FilterFormat::create([
    'format' => 'full_html',
    'name' => 'Full HTML',
    'weight' => 1,
    'filters' => [],
  ]);
  $full_html_format->save();
  // Create node type.
  $this->drupalCreateContentType([
    'type' => 'article',
    'name' => 'Article',
  ]);
  $this->untrustedUser = $this->drupalCreateUser([
    'create article content',
    'edit any article content',
  ]);
  $this->normalUser = $this->drupalCreateUser([
    'create article content',
    'edit any article content',
    'use text format filtered_html',
    'use text format full_html',
  ]);
}

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