You are here

protected function CKEditorTest::setUp in Drupal 8

Same name and namespace in other branches
  1. 9 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 46

Class

CKEditorTest
Tests for the 'CKEditor' text editor plugin.

Namespace

Drupal\Tests\ckeditor\Kernel

Code

protected function setUp() {
  parent::setUp();

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