You are here

public function CKEditorTest::testInternalGetConfig in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/ckeditor/tests/src/Kernel/CKEditorTest.php \Drupal\Tests\ckeditor\Kernel\CKEditorTest::testInternalGetConfig()

Tests Internal::getConfig().

File

core/modules/ckeditor/tests/src/Kernel/CKEditorTest.php, line 297

Class

CKEditorTest
Tests for the 'CKEditor' text editor plugin.

Namespace

Drupal\Tests\ckeditor\Kernel

Code

public function testInternalGetConfig() {
  $editor = Editor::load('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
    ->assertEquals($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
    ->assertEquals($expected, $internal_plugin
    ->getConfig($editor), '"Internal" plugin configuration built correctly for customized toolbar.');
}