function AddItemToToolbarConfigActionTest::testActionRequiresCKEditor5

File

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

Class

AddItemToToolbarConfigActionTest
@covers <a href="/api/drupal/core%21modules%21ckeditor5%21src%21Plugin%21ConfigAction%21AddItemToToolbar.php/class/AddItemToToolbar/11.x" title="AddItemToToolbar" class="local">\Drupal\ckeditor5\Plugin\ConfigAction\AddItemToToolbar</a> @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.