From 29b22a901429f065d9bd5b3c6c6257d1b54453d8 Mon Sep 17 00:00:00 2001 From: xjm <xjm@65776.no-reply.drupal.org> Date: Mon, 29 Apr 2024 18:30:31 -0500 Subject: [PATCH] Issue #3442167 by mondrake, xjm, larowlan: Fix string array keys in data sets returned by data provider methods that do not match the parameter names in Kernel tests --- .../migrate/source/d6/BoxTranslationTest.php | 8 +- .../source/d7/BlockCustomTranslationTest.php | 10 +- .../tests/src/Kernel/LanguageTest.php | 8 +- .../tests/src/Kernel/ValidatorsTest.php | 262 +++++++++--------- .../Migrate/d6/MigrateCommentTypeTest.php | 12 +- .../source/CommentTypeRequirementsTest.php | 36 +-- .../source/d6/ProfileFieldTranslationTest.php | 2 +- .../d6/FieldInstanceOptionTranslationTest.php | 8 +- .../source/d6/FieldOptionTranslationTest.php | 2 +- ...nstanceLabelDescriptionTranslationTest.php | 2 +- .../source/d7/FieldOptionTranslationTest.php | 2 +- .../FileExtensionConstraintValidatorTest.php | 36 +-- .../LinkCollectionNormalizerTest.php | 16 +- .../source/d6/MenuLinkTranslationTest.php | 2 +- .../source/d7/MenuLinkLocalizedTest.php | 2 +- .../source/d7/MenuLinkTranslationTest.php | 2 +- .../tests/src/Kernel/Plugin/MigrationTest.php | 34 +-- .../tests/src/Kernel/process/FileCopyTest.php | 8 +- .../Kernel/process/SubProcessWithSkipTest.php | 4 +- .../NodeMigrationTypePluginAlterTest.php | 6 +- .../Plugin/migrate/source/d8/ConfigTest.php | 6 +- .../Plugin/migrate/source/ExtensionTest.php | 2 +- .../source/d6/VocabularyTranslationTest.php | 2 +- .../source/d7/VocabularyTranslationTest.php | 4 +- .../Kernel/Plugin/StyleGridResponsiveTest.php | 6 +- .../Entity/ContentEntityStorageBaseTest.php | 12 +- .../Tests/Core/Access/AccessManagerTest.php | 2 +- 27 files changed, 236 insertions(+), 260 deletions(-) diff --git a/core/modules/block_content/tests/src/Kernel/Plugin/migrate/source/d6/BoxTranslationTest.php b/core/modules/block_content/tests/src/Kernel/Plugin/migrate/source/d6/BoxTranslationTest.php index d4c6f28f970a..337698c7311f 100644 --- a/core/modules/block_content/tests/src/Kernel/Plugin/migrate/source/d6/BoxTranslationTest.php +++ b/core/modules/block_content/tests/src/Kernel/Plugin/migrate/source/d6/BoxTranslationTest.php @@ -29,7 +29,7 @@ public static function providerSource() { $tests = []; // The source data. - $tests[0]['database']['boxes'] = [ + $tests[0]['source_data']['boxes'] = [ [ 'bid' => 1, 'body' => 'box 1 body', @@ -44,7 +44,7 @@ public static function providerSource() { ], ]; - $tests[0]['database']['i18n_strings'] = [ + $tests[0]['source_data']['i18n_strings'] = [ [ 'lid' => 1, 'objectid' => 1, @@ -71,7 +71,7 @@ public static function providerSource() { ], ]; - $tests[0]['database']['locales_target'] = [ + $tests[0]['source_data']['locales_target'] = [ [ 'lid' => 1, 'language' => 'fr', @@ -98,7 +98,7 @@ public static function providerSource() { ], ]; - $tests[0]['expected_results'] = [ + $tests[0]['expected_data'] = [ [ 'lid' => '1', 'property' => 'title', diff --git a/core/modules/block_content/tests/src/Kernel/Plugin/migrate/source/d7/BlockCustomTranslationTest.php b/core/modules/block_content/tests/src/Kernel/Plugin/migrate/source/d7/BlockCustomTranslationTest.php index 1ed5028a2381..6794975a3059 100644 --- a/core/modules/block_content/tests/src/Kernel/Plugin/migrate/source/d7/BlockCustomTranslationTest.php +++ b/core/modules/block_content/tests/src/Kernel/Plugin/migrate/source/d7/BlockCustomTranslationTest.php @@ -29,7 +29,7 @@ public static function providerSource() { $tests = []; // The source data. - $tests[0]['database']['block_custom'] = [ + $tests[0]['source_data']['block_custom'] = [ [ 'bid' => 1, 'body' => 'box 1 body', @@ -50,7 +50,7 @@ public static function providerSource() { ], ]; - $tests[0]['database']['i18n_string'] = [ + $tests[0]['source_data']['i18n_string'] = [ [ 'lid' => 1, 'objectid' => 1, @@ -85,7 +85,7 @@ public static function providerSource() { ], ]; - $tests[0]['database']['locales_target'] = [ + $tests[0]['source_data']['locales_target'] = [ [ 'lid' => 1, 'language' => 'fr', @@ -112,7 +112,7 @@ public static function providerSource() { ], ]; - $tests[0]['database']['system'] = [ + $tests[0]['source_data']['system'] = [ [ 'type' => 'module', 'name' => 'system', @@ -121,7 +121,7 @@ public static function providerSource() { ], ]; - $tests[0]['expected_results'] = [ + $tests[0]['expected_data'] = [ [ 'lid' => '1', 'property' => 'title', diff --git a/core/modules/ckeditor5/tests/src/Kernel/LanguageTest.php b/core/modules/ckeditor5/tests/src/Kernel/LanguageTest.php index 51a2b10444d6..66e6e5214188 100644 --- a/core/modules/ckeditor5/tests/src/Kernel/LanguageTest.php +++ b/core/modules/ckeditor5/tests/src/Kernel/LanguageTest.php @@ -102,19 +102,19 @@ public static function provider(): array { return [ 'Language code transformed from browser mappings' => [ 'drupal_langcode' => 'pt-pt', - 'cke_langcode' => 'pt', + 'cke5_langcode' => 'pt', ], 'Language code transformed from browser mappings 2' => [ 'drupal_langcode' => 'zh-hans', - 'cke_langcode' => 'zh-cn', + 'cke5_langcode' => 'zh-cn', ], 'Language code both in Drupal and CKEditor' => [ 'drupal_langcode' => 'fi', - 'cke_langcode' => 'fi', + 'cke5_langcode' => 'fi', ], 'Language code not in Drupal but in CKEditor 5 requires new language.mappings entry' => [ 'drupal_langcode' => $random_langcode, - 'cke_langcode' => 'de-ch', + 'cke5_langcode' => 'de-ch', 'is_missing_mapping' => TRUE, ], ]; diff --git a/core/modules/ckeditor5/tests/src/Kernel/ValidatorsTest.php b/core/modules/ckeditor5/tests/src/Kernel/ValidatorsTest.php index e3c609a9b4a8..d617d5ad2317 100644 --- a/core/modules/ckeditor5/tests/src/Kernel/ValidatorsTest.php +++ b/core/modules/ckeditor5/tests/src/Kernel/ValidatorsTest.php @@ -117,11 +117,11 @@ public static function provider(): array { $data = []; $data['CKEditor5::getDefaultSettings()'] = [ // @see ::test() - 'settings' => ['__DEFAULT__'], - 'violations' => [], + 'ckeditor5_settings' => ['__DEFAULT__'], + 'expected_violations' => [], ]; $data['non-existent toolbar button'] = [ - 'settings' => [ + 'ckeditor5_settings' => [ 'toolbar' => [ 'items' => [ 'underline', @@ -142,13 +142,13 @@ public static function provider(): array { ], ], ], - 'violations' => [ + 'expected_violations' => [ 'settings.toolbar.items.5' => 'The provided toolbar item <em class="placeholder">foobar</em> is not valid.', ], ]; $data['missing heading plugin configuration'] = [ - 'settings' => [ + 'ckeditor5_settings' => [ 'toolbar' => [ 'items' => [ 'heading', @@ -156,12 +156,12 @@ public static function provider(): array { ], 'plugins' => [], ], - 'violations' => [ + 'expected_violations' => [ 'settings.plugins.ckeditor5_heading' => 'Configuration for the enabled plugin "<em class="placeholder">Headings</em>" (<em class="placeholder">ckeditor5_heading</em>) is missing.', ], ]; $data['missing language plugin configuration'] = [ - 'settings' => [ + 'ckeditor5_settings' => [ 'toolbar' => [ 'items' => [ 'textPartLanguage', @@ -169,12 +169,12 @@ public static function provider(): array { ], 'plugins' => [], ], - 'violations' => [ + 'expected_violations' => [ 'settings.plugins.ckeditor5_language' => 'Configuration for the enabled plugin "<em class="placeholder">Language</em>" (<em class="placeholder">ckeditor5_language</em>) is missing.', ], ]; $data['empty language plugin configuration'] = [ - 'settings' => [ + 'ckeditor5_settings' => [ 'toolbar' => [ 'items' => [ 'textPartLanguage', @@ -184,7 +184,7 @@ public static function provider(): array { 'ckeditor5_language' => [], ], ], - 'violations' => [ + 'expected_violations' => [ 'settings.plugins.ckeditor5_language' => [ 'Configuration for the enabled plugin "<em class="placeholder">Language</em>" (<em class="placeholder">ckeditor5_language</em>) is missing.', "'language_list' is a required key because settings.plugins.%key is ckeditor5_language (see config schema type ckeditor5.plugin.ckeditor5_language).", @@ -192,7 +192,7 @@ public static function provider(): array { ], ]; $data['valid language plugin configuration: un'] = [ - 'settings' => [ + 'ckeditor5_settings' => [ 'toolbar' => [ 'items' => [ 'textPartLanguage', @@ -204,10 +204,10 @@ public static function provider(): array { ], ], ], - 'violations' => [], + 'expected_violations' => [], ]; $data['valid language plugin configuration: all'] = [ - 'settings' => [ + 'ckeditor5_settings' => [ 'toolbar' => [ 'items' => [ 'textPartLanguage', @@ -219,10 +219,10 @@ public static function provider(): array { ], ], ], - 'violations' => [], + 'expected_violations' => [], ]; $data['invalid language plugin configuration: textPartLanguage button not enabled'] = [ - 'settings' => [ + 'ckeditor5_settings' => [ 'toolbar' => [ 'items' => [ 'bold', @@ -234,12 +234,12 @@ public static function provider(): array { ], ], ], - 'violations' => [ + 'expected_violations' => [ 'settings.plugins.ckeditor5_language.language_list' => 'Depends on <em class="placeholder">textPartLanguage</em>, which is not enabled.', ], ]; $data['invalid language plugin configuration: invalid language_list setting'] = [ - 'settings' => [ + 'ckeditor5_settings' => [ 'toolbar' => [ 'items' => [ 'textPartLanguage', @@ -251,13 +251,13 @@ public static function provider(): array { ], ], ], - 'violations' => [ + 'expected_violations' => [ 'settings.plugins.ckeditor5_language.language_list' => 'The value you selected is not a valid choice.', ], ]; $data['drupalMedia toolbar item condition not met: media filter enabled'] = [ - 'settings' => [ + 'ckeditor5_settings' => [ 'toolbar' => [ 'items' => [ 'drupalMedia', @@ -265,12 +265,12 @@ public static function provider(): array { ], 'plugins' => [], ], - 'violations' => [ + 'expected_violations' => [ 'settings.toolbar.items.0' => 'The <em class="placeholder">Drupal media</em> toolbar item requires the <em class="placeholder">Embed media</em> filter to be enabled.', ], ]; $data['fooBarConditions toolbar item condition not met: Heading and Table plugins enabled, neither are'] = [ - 'settings' => [ + 'ckeditor5_settings' => [ 'toolbar' => [ 'items' => [ 'fooBarConditions', @@ -278,12 +278,12 @@ public static function provider(): array { ], 'plugins' => [], ], - 'violations' => [ + 'expected_violations' => [ 'settings.toolbar.items.0' => 'The <em class="placeholder">Foo Bar (Test Plugins Condition)</em> toolbar item requires the <em class="placeholder">Headings, Table</em> plugins to be enabled.', ], ]; $data['fooBarConditions toolbar item condition not met: Heading and Table plugins enabled, only one is'] = [ - 'settings' => [ + 'ckeditor5_settings' => [ 'toolbar' => [ 'items' => [ 'fooBarConditions', @@ -298,12 +298,12 @@ public static function provider(): array { ], ], ], - 'violations' => [ + 'expected_violations' => [ 'settings.toolbar.items.0' => 'The <em class="placeholder">Foo Bar (Test Plugins Condition)</em> toolbar item requires the <em class="placeholder">Table</em> plugin to be enabled.', ], ]; $data['fooBarConditions toolbar item condition met: Heading and Table plugins enabled, both are'] = [ - 'settings' => [ + 'ckeditor5_settings' => [ 'toolbar' => [ 'items' => [ 'fooBarConditions', @@ -319,10 +319,10 @@ public static function provider(): array { ], ], ], - 'violations' => [], + 'expected_violations' => [], ]; $data['INVALID: Style plugin with no styles'] = [ - 'settings' => [ + 'ckeditor5_settings' => [ 'toolbar' => [ 'items' => [ 'style', @@ -334,12 +334,12 @@ public static function provider(): array { ], ], ], - 'violations' => [ + 'expected_violations' => [ 'settings.plugins.ckeditor5_style.styles' => 'Enable at least one style, otherwise disable the Style plugin.', ], ]; $data['INVALID: Style plugin configured to add class to GHS-supported non-HTML5 tag'] = [ - 'settings' => [ + 'ckeditor5_settings' => [ 'toolbar' => [ 'items' => [ 'style', @@ -362,12 +362,12 @@ public static function provider(): array { ], ], ], - 'violations' => [ + 'expected_violations' => [ 'settings.plugins.ckeditor5_style.styles.0.element' => 'A style can only be specified for an HTML 5 tag. <code><foo></code> is not an HTML5 tag.', ], ]; $data['INVALID: Style plugin configured to add class to plugin-supported non-HTML5 tag'] = [ - 'settings' => [ + 'ckeditor5_settings' => [ 'toolbar' => [ 'items' => [ 'style', @@ -387,12 +387,12 @@ public static function provider(): array { ], ], ], - 'violations' => [ + 'expected_violations' => [ 'settings.plugins.ckeditor5_style.styles.0.element' => 'A style can only be specified for an HTML 5 tag. <code><drupal-media></code> is not an HTML5 tag.', ], ]; $data['INVALID: Style plugin configured to add class that is supported by a disabled plugin'] = [ - 'settings' => [ + 'ckeditor5_settings' => [ 'toolbar' => [ 'items' => [ 'style', @@ -409,12 +409,12 @@ public static function provider(): array { ], ], ], - 'violations' => [ + 'expected_violations' => [ 'settings.plugins.ckeditor5_style.styles.0.element' => 'A style must only specify classes not supported by other plugins. The <code>text-align-justify</code> classes on <code><p></code> are supported by the <em class="placeholder">Alignment</em> plugin. Remove this style and enable that plugin instead.', ], ]; $data['INVALID: Style plugin configured to add class that is supported by an enabled plugin if its configuration were different'] = [ - 'settings' => [ + 'ckeditor5_settings' => [ 'toolbar' => [ 'items' => [ 'style', @@ -435,10 +435,10 @@ public static function provider(): array { ], ], ], - 'violations' => [], + 'expected_violations' => [], ]; $data['INVALID: Style plugin configured to add class that is supported by an enabled plugin'] = [ - 'settings' => [ + 'ckeditor5_settings' => [ 'toolbar' => [ 'items' => [ 'style', @@ -459,12 +459,12 @@ public static function provider(): array { ], ], ], - 'violations' => [ + 'expected_violations' => [ 'settings.plugins.ckeditor5_style.styles.0.element' => 'A style must only specify classes not supported by other plugins. The <code>text-align-justify</code> classes on <code><p></code> are already supported by the enabled <em class="placeholder">Alignment</em> plugin.', ], ]; $data['INVALID: Style plugin configured to add class to plugin-supported tag known to not work with Style … yet'] = [ - 'settings' => [ + 'ckeditor5_settings' => [ 'toolbar' => [ 'items' => [ 'drupalInsertImage', @@ -492,13 +492,13 @@ public static function provider(): array { ], ], ], - 'violations' => [ + 'expected_violations' => [ 'settings.plugins.ckeditor5_style.styles.0.element' => 'The <code><img></code> tag is not yet supported by the Style plugin.', 'settings.plugins.ckeditor5_style.styles.1.element' => 'The <code><br></code> tag is not yet supported by the Style plugin.', ], ]; $data['INVALID: Style plugin has multiple styles with same label'] = [ - 'settings' => [ + 'ckeditor5_settings' => [ 'toolbar' => [ 'items' => [ 'blockQuote', @@ -520,12 +520,12 @@ public static function provider(): array { ], ], ], - 'violations' => [ + 'expected_violations' => [ 'settings.plugins.ckeditor5_style.styles' => 'The label <em class="placeholder">Highlighted</em> is not unique.', ], ]; $data['INVALID: Style plugin has styles with invalid elements'] = [ - 'settings' => [ + 'ckeditor5_settings' => [ 'toolbar' => [ 'items' => [ 'blockQuote', @@ -547,7 +547,7 @@ public static function provider(): array { ], ], ], - 'violations' => [ + 'expected_violations' => [ 'settings.plugins.ckeditor5_style.styles.0.element' => 'The following tag is missing the required attribute <code>class</code>: <code><p></code>.', 'settings.plugins.ckeditor5_style.styles.1.element' => [ 'The following tag is not valid HTML: <em class="placeholder"><blockquote class=""></em>.', @@ -556,7 +556,7 @@ public static function provider(): array { ], ]; $data['VALID: Style plugin has multiple styles with different labels'] = [ - 'settings' => [ + 'ckeditor5_settings' => [ 'toolbar' => [ 'items' => [ 'blockQuote', @@ -582,10 +582,10 @@ public static function provider(): array { ], ], ], - 'violations' => [], + 'expected_violations' => [], ]; $data['INVALID: SourceEditing plugin configuration: <ol start type> must not be allowed because List can generate <ol reversed start>'] = [ - 'settings' => [ + 'ckeditor5_settings' => [ 'toolbar' => [ 'items' => [ 'numberedList', @@ -607,12 +607,12 @@ public static function provider(): array { ], ], ], - 'violations' => [ + 'expected_violations' => [ 'settings.plugins.ckeditor5_sourceEditing.allowed_tags.0' => 'The following attribute(s) are already supported by enabled plugins and should not be added to the Source Editing "Manually editable HTML tags" field: <em class="placeholder">List (<ol start>)</em>.', ], ]; $data['INVALID: SourceEditing plugin configuration: <ol start type> must not be allowed because List can generate <ol start>'] = [ - 'settings' => [ + 'ckeditor5_settings' => [ 'toolbar' => [ 'items' => [ 'numberedList', @@ -634,7 +634,7 @@ public static function provider(): array { ], ], ], - 'violations' => [ + 'expected_violations' => [ 'settings.plugins.ckeditor5_sourceEditing.allowed_tags.0' => 'The following attribute(s) can optionally be supported by enabled plugins and should not be added to the Source Editing "Manually editable HTML tags" field: <em class="placeholder">List (<ol start>)</em>.', ], ]; @@ -713,7 +713,7 @@ public static function providerPair(): array { // cspell:ignore donk $data = []; $data['INVALID: allow_view_mode_override condition not met: filter must be configured to allow 2 or more view modes'] = [ - 'settings' => [ + 'ckeditor5_settings' => [ 'toolbar' => [ 'items' => [], ], @@ -723,7 +723,7 @@ public static function providerPair(): array { ], ], ], - 'image_upload' => [ + 'editor_image_upload_settings' => [ 'status' => FALSE, ], 'filters' => [ @@ -739,12 +739,12 @@ public static function providerPair(): array { ], ], ], - 'violations' => [ + 'expected_violations' => [ '' => 'The CKEditor 5 "<em class="placeholder">Media</em>" plugin\'s "<em class="placeholder">Allow the user to override the default view mode</em>" setting should be in sync with the "<em class="placeholder">Embed media</em>" filter\'s "<em class="placeholder">View modes selectable in the "Edit media" dialog</em>" setting: when checked, two or more view modes must be allowed by the filter.', ], ]; $data['VALID: allow_view_mode_override condition met: filter must be configured to allow 2 or more view modes'] = [ - 'settings' => [ + 'ckeditor5_settings' => [ 'toolbar' => [ 'items' => [ 'drupalMedia', @@ -756,7 +756,7 @@ public static function providerPair(): array { ], ], ], - 'image_upload' => [ + 'editor_image_upload_settings' => [ 'status' => FALSE, ], 'filters' => [ @@ -775,10 +775,10 @@ public static function providerPair(): array { ], ], ], - 'violations' => [], + 'expected_violations' => [], ]; $data['VALID: legacy format: filter_autop'] = [ - 'settings' => [ + 'ckeditor5_settings' => [ 'toolbar' => [ 'items' => [ 'bold', @@ -786,7 +786,7 @@ public static function providerPair(): array { ], 'plugins' => [], ], - 'image_upload' => [ + 'editor_image_upload_settings' => [ 'status' => FALSE, ], 'filters' => [ @@ -798,10 +798,10 @@ public static function providerPair(): array { 'settings' => [], ], ], - 'violations' => [], + 'expected_violations' => [], ]; $data['VALID: legacy HTML format: filter_autop + filter_url'] = [ - 'settings' => [ + 'ckeditor5_settings' => [ 'toolbar' => [ 'items' => [ 'bold', @@ -809,7 +809,7 @@ public static function providerPair(): array { ], 'plugins' => [], ], - 'image_upload' => [ + 'editor_image_upload_settings' => [ 'status' => FALSE, ], 'filters' => [ @@ -830,10 +830,10 @@ public static function providerPair(): array { ], ], ], - 'violations' => [], + 'expected_violations' => [], ]; $data['VALID: legacy HTML format: filter_autop + filter_url (different order)'] = [ - 'settings' => [ + 'ckeditor5_settings' => [ 'toolbar' => [ 'items' => [ 'bold', @@ -841,7 +841,7 @@ public static function providerPair(): array { ], 'plugins' => [], ], - 'image_upload' => [ + 'editor_image_upload_settings' => [ 'status' => FALSE, ], 'filters' => [ @@ -862,50 +862,50 @@ public static function providerPair(): array { ], ], ], - 'violations' => [], + 'expected_violations' => [], ]; $restricted_html_format_filters = Yaml::parseFile(__DIR__ . '/../../../../../profiles/standard/config/install/filter.format.restricted_html.yml')['filters']; $data['INVALID: the default restricted_html text format'] = [ - 'settings' => [ + 'ckeditor5_settings' => [ 'toolbar' => [ 'items' => [], ], 'plugins' => [], ], - 'image_upload' => [ + 'editor_image_upload_settings' => [ 'status' => FALSE, ], 'filters' => $restricted_html_format_filters, - 'violations' => [ + 'expected_violations' => [ '' => 'CKEditor 5 needs at least the <p> and <br> tags to be allowed to be able to function. They are not allowed by the "<em class="placeholder">Limit allowed HTML tags and correct faulty HTML</em>" (<em class="placeholder">filter_html</em>) filter.', ], ]; $data['INVALID: the modified restricted_html text format (with filter_autop and filter_url removed)'] = [ - 'settings' => [ + 'ckeditor5_settings' => [ 'toolbar' => [ 'items' => [], ], 'plugins' => [], ], - 'image_upload' => [ + 'editor_image_upload_settings' => [ 'status' => FALSE, ], 'filters' => array_diff_key( $restricted_html_format_filters, ['filter_autop' => TRUE, 'filter_url' => TRUE] ), - 'violations' => [ + 'expected_violations' => [ '' => 'CKEditor 5 needs at least the <p> and <br> tags to be allowed to be able to function. They are not allowed by the "<em class="placeholder">Limit allowed HTML tags and correct faulty HTML</em>" (<em class="placeholder">filter_html</em>) filter.', ], ]; $data['VALID: HTML format: empty toolbar + minimal allowed HTML'] = [ - 'settings' => [ + 'ckeditor5_settings' => [ 'toolbar' => [ 'items' => [], ], 'plugins' => [], ], - 'image_upload' => [ + 'editor_image_upload_settings' => [ 'status' => FALSE, ], 'filters' => [ @@ -921,10 +921,10 @@ public static function providerPair(): array { ], ], ], - 'violations' => [], + 'expected_violations' => [], ]; $data['VALID: HTML format: very minimal toolbar + minimal allowed HTML'] = [ - 'settings' => [ + 'ckeditor5_settings' => [ 'toolbar' => [ 'items' => [ 'bold', @@ -932,7 +932,7 @@ public static function providerPair(): array { ], 'plugins' => [], ], - 'image_upload' => [ + 'editor_image_upload_settings' => [ 'status' => FALSE, ], 'filters' => [ @@ -948,16 +948,16 @@ public static function providerPair(): array { ], ], ], - 'violations' => [], + 'expected_violations' => [], ]; $data['INVALID: HTML format: empty toolbar + default allowed HTML tags + <p> + <br>'] = [ - 'settings' => [ + 'ckeditor5_settings' => [ 'toolbar' => [ 'items' => [], ], 'plugins' => [], ], - 'image_upload' => [ + 'editor_image_upload_settings' => [ 'status' => FALSE, ], 'filters' => [ @@ -973,7 +973,7 @@ public static function providerPair(): array { ], ], ], - 'violations' => [ + 'expected_violations' => [ 'filters.filter_html' => sprintf( 'The current CKEditor 5 build requires the following elements and attributes: <br><code>%s</code><br>The following elements are not supported: <br><code>%s</code>', Html::escape('<br> <p> <* dir="ltr rtl" lang>'), @@ -982,13 +982,13 @@ public static function providerPair(): array { ], ]; $data['INVALID: HTML format: empty toolbar + default allowed HTML tags'] = [ - 'settings' => [ + 'ckeditor5_settings' => [ 'toolbar' => [ 'items' => [], ], 'plugins' => [], ], - 'image_upload' => [ + 'editor_image_upload_settings' => [ 'status' => FALSE, ], 'filters' => [ @@ -1004,12 +1004,12 @@ public static function providerPair(): array { ], ], ], - 'violations' => [ + 'expected_violations' => [ '' => 'CKEditor 5 needs at least the <p> and <br> tags to be allowed to be able to function. They are not allowed by the "<em class="placeholder">Limit allowed HTML tags and correct faulty HTML</em>" (<em class="placeholder">filter_html</em>) filter.', ], ]; $data['INVALID Source Editable tag already provided by plugin and another available in a not enabled plugin'] = [ - 'settings' => [ + 'ckeditor5_settings' => [ 'toolbar' => [ 'items' => [ 'heading', @@ -1061,11 +1061,11 @@ public static function providerPair(): array { ], ], ], - 'image_upload' => [ + 'editor_image_upload_settings' => [ 'status' => FALSE, ], 'filters' => [], - 'violations' => [ + 'expected_violations' => [ 'settings.plugins.ckeditor5_sourceEditing.allowed_tags.0' => 'The following tag(s) are already supported by enabled plugins and should not be added to the Source Editing "Manually editable HTML tags" field: <em class="placeholder">Bold (<strong>)</em>.', 'settings.plugins.ckeditor5_sourceEditing.allowed_tags.1' => 'The following tag(s) are already supported by available plugins and should not be added to the Source Editing "Manually editable HTML tags" field. Instead, enable the following plugins to support these tags: <em class="placeholder">Table (<table>)</em>.', 'settings.plugins.ckeditor5_sourceEditing.allowed_tags.3' => 'The following attribute(s) are already supported by enabled plugins and should not be added to the Source Editing "Manually editable HTML tags" field: <em class="placeholder">Language (<span lang>)</em>.', @@ -1075,7 +1075,7 @@ public static function providerPair(): array { ], ]; $data['INVALID some invalid Source Editable tags provided by plugin and another available in a not enabled plugin'] = [ - 'settings' => [ + 'ckeditor5_settings' => [ 'toolbar' => [ 'items' => [ 'heading', @@ -1107,11 +1107,11 @@ public static function providerPair(): array { ], ], ], - 'image_upload' => [ + 'editor_image_upload_settings' => [ 'status' => FALSE, ], 'filters' => [], - 'violations' => [ + 'expected_violations' => [ 'settings.plugins.ckeditor5_sourceEditing.allowed_tags.2' => 'The following tag is not valid HTML: <em class="placeholder">roy</em>.', 'settings.plugins.ckeditor5_sourceEditing.allowed_tags.3' => 'The following tag is not valid HTML: <em class="placeholder"><#donk></em>.', 'settings.plugins.ckeditor5_sourceEditing.allowed_tags.4' => 'The following tag is not valid HTML: <em class="placeholder"><junior>cruft</em>.', @@ -1121,7 +1121,7 @@ public static function providerPair(): array { ]; $data['INVALID: drupalInsertImage without required dependent plugin configuration'] = [ - 'settings' => [ + 'ckeditor5_settings' => [ 'toolbar' => [ 'items' => [ 'drupalInsertImage', @@ -1129,16 +1129,16 @@ public static function providerPair(): array { ], 'plugins' => [], ], - 'image_upload' => [ + 'editor_image_upload_settings' => [ 'status' => FALSE, ], 'filters' => [], - 'violations' => [ + 'expected_violations' => [ 'settings.plugins.ckeditor5_imageResize' => 'Configuration for the enabled plugin "<em class="placeholder">Image resize</em>" (<em class="placeholder">ckeditor5_imageResize</em>) is missing.', ], ]; $data['VALID: drupalInsertImage toolbar item without image upload'] = [ - 'settings' => [ + 'ckeditor5_settings' => [ 'toolbar' => [ 'items' => [ 'drupalInsertImage', @@ -1150,14 +1150,14 @@ public static function providerPair(): array { ], ], ], - 'image_upload' => [ + 'editor_image_upload_settings' => [ 'status' => FALSE, ], 'filters' => [], - 'violations' => [], + 'expected_violations' => [], ]; $data['VALID: drupalInsertImage image upload enabled'] = [ - 'settings' => [ + 'ckeditor5_settings' => [ 'toolbar' => [ 'items' => [ 'drupalInsertImage', @@ -1169,7 +1169,7 @@ public static function providerPair(): array { ], ], ], - 'image_upload' => [ + 'editor_image_upload_settings' => [ 'status' => TRUE, 'scheme' => 'public', 'directory' => 'inline-images', @@ -1180,10 +1180,10 @@ public static function providerPair(): array { ], ], 'filters' => [], - 'violations' => [], + 'expected_violations' => [], ]; $data['INVALID: drupalMedia toolbar item condition NOT met: media filter disabled'] = [ - 'settings' => [ + 'ckeditor5_settings' => [ 'toolbar' => [ 'items' => [ 'drupalMedia', @@ -1191,16 +1191,16 @@ public static function providerPair(): array { ], 'plugins' => [], ], - 'image_upload' => [ + 'editor_image_upload_settings' => [ 'status' => FALSE, ], 'filters' => [], - 'violations' => [ + 'expected_violations' => [ 'settings.toolbar.items.0' => 'The <em class="placeholder">Drupal media</em> toolbar item requires the <em class="placeholder">Embed media</em> filter to be enabled.', ], ]; $data['VALID: drupalMedia toolbar item condition met: media filter enabled'] = [ - 'settings' => [ + 'ckeditor5_settings' => [ 'toolbar' => [ 'items' => [ 'drupalMedia', @@ -1212,7 +1212,7 @@ public static function providerPair(): array { ], ], ], - 'image_upload' => [ + 'editor_image_upload_settings' => [ 'status' => FALSE, ], 'filters' => [ @@ -1228,10 +1228,10 @@ public static function providerPair(): array { ], ], ], - 'violations' => [], + 'expected_violations' => [], ]; $data['VALID: HTML format: very minimal toolbar + wildcard in source editing HTML'] = [ - 'settings' => [ + 'ckeditor5_settings' => [ 'toolbar' => [ 'items' => [ 'bold', @@ -1244,7 +1244,7 @@ public static function providerPair(): array { ], ], ], - 'image_upload' => [ + 'editor_image_upload_settings' => [ 'status' => FALSE, ], 'filters' => [ @@ -1260,7 +1260,7 @@ public static function providerPair(): array { ], ], ], - 'violations' => [], + 'expected_violations' => [], ]; $self_xss_source_editing = [ // Dangerous attribute with all values allowed. @@ -1279,7 +1279,7 @@ public static function providerPair(): array { '<$text-container style>', ]; $data['INVALID: SourceEditing plugin configuration: self-XSS detected when using filter_html'] = [ - 'settings' => [ + 'ckeditor5_settings' => [ 'toolbar' => [ 'items' => [ 'sourceEditing', @@ -1291,7 +1291,7 @@ public static function providerPair(): array { ], ], ], - 'image_upload' => [ + 'editor_image_upload_settings' => [ 'status' => FALSE, ], 'filters' => [ @@ -1307,7 +1307,7 @@ public static function providerPair(): array { ], ], ], - 'violations' => [ + 'expected_violations' => [ 'filters.filter_html' => 'The current CKEditor 5 build requires the following elements and attributes: <br><code><br> <p onhover style> <* dir="ltr rtl" lang> <img on*> <blockquote style> <marquee> <a onclick="javascript:*"> <code style="foo: bar;"></code><br>The following elements are missing: <br><code><p onhover style> <img on*> <blockquote style> <code style="foo: bar;"></code>', 'settings.plugins.ckeditor5_sourceEditing.allowed_tags.0' => 'The following tag in the Source Editing "Manually editable HTML tags" field is a security risk: <em class="placeholder"><p onhover></em>.', 'settings.plugins.ckeditor5_sourceEditing.allowed_tags.1' => 'The following tag in the Source Editing "Manually editable HTML tags" field is a security risk: <em class="placeholder"><img on*></em>.', @@ -1318,7 +1318,7 @@ public static function providerPair(): array { ], ]; $data['VALID: SourceEditing plugin configuration: self-XSS not detected when not using filter_html'] = [ - 'settings' => [ + 'ckeditor5_settings' => [ 'toolbar' => [ 'items' => [ 'sourceEditing', @@ -1330,14 +1330,14 @@ public static function providerPair(): array { ], ], ], - 'image_upload' => [ + 'editor_image_upload_settings' => [ 'status' => FALSE, ], 'filters' => [], - 'violations' => [], + 'expected_violations' => [], ]; $data['INVALID: Style plugin configured to add class to unsupported tag'] = [ - 'settings' => [ + 'ckeditor5_settings' => [ 'toolbar' => [ 'items' => [ 'style', @@ -1354,7 +1354,7 @@ public static function providerPair(): array { ], ], ], - 'image_upload' => [ + 'editor_image_upload_settings' => [ 'status' => FALSE, ], 'filters' => [ @@ -1370,12 +1370,12 @@ public static function providerPair(): array { ], ], ], - 'violations' => [ + 'expected_violations' => [ 'settings.plugins.ckeditor5_style' => 'The <em class="placeholder">Style</em> plugin needs another plugin to create <code><blockquote></code>, for it to be able to create the following attributes: <code><blockquote class="highlighted"></code>. Enable a plugin that supports creating this tag. If none exists, you can configure the Source Editing plugin to support it.', ], ]; $data['INVALID: Style plugin configured to add class already added by an other plugin'] = [ - 'settings' => [ + 'ckeditor5_settings' => [ 'toolbar' => [ 'items' => [ 'alignment', @@ -1396,7 +1396,7 @@ public static function providerPair(): array { ], ], ], - 'image_upload' => [ + 'editor_image_upload_settings' => [ 'status' => FALSE, ], 'filters' => [ @@ -1412,12 +1412,12 @@ public static function providerPair(): array { ], ], ], - 'violations' => [ + 'expected_violations' => [ 'settings.plugins.ckeditor5_style.styles.0.element' => 'A style must only specify classes not supported by other plugins. The <code>text-align-justify</code> classes on <code><p></code> are already supported by the enabled <em class="placeholder">Alignment</em> plugin.', ], ]; $data['VALID: Style plugin configured to add new class to an already restricted tag'] = [ - 'settings' => [ + 'ckeditor5_settings' => [ 'toolbar' => [ 'items' => [ 'alignment', @@ -1438,7 +1438,7 @@ public static function providerPair(): array { ], ], ], - 'image_upload' => [ + 'editor_image_upload_settings' => [ 'status' => FALSE, ], 'filters' => [ @@ -1454,10 +1454,10 @@ public static function providerPair(): array { ], ], ], - 'violations' => [], + 'expected_violations' => [], ]; $data['VALID: Style plugin configured to add class to an element provided by an explicit plugin that already allows all classes'] = [ - 'settings' => [ + 'ckeditor5_settings' => [ 'toolbar' => [ 'items' => [ 'kbdAllClasses', @@ -1475,7 +1475,7 @@ public static function providerPair(): array { ], ], ], - 'image_upload' => [ + 'editor_image_upload_settings' => [ 'status' => FALSE, ], 'filters' => [ @@ -1491,10 +1491,10 @@ public static function providerPair(): array { ], ], ], - 'violations' => [], + 'expected_violations' => [], ]; $data['VALID: Style plugin configured to add class to GHS-supported HTML5 tag'] = [ - 'settings' => [ + 'ckeditor5_settings' => [ 'toolbar' => [ 'items' => [ 'style', @@ -1517,7 +1517,7 @@ public static function providerPair(): array { ], ], ], - 'image_upload' => [ + 'editor_image_upload_settings' => [ 'status' => FALSE, ], 'filters' => [ @@ -1533,10 +1533,10 @@ public static function providerPair(): array { ], ], ], - 'violations' => [], + 'expected_violations' => [], ]; $data['VALID: Style plugin configured to add class to GHS-supported HTML5 tag that already allows all classes'] = [ - 'settings' => [ + 'ckeditor5_settings' => [ 'toolbar' => [ 'items' => [ 'style', @@ -1559,7 +1559,7 @@ public static function providerPair(): array { ], ], ], - 'image_upload' => [ + 'editor_image_upload_settings' => [ 'status' => FALSE, ], 'filters' => [ @@ -1575,7 +1575,7 @@ public static function providerPair(): array { ], ], ], - 'violations' => [], + 'expected_violations' => [], ]; return $data; } diff --git a/core/modules/comment/tests/src/Kernel/Migrate/d6/MigrateCommentTypeTest.php b/core/modules/comment/tests/src/Kernel/Migrate/d6/MigrateCommentTypeTest.php index 255cfc1d037a..8ee007673985 100644 --- a/core/modules/comment/tests/src/Kernel/Migrate/d6/MigrateCommentTypeTest.php +++ b/core/modules/comment/tests/src/Kernel/Migrate/d6/MigrateCommentTypeTest.php @@ -118,24 +118,24 @@ public function testNoCommentTypeMigration(array $disabled_source_modules, array public static function providerTestNoCommentTypeMigration() { return [ 'Node module is disabled in source' => [ - 'Disabled source modules' => ['node'], - 'Expected messages' => [ + 'disabled_source_modules' => ['node'], + 'expected_messages' => [ 'error' => [ 'Migration d6_comment_type did not meet the requirements. The node module is not enabled in the source site.', ], ], ], 'Comment module is disabled in source' => [ - 'Disabled source modules' => ['comment'], - 'Expected messages' => [ + 'disabled_source_modules' => ['comment'], + 'expected_messages' => [ 'error' => [ 'Migration d6_comment_type did not meet the requirements. The module comment is not enabled in the source site.', ], ], ], 'Node and comment modules are disabled in source' => [ - 'Disabled source modules' => ['comment', 'node'], - 'Expected messages' => [ + 'disabled_source_modules' => ['comment', 'node'], + 'expected_messages' => [ 'error' => [ 'Migration d6_comment_type did not meet the requirements. The module comment is not enabled in the source site.', ], diff --git a/core/modules/comment/tests/src/Kernel/Plugin/migrate/source/CommentTypeRequirementsTest.php b/core/modules/comment/tests/src/Kernel/Plugin/migrate/source/CommentTypeRequirementsTest.php index d4470b1c947e..29404430f430 100644 --- a/core/modules/comment/tests/src/Kernel/Plugin/migrate/source/CommentTypeRequirementsTest.php +++ b/core/modules/comment/tests/src/Kernel/Plugin/migrate/source/CommentTypeRequirementsTest.php @@ -52,34 +52,34 @@ public function testCheckCommentTypeRequirements(array $disabled_source_modules, public static function providerTestCheckCommentTypeRequirements() { return [ 'D6 comment is disabled on source' => [ - 'Disabled source modules' => ['comment'], - 'RequirementsException message' => 'The module comment is not enabled in the source site.', - 'migration' => 'd6_comment_type', + 'disabled_source_modules' => ['comment'], + 'exception_message' => 'The module comment is not enabled in the source site.', + 'migration_plugin_id' => 'd6_comment_type', ], 'D6 node is disabled on source' => [ - 'Disabled source modules' => ['node'], - 'RequirementsException message' => 'The node module is not enabled in the source site.', - 'migration' => 'd6_comment_type', + 'disabled_source_modules' => ['node'], + 'exception_message' => 'The node module is not enabled in the source site.', + 'migration_plugin_id' => 'd6_comment_type', ], 'D6 comment and node are disabled on source' => [ - 'Disabled source modules' => ['comment', 'node'], - 'RequirementsException message' => 'The module comment is not enabled in the source site.', - 'migration' => 'd6_comment_type', + 'disabled_source_modules' => ['comment', 'node'], + 'exception_message' => 'The module comment is not enabled in the source site.', + 'migration_plugin_id' => 'd6_comment_type', ], 'D7 comment is disabled on source' => [ - 'Disabled source modules' => ['comment'], - 'RequirementsException message' => 'The module comment is not enabled in the source site.', - 'migration' => 'd7_comment_type', + 'disabled_source_modules' => ['comment'], + 'exception_message' => 'The module comment is not enabled in the source site.', + 'migration_plugin_id' => 'd7_comment_type', ], 'D7 node is disabled on source' => [ - 'Disabled source modules' => ['node'], - 'RequirementsException message' => 'The node module is not enabled in the source site.', - 'migration' => 'd7_comment_type', + 'disabled_source_modules' => ['node'], + 'exception_message' => 'The node module is not enabled in the source site.', + 'migration_plugin_id' => 'd7_comment_type', ], 'D7 comment and node are disabled on source' => [ - 'Disabled source modules' => ['comment', 'node'], - 'RequirementsException message' => 'The module comment is not enabled in the source site.', - 'migration' => 'd7_comment_type', + 'disabled_source_modules' => ['comment', 'node'], + 'exception_message' => 'The module comment is not enabled in the source site.', + 'migration_plugin_id' => 'd7_comment_type', ], ]; } diff --git a/core/modules/config_translation/tests/src/Kernel/Plugin/migrate/source/d6/ProfileFieldTranslationTest.php b/core/modules/config_translation/tests/src/Kernel/Plugin/migrate/source/d6/ProfileFieldTranslationTest.php index 1358c35411b1..35e23f8a18de 100644 --- a/core/modules/config_translation/tests/src/Kernel/Plugin/migrate/source/d6/ProfileFieldTranslationTest.php +++ b/core/modules/config_translation/tests/src/Kernel/Plugin/migrate/source/d6/ProfileFieldTranslationTest.php @@ -72,7 +72,7 @@ public static function providerSource() { ], ], ]; - $test[0]['expected_results'] = [ + $test[0]['expected_data'] = [ [ 'property' => 'title', 'translation' => "fr - I love migration.", diff --git a/core/modules/field/tests/src/Kernel/Plugin/migrate/source/d6/FieldInstanceOptionTranslationTest.php b/core/modules/field/tests/src/Kernel/Plugin/migrate/source/d6/FieldInstanceOptionTranslationTest.php index 252efe27ebff..9ab97e87570d 100644 --- a/core/modules/field/tests/src/Kernel/Plugin/migrate/source/d6/FieldInstanceOptionTranslationTest.php +++ b/core/modules/field/tests/src/Kernel/Plugin/migrate/source/d6/FieldInstanceOptionTranslationTest.php @@ -26,10 +26,10 @@ public static function providerSource() { // FieldInstanceOptionTranslation extends FieldOptionTranslation so the // same test can be used with the addition of the 'type' field to the // output. - $test[0]['expected_results'][0]['type'] = 'text'; - $test[0]['expected_results'][1]['type'] = 'text'; - $test[0]['expected_results'][2]['type'] = 'number_integer'; - $test[0]['expected_results'][3]['type'] = 'number_integer'; + $test[0]['expected_data'][0]['type'] = 'text'; + $test[0]['expected_data'][1]['type'] = 'text'; + $test[0]['expected_data'][2]['type'] = 'number_integer'; + $test[0]['expected_data'][3]['type'] = 'number_integer'; return $test; } diff --git a/core/modules/field/tests/src/Kernel/Plugin/migrate/source/d6/FieldOptionTranslationTest.php b/core/modules/field/tests/src/Kernel/Plugin/migrate/source/d6/FieldOptionTranslationTest.php index 19ace3c3f0e2..03a0b8768f13 100644 --- a/core/modules/field/tests/src/Kernel/Plugin/migrate/source/d6/FieldOptionTranslationTest.php +++ b/core/modules/field/tests/src/Kernel/Plugin/migrate/source/d6/FieldOptionTranslationTest.php @@ -158,7 +158,7 @@ public static function providerSource() { ], ]; - $test[0]['expected_results'] = [ + $test[0]['expected_data'] = [ [ 'field_name' => 'field_test_text_single_checkbox', 'type' => 'text', diff --git a/core/modules/field/tests/src/Kernel/Plugin/migrate/source/d7/FieldInstanceLabelDescriptionTranslationTest.php b/core/modules/field/tests/src/Kernel/Plugin/migrate/source/d7/FieldInstanceLabelDescriptionTranslationTest.php index 4b5a3de271cb..58e27aa00122 100644 --- a/core/modules/field/tests/src/Kernel/Plugin/migrate/source/d7/FieldInstanceLabelDescriptionTranslationTest.php +++ b/core/modules/field/tests/src/Kernel/Plugin/migrate/source/d7/FieldInstanceLabelDescriptionTranslationTest.php @@ -120,7 +120,7 @@ public static function providerSource() { ], ]; - $test[0]['expected_results'] = [ + $test[0]['expected_data'] = [ [ 'property' => 'label', 'translation' => "fr - story label", diff --git a/core/modules/field/tests/src/Kernel/Plugin/migrate/source/d7/FieldOptionTranslationTest.php b/core/modules/field/tests/src/Kernel/Plugin/migrate/source/d7/FieldOptionTranslationTest.php index c8efa643333e..1ec919d45f38 100644 --- a/core/modules/field/tests/src/Kernel/Plugin/migrate/source/d7/FieldOptionTranslationTest.php +++ b/core/modules/field/tests/src/Kernel/Plugin/migrate/source/d7/FieldOptionTranslationTest.php @@ -175,7 +175,7 @@ public static function providerSource() { 'i18n_status' => '0', ], ]; - $test[0]['expected_results'] = [ + $test[0]['expected_data'] = [ [ 'i18n_lid' => '1', 'textgroup' => 'field', diff --git a/core/modules/file/tests/src/Kernel/Plugin/Validation/Constraint/FileExtensionConstraintValidatorTest.php b/core/modules/file/tests/src/Kernel/Plugin/Validation/Constraint/FileExtensionConstraintValidatorTest.php index 9347eb7f529f..ac035d783d4e 100644 --- a/core/modules/file/tests/src/Kernel/Plugin/Validation/Constraint/FileExtensionConstraintValidatorTest.php +++ b/core/modules/file/tests/src/Kernel/Plugin/Validation/Constraint/FileExtensionConstraintValidatorTest.php @@ -68,38 +68,38 @@ public static function providerTestFileValidateExtensionsOnUri(): array { ]; return [ 'Temporary txt validated with "asdf", "txt", "pork"' => [ - 'File properties' => $temporary_txt_file_properties, - 'Allowed_extensions' => ['asdf', 'txt', 'pork'], - 'Expected errors' => [], + 'file_properties' => $temporary_txt_file_properties, + 'extensions' => ['asdf', 'txt', 'pork'], + 'expected_errors' => [], ], 'Temporary txt validated with "exe" and "png"' => [ - 'File properties' => $temporary_txt_file_properties, - 'Allowed_extensions' => ['exe', 'png'], - 'Expected errors' => [ + 'file_properties' => $temporary_txt_file_properties, + 'extensions' => ['exe', 'png'], + 'expected_errors' => [ 'Only files with the following extensions are allowed: exe png.', ], ], 'Permanent txt validated with "asdf", "txt", "pork"' => [ - 'File properties' => $permanent_txt_file_properties, - 'Allowed_extensions' => ['asdf', 'txt', 'pork'], - 'Expected errors' => [], + 'file_properties' => $permanent_txt_file_properties, + 'extensions' => ['asdf', 'txt', 'pork'], + 'expected_errors' => [], ], 'Permanent txt validated with "exe" and "png"' => [ - 'File properties' => $permanent_txt_file_properties, - 'Allowed_extensions' => ['exe', 'png'], - 'Expected errors' => [ + 'file_properties' => $permanent_txt_file_properties, + 'extensions' => ['exe', 'png'], + 'expected_errors' => [ 'Only files with the following extensions are allowed: exe png.', ], ], 'Permanent png validated with "png", "gif", "jpg", "jpeg"' => [ - 'File properties' => $permanent_png_file_properties, - 'Allowed_extensions' => ['png', 'gif', 'jpg', 'jpeg'], - 'Expected errors' => [], + 'file_properties' => $permanent_png_file_properties, + 'extensions' => ['png', 'gif', 'jpg', 'jpeg'], + 'expected_errors' => [], ], 'Permanent png validated with "exe" and "txt"' => [ - 'File properties' => $permanent_png_file_properties, - 'Allowed_extensions' => ['exe', 'txt'], - 'Expected errors' => [ + 'file_properties' => $permanent_png_file_properties, + 'extensions' => ['exe', 'txt'], + 'expected_errors' => [ 'Only files with the following extensions are allowed: exe txt.', ], ], diff --git a/core/modules/jsonapi/tests/src/Kernel/Normalizer/LinkCollectionNormalizerTest.php b/core/modules/jsonapi/tests/src/Kernel/Normalizer/LinkCollectionNormalizerTest.php index 43b02ea2610c..d3d3a0d1a42b 100644 --- a/core/modules/jsonapi/tests/src/Kernel/Normalizer/LinkCollectionNormalizerTest.php +++ b/core/modules/jsonapi/tests/src/Kernel/Normalizer/LinkCollectionNormalizerTest.php @@ -173,16 +173,16 @@ public function testLinkAccess($current_user_id, $edit_form_uid, $expected_link_ public static function linkAccessTestData() { return [ 'the edit-form link is present because uid 2 has access to the targeted resource (its own edit form)' => [ - 'uid' => 2, - 'edit-form uid' => 2, - 'expected link keys' => ['edit-form'], - 'expected cache contexts' => ['url.site', 'user'], + 'current_user_id' => 2, + 'edit_form_uid' => 2, + 'expected_link_keys' => ['edit-form'], + 'expected_cache_contexts' => ['url.site', 'user'], ], "the edit-form link is omitted because uid 3 doesn't have access to the targeted resource (another account's edit form)" => [ - 'uid' => 3, - 'edit-form uid' => 2, - 'expected link keys' => [], - 'expected cache contexts' => ['url.site', 'user'], + 'current_user_id' => 3, + 'edit_form_uid' => 2, + 'expected_link_keys' => [], + 'expected_cache_contexts' => ['url.site', 'user'], ], ]; } diff --git a/core/modules/menu_link_content/tests/src/Kernel/Plugin/migrate/source/d6/MenuLinkTranslationTest.php b/core/modules/menu_link_content/tests/src/Kernel/Plugin/migrate/source/d6/MenuLinkTranslationTest.php index 032361da4617..70046f1ef6f2 100644 --- a/core/modules/menu_link_content/tests/src/Kernel/Plugin/migrate/source/d6/MenuLinkTranslationTest.php +++ b/core/modules/menu_link_content/tests/src/Kernel/Plugin/migrate/source/d6/MenuLinkTranslationTest.php @@ -205,7 +205,7 @@ public static function providerSource() { ], ]; - $test[0]['expected_results'] = [ + $test[0]['expected_data'] = [ [ 'menu_name' => 'menu-test-menu', 'mlid' => 139, diff --git a/core/modules/menu_link_content/tests/src/Kernel/Plugin/migrate/source/d7/MenuLinkLocalizedTest.php b/core/modules/menu_link_content/tests/src/Kernel/Plugin/migrate/source/d7/MenuLinkLocalizedTest.php index 2a22259abdbe..e4a29a7b7874 100644 --- a/core/modules/menu_link_content/tests/src/Kernel/Plugin/migrate/source/d7/MenuLinkLocalizedTest.php +++ b/core/modules/menu_link_content/tests/src/Kernel/Plugin/migrate/source/d7/MenuLinkLocalizedTest.php @@ -149,7 +149,7 @@ public static function providerSource() { ], ]; - $tests[0]['expected_results'] = [ + $tests[0]['expected_data'] = [ [ 'menu_name' => 'menu-test-menu', 'mlid' => 130, diff --git a/core/modules/menu_link_content/tests/src/Kernel/Plugin/migrate/source/d7/MenuLinkTranslationTest.php b/core/modules/menu_link_content/tests/src/Kernel/Plugin/migrate/source/d7/MenuLinkTranslationTest.php index 3ffd41c772e7..af03b649c30b 100644 --- a/core/modules/menu_link_content/tests/src/Kernel/Plugin/migrate/source/d7/MenuLinkTranslationTest.php +++ b/core/modules/menu_link_content/tests/src/Kernel/Plugin/migrate/source/d7/MenuLinkTranslationTest.php @@ -105,7 +105,7 @@ public static function providerSource() { ], ]; - $test[0]['expected_results'] = [ + $test[0]['expected_data'] = [ [ 'menu_name' => 'menu-test-menu', 'mlid' => 130, diff --git a/core/modules/migrate/tests/src/Kernel/Plugin/MigrationTest.php b/core/modules/migrate/tests/src/Kernel/Plugin/MigrationTest.php index c0f337e5a3f7..2792d90d96d0 100644 --- a/core/modules/migrate/tests/src/Kernel/Plugin/MigrationTest.php +++ b/core/modules/migrate/tests/src/Kernel/Plugin/MigrationTest.php @@ -53,7 +53,7 @@ public function testGetProcessPluginsException() { * * @dataProvider getProcessPluginsExceptionMessageProvider */ - public function testGetProcessPluginsExceptionMessage(array $process) { + public function testGetProcessPluginsExceptionMessage(array $process): void { // Test with an invalid process pipeline. $plugin_definition = [ 'id' => 'foo', @@ -71,33 +71,11 @@ public function testGetProcessPluginsExceptionMessage(array $process) { /** * Provides data for testing invalid process pipeline. */ - public static function getProcessPluginsExceptionMessageProvider() { - return [ - [ - 'Null' => - [ - 'dest' => NULL, - ], - ], - [ - 'boolean' => - [ - 'dest' => TRUE, - ], - ], - [ - 'integer' => - [ - 'dest' => 2370, - ], - ], - [ - 'float' => - [ - 'dest' => 1.61, - ], - ], - ]; + public static function getProcessPluginsExceptionMessageProvider(): \Generator { + yield 'null' => ['process' => ['dest' => NULL]]; + yield 'boolean' => ['process' => ['dest' => TRUE]]; + yield 'integer' => ['process' => ['dest' => 2370]]; + yield 'float' => ['process' => ['dest' => 1.61]]; } /** diff --git a/core/modules/migrate/tests/src/Kernel/process/FileCopyTest.php b/core/modules/migrate/tests/src/Kernel/process/FileCopyTest.php index 0386e040969d..87cb1ee87290 100644 --- a/core/modules/migrate/tests/src/Kernel/process/FileCopyTest.php +++ b/core/modules/migrate/tests/src/Kernel/process/FileCopyTest.php @@ -114,12 +114,12 @@ public function testSuccessfulReuse($source_path, $destination_path) { public static function providerSuccessfulReuse() { return [ [ - 'local_source_path' => static::getDrupalRoot() . '/core/tests/fixtures/files/image-test.jpg', - 'local_destination_path' => 'public://file1.jpg', + 'source_path' => static::getDrupalRoot() . '/core/tests/fixtures/files/image-test.jpg', + 'destination_path' => 'public://file1.jpg', ], [ - 'remote_source_path' => 'https://www.drupal.org/favicon.ico', - 'remote_destination_path' => 'public://file2.jpg', + 'source_path' => 'https://www.drupal.org/favicon.ico', + 'destination_path' => 'public://file2.jpg', ], ]; } diff --git a/core/modules/migrate/tests/src/Kernel/process/SubProcessWithSkipTest.php b/core/modules/migrate/tests/src/Kernel/process/SubProcessWithSkipTest.php index ce91a921a5fe..ef970b4519d7 100644 --- a/core/modules/migrate/tests/src/Kernel/process/SubProcessWithSkipTest.php +++ b/core/modules/migrate/tests/src/Kernel/process/SubProcessWithSkipTest.php @@ -115,7 +115,7 @@ public static function providerTestSubProcessSkip(): array { return [ 'skip row' => [ 'method' => 'row', - 'expected' => [ + 'expected_data' => [ 'first' => 'something outside of sub_process', 'second' => [ [ @@ -127,7 +127,7 @@ public static function providerTestSubProcessSkip(): array { ], 'skip process' => [ 'method' => 'process', - 'expected' => [ + 'expected_data' => [ 'first' => 'something outside of sub_process', 'second' => [ [ diff --git a/core/modules/migrate_drupal/tests/src/Kernel/NodeMigrationTypePluginAlterTest.php b/core/modules/migrate_drupal/tests/src/Kernel/NodeMigrationTypePluginAlterTest.php index 434aac024505..935a7212ab40 100644 --- a/core/modules/migrate_drupal/tests/src/Kernel/NodeMigrationTypePluginAlterTest.php +++ b/core/modules/migrate_drupal/tests/src/Kernel/NodeMigrationTypePluginAlterTest.php @@ -103,13 +103,13 @@ public static function providerMigrationPluginAlter() { // Test migrations are not altered when classic node migrations is in use. $tests[0]['type'] = NodeMigrateType::NODE_MIGRATE_TYPE_CLASSIC; - $tests[0]['migrations'] = $migrations; - $tests[0]['expected_data'] = $tests[0]['migrations']; + $tests[0]['migration_definitions'] = $migrations; + $tests[0]['expected'] = $tests[0]['migration_definitions']; // Test migrations are altered when complete node migrations is in use. $tests[1] = $tests[0]; $tests[1]['type'] = NodeMigrateType::NODE_MIGRATE_TYPE_COMPLETE; - $tests[1]['expected_data']['dependencies_altered_if_complete']['migration_dependencies'] = [ + $tests[1]['expected']['dependencies_altered_if_complete']['migration_dependencies'] = [ 'required' => [ 'd7_node_complete', ], diff --git a/core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/d8/ConfigTest.php b/core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/d8/ConfigTest.php index b3ab62c3b77e..966f1d483450 100644 --- a/core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/d8/ConfigTest.php +++ b/core/modules/migrate_drupal/tests/src/Kernel/Plugin/migrate/source/d8/ConfigTest.php @@ -52,7 +52,7 @@ public static function providerSource() { ]; // The expected results. - $data[0]['expected_results'] = [ + $data[0]['expected_data'] = [ [ 'collection' => 'language.af', 'name' => 'user.settings', @@ -79,7 +79,7 @@ public static function providerSource() { // Test with name and no collection in configuration. $data[1]['source_data'] = $data[0]['source_data']; - $data[1]['expected_results'] = [ + $data[1]['expected_data'] = [ [ 'collection' => 'language.af', 'name' => 'bar', @@ -95,7 +95,7 @@ public static function providerSource() { // Test with collection and no name in configuration. $data[2]['source_data'] = $data[0]['source_data']; - $data[2]['expected_results'] = [ + $data[2]['expected_data'] = [ [ 'collection' => 'language.de', 'name' => 'user.settings', diff --git a/core/modules/system/tests/src/Kernel/Plugin/migrate/source/ExtensionTest.php b/core/modules/system/tests/src/Kernel/Plugin/migrate/source/ExtensionTest.php index b19194a51042..737093acd2a8 100644 --- a/core/modules/system/tests/src/Kernel/Plugin/migrate/source/ExtensionTest.php +++ b/core/modules/system/tests/src/Kernel/Plugin/migrate/source/ExtensionTest.php @@ -53,7 +53,7 @@ public static function providerSource() { ]; $info = unserialize('a:9:{s:4:"name";s:12:"Variable API";s:11:"description";s:12:"Variable API";s:4:"core";s:3:"6.x";s:7:"version";s:14:"6.x-1.0-alpha1";s:7:"project";s:8:"variable";s:9:"datestamp";s:10:"1414059742";s:12:"dependencies";a:0:{}s:10:"dependents";a:0:{}s:3:"php";s:5:"4.3.5";}'); - $test[0]['expected_results'] = [ + $test[0]['expected_data'] = [ [ 'filename' => 'sites/all/modules/variable/variable.module ', 'name' => 'variable', diff --git a/core/modules/taxonomy/tests/src/Kernel/Plugin/migrate/source/d6/VocabularyTranslationTest.php b/core/modules/taxonomy/tests/src/Kernel/Plugin/migrate/source/d6/VocabularyTranslationTest.php index ed6a6a2d3b82..2ef3cd4dc607 100644 --- a/core/modules/taxonomy/tests/src/Kernel/Plugin/migrate/source/d6/VocabularyTranslationTest.php +++ b/core/modules/taxonomy/tests/src/Kernel/Plugin/migrate/source/d6/VocabularyTranslationTest.php @@ -119,7 +119,7 @@ public static function providerSource() { ], ]; - $tests[0]['expected_results'] = [ + $tests[0]['expected_data'] = [ [ 'vid' => 1, 'name' => 'vocabulary 1', diff --git a/core/modules/taxonomy/tests/src/Kernel/Plugin/migrate/source/d7/VocabularyTranslationTest.php b/core/modules/taxonomy/tests/src/Kernel/Plugin/migrate/source/d7/VocabularyTranslationTest.php index 886ac9e40c9e..933bb0da6370 100644 --- a/core/modules/taxonomy/tests/src/Kernel/Plugin/migrate/source/d7/VocabularyTranslationTest.php +++ b/core/modules/taxonomy/tests/src/Kernel/Plugin/migrate/source/d7/VocabularyTranslationTest.php @@ -114,7 +114,7 @@ public static function providerSource() { ], ]; - $tests[0]['expected_results'] = [ + $tests[0]['expected_data'] = [ [ 'vid' => 1, 'name' => 'vocabulary 1', @@ -174,7 +174,7 @@ public static function providerSource() { unset($data['language']); unset($data['i18n_mode']); } - foreach ($tests[1]['expected_results'] as &$data) { + foreach ($tests[1]['expected_data'] as &$data) { unset($data['v_language']); unset($data['i18n_mode']); } diff --git a/core/modules/views/tests/src/Kernel/Plugin/StyleGridResponsiveTest.php b/core/modules/views/tests/src/Kernel/Plugin/StyleGridResponsiveTest.php index a3c9b44b4522..04cc6c53c16d 100644 --- a/core/modules/views/tests/src/Kernel/Plugin/StyleGridResponsiveTest.php +++ b/core/modules/views/tests/src/Kernel/Plugin/StyleGridResponsiveTest.php @@ -73,7 +73,7 @@ public function testResponsiveGrid(array $options, array $expected): void { public static function providerTestResponsiveGrid() { return [ 'horizontal' => [ - 'settings' => [ + 'options' => [ 'columns' => 7, 'cell_min_width' => 123, 'grid_gutter' => 13, @@ -87,7 +87,7 @@ public static function providerTestResponsiveGrid() { ], ], 'vertical' => [ - 'settings' => [ + 'options' => [ 'columns' => 8, 'cell_min_width' => 50, 'grid_gutter' => 44, @@ -101,7 +101,7 @@ public static function providerTestResponsiveGrid() { ], ], 'default options' => [ - 'settings' => [], + 'options' => [], 'expected' => [ 'columns' => 4, 'cell_min_width' => 100, diff --git a/core/tests/Drupal/KernelTests/Core/Entity/ContentEntityStorageBaseTest.php b/core/tests/Drupal/KernelTests/Core/Entity/ContentEntityStorageBaseTest.php index afc16d138b34..0ee23a8e8d4a 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/ContentEntityStorageBaseTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/ContentEntityStorageBaseTest.php @@ -33,7 +33,7 @@ protected function setUp(): void { * * @dataProvider providerTestCreate */ - public function testCreate($bundle) { + public function testCreate(string|array $bundle): void { $storage = $this->container->get('entity_type.manager')->getStorage('entity_test'); $entity = $storage->create(['type' => $bundle]); @@ -43,12 +43,10 @@ public function testCreate($bundle) { /** * Provides test data for testCreate(). */ - public static function providerTestCreate() { - return [ - ['scalar' => 'test_bundle'], - ['array keyed by delta' => [0 => ['value' => 'test_bundle']]], - ['array keyed by main property name' => ['value' => 'test_bundle']], - ]; + public static function providerTestCreate(): \Generator { + yield 'scalar' => ['bundle' => 'test_bundle']; + yield 'array keyed by delta' => ['bundle' => [0 => ['value' => 'test_bundle']]]; + yield 'array keyed by main property name' => ['bundle' => ['value' => 'test_bundle']]; } /** diff --git a/core/tests/Drupal/Tests/Core/Access/AccessManagerTest.php b/core/tests/Drupal/Tests/Core/Access/AccessManagerTest.php index 3ab74deee02f..248cbeac54ff 100644 --- a/core/tests/Drupal/Tests/Core/Access/AccessManagerTest.php +++ b/core/tests/Drupal/Tests/Core/Access/AccessManagerTest.php @@ -264,7 +264,7 @@ public static function providerTestCheckConjunctions() { 'name' => 'test_route_5', 'condition_one' => 'TRUE', 'condition_two' => 'NULL', - 'expected' => $access_deny, + 'expected_access' => $access_deny, ]; $access_configurations[] = [ 'name' => 'test_route_6', -- GitLab