function AddItemToToolbarConfigActionTest::testAddNonExistentItem

File

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

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 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.