You are here

protected function CKEditorTest::setUp in Drupal 9

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

Overrides KernelTestBase::setUp

File

core/modules/ckeditor/tests/src/Kernel/CKEditorTest.php, line 52

Class

CKEditorTest
Tests for the 'CKEditor' text editor plugin.

Namespace

Drupal\Tests\ckeditor\Kernel

Code

protected function setUp() : void {
  parent::setUp();
  $this->fileUrlGenerator = $this->container
    ->get('file_url_generator');

  // Install the Filter module.
  // Create text format, associate CKEditor.
  $filtered_html_format = FilterFormat::create([
    'format' => 'filtered_html',
    'name' => 'Filtered HTML',
    'weight' => 0,
    'filters' => [
      'filter_html' => [
        'status' => 1,
        'settings' => [
          'allowed_html' => '<h2 id> <h3> <h4> <h5> <h6> <p> <br> <strong> <a href hreflang>',
        ],
      ],
    ],
  ]);
  $filtered_html_format
    ->save();
  $editor = Editor::create([
    'format' => 'filtered_html',
    'editor' => 'ckeditor',
  ]);
  $editor
    ->save();

  // Create "CKEditor" text editor plugin instance.
  $this->ckeditor = $this->container
    ->get('plugin.manager.editor')
    ->createInstance('ckeditor');
}