You are here

protected function TinyMCETest::setUp in TinyMCE 1.x

Overrides KernelTestBase::setUp

File

tests/src/Kernel/TinyMCETest.php, line 45

Class

TinyMCETest
Tests for the 'TinyMCE' text editor plugin.

Namespace

Drupal\Tests\tinymce\Kernel

Code

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

  // Install the Filter module.
  // Create text format, associate TinyMCE.
  $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' => 'tinymce',
  ]);
  $editor
    ->save();

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