You are here

public function MediaImageTest::testCkeditorWidgetIsLinkableWhenDrupalImageIsAbsent in Entity Embed 8

Tests linkability of the CKEditor widget when `drupalimage` is disabled.

File

tests/src/FunctionalJavascript/MediaImageTest.php, line 600

Class

MediaImageTest
Test Media Image specific functionality.

Namespace

Drupal\Tests\entity_embed\FunctionalJavascript

Code

public function testCkeditorWidgetIsLinkableWhenDrupalImageIsAbsent() {

  // Remove the `drupalimage` plugin's `DrupalImage` button.
  $editor = Editor::load('full_html');
  $settings = $editor
    ->getSettings();
  $rows = $settings['toolbar']['rows'];
  foreach ($rows as $row_key => $row) {
    foreach ($row as $group_key => $group) {
      foreach ($group['items'] as $item_key => $item) {
        if ($item === 'DrupalImage') {
          unset($settings['toolbar']['rows'][$row_key][$group_key]['items'][$item_key]);
        }
      }
    }
  }
  $editor
    ->setSettings($settings);
  $editor
    ->save();
  $this
    ->testCkeditorWidgetIsLinkable();
}