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()

File

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

Class

AddItemToToolbarConfigActionTest
@covers \Drupal\ckeditor5\Plugin\ConfigAction\AddItemToToolbar[[api-linebreak]] @group ckeditor5 @group Recipe

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.