You are here

function CKEditorTest::testInternalGetConfig 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::testInternalGetConfig()

Tests Internal::getConfig().

File

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

Class

CKEditorTest
Tests for the 'CKEditor' text editor plugin.

Namespace

Drupal\ckeditor\Tests

Code

function testInternalGetConfig() {
  $editor = entity_load('editor', 'filtered_html');
  $internal_plugin = $this->container
    ->get('plugin.manager.ckeditor.plugin')
    ->createInstance('internal');

  // Default toolbar.
  $expected = $this
    ->getDefaultInternalConfig();
  $expected['disallowedContent'] = $this
    ->getDefaultDisallowedContentConfig();
  $expected['allowedContent'] = $this
    ->getDefaultAllowedContentConfig();
  $this
    ->assertEqual($expected, $internal_plugin
    ->getConfig($editor), '"Internal" plugin configuration built correctly for default toolbar.');

  // Format dropdown/button enabled: new setting should be present.
  $settings = $editor
    ->getSettings();
  $settings['toolbar']['rows'][0][0]['items'][] = 'Format';
  $editor
    ->setSettings($settings);
  $expected['format_tags'] = 'p;h2;h3;h4;h5;h6';
  $this
    ->assertEqual($expected, $internal_plugin
    ->getConfig($editor), '"Internal" plugin configuration built correctly for customized toolbar.');
}