function AddItemToToolbarConfigActionTest::testActionRequiresCKEditor5

Same name and namespace in other branches
  1. 11.x core/modules/ckeditor5/tests/src/Kernel/ConfigAction/AddItemToToolbarConfigActionTest.php \Drupal\Tests\ckeditor5\Kernel\ConfigAction\AddItemToToolbarConfigActionTest::testActionRequiresCKEditor5()
  2. 10 core/modules/ckeditor5/tests/src/Kernel/ConfigAction/AddItemToToolbarConfigActionTest.php \Drupal\Tests\ckeditor5\Kernel\ConfigAction\AddItemToToolbarConfigActionTest::testActionRequiresCKEditor5()

Tests that the `addItemToToolbar` config action requires CKEditor 5.

File

core/modules/ckeditor5/tests/src/Kernel/ConfigAction/AddItemToToolbarConfigActionTest.php, line 132

Class

AddItemToToolbarConfigActionTest
Tests add item to toolbar config action.

Namespace

Drupal\Tests\ckeditor5\Kernel\ConfigAction

Code

public function testActionRequiresCKEditor5() : void {
  $this->enableModules([
    'editor_test',
  ]);
  Editor::load('filter_test')?->setEditor('unicorn')->setSettings([])
    ->save();
  $recipe = <<<YAML
  name: Not a CKEditor
  config:
    actions:
      editor.editor.filter_test:
        addItemToToolbar: strikethrough
  YAML;
  $this->expectException(ConfigActionException::class);
  $this->expectExceptionMessage('The editor:addItemToToolbar config action only works with editors that use CKEditor 5.');
  RecipeRunner::processRecipe($this->createRecipe($recipe));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.