You are here

protected function CKEditorLoadingTest::setUp in Drupal 10

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

File

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

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',
  ]);
}