function AddItemToToolbarConfigActionTest::testAddNonExistentItem

Same name in other branches
  1. 10 core/modules/ckeditor5/tests/src/Kernel/ConfigAction/AddItemToToolbarConfigActionTest.php \Drupal\Tests\ckeditor5\Kernel\ConfigAction\AddItemToToolbarConfigActionTest::testAddNonExistentItem()

File

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

Class

AddItemToToolbarConfigActionTest
@covers \Drupal\ckeditor5\Plugin\ConfigAction\AddItemToToolbar @group ckeditor5 @group Recipe

Namespace

Drupal\Tests\ckeditor5\Kernel\ConfigAction

Code

public function testAddNonExistentItem() : void {
    $recipe = $this->createRecipe([
        'name' => 'Add an invalid toolbar item',
        'config' => [
            'actions' => [
                'editor.editor.filter_test' => [
                    'addItemToToolbar' => 'bogus_item',
                ],
            ],
        ],
    ]);
    $this->expectException(InvalidConfigException::class);
    $this->expectExceptionMessage("There were validation errors in editor.editor.filter_test:\n- settings.toolbar.items.3: The provided toolbar item <em class=\"placeholder\">bogus_item</em> is not valid.");
    RecipeRunner::processRecipe($recipe);
}

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