thrownewInvalidPluginDefinitionException($id,sprintf('The "%s" CKEditor 5 plugin definition has a "drupal.label" value that is not a string nor a TranslatableMarkup instance.',$id));
@@ -225,15 +225,16 @@ public static function providerTestInvalidPluginDefinitions(): \Generator {
yield'only plugin ID, nothing else'=>[
<<<YAML
foo_bar: {}
ckeditor5_invalid_plugin_foo_bar: {}
YAML,
InvalidPluginDefinitionException::class,
'The "foo_bar" CKEditor 5 plugin definition must have a plugin ID that starts with "ckeditor5_invalid_plugin_".',
'The "ckeditor5_invalid_plugin_foo_bar" CKEditor 5 plugin definition must contain a "drupal" key.',
];
yield'fixed plugin ID'=>[
yield'added drupal'=>[
<<<YAML
ckeditor5_invalid_plugin_foo_bar: {}
ckeditor5_invalid_plugin_foo_bar:
drupal: {}
YAML,
InvalidPluginDefinitionException::class,
'The "ckeditor5_invalid_plugin_foo_bar" CKEditor 5 plugin definition must contain a "ckeditor5" key.',
@@ -243,22 +244,13 @@ public static function providerTestInvalidPluginDefinitions(): \Generator {
<<<YAML
ckeditor5_invalid_plugin_foo_bar:
ckeditor5: {}
YAML,
\ArgumentCountError::class,
NULL,
];
yield'added ckeditor5.plugins'=>[
<<<YAML
ckeditor5_invalid_plugin_foo_bar:
ckeditor5:
plugins: {}
drupal: {}
YAML,
InvalidPluginDefinitionException::class,
'The "ckeditor5_invalid_plugin_foo_bar" CKEditor 5 plugin definition must contain a "drupal" key.',
'The "ckeditor5_invalid_plugin_foo_bar" CKEditor 5 plugin definition must contain a "ckeditor5.plugins" key.',
];
yield'added drupal'=>[
yield'added ckeditor5.plugins'=>[
<<<YAML
ckeditor5_invalid_plugin_foo_bar:
ckeditor5:
@@ -277,7 +269,8 @@ public static function providerTestInvalidPluginDefinitions(): \Generator {
drupal:
label: {}
YAML,
\TypeError::class,
InvalidPluginDefinitionException::class,
'The "ckeditor5_invalid_plugin_foo_bar" CKEditor 5 plugin definition has a "drupal.label" value that is not a string nor a TranslatableMarkup instance.',
];
yield'fixed drupal.label'=>[
@@ -347,6 +340,21 @@ public static function providerTestInvalidPluginDefinitions(): \Generator {
YAML,
];
yield'change plugin ID to something invalid'=>[
<<<YAML
foo_bar:
ckeditor5:
plugins: {}
drupal:
label: "Foo bar"
elements:
- <foo>
- <bar>
YAML,
InvalidPluginDefinitionException::class,
'The "foo_bar" CKEditor 5 plugin definition must have a plugin ID that starts with "ckeditor5_invalid_plugin_".',