function CKEditorTest::setUp

Same name in other branches
  1. 8.9.x 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 56

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

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