You are here

protected function CKEditorTest::setUp in Zircon Profile 8

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

Performs setup tasks before each individual test method is run.

Overrides KernelTestBase::setUp

File

core/modules/ckeditor/src/Tests/CKEditorTest.php, line 42
Contains \Drupal\ckeditor\Tests\CKEditorTest.

Class

CKEditorTest
Tests for the 'CKEditor' text editor plugin.

Namespace

Drupal\ckeditor\Tests

Code

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

  // Install the Filter module.
  $this
    ->installSchema('system', 'url_alias');

  // Create text format, associate CKEditor.
  $filtered_html_format = entity_create('filter_format', array(
    'format' => 'filtered_html',
    'name' => 'Filtered HTML',
    'weight' => 0,
    'filters' => array(
      'filter_html' => array(
        'status' => 1,
        'settings' => array(
          'allowed_html' => '<h2 id> <h3> <h4> <h5> <h6> <p> <br> <strong> <a href hreflang>',
        ),
      ),
    ),
  ));
  $filtered_html_format
    ->save();
  $editor = entity_create('editor', array(
    'format' => 'filtered_html',
    'editor' => 'ckeditor',
  ));
  $editor
    ->save();

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