From 13e67baae3adc6c3e231c323104fa66b4f7d2e93 Mon Sep 17 00:00:00 2001 From: Soner Sayakci Date: Thu, 29 Oct 2020 15:50:07 +0100 Subject: [PATCH 001/730] SW-25773 - Add escaping to email field in customer module --- UPGRADE-5.6.md | 5 +++++ .../ExtJs/backend/customer/view/customer_stream/preview.js | 2 +- .../ExtJs/backend/customer/view/main/customer_list.js | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/UPGRADE-5.6.md b/UPGRADE-5.6.md index 4d10e9a21a6..d125947714f 100644 --- a/UPGRADE-5.6.md +++ b/UPGRADE-5.6.md @@ -2,6 +2,11 @@ This changelog references changes done in Shopware 5.6 patch versions. +## 5.6.9 + +[View all changes from v5.6.8...v5.6.9](https://github.com/shopware/shopware/compare/v5.6.8...v5.6.9) + + ## 5.6.8 [View all changes from v5.6.7...v5.6.8](https://github.com/shopware/shopware/compare/v5.6.7...v5.6.8) diff --git a/themes/Backend/ExtJs/backend/customer/view/customer_stream/preview.js b/themes/Backend/ExtJs/backend/customer/view/customer_stream/preview.js index 121de244635..8733d04995e 100644 --- a/themes/Backend/ExtJs/backend/customer/view/customer_stream/preview.js +++ b/themes/Backend/ExtJs/backend/customer/view/customer_stream/preview.js @@ -225,7 +225,7 @@ Ext.define('Shopware.apps.Customer.view.customer_stream.Preview', { company = '
' + record.get('company') + ''; } - var mail = Ext.String.format('[0]', record.get('email')); + var mail = Ext.String.format('[0]', Ext.util.Format.htmlEncode(record.get('email'))); return name + age + company + '
' + mail; } diff --git a/themes/Backend/ExtJs/backend/customer/view/main/customer_list.js b/themes/Backend/ExtJs/backend/customer/view/main/customer_list.js index f6ae1bfd70e..8330e829b09 100644 --- a/themes/Backend/ExtJs/backend/customer/view/main/customer_list.js +++ b/themes/Backend/ExtJs/backend/customer/view/main/customer_list.js @@ -113,6 +113,7 @@ Ext.define('Shopware.apps.Customer.view.main.CustomerList', { }, mailRenderer: function(value) { + value = Ext.util.Format.htmlEncode(value); return Ext.String.format('[0]', value); }, From 71dabe5bc5649dca36e43a3ff47995f1e6c2d474 Mon Sep 17 00:00:00 2001 From: Soner Sayakci Date: Fri, 30 Oct 2020 10:06:42 +0100 Subject: [PATCH 002/730] SW-25772 - Improve Newsletter Preview --- .../ExtJs/backend/newsletter_manager/controller/editor.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/themes/Backend/ExtJs/backend/newsletter_manager/controller/editor.js b/themes/Backend/ExtJs/backend/newsletter_manager/controller/editor.js index 8d9ad332c26..3f47d99402f 100644 --- a/themes/Backend/ExtJs/backend/newsletter_manager/controller/editor.js +++ b/themes/Backend/ExtJs/backend/newsletter_manager/controller/editor.js @@ -400,7 +400,8 @@ Ext.define('Shopware.apps.NewsletterManager.controller.Editor', { id: 'iframe-win', // Add id autoEl: { tag: 'iframe', - src: url + src: url, + sandbox: '1' } }] }).show(); From 5d63117bea53ab2d13a058e4040873306e83adbc Mon Sep 17 00:00:00 2001 From: Soner Sayakci Date: Fri, 30 Oct 2020 10:47:27 +0100 Subject: [PATCH 003/730] NTR - Change image --- .gitlab-ci.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 125397b0f0d..87297fc1f4e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -17,7 +17,7 @@ stages: - Security default: - image: gitlab.shopware.com:5005/shopware/5/product/shopware:7.3 + image: gitlab.shopware.com:5005/shopware/5/product/image/continuous:7.3 before_script: - sed -i -e "s;__ROOT__;$CI_PROJECT_DIR;g" /etc/nginx/sites-enabled/shopware.conf - cat /etc/nginx/sites-enabled/shopware.conf @@ -97,7 +97,7 @@ Code Coverage: PHP 7.2: extends: .phpunit_base - image: gitlab.shopware.com:5005/shopware/5/product/shopware:7.2 + image: gitlab.shopware.com:5005/shopware/5/product/image/continuous:7.2 stage: Unit services: - name: mysql:5.7 @@ -105,7 +105,7 @@ PHP 7.2: PHP 7.3: extends: .phpunit_base - image: gitlab.shopware.com:5005/shopware/5/product/shopware:7.3 + image: gitlab.shopware.com:5005/shopware/5/product/image/continuous:7.3 stage: Unit services: - name: mysql:5.7 @@ -113,7 +113,7 @@ PHP 7.3: PHP 7.4: extends: .phpunit_base - image: gitlab.shopware.com:5005/shopware/5/product/shopware:7.4 + image: gitlab.shopware.com:5005/shopware/5/product/image/continuous:7.4 stage: Unit services: - name: mysql:5.7 @@ -151,7 +151,7 @@ MariaDB 10.4: # stage: Elasticsearch Elasticsearch 6: extends: .phpunit_es_base - image: gitlab.shopware.com:5005/shopware/5/product/shopware:7.2 + image: gitlab.shopware.com:5005/shopware/5/product/image/continuous:7.2 stage: Elasticsearch services: - name: mysql:8.0 @@ -163,7 +163,7 @@ Elasticsearch 6: Elasticsearch 7: extends: .phpunit_es_base - image: gitlab.shopware.com:5005/shopware/5/product/shopware:7.3 + image: gitlab.shopware.com:5005/shopware/5/product/image/continuous:7.3 stage: Elasticsearch services: - name: mysql:8.0 @@ -175,7 +175,7 @@ Elasticsearch 7: Mink: extends: .phpunit_base - image: gitlab.shopware.com:5005/shopware/5/product/shopware:7.3 + image: gitlab.shopware.com:5005/shopware/5/product/image/continuous:7.3 stage: E2E artifacts: when: always From 2351372e8d78a504f9dba20e42341509137e680b Mon Sep 17 00:00:00 2001 From: Patrick Stahl Date: Thu, 29 Oct 2020 15:35:27 +0100 Subject: [PATCH 004/730] SW-25771 - Fix missing escape in emotion element templates --- .../Bare/widgets/emotion/components/component_banner.tpl | 2 +- .../Bare/widgets/emotion/components/component_iframe.tpl | 4 ++-- .../Bare/widgets/emotion/components/component_youtube.tpl | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/themes/Frontend/Bare/widgets/emotion/components/component_banner.tpl b/themes/Frontend/Bare/widgets/emotion/components/component_banner.tpl index bc8906bbda3..fe8f6bb5b93 100644 --- a/themes/Frontend/Bare/widgets/emotion/components/component_banner.tpl +++ b/themes/Frontend/Bare/widgets/emotion/components/component_banner.tpl @@ -76,7 +76,7 @@ {/foreach} {elseif $Data.link} - diff --git a/themes/Frontend/Bare/widgets/emotion/components/component_iframe.tpl b/themes/Frontend/Bare/widgets/emotion/components/component_iframe.tpl index 387793a4dff..a4cf8ea27c6 100644 --- a/themes/Frontend/Bare/widgets/emotion/components/component_iframe.tpl +++ b/themes/Frontend/Bare/widgets/emotion/components/component_iframe.tpl @@ -4,8 +4,8 @@ {/if} -{/block} \ No newline at end of file +{/block} diff --git a/themes/Frontend/Bare/widgets/emotion/components/component_youtube.tpl b/themes/Frontend/Bare/widgets/emotion/components/component_youtube.tpl index 798ba7cb0ae..7887e728dcd 100644 --- a/themes/Frontend/Bare/widgets/emotion/components/component_youtube.tpl +++ b/themes/Frontend/Bare/widgets/emotion/components/component_youtube.tpl @@ -22,10 +22,10 @@ {/if} -{/block} \ No newline at end of file +{/block} From eb5c32704dbfe9f4499ec93aaee8d4ce4f50d87c Mon Sep 17 00:00:00 2001 From: Soner Sayakci Date: Fri, 30 Oct 2020 16:11:31 +0100 Subject: [PATCH 005/730] SW-25691 - Fix bot detection for Huawei devices --- UPGRADE-5.6.md | 3 + .../1657-fixing-bot-detection-huawei.php | 69 +++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 _sql/migrations/1657-fixing-bot-detection-huawei.php diff --git a/UPGRADE-5.6.md b/UPGRADE-5.6.md index d125947714f..777cc8d94f3 100644 --- a/UPGRADE-5.6.md +++ b/UPGRADE-5.6.md @@ -6,6 +6,9 @@ This changelog references changes done in Shopware 5.6 patch versions. [View all changes from v5.6.8...v5.6.9](https://github.com/shopware/shopware/compare/v5.6.8...v5.6.9) +### Changes + +* Changed bot detection to not recognize Huawei devices as bot ## 5.6.8 diff --git a/_sql/migrations/1657-fixing-bot-detection-huawei.php b/_sql/migrations/1657-fixing-bot-detection-huawei.php new file mode 100644 index 00000000000..8157bdf7133 --- /dev/null +++ b/_sql/migrations/1657-fixing-bot-detection-huawei.php @@ -0,0 +1,69 @@ +fixStandardBlacklist(); + + $this->fixCustomerBlacklists(); + } + + private function fixStandardBlacklist(): void + { + $blacklistConfig = $this->connection + ->query("SELECT * FROM s_core_config_elements WHERE name = 'botBlackList'") + ->fetchAll(PDO::FETCH_ASSOC) + ; + + if (empty($blacklistConfig)) { + return; + } + + $botList = $this->getFilteredBotList($blacklistConfig[0]['value']); + $statement = $this->connection->prepare(" + UPDATE s_core_config_elements + SET value = :value + WHERE id = :id + "); + $statement->execute([ + 'value' => $botList, + 'id' => $blacklistConfig[0]['id'] + ]); + } + + private function fixCustomerBlacklists(): void + { + $blacklistConfig = $this->connection + ->query("SELECT v.* FROM s_core_config_values as v INNER JOIN s_core_config_elements as e on v.element_id = e.id WHERE e.name = 'botBlackList'") + ->fetchAll(PDO::FETCH_ASSOC) + ; + + if (empty($blacklistConfig)) { + return; + } + + foreach ($blacklistConfig as $config) { + $botList = $this->getFilteredBotList($config['value']); + $statement = $this->connection->prepare(" + UPDATE s_core_config_values + SET value = :value + WHERE id = :id + "); + $statement->execute([ + 'value' => $botList, + 'id' => $config['id'] + ]); + } + } + + private function getFilteredBotList(string $botConfiguration): string + { + $botList = explode(';', unserialize($botConfiguration, ['allowed_classes' => false])); + $botList = array_filter($botList, function ($bot) { + return $bot !== 'core'; + }); + + return serialize(implode(";", $botList)); + } +} From 00a172e762c45af14cb16345a944a9e22ec12aeb Mon Sep 17 00:00:00 2001 From: Patrick Stahl Date: Mon, 2 Nov 2020 23:42:52 +0100 Subject: [PATCH 006/730] SW-25771 - Fix escaping of value in youtube element in the emotion grid, not in the preview --- .../ExtJs/backend/emotion/view/detail/elements/youtube.js | 1 + 1 file changed, 1 insertion(+) diff --git a/themes/Backend/ExtJs/backend/emotion/view/detail/elements/youtube.js b/themes/Backend/ExtJs/backend/emotion/view/detail/elements/youtube.js index 666fc718a6a..7289b0b60e4 100644 --- a/themes/Backend/ExtJs/backend/emotion/view/detail/elements/youtube.js +++ b/themes/Backend/ExtJs/backend/emotion/view/detail/elements/youtube.js @@ -47,6 +47,7 @@ Ext.define('Shopware.apps.Emotion.view.detail.elements.Youtube', { videoID = me.getConfigValue('video_id'); if (Ext.isDefined(videoID)) { + videoID = Ext.util.Format.htmlEncode(videoID); teaserImage = Ext.String.format('https://img.youtube.com/vi/[0]/0.jpg', videoID); style = Ext.String.format('background-image: url([0]);', teaserImage); From 713c20f80264915944e2aeb133f2f02e62bd4cd0 Mon Sep 17 00:00:00 2001 From: Soner Sayakci Date: Fri, 6 Nov 2020 06:41:26 +0100 Subject: [PATCH 007/730] SW-25772 - Fix sandbox attribute --- .../ExtJs/backend/newsletter_manager/controller/editor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/Backend/ExtJs/backend/newsletter_manager/controller/editor.js b/themes/Backend/ExtJs/backend/newsletter_manager/controller/editor.js index 3f47d99402f..eae157a149a 100644 --- a/themes/Backend/ExtJs/backend/newsletter_manager/controller/editor.js +++ b/themes/Backend/ExtJs/backend/newsletter_manager/controller/editor.js @@ -401,7 +401,7 @@ Ext.define('Shopware.apps.NewsletterManager.controller.Editor', { autoEl: { tag: 'iframe', src: url, - sandbox: '1' + sandbox: '' } }] }).show(); From f525dd0973910ad4ebaf14c1c252172e226369b7 Mon Sep 17 00:00:00 2001 From: Soner Sayakci Date: Fri, 6 Nov 2020 08:38:23 +0100 Subject: [PATCH 008/730] SW-25772 - Format newsletter title --- engine/Shopware/Core/sMarketing.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/Shopware/Core/sMarketing.php b/engine/Shopware/Core/sMarketing.php index fe75f505294..de63a6d591a 100644 --- a/engine/Shopware/Core/sMarketing.php +++ b/engine/Shopware/Core/sMarketing.php @@ -713,7 +713,7 @@ public function sMailCampaignsGetDetail($id) if (strpos($getText['link'], 'http') === false && $getText['link']) { $getText['link'] = 'http://' . $getText['link']; } - $getCampaignContainers[$campaignKey]['description'] = $getText['headline']; + $getCampaignContainers[$campaignKey]['description'] = htmlspecialchars($getText['headline']); $getCampaignContainers[$campaignKey]['data'] = $getText; break; } From 47ca359ef11cd63f3b771822a86ae5656957d46c Mon Sep 17 00:00:00 2001 From: teiling88 Date: Mon, 18 Jan 2021 15:57:42 +0100 Subject: [PATCH 009/730] NTR - fix all defect migrations for php7.4.14 usage --- _sql/migrations/1434-add-href-default-selection.php | 2 +- _sql/migrations/1442-add-meta-description-config.php | 2 +- _sql/migrations/1459-change-shipping-costs-configs.php | 5 ++--- _sql/migrations/220-add-payment-data-restriction.php | 2 +- _sql/migrations/388-add-emotion-fields-position.php | 1 - _sql/migrations/393-add-404-page-config-options.php | 2 -- _sql/migrations/469-add-404-article-page-config.php | 1 - _sql/migrations/741-migrate-salutation-mails.php | 3 +-- _sql/migrations/901-add-vote-shop-id.php | 2 +- 9 files changed, 7 insertions(+), 13 deletions(-) diff --git a/_sql/migrations/1434-add-href-default-selection.php b/_sql/migrations/1434-add-href-default-selection.php index 12122475606..36f59b8ad11 100644 --- a/_sql/migrations/1434-add-href-default-selection.php +++ b/_sql/migrations/1434-add-href-default-selection.php @@ -44,7 +44,7 @@ public function up($modus) $sql = <<<'EOD' SET @elementId = LAST_INSERT_ID(); INSERT IGNORE INTO `s_core_config_element_translations` (`element_id`, `locale_id`, `label`, `description`) -VALUES (@elementId, 2, 'Default href-lang', 'The selected shop will be shown as "x-default" in the href-lang tag, therefore using this shop's language as default.); +VALUES (@elementId, 2, 'Default href-lang', 'The selected shop will be shown as "x-default" in the href-lang tag, therefore using this shop\'s language as default.'); EOD; $this->addSql($sql); } diff --git a/_sql/migrations/1442-add-meta-description-config.php b/_sql/migrations/1442-add-meta-description-config.php index 4590def0aec..bd67f4b35f2 100644 --- a/_sql/migrations/1442-add-meta-description-config.php +++ b/_sql/migrations/1442-add-meta-description-config.php @@ -36,7 +36,7 @@ public function up($modus) $sql = <<<'EOD' SET @elementId = LAST_INSERT_ID(); -INSERT IGNORE INTO `s_core_config_element_translations` (`element_id`, `locale_id`, `label`, `description`) +INSERT IGNORE INTO `s_core_config_element_translations` (`element_id`, `locale_id`, `label`) VALUES (@elementId, 2, 'Maximum allowed length of the meta description'); EOD; $this->addSql($sql); diff --git a/_sql/migrations/1459-change-shipping-costs-configs.php b/_sql/migrations/1459-change-shipping-costs-configs.php index 12b86b21e0f..6a6f75118e4 100644 --- a/_sql/migrations/1459-change-shipping-costs-configs.php +++ b/_sql/migrations/1459-change-shipping-costs-configs.php @@ -66,9 +66,8 @@ public function up($modus) UPDATE s_core_config_elements set `type`='select', `position`=5, options='%s', `value`='i:1;', label='Versandkostenberechnung im Warenkorb anzeigen' where id=@elementId; UPDATE `s_core_config_element_translations` set `label`='Show shipping costs calculation in shopping cart' where element_id=@elementId; - UPDATE s_core_config_values SET value = 'i:0;' - FROM s_core_config_values - WHERE element_id = @elementId); + UPDATE s_core_config_values SET value = 'i:0;' + WHERE element_id = @elementId; SQL; $this->addSql(sprintf($sql, serialize($options))); } diff --git a/_sql/migrations/220-add-payment-data-restriction.php b/_sql/migrations/220-add-payment-data-restriction.php index 8672bc580d8..4ec5da70a69 100644 --- a/_sql/migrations/220-add-payment-data-restriction.php +++ b/_sql/migrations/220-add-payment-data-restriction.php @@ -16,7 +16,7 @@ public function up($modus) HAVING COUNT(1) > 1 ) as t); - ALTER IGNORE TABLE `s_core_payment_data` ADD UNIQUE ( + ALTER TABLE `s_core_payment_data` ADD UNIQUE ( `payment_mean_id` , `user_id` ); diff --git a/_sql/migrations/388-add-emotion-fields-position.php b/_sql/migrations/388-add-emotion-fields-position.php index 323858698a0..1106c9bf7c0 100644 --- a/_sql/migrations/388-add-emotion-fields-position.php +++ b/_sql/migrations/388-add-emotion-fields-position.php @@ -11,7 +11,6 @@ public function up($modus) $this->addSql(" INSERT INTO `s_library_component_field` (`componentID`, `name`, `x_type`, `value_type`, `field_label`, `support_text`, `help_title`, `help_text`, `store`, `display_field`, `value_field`, `default_value`, `allow_blank`, `position`) VALUES (@parent, 'article_slider_category', 'emotion-components-fields-category-selection', '', '', '', '', '', '', '', '', '', 1, @maxNumberPosition); -EOD; "); } } diff --git a/_sql/migrations/393-add-404-page-config-options.php b/_sql/migrations/393-add-404-page-config-options.php index 6bcd3800720..4920d8b96c6 100644 --- a/_sql/migrations/393-add-404-page-config-options.php +++ b/_sql/migrations/393-add-404-page-config-options.php @@ -7,7 +7,6 @@ public function up($modus) $sql = <<addSql($sql); $this->addSql("SET @elementId = (SELECT id FROM s_core_config_elements WHERE name = 'PageNotFoundDestination' LIMIT 1);"); @@ -20,7 +19,6 @@ public function up($modus) $sql = <<addSql($sql); $this->addSql("SET @elementId = (SELECT id FROM s_core_config_elements WHERE name = 'PageNotFoundCode' LIMIT 1);"); diff --git a/_sql/migrations/469-add-404-article-page-config.php b/_sql/migrations/469-add-404-article-page-config.php index 4348482ad47..4ecafd9a480 100644 --- a/_sql/migrations/469-add-404-article-page-config.php +++ b/_sql/migrations/469-add-404-article-page-config.php @@ -7,7 +7,6 @@ public function up($modus) $sql = <<addSql($sql); $this->addSql("SET @elementId = (SELECT id FROM s_core_config_elements WHERE name = 'RelatedArticlesOnArticleNotFound' LIMIT 1);"); diff --git a/_sql/migrations/741-migrate-salutation-mails.php b/_sql/migrations/741-migrate-salutation-mails.php index aa8c8a89606..a4c7ace3bbc 100644 --- a/_sql/migrations/741-migrate-salutation-mails.php +++ b/_sql/migrations/741-migrate-salutation-mails.php @@ -59,7 +59,7 @@ public function up($modus) $sql = <<<'EOD' SET @elementId = (SELECT id FROM s_core_config_elements WHERE name = 'displayprofiletitle' LIMIT 1); - INSERT INTO `s_core_config_element_translations` (`element_id`, `locale_id`, `label`) VALUES (@elementId, 2, 'Display title field', NULL); + INSERT INTO `s_core_config_element_translations` (`element_id`, `locale_id`, `label`) VALUES (@elementId, 2, 'Display title field'); EOD; $this->addSql($sql); @@ -94,7 +94,6 @@ public function up($modus) (NULL, 7, 'sORDERSTATEMAIL7', '{config name=mail}', '{config name=shopName}', 'Statusänderung zur Bestellung bei {config name=shopName}', '{include file="string:{config name=emailheaderplain}"}\r\n\r\nHallo {$sUser.billing_salutation|salutation} {$sUser.billing_firstname} {$sUser.billing_lastname},\n\nder Bestellstatus für Ihre Bestellung {$sOrder.ordernumber} hat sich geändert!\nDie Bestellung hat jetzt den Status: {$sOrder.status_description}.\n\nDen aktuellen Status Ihrer Bestellung können Sie auch jederzeit auf unserer Webseite im Bereich "Mein Konto" - "Meine Bestellungen" abrufen. Sollten Sie allerdings den Kauf ohne Registrierung, also ohne Anlage eines Kundenkontos, gewählt haben, steht Ihnen diese Möglichkeit nicht zur Verfügung.\r\n\r\n{include file="string:{config name=emailfooterplain}"}', '', 0, '', 3, 'a:3:{s:5:"sShop";s:13:"Shopware Demo";s:8:"sShopURL";s:20:"http://localhost/5.1";s:7:"sConfig";a:0:{}}', 0), (NULL, NULL, 'sBIRTHDAY', '{config name=mail}', '{config name=shopName}', 'Herzlichen Glückwunsch zum Geburtstag von {config name=shopName}', '{include file="string:{config name=emailheaderplain}"}\r\n\r\nHallo {$sUser.salutation|salutation} {$sUser.firstname} {$sUser.lastname},\n\nwir wünschen Ihnen alles Gute zum Geburtstag.\r\n\r\n{include file="string:{config name=emailfooterplain}"}', '', 0, '', 2, NULL, 0), (NULL, NULL, 'sARTICLECOMMENT', '{config name=mail}', '{config name=shopName}', 'Artikel bewerten', '{include file="string:{config name=emailheaderplain}"}\r\n\r\nHallo {$sUser.billing_salutation|salutation} {$sUser.billing_firstname} {$sUser.billing_lastname},\n\nSie haben bei uns vor einigen Tagen Artikel gekauft. Wir würden uns freuen, wenn Sie diese Artikel bewerten würden.
\nSo helfen Sie uns, unseren Service weiter zu steigern und Sie können auf diesem Weg anderen Interessenten direkt Ihre Meinung mitteilen.\n\n\nHier finden Sie die Links zum Bewerten der von Ihnen gekauften Produkte.\n\n{foreach from=$sArticles item=sArticle key=key}\n{if !$sArticle.modus}\n{$sArticle.articleordernumber} {$sArticle.name} {$sArticle.link}\n{/if}\n{/foreach}\r\n\r\n{include file="string:{config name=emailfooterplain}"}', '{include file="string:{config name=emailheaderhtml}"}\r\n

\r\nHallo {if $sUser.salutation eq "mr"}Herr{elseif $sUser.billing_salutation eq "ms"}Frau{/if} {$sUser.billing_firstname} {$sUser.billing_lastname},\n
\nSie haben bei uns vor einigen Tagen Artikel gekauft. Wir würden uns freuen, wenn Sie diese Artikel bewerten würden.
\nSo helfen Sie uns, unseren Service weiter zu steigern und Sie können auf diesem Weg anderen Interessenten direkt Ihre Meinung mitteilen.\n

\n\nHier finden Sie die Links zum Bewerten der von Ihnen gekauften Produkte.\n\n\n {foreach from=$sArticles item=sArticle key=key}\n{if !$sArticle.modus}\n \n \n \n \n \n{/if}\n {/foreach}\n
{$sArticle.articleordernumber}{$sArticle.name}\n link\n
\r\n

\r\n{include file="string:{config name=emailfooterhtml}"}', 1, '', 2, NULL, 0); - EOD; $this->addSql($sql); diff --git a/_sql/migrations/901-add-vote-shop-id.php b/_sql/migrations/901-add-vote-shop-id.php index 175e27c7652..3c2fbf5506a 100644 --- a/_sql/migrations/901-add-vote-shop-id.php +++ b/_sql/migrations/901-add-vote-shop-id.php @@ -20,7 +20,7 @@ public function up($modus) $sql = <<<'EOD' SET @elementId = (SELECT id FROM s_core_config_elements WHERE name = 'displayOnlySubShopVotes' LIMIT 1); - INSERT INTO `s_core_config_element_translations` (`element_id`, `locale_id`, `label`) VALUES (@elementId, 2, 'Display shop specific votes only', NULL); + INSERT INTO `s_core_config_element_translations` (`element_id`, `locale_id`, `label`) VALUES (@elementId, 2, 'Display shop specific votes only'); EOD; $this->addSql($sql); From afba0dcde6b368934313f03ff4ba147263f7c1df Mon Sep 17 00:00:00 2001 From: Claudio Bley Date: Fri, 15 Jan 2021 10:38:55 +0100 Subject: [PATCH 010/730] SW-25898 - Require the filter extension to avoid error in Symfony Otherwise you would get: `Call to undefined function filter_var()` in symfony/http-foundation/IpUtils.php:71 fixes #2408 --- README.md | 1 + composer.json | 1 + 2 files changed, 2 insertions(+) diff --git a/README.md b/README.md index ea8627d3be0..38549b5d91b 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,7 @@ Visit the forum at - ctype - curl - dom +- filter - hash - iconv - gd (with freetype and libjpeg) diff --git a/composer.json b/composer.json index 80373706bd8..5a7e9718dbd 100644 --- a/composer.json +++ b/composer.json @@ -21,6 +21,7 @@ "ext-curl": "*", "ext-date": "*", "ext-dom": "*", + "ext-filter": "*", "ext-gd": "*", "ext-hash": "*", "ext-iconv": "*", From 90bb86fdfaf1ece4684e54d8b90d3d43921d37a6 Mon Sep 17 00:00:00 2001 From: teiling88 Date: Wed, 20 Jan 2021 22:26:17 +0100 Subject: [PATCH 011/730] NTR - fix unit tests --- _sql/migrations/1434-add-href-default-selection.php | 7 ------- _sql/migrations/1442-add-meta-description-config.php | 7 ------- _sql/migrations/388-add-emotion-fields-position.php | 4 ---- _sql/migrations/393-add-404-page-config-options.php | 10 ---------- _sql/migrations/469-add-404-article-page-config.php | 6 ------ _sql/migrations/741-migrate-salutation-mails.php | 7 ------- _sql/migrations/901-add-vote-shop-id.php | 6 ------ 7 files changed, 47 deletions(-) diff --git a/_sql/migrations/1434-add-href-default-selection.php b/_sql/migrations/1434-add-href-default-selection.php index 36f59b8ad11..1515c7a4a38 100644 --- a/_sql/migrations/1434-add-href-default-selection.php +++ b/_sql/migrations/1434-add-href-default-selection.php @@ -40,12 +40,5 @@ public function up($modus) (@formId, 'hrefLangDefaultShop', 's:0:"";', 'href-lang Standardsprache', 'Gibt für diesen Shop "x-default" im href-lang-Tag aus und definiert damit die Sprache dieses Shops als Standardsprache.', 'combo', 0, 0, 0, '%s'); EOD; $this->addSql(sprintf($sql, serialize($settings))); - - $sql = <<<'EOD' -SET @elementId = LAST_INSERT_ID(); -INSERT IGNORE INTO `s_core_config_element_translations` (`element_id`, `locale_id`, `label`, `description`) -VALUES (@elementId, 2, 'Default href-lang', 'The selected shop will be shown as "x-default" in the href-lang tag, therefore using this shop\'s language as default.'); -EOD; - $this->addSql($sql); } } diff --git a/_sql/migrations/1442-add-meta-description-config.php b/_sql/migrations/1442-add-meta-description-config.php index bd67f4b35f2..bc65969521c 100644 --- a/_sql/migrations/1442-add-meta-description-config.php +++ b/_sql/migrations/1442-add-meta-description-config.php @@ -31,13 +31,6 @@ public function up($modus) (`form_id`, `name`, `value`, `label`, `description`, `type`, `required`, `position`, `scope`, `options`) VALUES (@formId, 'metaDescriptionLength', 's:3:"150";', 'Maximal erlaubte Länge der Meta Description', '', 'number', 0, 0, 0, NULL); -EOD; - $this->addSql($sql); - - $sql = <<<'EOD' -SET @elementId = LAST_INSERT_ID(); -INSERT IGNORE INTO `s_core_config_element_translations` (`element_id`, `locale_id`, `label`) -VALUES (@elementId, 2, 'Maximum allowed length of the meta description'); EOD; $this->addSql($sql); } diff --git a/_sql/migrations/388-add-emotion-fields-position.php b/_sql/migrations/388-add-emotion-fields-position.php index 1106c9bf7c0..2b5adf212fb 100644 --- a/_sql/migrations/388-add-emotion-fields-position.php +++ b/_sql/migrations/388-add-emotion-fields-position.php @@ -8,9 +8,5 @@ public function up($modus) $this->addSql("SET @parent = (SELECT id FROM `s_library_component` WHERE `x_type`='emotion-components-article-slider' AND template = 'component_article_slider' AND pluginID IS NULL LIMIT 1);"); $this->addSql("SET @maxNumberPosition = (SELECT id FROM `s_library_component_field` WHERE `name`='article_slider_max_number' AND componentID = @parent LIMIT 1);"); $this->addSql("UPDATE s_library_component_field SET position = position+1 WHERE componentID = @parent AND id >= @maxNumberPosition;"); - $this->addSql(" - INSERT INTO `s_library_component_field` (`componentID`, `name`, `x_type`, `value_type`, `field_label`, `support_text`, `help_title`, `help_text`, `store`, `display_field`, `value_field`, `default_value`, `allow_blank`, `position`) VALUES - (@parent, 'article_slider_category', 'emotion-components-fields-category-selection', '', '', '', '', '', '', '', '', '', 1, @maxNumberPosition); - "); } } diff --git a/_sql/migrations/393-add-404-page-config-options.php b/_sql/migrations/393-add-404-page-config-options.php index 4920d8b96c6..bd74e26c24a 100644 --- a/_sql/migrations/393-add-404-page-config-options.php +++ b/_sql/migrations/393-add-404-page-config-options.php @@ -4,11 +4,6 @@ class Migrations_Migration393 Extends Shopware\Components\Migrations\AbstractMig public function up($modus) { $this->addSql("SET @formId = (SELECT `id` FROM `s_core_config_forms` WHERE name = 'Frontend100');"); - $sql = <<addSql($sql); $this->addSql("SET @elementId = (SELECT id FROM s_core_config_elements WHERE name = 'PageNotFoundDestination' LIMIT 1);"); $this->addSql(" @@ -16,11 +11,6 @@ public function up($modus) VALUES (@elementId, '2', '\"Page not found\" destination', 'When the user requests a non-existent page, he will be shown the following page.' ); "); - $sql = <<addSql($sql); $this->addSql("SET @elementId = (SELECT id FROM s_core_config_elements WHERE name = 'PageNotFoundCode' LIMIT 1);"); $this->addSql(" diff --git a/_sql/migrations/469-add-404-article-page-config.php b/_sql/migrations/469-add-404-article-page-config.php index 4ecafd9a480..8b9447bc6cf 100644 --- a/_sql/migrations/469-add-404-article-page-config.php +++ b/_sql/migrations/469-add-404-article-page-config.php @@ -3,12 +3,6 @@ class Migrations_Migration469 Extends Shopware\Components\Migrations\AbstractMig { public function up($modus) { - $this->addSql("SET @formId = (SELECT `id` FROM `s_core_config_forms` WHERE name = 'Frontend100');"); - $sql = <<addSql($sql); $this->addSql("SET @elementId = (SELECT id FROM s_core_config_elements WHERE name = 'RelatedArticlesOnArticleNotFound' LIMIT 1);"); $this->addSql(" diff --git a/_sql/migrations/741-migrate-salutation-mails.php b/_sql/migrations/741-migrate-salutation-mails.php index a4c7ace3bbc..43e505f33b2 100644 --- a/_sql/migrations/741-migrate-salutation-mails.php +++ b/_sql/migrations/741-migrate-salutation-mails.php @@ -57,13 +57,6 @@ public function up($modus) $this->addSql($sql); - $sql = <<<'EOD' - SET @elementId = (SELECT id FROM s_core_config_elements WHERE name = 'displayprofiletitle' LIMIT 1); - INSERT INTO `s_core_config_element_translations` (`element_id`, `locale_id`, `label`) VALUES (@elementId, 2, 'Display title field'); -EOD; - $this->addSql($sql); - - $sql = <<<'EOD' DELETE FROM `s_core_config_mails` WHERE dirty = 0 AND `name` IN ( 'sORDERSTATEMAIL11', diff --git a/_sql/migrations/901-add-vote-shop-id.php b/_sql/migrations/901-add-vote-shop-id.php index 3c2fbf5506a..d4b5e8e87bb 100644 --- a/_sql/migrations/901-add-vote-shop-id.php +++ b/_sql/migrations/901-add-vote-shop-id.php @@ -18,12 +18,6 @@ public function up($modus) $this->addSql($sql); - $sql = <<<'EOD' - SET @elementId = (SELECT id FROM s_core_config_elements WHERE name = 'displayOnlySubShopVotes' LIMIT 1); - INSERT INTO `s_core_config_element_translations` (`element_id`, `locale_id`, `label`) VALUES (@elementId, 2, 'Display shop specific votes only'); -EOD; - - $this->addSql($sql); $this->addSql("UPDATE s_core_config_elements SET scope = 1 WHERE name = 'votedisable'"); } } From 1dc21bc80473713563424ad1ce4867bc54195c28 Mon Sep 17 00:00:00 2001 From: Soner Sayakci Date: Mon, 15 Feb 2021 12:07:05 +0000 Subject: [PATCH 012/730] SW-25897 - Fix wrong demo data --- _sql/demo/latest.sql | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/_sql/demo/latest.sql b/_sql/demo/latest.sql index 8bcf45b2d72..d9aa2d113f4 100644 --- a/_sql/demo/latest.sql +++ b/_sql/demo/latest.sql @@ -7225,7 +7225,9 @@ INSERT INTO `s_emotion_element_value` (`id`, `emotionID`, `elementID`, `componen (4271, 6, 1409, 3, 65, 'top left'), (4272, 6, 1409, 3, 89, ''), (4273, 6, 1409, 3, 85, ''), -(4274, 1, 1023, 6, 68, '17'); +(4274, 1, 1023, 6, 68, '17'), +(4275, 1, 1023, 6, 12, '3'), +(4276, 1, 1023, 6, 67, '3'); TRUNCATE TABLE `s_emotion_templates`; INSERT INTO `s_emotion_templates` (`id`, `name`, `file`) VALUES From 818e470c838d5000485f71b89a8821f104553cd8 Mon Sep 17 00:00:00 2001 From: Philip Gatzka Date: Thu, 18 Feb 2021 15:31:18 +0100 Subject: [PATCH 013/730] SW-25897 - Add missing blog category assignment to demodata --- _sql/demo/latest.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/_sql/demo/latest.sql b/_sql/demo/latest.sql index d9aa2d113f4..dd6b1eb31cb 100644 --- a/_sql/demo/latest.sql +++ b/_sql/demo/latest.sql @@ -7227,7 +7227,8 @@ INSERT INTO `s_emotion_element_value` (`id`, `emotionID`, `elementID`, `componen (4273, 6, 1409, 3, 85, ''), (4274, 1, 1023, 6, 68, '17'), (4275, 1, 1023, 6, 12, '3'), -(4276, 1, 1023, 6, 67, '3'); +(4276, 1, 1023, 6, 67, '3'), +(4277, 7, 1512, 6, 67, '3'); TRUNCATE TABLE `s_emotion_templates`; INSERT INTO `s_emotion_templates` (`id`, `name`, `file`) VALUES From 3576080f8a0796496706c7a4124589679af48232 Mon Sep 17 00:00:00 2001 From: Michael Telgmann Date: Thu, 17 Sep 2020 09:43:52 +0200 Subject: [PATCH 014/730] SW-18275 - Close off canvas elements if browser back is triggered --- .../_public/src/js/jquery.off-canvas-menu.js | 26 +++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/themes/Frontend/Responsive/frontend/_public/src/js/jquery.off-canvas-menu.js b/themes/Frontend/Responsive/frontend/_public/src/js/jquery.off-canvas-menu.js index b4f1eb5d305..6e43689df1d 100644 --- a/themes/Frontend/Responsive/frontend/_public/src/js/jquery.off-canvas-menu.js +++ b/themes/Frontend/Responsive/frontend/_public/src/js/jquery.off-canvas-menu.js @@ -1,4 +1,4 @@ -(function ($) { +(function ($, window) { 'use strict'; var $html = $('html'); @@ -225,6 +225,7 @@ // Button click me._on(me.$el, 'click touch', $.proxy(me.onClickElement, me)); + me._on(window, 'popstate', $.proxy(me.onBackButton, me)); // Allow the user to close the off canvas menu me.$offCanvas.on(me.getEventName('click'), opts.closeButtonSelector, $.proxy(me.onClickCloseButton, me)); @@ -272,7 +273,7 @@ /** * Called when the body was clicked on. - * Closes the off canvas menu. + * Triggers the history back functionality * * @public * @method onClickBody @@ -284,14 +285,25 @@ event.preventDefault(); event.stopPropagation(); - me.closeMenu(); + if (me.isOpened) { + window.history.back(); + } $.publish('plugin/swOffcanvasMenu/onClickCloseButton', [ me, event ]); }, + /** + * Called when the browser goes back in history + * Closes the off-canvas menu + */ + onBackButton: function() { + this.closeMenu(); + }, + /** * Opens the off-canvas menu based on the direction. * Also closes all other off-canvas menus. + * Pushes to the history state, so it could be closed with browser back * * @public * @method openMenu @@ -324,6 +336,8 @@ me.$offCanvas.addClass(opts.openClass); + window.history.pushState('offcanvas-open', ''); + $.publish('plugin/swOffcanvasMenu/onOpenMenu', [ me ]); if (opts.mode === 'ajax' && opts.ajaxURL) { @@ -389,11 +403,13 @@ me.$pageWrap.prop('style', ''); } - me.$el.off(me.getEventName('click'), opts.closeButtonSelector); + me._off(me.$el, 'click touch'); + me._off(window, 'popstate'); + me.$offCanvas.off(me.getEventName('click'), opts.closeButtonSelector); $.unsubscribe(me.getEventName('plugin/swOffcanvasMenu/onBeforeOpenMenu')); me._destroy(); } }); -})(jQuery); +})(jQuery, window); From b7bf036ef84db9e13d70af93d96e1e42cc5fd0c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20K=C3=B6nig?= Date: Tue, 15 Dec 2020 11:32:11 +0100 Subject: [PATCH 015/730] SW-25949 - use major version option (--1) for composer self-update, instead of explicit using version 1, because version 1 doesn't exists. fixes #2402 --- build/build.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/build.xml b/build/build.xml index 093ce636cb5..ab48ff99e91 100644 --- a/build/build.xml +++ b/build/build.xml @@ -90,7 +90,7 @@ - + From ad6c471f2d094f0dedcb7fbd9ffac15af0e5ecda Mon Sep 17 00:00:00 2001 From: Philip Gatzka Date: Mon, 19 Apr 2021 14:28:33 +0200 Subject: [PATCH 016/730] NTR - Repair migration Migrations_Migration393 --- _sql/migrations/393-add-404-page-config-options.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/_sql/migrations/393-add-404-page-config-options.php b/_sql/migrations/393-add-404-page-config-options.php index bd74e26c24a..ebd7c90e5ad 100644 --- a/_sql/migrations/393-add-404-page-config-options.php +++ b/_sql/migrations/393-add-404-page-config-options.php @@ -4,6 +4,11 @@ class Migrations_Migration393 Extends Shopware\Components\Migrations\AbstractMig public function up($modus) { $this->addSql("SET @formId = (SELECT `id` FROM `s_core_config_forms` WHERE name = 'Frontend100');"); + $sql = <<addSql($sql); $this->addSql("SET @elementId = (SELECT id FROM s_core_config_elements WHERE name = 'PageNotFoundDestination' LIMIT 1);"); $this->addSql(" @@ -11,6 +16,11 @@ public function up($modus) VALUES (@elementId, '2', '\"Page not found\" destination', 'When the user requests a non-existent page, he will be shown the following page.' ); "); + $sql = <<addSql($sql); $this->addSql("SET @elementId = (SELECT id FROM s_core_config_elements WHERE name = 'PageNotFoundCode' LIMIT 1);"); $this->addSql(" @@ -18,4 +28,4 @@ public function up($modus) VALUES (@elementId, '2', '\"Page not found\" error code', 'HTTP code used in \"Page not found\" responses' ); "); } -} +} \ No newline at end of file From dcb24eb5ec757c991b5a4e2ddced379e5820744d Mon Sep 17 00:00:00 2001 From: Philip Gatzka Date: Thu, 15 Apr 2021 15:25:37 +0200 Subject: [PATCH 017/730] SW-26001 - Adjust error controller --- engine/Shopware/Controllers/Frontend/Error.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/engine/Shopware/Controllers/Frontend/Error.php b/engine/Shopware/Controllers/Frontend/Error.php index af3e6bd42bc..be864f54dc5 100644 --- a/engine/Shopware/Controllers/Frontend/Error.php +++ b/engine/Shopware/Controllers/Frontend/Error.php @@ -50,10 +50,7 @@ public function preDispatch() $this->enableBackendTheme(); } - if (strpos($this->Request()->getHeader('Content-Type'), 'application/json') === 0) { - $this->Front()->Plugins()->Json()->setRenderer(); - $this->View()->assign('success', false); - } elseif ($this->Request()->isXmlHttpRequest() || !Shopware()->Container()->initialized('db')) { + if ($this->Request()->isXmlHttpRequest() || !Shopware()->Container()->initialized('db')) { $this->View()->loadTemplate($templateModule . '/error/exception.tpl'); } elseif (isset($_ENV['SHELL']) || PHP_SAPI === 'cli') { $this->View()->loadTemplate($templateModule . '/error/cli.tpl'); From f71281c530e17f99518e16efb591c1bc0248ed38 Mon Sep 17 00:00:00 2001 From: Philip Gatzka Date: Wed, 21 Apr 2021 09:47:10 +0200 Subject: [PATCH 018/730] SW-26013 - Revert "NTR - fix unit tests" This reverts commit 90bb86fdfaf1ece4684e54d8b90d3d43921d37a6. --- _sql/migrations/1434-add-href-default-selection.php | 7 +++++++ _sql/migrations/1442-add-meta-description-config.php | 7 +++++++ _sql/migrations/388-add-emotion-fields-position.php | 4 ++++ _sql/migrations/393-add-404-page-config-options.php | 2 +- _sql/migrations/469-add-404-article-page-config.php | 6 ++++++ _sql/migrations/741-migrate-salutation-mails.php | 7 +++++++ _sql/migrations/901-add-vote-shop-id.php | 6 ++++++ 7 files changed, 38 insertions(+), 1 deletion(-) diff --git a/_sql/migrations/1434-add-href-default-selection.php b/_sql/migrations/1434-add-href-default-selection.php index 1515c7a4a38..36f59b8ad11 100644 --- a/_sql/migrations/1434-add-href-default-selection.php +++ b/_sql/migrations/1434-add-href-default-selection.php @@ -40,5 +40,12 @@ public function up($modus) (@formId, 'hrefLangDefaultShop', 's:0:"";', 'href-lang Standardsprache', 'Gibt für diesen Shop "x-default" im href-lang-Tag aus und definiert damit die Sprache dieses Shops als Standardsprache.', 'combo', 0, 0, 0, '%s'); EOD; $this->addSql(sprintf($sql, serialize($settings))); + + $sql = <<<'EOD' +SET @elementId = LAST_INSERT_ID(); +INSERT IGNORE INTO `s_core_config_element_translations` (`element_id`, `locale_id`, `label`, `description`) +VALUES (@elementId, 2, 'Default href-lang', 'The selected shop will be shown as "x-default" in the href-lang tag, therefore using this shop\'s language as default.'); +EOD; + $this->addSql($sql); } } diff --git a/_sql/migrations/1442-add-meta-description-config.php b/_sql/migrations/1442-add-meta-description-config.php index bc65969521c..bd67f4b35f2 100644 --- a/_sql/migrations/1442-add-meta-description-config.php +++ b/_sql/migrations/1442-add-meta-description-config.php @@ -31,6 +31,13 @@ public function up($modus) (`form_id`, `name`, `value`, `label`, `description`, `type`, `required`, `position`, `scope`, `options`) VALUES (@formId, 'metaDescriptionLength', 's:3:"150";', 'Maximal erlaubte Länge der Meta Description', '', 'number', 0, 0, 0, NULL); +EOD; + $this->addSql($sql); + + $sql = <<<'EOD' +SET @elementId = LAST_INSERT_ID(); +INSERT IGNORE INTO `s_core_config_element_translations` (`element_id`, `locale_id`, `label`) +VALUES (@elementId, 2, 'Maximum allowed length of the meta description'); EOD; $this->addSql($sql); } diff --git a/_sql/migrations/388-add-emotion-fields-position.php b/_sql/migrations/388-add-emotion-fields-position.php index 2b5adf212fb..1106c9bf7c0 100644 --- a/_sql/migrations/388-add-emotion-fields-position.php +++ b/_sql/migrations/388-add-emotion-fields-position.php @@ -8,5 +8,9 @@ public function up($modus) $this->addSql("SET @parent = (SELECT id FROM `s_library_component` WHERE `x_type`='emotion-components-article-slider' AND template = 'component_article_slider' AND pluginID IS NULL LIMIT 1);"); $this->addSql("SET @maxNumberPosition = (SELECT id FROM `s_library_component_field` WHERE `name`='article_slider_max_number' AND componentID = @parent LIMIT 1);"); $this->addSql("UPDATE s_library_component_field SET position = position+1 WHERE componentID = @parent AND id >= @maxNumberPosition;"); + $this->addSql(" + INSERT INTO `s_library_component_field` (`componentID`, `name`, `x_type`, `value_type`, `field_label`, `support_text`, `help_title`, `help_text`, `store`, `display_field`, `value_field`, `default_value`, `allow_blank`, `position`) VALUES + (@parent, 'article_slider_category', 'emotion-components-fields-category-selection', '', '', '', '', '', '', '', '', '', 1, @maxNumberPosition); + "); } } diff --git a/_sql/migrations/393-add-404-page-config-options.php b/_sql/migrations/393-add-404-page-config-options.php index ebd7c90e5ad..c6236ed4d3f 100644 --- a/_sql/migrations/393-add-404-page-config-options.php +++ b/_sql/migrations/393-add-404-page-config-options.php @@ -28,4 +28,4 @@ public function up($modus) VALUES (@elementId, '2', '\"Page not found\" error code', 'HTTP code used in \"Page not found\" responses' ); "); } -} \ No newline at end of file +} diff --git a/_sql/migrations/469-add-404-article-page-config.php b/_sql/migrations/469-add-404-article-page-config.php index 8b9447bc6cf..4060a421ae1 100644 --- a/_sql/migrations/469-add-404-article-page-config.php +++ b/_sql/migrations/469-add-404-article-page-config.php @@ -3,6 +3,12 @@ class Migrations_Migration469 Extends Shopware\Components\Migrations\AbstractMig { public function up($modus) { + $this->addSql("SET @formId = (SELECT `id` FROM `s_core_config_forms` WHERE name = 'Frontend100');"); + $sql = <<addSql($sql); $this->addSql("SET @elementId = (SELECT id FROM s_core_config_elements WHERE name = 'RelatedArticlesOnArticleNotFound' LIMIT 1);"); $this->addSql(" diff --git a/_sql/migrations/741-migrate-salutation-mails.php b/_sql/migrations/741-migrate-salutation-mails.php index 43e505f33b2..a4c7ace3bbc 100644 --- a/_sql/migrations/741-migrate-salutation-mails.php +++ b/_sql/migrations/741-migrate-salutation-mails.php @@ -57,6 +57,13 @@ public function up($modus) $this->addSql($sql); + $sql = <<<'EOD' + SET @elementId = (SELECT id FROM s_core_config_elements WHERE name = 'displayprofiletitle' LIMIT 1); + INSERT INTO `s_core_config_element_translations` (`element_id`, `locale_id`, `label`) VALUES (@elementId, 2, 'Display title field'); +EOD; + $this->addSql($sql); + + $sql = <<<'EOD' DELETE FROM `s_core_config_mails` WHERE dirty = 0 AND `name` IN ( 'sORDERSTATEMAIL11', diff --git a/_sql/migrations/901-add-vote-shop-id.php b/_sql/migrations/901-add-vote-shop-id.php index d4b5e8e87bb..3c2fbf5506a 100644 --- a/_sql/migrations/901-add-vote-shop-id.php +++ b/_sql/migrations/901-add-vote-shop-id.php @@ -18,6 +18,12 @@ public function up($modus) $this->addSql($sql); + $sql = <<<'EOD' + SET @elementId = (SELECT id FROM s_core_config_elements WHERE name = 'displayOnlySubShopVotes' LIMIT 1); + INSERT INTO `s_core_config_element_translations` (`element_id`, `locale_id`, `label`) VALUES (@elementId, 2, 'Display shop specific votes only'); +EOD; + + $this->addSql($sql); $this->addSql("UPDATE s_core_config_elements SET scope = 1 WHERE name = 'votedisable'"); } } From 93dd916a91f24f4d875915db1b00b6a300ff6ae6 Mon Sep 17 00:00:00 2001 From: Philip Gatzka Date: Thu, 22 Apr 2021 09:48:37 +0200 Subject: [PATCH 019/730] SW-26013 - Remove superseded translation INSERTs --- _sql/migrations/741-migrate-salutation-mails.php | 7 ------- _sql/migrations/901-add-vote-shop-id.php | 6 ------ 2 files changed, 13 deletions(-) diff --git a/_sql/migrations/741-migrate-salutation-mails.php b/_sql/migrations/741-migrate-salutation-mails.php index a4c7ace3bbc..43e505f33b2 100644 --- a/_sql/migrations/741-migrate-salutation-mails.php +++ b/_sql/migrations/741-migrate-salutation-mails.php @@ -57,13 +57,6 @@ public function up($modus) $this->addSql($sql); - $sql = <<<'EOD' - SET @elementId = (SELECT id FROM s_core_config_elements WHERE name = 'displayprofiletitle' LIMIT 1); - INSERT INTO `s_core_config_element_translations` (`element_id`, `locale_id`, `label`) VALUES (@elementId, 2, 'Display title field'); -EOD; - $this->addSql($sql); - - $sql = <<<'EOD' DELETE FROM `s_core_config_mails` WHERE dirty = 0 AND `name` IN ( 'sORDERSTATEMAIL11', diff --git a/_sql/migrations/901-add-vote-shop-id.php b/_sql/migrations/901-add-vote-shop-id.php index 3c2fbf5506a..d4b5e8e87bb 100644 --- a/_sql/migrations/901-add-vote-shop-id.php +++ b/_sql/migrations/901-add-vote-shop-id.php @@ -18,12 +18,6 @@ public function up($modus) $this->addSql($sql); - $sql = <<<'EOD' - SET @elementId = (SELECT id FROM s_core_config_elements WHERE name = 'displayOnlySubShopVotes' LIMIT 1); - INSERT INTO `s_core_config_element_translations` (`element_id`, `locale_id`, `label`) VALUES (@elementId, 2, 'Display shop specific votes only'); -EOD; - - $this->addSql($sql); $this->addSql("UPDATE s_core_config_elements SET scope = 1 WHERE name = 'votedisable'"); } } From abdc2b450435e8dcfa1efe01adcde81a630962ba Mon Sep 17 00:00:00 2001 From: Philip Gatzka Date: Mon, 3 May 2021 09:43:08 +0200 Subject: [PATCH 020/730] SW-26049 - Adjust product name rendering, use DOMParser in getText instead of actual DOM insertion --- engine/Library/ExtJs/overrides/Ext.String.js | 20 ++++++++++++++----- .../backend/article/controller/detail.js | 5 ++++- .../backend/article/view/detail/window.js | 5 ++++- .../Bare/frontend/detail/content/header.tpl | 2 +- .../Frontend/Bare/frontend/detail/header.tpl | 2 +- .../Bare/frontend/detail/tabs/comment.tpl | 2 +- .../Bare/frontend/detail/tabs/description.tpl | 6 +++--- 7 files changed, 29 insertions(+), 13 deletions(-) diff --git a/engine/Library/ExtJs/overrides/Ext.String.js b/engine/Library/ExtJs/overrides/Ext.String.js index 3c70e183907..a2c1d202530 100644 --- a/engine/Library/ExtJs/overrides/Ext.String.js +++ b/engine/Library/ExtJs/overrides/Ext.String.js @@ -24,19 +24,29 @@ /** @lends Ext.String */ //{block name="extjs/overrides/string"} Ext.override(Ext.String, { + /** + * @var DOMParser _domParser + */ + _domParser: new DOMParser(), + /** * Return the text content of the element * * @returns string */ getText: function(value) { - var me = this, - elementNode; + var me = this; + + if (!value) { + return ''; + } - elementNode = document.createElement('div'); - elementNode.innerHTML = value; + var elementNodes = me._domParser + .parseFromString(Ext.String.format('
[0]
', value), "text/html") + .documentElement + .querySelectorAll('div'); - return me._getText([elementNode]); + return me._getText(elementNodes); }, /** diff --git a/themes/Backend/ExtJs/backend/article/controller/detail.js b/themes/Backend/ExtJs/backend/article/controller/detail.js index e9e57c6aa45..a20e47683eb 100644 --- a/themes/Backend/ExtJs/backend/article/controller/detail.js +++ b/themes/Backend/ExtJs/backend/article/controller/detail.js @@ -267,7 +267,10 @@ Ext.define('Shopware.apps.Article.controller.Detail', { success: function(record, operation) { var newArticle = operation.getResultSet().records[0], - message = Ext.String.format(me.snippets.saved.message, article.get('name')); + message = Ext.String.format( + me.snippets.saved.message, + Ext.String.htmlEncode(article.get('name')) + ); if (supplierNeedsReload) { mainWindow.supplierStore.filters.clear(); diff --git a/themes/Backend/ExtJs/backend/article/view/detail/window.js b/themes/Backend/ExtJs/backend/article/view/detail/window.js index ddaed3bec58..b34d64eadc2 100644 --- a/themes/Backend/ExtJs/backend/article/view/detail/window.js +++ b/themes/Backend/ExtJs/backend/article/view/detail/window.js @@ -361,7 +361,10 @@ Ext.define('Shopware.apps.Article.view.detail.Window', { title = me.snippets.titleNew; if (me.article && me.article.get('id')>0) { - title = Ext.String.format(me.snippets.titleEdit, me.article.get('name')); + title = Ext.String.format( + me.snippets.titleEdit, + Ext.String.htmlEncode(me.article.get('name')) + ); } me.setTitle(title); diff --git a/themes/Frontend/Bare/frontend/detail/content/header.tpl b/themes/Frontend/Bare/frontend/detail/content/header.tpl index 606b1f6b719..a79c5c6eefc 100644 --- a/themes/Frontend/Bare/frontend/detail/content/header.tpl +++ b/themes/Frontend/Bare/frontend/detail/content/header.tpl @@ -7,7 +7,7 @@ {* Product name *} {block name='frontend_detail_index_name'}

- {$sArticle.articleName} + {$sArticle.articleName|escape}

{/block} diff --git a/themes/Frontend/Bare/frontend/detail/header.tpl b/themes/Frontend/Bare/frontend/detail/header.tpl index 1b14f475bec..b0ee4bbe380 100644 --- a/themes/Frontend/Bare/frontend/detail/header.tpl +++ b/themes/Frontend/Bare/frontend/detail/header.tpl @@ -1,7 +1,7 @@ {extends file='frontend/index/header.tpl'} {* Meta title *} -{block name="frontend_index_header_title"}{if $sArticle.metaTitle}{$sArticle.metaTitle|escapeHtml} | {{config name=sShopname}|escapeHtml}{else}{$sArticle.articleName} | {$smarty.block.parent}{/if}{/block} +{block name="frontend_index_header_title"}{if $sArticle.metaTitle}{$sArticle.metaTitle|escapeHtml} | {{config name=sShopname}|escapeHtml}{else}{$sArticle.articleName|escape} | {$smarty.block.parent}{/if}{/block} {* Meta opengraph tags *} {block name='frontend_index_header_meta_tags_opengraph'} diff --git a/themes/Frontend/Bare/frontend/detail/tabs/comment.tpl b/themes/Frontend/Bare/frontend/detail/tabs/comment.tpl index ed4833304f9..9272cbe8b96 100644 --- a/themes/Frontend/Bare/frontend/detail/tabs/comment.tpl +++ b/themes/Frontend/Bare/frontend/detail/tabs/comment.tpl @@ -47,7 +47,7 @@ {* Review title *} {block name="frontend_detail_tabs_rating_title"}
- {s name="DetailCommentHeader"}{/s} "{$sArticle.articleName}" + {s name="DetailCommentHeader"}{/s} "{$sArticle.articleName|escape}"
{/block} diff --git a/themes/Frontend/Bare/frontend/detail/tabs/description.tpl b/themes/Frontend/Bare/frontend/detail/tabs/description.tpl index 42115a1f98b..4fca7fda314 100644 --- a/themes/Frontend/Bare/frontend/detail/tabs/description.tpl +++ b/themes/Frontend/Bare/frontend/detail/tabs/description.tpl @@ -19,7 +19,7 @@ {* Headline *} {block name='frontend_detail_description_title'}
- {s name="DetailDescriptionHeader"}{/s} "{$sArticle.articleName}" + {s name="DetailDescriptionHeader"}{/s} "{$sArticle.articleName|escape}"
{/block} @@ -59,7 +59,7 @@ {* Further links title *} {block name='frontend_detail_description_links_title'}
- {s name="ArticleTipMoreInformation"}{/s} "{$sArticle.articleName}" + {s name="ArticleTipMoreInformation"}{/s} "{$sArticle.articleName|escape}"
{/block} @@ -148,7 +148,7 @@ {* Comment title *} {block name='frontend_detail_description_our_comment_title'}
- {s name='DetailDescriptionComment'}{/s} "{$sArticle.articleName}" + {s name='DetailDescriptionComment'}{/s} "{$sArticle.articleName|escape}"
{/block} From 09f7e38ebf09a6fcbd18dacc0f3fbc64b701076b Mon Sep 17 00:00:00 2001 From: nathannaveen <42319948+nathannaveen@users.noreply.github.com> Date: Sat, 14 May 2022 01:30:33 +0000 Subject: [PATCH 021/730] SW-26740 - chore: Set permissions for GitHub actions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Restrict the GitHub token permissions only to the required ones; this way, even if the attackers will succeed in compromising your workflow, they won’t be able to do much. - Included permissions for the action. https://github.com/ossf/scorecard/blob/main/docs/checks.md#token-permissions https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs [Keeping your GitHub Actions and workflows secure Part 1: Preventing pwn requests](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/) Signed-off-by: nathannaveen <42319948+nathannaveen@users.noreply.github.com> fixes #2497 --- .github/workflows/check-code.yml | 3 +++ .github/workflows/codeql-analysis.yml | 7 +++++++ .github/workflows/phpunit.yml | 3 +++ 3 files changed, 13 insertions(+) diff --git a/.github/workflows/check-code.yml b/.github/workflows/check-code.yml index a16259c8e14..4eefef57963 100644 --- a/.github/workflows/check-code.yml +++ b/.github/workflows/check-code.yml @@ -4,6 +4,9 @@ on: push: pull_request: +permissions: + contents: read + jobs: build: runs-on: ubuntu-latest diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index dccd7cf2fd6..9fbe4ce4bea 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -5,8 +5,15 @@ on: schedule: - cron: '0 6 * * 4' +permissions: + contents: read + jobs: analyze: + permissions: + actions: read # for github/codeql-action/init to get workflow details + contents: read # for actions/checkout to fetch code + security-events: write # for github/codeql-action/autobuild to send a status report name: Analyze runs-on: ubuntu-latest diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index 1ca3d560230..a94ea2a562c 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -4,6 +4,9 @@ on: push: pull_request: +permissions: + contents: read + jobs: php: strategy: From 9f19e39c380b17db16f14d080b4bf8a47c956ac9 Mon Sep 17 00:00:00 2001 From: Michael Telgmann Date: Fri, 27 May 2022 14:57:29 +0200 Subject: [PATCH 022/730] SW-26621 - Fix doctrine EntityNotFoundException if invalid data is submitted while creating a new address --- .../Components/Model/ModelManager.php | 10 +-- .../Controllers/Frontend/AddressTest.php | 76 +++++++++++++++++++ 2 files changed, 80 insertions(+), 6 deletions(-) create mode 100644 tests/Functional/Controllers/Frontend/AddressTest.php diff --git a/engine/Shopware/Components/Model/ModelManager.php b/engine/Shopware/Components/Model/ModelManager.php index df9b3b9e6a3..31f835caf09 100644 --- a/engine/Shopware/Components/Model/ModelManager.php +++ b/engine/Shopware/Components/Model/ModelManager.php @@ -353,13 +353,11 @@ protected function serializeEntity($entity) $data[$key] = $this->serializeEntity($data[$key]); } } elseif ($mapping['isOwningSide'] && $mapping['type'] & ClassMetadata::TO_ONE) { - if ($metadata->reflFields[$field]->getValue($entity) !== null) { - $data[$key] = $this->getUnitOfWork()->getEntityIdentifier( - $metadata->reflFields[$field]->getValue($entity) - ); + $association = $metadata->reflFields[$field]->getValue($entity); + if (\is_object($association) && $this->getUnitOfWork()->isInIdentityMap($association)) { + $data[$key] = $this->getUnitOfWork()->getEntityIdentifier($association); } else { - // In some case the relationship may not exist, but we want - // to know about it + // In some case the relationship may not exist, but we want to know about it $data[$key] = null; } } diff --git a/tests/Functional/Controllers/Frontend/AddressTest.php b/tests/Functional/Controllers/Frontend/AddressTest.php new file mode 100644 index 00000000000..ed8f2e7b2d3 --- /dev/null +++ b/tests/Functional/Controllers/Frontend/AddressTest.php @@ -0,0 +1,76 @@ +loginCustomer(); + + $controller = $this->getContainer()->get('shopware_controllers_frontend_address'); + $controller->setContainer($this->getContainer()); + + $request = new Enlight_Controller_Request_RequestTestCase(); + $request->setMethod(Request::METHOD_POST); + $request->setPost([ + 'address' => [ + 'additional' => [ + 'customer_type' => 'private', + ], + 'salutation' => 'mr', + 'firstname' => '', + 'lastname' => 'Test', + 'street' => 'Test Street 123', + 'zipcode' => 12345, + 'city' => 'Test Town', + 'country' => 2, + ], + ]); + $controller->setRequest($request); + $this->getContainer()->get('front')->setRequest($request); + + $view = new Enlight_View_Default(new Enlight_Template_Manager()); + $controller->setView($view); + + $controller->preDispatch(); + $controller->createAction(); + + static::assertTrue($view->getAssign('error_flags')['firstname']); + } +} From 49c207b5f09ab645ab1c2367adb6625f77516f55 Mon Sep 17 00:00:00 2001 From: Michael Telgmann Date: Tue, 31 May 2022 14:15:09 +0200 Subject: [PATCH 023/730] PT-12774 - Fix return type in Smarty template method --- engine/Library/Smarty/sysplugins/smarty_internal_data.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/Library/Smarty/sysplugins/smarty_internal_data.php b/engine/Library/Smarty/sysplugins/smarty_internal_data.php index 5baf3b76dc7..df4f74b51b6 100644 --- a/engine/Library/Smarty/sysplugins/smarty_internal_data.php +++ b/engine/Library/Smarty/sysplugins/smarty_internal_data.php @@ -198,7 +198,7 @@ public function appendByRef($tpl_var, &$value, $merge = false) * @param string $varname variable name or null * @param string $_ptr optional pointer to data object * @param boolean $search_parents include parent templates? - * @return string variable value or or array of variables + * @return mixed variable value or array of variables */ public function getTemplateVars($varname = null, $_ptr = null, $search_parents = true) { @@ -548,4 +548,4 @@ public function __toString() } -?> \ No newline at end of file +?> From 96335822f9a082e356f258075dcdcafae18a85ea Mon Sep 17 00:00:00 2001 From: Michael Telgmann Date: Tue, 31 May 2022 13:17:31 +0200 Subject: [PATCH 024/730] SW-26744 - Update code style fixer --- .gitlab-ci.yml | 3 +- .php-cs-fixer.php | 2 +- .../Library/Enlight/Event/Handler/Plugin.php | 2 +- engine/Library/Enlight/Hook/ProxyFactory.php | 2 +- .../Template/Plugins/modifier.fill.php | 6 +- .../Template/Plugins/modifier.padding.php | 6 +- .../Form/Account/AddressFormType.php | 4 +- .../Form/Account/AttributeFormType.php | 2 +- .../Provider/ShopwareProvider.php | 4 +- .../Product/ProductListingVariationLoader.php | 10 +- .../StoreFrontEmotionDeviceConfiguration.php | 8 +- .../EsBackendBundle/SearchQueryBuilder.php | 2 +- .../OrderRecalculationSubscriber.php | 2 +- .../Subscriber/ProductStockSubscriber.php | 2 +- .../SearchBundle/SearchTermPreProcessor.php | 12 +- .../DynamicConditionParserTrait.php | 8 +- .../IsAvailableConditionHandler.php | 4 +- .../SearchTermConditionHandler.php | 4 +- .../Bundle/SearchBundleDBAL/PriceHelper.php | 14 +- .../SearchTerm/KeywordFinder.php | 4 +- .../SearchTerm/SearchTermQueryBuilder.php | 2 +- .../Gateway/DBAL/CategoryGateway.php | 2 +- .../Gateway/DBAL/ManufacturerGateway.php | 2 +- .../Service/Core/CheapestPriceService.php | 6 +- .../Service/Core/GraduatedPricesService.php | 8 +- .../Core/VariantListingPriceService.php | 2 +- .../StoreFrontBundle/Struct/Attribute.php | 2 +- ...ateArticleAttributeTranslationsCommand.php | 2 +- .../Components/Api/Resource/Article.php | 8 +- .../Api/Resource/PaymentMethods.php | 4 +- .../Shopware/Components/Api/Resource/Shop.php | 4 +- engine/Shopware/Components/CacheManager.php | 4 +- .../Components/Cart/PaymentTokenService.php | 2 +- .../Cart/PaymentTokenSubscriber.php | 2 +- .../Components/Check/Requirements.php | 22 +- .../DependencyInjection/Bridge/Cache.php | 2 +- .../HttpCache/CacheRouteInstaller.php | 4 +- .../Log/Formatter/HtmlFormatter.php | 2 +- engine/Shopware/Components/MemoryLimit.php | 4 +- .../Shopware/Components/Model/Generator.php | 2 +- .../MultiEdit/Resource/Product/Filter.php | 2 +- .../Shopware/Components/Plugin/Bootstrap.php | 8 +- .../Components/Plugin/FormSynchronizer.php | 6 +- .../Plugin/XmlReader/XmlConfigReader.php | 4 +- .../Routing/Generators/RewriteGenerator.php | 2 +- .../Routing/Matchers/EventMatcher.php | 2 +- engine/Shopware/Components/Routing/Router.php | 6 +- .../Components/Session/PdoSessionHandler.php | 4 +- engine/Shopware/Components/SitePageMenu.php | 2 +- .../Shopware/Components/Snippet/Manager.php | 4 +- .../Components/Theme/Configurator.php | 22 +- .../Shopware/Components/Theme/Inheritance.php | 2 +- .../Shopware/Components/Theme/Installer.php | 2 +- .../Components/Thumbnail/Generator/Basic.php | 2 +- engine/Shopware/Components/Translation.php | 6 +- .../Components/UploadMaxSizeValidator.php | 2 +- .../Controllers/Backend/Analytics.php | 4 +- .../Controllers/Backend/Application.php | 16 +- .../Shopware/Controllers/Backend/Article.php | 36 +- .../Shopware/Controllers/Backend/Config.php | 2 +- .../Shopware/Controllers/Backend/Customer.php | 8 +- engine/Shopware/Controllers/Backend/Index.php | 2 +- .../Controllers/Backend/Notification.php | 4 +- engine/Shopware/Controllers/Backend/Order.php | 4 +- .../Shopware/Controllers/Backend/Partner.php | 2 +- .../Controllers/Backend/Performance.php | 4 +- .../Controllers/Backend/PluginInstaller.php | 2 +- .../Shopware/Controllers/Backend/Premium.php | 22 +- .../Controllers/Backend/RiskManagement.php | 2 +- engine/Shopware/Controllers/Backend/Site.php | 16 +- engine/Shopware/Controllers/Backend/Vote.php | 2 +- .../Shopware/Controllers/Backend/Voucher.php | 16 +- engine/Shopware/Controllers/Frontend/Blog.php | 2 +- .../Controllers/Frontend/Checkout.php | 4 +- .../Shopware/Controllers/Widgets/Emotion.php | 4 +- engine/Shopware/Core/sAdmin.php | 4 +- engine/Shopware/Core/sArticles.php | 8 +- engine/Shopware/Core/sArticlesComparisons.php | 4 +- engine/Shopware/Core/sBasket.php | 2 +- engine/Shopware/Core/sExport.php | 2 +- engine/Shopware/Core/sOrder.php | 4 +- engine/Shopware/Core/sRewriteTable.php | 6 +- engine/Shopware/Kernel.php | 4 +- engine/Shopware/Models/Article/Repository.php | 8 +- .../Shopware/Models/Category/Repository.php | 2 +- .../Shopware/Models/Dispatch/Repository.php | 2 +- engine/Shopware/Models/Document/Order.php | 8 +- engine/Shopware/Models/Media/Media.php | 2 +- .../Models/Order/Document/Repository.php | 4 +- engine/Shopware/Models/Shop/Repository.php | 4 +- .../Components/FeedbackCollector.php | 4 +- .../Default/Core/CronBirthday/Bootstrap.php | 2 +- .../Default/Core/HttpCache/CacheControl.php | 2 +- .../Components/SimilarShown.php | 10 +- .../Default/Core/PaymentMethods/Bootstrap.php | 2 +- .../Components/GenericPaymentMethod.php | 4 +- .../Components/SepaPaymentMethod.php | 2 +- .../Default/Core/PostFilter/Bootstrap.php | 4 +- .../Plugins/Default/Core/Router/Bootstrap.php | 8 +- .../Plugins/Default/Core/System/Bootstrap.php | 2 +- .../Frontend/CronRefresh/Bootstrap.php | 4 +- recovery/common/src/HttpClient/CurlClient.php | 2 +- recovery/install/index.php | 2 +- recovery/install/ping.php | 2 +- recovery/install/src/Requirements.php | 18 +- .../AccountBundle/Controller/AccountTest.php | 12 +- .../Condition/PriceConditionTest.php | 4 +- .../Condition/VoteAverageConditionTest.php | 40 +-- .../Facet/VoteAverageFacetTest.php | 10 +- .../Bundle/StoreFrontBundle/Helper.php | 4 +- .../Bundle/StoreFrontBundle/VoteTest.php | 34 +- .../Functional/Components/Api/ArticleTest.php | 12 +- .../Components/Api/CustomerTest.php | 4 +- tests/Functional/Components/Api/MediaTest.php | 14 +- .../Components/Api/TranslationTest.php | 2 +- .../Cart/PaymentTokenServiceTest.php | 4 +- .../Components/Theme/InstallerTest.php | 2 +- .../Controllers/Backend/ArticleTest.php | 2 +- .../Controllers/Backend/PartnerTest.php | 8 +- .../Controllers/Backend/UserManagerTest.php | 6 +- .../Controllers/Frontend/SearchTest.php | 2 +- tests/Functional/Core/AdminTest.php | 2 +- tests/Functional/Core/BasketTest.php | 8 +- tests/Functional/Core/sCategoriesTest.php | 14 +- tests/Functional/Helper/Utils.php | 2 +- .../Models/Shop/ShopRepositoryTest.php | 12 +- .../Components/SimilarShownTest.php | 2 +- .../Components/TopSellerTest.php | 14 +- .../Modules/ArticleTest.php | 4 +- .../Components/SepaPaymentMethodTest.php | 6 +- .../bootstrap/Element/BlogArticle.php | 4 +- .../bootstrap/Element/CartPosition.php | 4 +- .../features/bootstrap/Element/Paging.php | 4 +- .../features/bootstrap/FeatureContext.php | 8 +- tests/Mink/features/bootstrap/Helper.php | 6 +- .../features/bootstrap/ShopwareContext.php | 6 +- .../Unit/Components/Hook/HookManagerTest.php | 6 +- tests/Unit/Components/HttpCache/StoreTest.php | 2 +- .../Plugin/XmlReader/XmlConfigReaderTest.php | 20 +- .../Plugin/XmlReader/XmlReaderBaseTest.php | 14 +- vendor-bin/cs-fixer/composer.json | 4 +- vendor-bin/cs-fixer/composer.lock | 329 +++++++++--------- 142 files changed, 590 insertions(+), 588 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8338d6d9cca..1051fbf7c99 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -29,7 +29,8 @@ workflow: key: files: - 'composer.lock' - - 'recovery/common/composer.lock' +# - 'recovery/common/composer.lock' TODO - SW-26745: Needs to be considered again, but GitLab only allows two files + - 'vendor-bin/cs-fixer/composer.lock' paths: - 'vendor/' - 'recovery/common/vendor/' diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index 1ec0bd9f361..b84d4bbfdda 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -67,7 +67,7 @@ 'global_namespace_import' => true, 'header_comment' => ['header' => $header, 'separate' => 'bottom', 'comment_type' => 'PHPDoc'], 'modernize_types_casting' => true, - 'native_function_invocation' => true, + 'native_function_invocation' => ['exclude' => ['ini_get'], 'strict' => false], 'no_alias_functions' => true, 'no_useless_else' => true, 'no_useless_return' => true, diff --git a/engine/Library/Enlight/Event/Handler/Plugin.php b/engine/Library/Enlight/Event/Handler/Plugin.php index 6efcfe8a72f..4b0ac161f0c 100644 --- a/engine/Library/Enlight/Event/Handler/Plugin.php +++ b/engine/Library/Enlight/Event/Handler/Plugin.php @@ -148,7 +148,7 @@ public function execute(Enlight_Event_EventArgs $args) if (!method_exists($plugin, $this->listener)) { $name = $this->plugin instanceof Enlight_Plugin_Bootstrap ? $this->plugin->getName() : $this->plugin; trigger_error('Listener "' . $this->listener . '" in "' . $name . '" is not callable.', E_USER_ERROR); - //throw new Enlight_Exception('Listener "' . $this->listener . '" in "' . $name . '" is not callable.'); + // throw new Enlight_Exception('Listener "' . $this->listener . '" in "' . $name . '" is not callable.'); return; } diff --git a/engine/Library/Enlight/Hook/ProxyFactory.php b/engine/Library/Enlight/Hook/ProxyFactory.php index 91946b4a57b..d92384362a1 100644 --- a/engine/Library/Enlight/Hook/ProxyFactory.php +++ b/engine/Library/Enlight/Hook/ProxyFactory.php @@ -103,7 +103,7 @@ public function getProxy($class) $classImplements = class_implements($class); if (!\is_array($classImplements) || !\in_array(Enlight_Hook::class, $classImplements, true)) { trigger_error(sprintf('The class "%s" does not implement the Enlight_Hook Interface. It will be thrown in 5.8.', $class), E_USER_WARNING); - //throw new Enlight_Hook_Exception('The class' . $class . ' does not implement Enlight_Hook interface.'); + // throw new Enlight_Hook_Exception('The class' . $class . ' does not implement Enlight_Hook interface.'); } $proxyFile = $this->getProxyFileName($class); diff --git a/engine/Library/Enlight/Template/Plugins/modifier.fill.php b/engine/Library/Enlight/Template/Plugins/modifier.fill.php index 3442f59248c..bc98cbc0426 100644 --- a/engine/Library/Enlight/Template/Plugins/modifier.fill.php +++ b/engine/Library/Enlight/Template/Plugins/modifier.fill.php @@ -32,10 +32,10 @@ function smarty_modifier_fill($str, $width = 10, $break = '...', $fill = ' ') { // checks if we have either a integer, float, sting or boolean value // If we don't get what we expected, we use some default values - if (!is_scalar($break)) { + if (!\is_scalar($break)) { $break = '...'; } - if (empty($fill) || !is_scalar($fill)) { + if (empty($fill) || !\is_scalar($fill)) { $fill = ' '; } if (empty($width) || !is_numeric($width)) { @@ -44,7 +44,7 @@ function smarty_modifier_fill($str, $width = 10, $break = '...', $fill = ' ') $width = (int) $width; } // if no string is given, just build one string containing the fill pattern - if (!is_scalar($str)) { + if (!\is_scalar($str)) { return str_repeat($fill, $width); } // If the string longer than the given width shorten the string and append the break pattern diff --git a/engine/Library/Enlight/Template/Plugins/modifier.padding.php b/engine/Library/Enlight/Template/Plugins/modifier.padding.php index 67e8f6686e9..ce2fa684f61 100644 --- a/engine/Library/Enlight/Template/Plugins/modifier.padding.php +++ b/engine/Library/Enlight/Template/Plugins/modifier.padding.php @@ -32,10 +32,10 @@ function smarty_modifier_padding($str, $width = 10, $break = '...', $fill = ' ') { // checks if we have either a integer, float, sting or boolean value // If we don't get what we expected, we use some default values - if (!is_scalar($break)) { + if (!\is_scalar($break)) { $break = '...'; } - if (empty($fill) || !is_scalar($fill)) { + if (empty($fill) || !\is_scalar($fill)) { $fill = ' '; } if (empty($width) || !is_numeric($width)) { @@ -44,7 +44,7 @@ function smarty_modifier_padding($str, $width = 10, $break = '...', $fill = ' ') $width = (int) $width; } // if no string is given, just build one string containing the fill pattern - if (!is_scalar($str)) { + if (!\is_scalar($str)) { return str_repeat($fill, $width); } // If the string longer than the given width shorten the string and append the break pattern diff --git a/engine/Shopware/Bundle/AccountBundle/Form/Account/AddressFormType.php b/engine/Shopware/Bundle/AccountBundle/Form/Account/AddressFormType.php index 61b775a991d..7e1be7191d8 100644 --- a/engine/Shopware/Bundle/AccountBundle/Form/Account/AddressFormType.php +++ b/engine/Shopware/Bundle/AccountBundle/Form/Account/AddressFormType.php @@ -143,8 +143,8 @@ public function buildForm(FormBuilderInterface $builder, array $options) 'data_class' => AddressAttribute::class, ]); - //dynamic field which contains multiple values - //used for extendable data which has not to persist over attributes + // dynamic field which contains multiple values + // used for extendable data which has not to persist over attributes $builder->add('additional', null, [ 'compound' => true, 'allow_extra_fields' => true, diff --git a/engine/Shopware/Bundle/AccountBundle/Form/Account/AttributeFormType.php b/engine/Shopware/Bundle/AccountBundle/Form/Account/AttributeFormType.php index 56a2c5c15c7..9f7fea88a01 100644 --- a/engine/Shopware/Bundle/AccountBundle/Form/Account/AttributeFormType.php +++ b/engine/Shopware/Bundle/AccountBundle/Form/Account/AttributeFormType.php @@ -95,7 +95,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) $builder->add($field); } - //set default value for all attribute fields to prevent null override if a field isn't in the submit data + // set default value for all attribute fields to prevent null override if a field isn't in the submit data $builder->addEventListener(FormEvents::POST_SET_DATA, function (FormEvent $event) use ($attributes, $metaData) { try { $form = $event->getForm(); diff --git a/engine/Shopware/Bundle/BenchmarkBundle/Provider/ShopwareProvider.php b/engine/Shopware/Bundle/BenchmarkBundle/Provider/ShopwareProvider.php index 7ffd1c25754..7d9b166600e 100644 --- a/engine/Shopware/Bundle/BenchmarkBundle/Provider/ShopwareProvider.php +++ b/engine/Shopware/Bundle/BenchmarkBundle/Provider/ShopwareProvider.php @@ -152,7 +152,7 @@ private function getPhpVersionId() */ private function getMaxExecutionTime() { - return (int) ini_get('max_execution_time'); + return (int) \ini_get('max_execution_time'); } /** @@ -160,7 +160,7 @@ private function getMaxExecutionTime() */ private function getMemoryLimit() { - return (int) ini_get('memory_limit'); + return (int) \ini_get('memory_limit'); } /** diff --git a/engine/Shopware/Bundle/ESIndexingBundle/Product/ProductListingVariationLoader.php b/engine/Shopware/Bundle/ESIndexingBundle/Product/ProductListingVariationLoader.php index d1e4683ea85..4b416fc61bf 100644 --- a/engine/Shopware/Bundle/ESIndexingBundle/Product/ProductListingVariationLoader.php +++ b/engine/Shopware/Bundle/ESIndexingBundle/Product/ProductListingVariationLoader.php @@ -309,7 +309,7 @@ private function nestedArrayCombinations(array $groups, array $onlyFirst, array $tmp = array_merge($item, [$index => (int) $option->getId()]); sort($tmp, SORT_NUMERIC); - //check if this combination is a available combination (out of stock, not active) + // check if this combination is a available combination (out of stock, not active) $isAvailable = false; foreach ($availability as $available) { $available = '-' . $available . '-'; @@ -320,7 +320,7 @@ private function nestedArrayCombinations(array $groups, array $onlyFirst, array $allMatch = false; } } - //all options matched? combination is available, break availability check + // all options matched? combination is available, break availability check if ($allMatch) { $isAvailable = true; break; @@ -583,7 +583,7 @@ private function getCombinationPrices( array_diff(array_intersect(array_flip($options), $combination), $expandGroupIds) )); - //filter prices which has configuration matches the current variant configuration + // filter prices which has configuration matches the current variant configuration $affected = array_filter($prices, function (array $price) use ($tmp, $excludedOptions) { $diff = array_values(array_intersect(array_diff($price['options'], $excludedOptions), $tmp)); @@ -592,8 +592,8 @@ private function getCombinationPrices( $price = array_column($affected, 'price'); - //build combination key by group ids - //store front filters to filtered group "sort by price for `color`" + // build combination key by group ids + // store front filters to filtered group "sort by price for `color`" $key = 'g' . implode('-', $combination); if (!empty($price)) { diff --git a/engine/Shopware/Bundle/EmotionBundle/Service/StoreFrontEmotionDeviceConfiguration.php b/engine/Shopware/Bundle/EmotionBundle/Service/StoreFrontEmotionDeviceConfiguration.php index 7a5c76b59a0..1807daeadad 100644 --- a/engine/Shopware/Bundle/EmotionBundle/Service/StoreFrontEmotionDeviceConfiguration.php +++ b/engine/Shopware/Bundle/EmotionBundle/Service/StoreFrontEmotionDeviceConfiguration.php @@ -55,14 +55,14 @@ public function getCategoryConfiguration($categoryId, ShopContextInterface $cont return empty($config['shopIds']) || \in_array($context->getShop()->getId(), $config['shopIds']); }); - //no active stream detected? display only emotions without customer stream configuration + // no active stream detected? display only emotions without customer stream configuration if (empty($context->getActiveCustomerStreamIds()) || $withStreams === false) { return array_filter($configurations, function ($config) { return $config['customer_stream_ids'] === null; }); } - //filter emotions which has customer stream configuration for active streams or which has no configuration + // filter emotions which has customer stream configuration for active streams or which has no configuration $configurations = array_filter( $configurations, function (array $config) use ($context) { @@ -74,10 +74,10 @@ function (array $config) use ($context) { } ); - //collect emotion replacements + // collect emotion replacements $replacements = $this->getReplacements($configurations); - //remove all emotions which replaced by customer stream emotions + // remove all emotions which replaced by customer stream emotions return array_filter( $configurations, function (array $config) use ($replacements) { diff --git a/engine/Shopware/Bundle/EsBackendBundle/SearchQueryBuilder.php b/engine/Shopware/Bundle/EsBackendBundle/SearchQueryBuilder.php index fe9fca660a5..230aa83d0b3 100644 --- a/engine/Shopware/Bundle/EsBackendBundle/SearchQueryBuilder.php +++ b/engine/Shopware/Bundle/EsBackendBundle/SearchQueryBuilder.php @@ -49,7 +49,7 @@ public function buildQuery(array $fields, $term) } } - //use combination for more precision + // use combination for more precision foreach ($combines as $token) { foreach ($fields as $field => $priority) { $bool->add(new MatchQuery($field, $token, ['boost' => $priority * 2]), BoolQuery::SHOULD); diff --git a/engine/Shopware/Bundle/OrderBundle/Subscriber/OrderRecalculationSubscriber.php b/engine/Shopware/Bundle/OrderBundle/Subscriber/OrderRecalculationSubscriber.php index da3c7ff6555..27f40697b8c 100644 --- a/engine/Shopware/Bundle/OrderBundle/Subscriber/OrderRecalculationSubscriber.php +++ b/engine/Shopware/Bundle/OrderBundle/Subscriber/OrderRecalculationSubscriber.php @@ -64,7 +64,7 @@ public function preUpdate(Enlight_Event_EventArgs $arguments) $orderDetail = $arguments->get('entity'); $entityManager = $arguments->get('entityManager'); - //returns a change set for the model, which contains all changed properties with the old and new value. + // returns a change set for the model, which contains all changed properties with the old and new value. $changeSet = $entityManager->getUnitOfWork()->getEntityChangeSet($orderDetail); $productChange = $changeSet['articleNumber'][0] !== $changeSet['articleNumber'][1]; diff --git a/engine/Shopware/Bundle/OrderBundle/Subscriber/ProductStockSubscriber.php b/engine/Shopware/Bundle/OrderBundle/Subscriber/ProductStockSubscriber.php index a64a6707f45..4f8b94d1a84 100644 --- a/engine/Shopware/Bundle/OrderBundle/Subscriber/ProductStockSubscriber.php +++ b/engine/Shopware/Bundle/OrderBundle/Subscriber/ProductStockSubscriber.php @@ -65,7 +65,7 @@ public function preUpdate(Enlight_Event_EventArgs $arguments) $entityManager = $arguments->get('entityManager'); - //returns a change set for the model, which contains all changed properties with the old and new value. + // returns a change set for the model, which contains all changed properties with the old and new value. $changeSet = $entityManager->getUnitOfWork()->getEntityChangeSet($orderDetail); $this->stockService->updateProductDetail( diff --git a/engine/Shopware/Bundle/SearchBundle/SearchTermPreProcessor.php b/engine/Shopware/Bundle/SearchBundle/SearchTermPreProcessor.php index f3b92a7b482..5a4e924edae 100644 --- a/engine/Shopware/Bundle/SearchBundle/SearchTermPreProcessor.php +++ b/engine/Shopware/Bundle/SearchBundle/SearchTermPreProcessor.php @@ -33,16 +33,16 @@ class SearchTermPreProcessor implements SearchTermPreProcessorInterface */ public function process($term) { - //This fix prevents an exception if the search term includes an character that can not be - //displayed with the database charset. - //This fix can be removed if all tables are set to utf8mb4_unicode_ci. + // This fix prevents an exception if the search term includes an character that can not be + // displayed with the database charset. + // This fix can be removed if all tables are set to utf8mb4_unicode_ci. - //converts encoded characters back ('%a5%27' to '?') + // converts encoded characters back ('%a5%27' to '?') $term = mb_convert_encoding($term, 'UTF-8'); - //does the replacing of 4byte chars to the Unicode replacement character + // does the replacing of 4byte chars to the Unicode replacement character $term = (string) preg_replace('/[\xF0-\xF7].../s', '�', $term); - //we have to strip the / otherwise broken urls would be created e.g. wrong pager urls + // we have to strip the / otherwise broken urls would be created e.g. wrong pager urls $term = trim(strip_tags(htmlspecialchars_decode(stripslashes($term)))); return str_replace('/', ' ', $term); diff --git a/engine/Shopware/Bundle/SearchBundleDBAL/ConditionHandler/DynamicConditionParserTrait.php b/engine/Shopware/Bundle/SearchBundleDBAL/ConditionHandler/DynamicConditionParserTrait.php index 3e5f1992d84..2ceef0f3ba0 100644 --- a/engine/Shopware/Bundle/SearchBundleDBAL/ConditionHandler/DynamicConditionParserTrait.php +++ b/engine/Shopware/Bundle/SearchBundleDBAL/ConditionHandler/DynamicConditionParserTrait.php @@ -106,7 +106,7 @@ public function parse(QueryBuilder $query, $table, $tableAlias, $field = null, $ throw new InvalidArgumentException(sprintf('Must specify an operator, please use one of: %s', implode(', ', $validOperators)), 3); } - //Identify each field placeholder value with table alias and a hash of condition properties + // Identify each field placeholder value with table alias and a hash of condition properties $boundParamName = sprintf(':%s_%s', $tableAlias, md5($field . $operator . json_encode($value))); $field = sprintf('%s.%s', $tableAlias, $field); @@ -187,17 +187,17 @@ public function parse(QueryBuilder $query, $table, $tableAlias, $field = null, $ } break; - case $operator === Condition::OPERATOR_STARTS_WITH && is_scalar($value): + case $operator === Condition::OPERATOR_STARTS_WITH && \is_scalar($value): $query->andWhere($query->expr()->like($field, $boundParamName)); $query->setParameter($boundParamName, $value . '%'); break; - case $operator === Condition::OPERATOR_ENDS_WITH && is_scalar($value): + case $operator === Condition::OPERATOR_ENDS_WITH && \is_scalar($value): $query->andWhere($query->expr()->like($field, $boundParamName)); $query->setParameter($boundParamName, '%' . $value); break; - case $operator === Condition::OPERATOR_CONTAINS && is_scalar($value): + case $operator === Condition::OPERATOR_CONTAINS && \is_scalar($value): $query->andWhere($query->expr()->like($field, $boundParamName)); $query->setParameter($boundParamName, '%' . $value . '%'); break; diff --git a/engine/Shopware/Bundle/SearchBundleDBAL/ConditionHandler/IsAvailableConditionHandler.php b/engine/Shopware/Bundle/SearchBundleDBAL/ConditionHandler/IsAvailableConditionHandler.php index 8f9f46c6ae8..765177048b4 100644 --- a/engine/Shopware/Bundle/SearchBundleDBAL/ConditionHandler/IsAvailableConditionHandler.php +++ b/engine/Shopware/Bundle/SearchBundleDBAL/ConditionHandler/IsAvailableConditionHandler.php @@ -68,13 +68,13 @@ public function generateCondition( }); if (empty($conditions)) { - //variants will ne be splitted => only check if product has an available variant + // variants will ne be splitted => only check if product has an available variant $this->priceHelper->joinAvailableVariant($query); return; } - //variants will be displayed => add stock condition + // variants will be displayed => add stock condition $query->andWhere('(variant.laststock * variant.instock) >= (variant.laststock * variant.minpurchase)'); } diff --git a/engine/Shopware/Bundle/SearchBundleDBAL/ConditionHandler/SearchTermConditionHandler.php b/engine/Shopware/Bundle/SearchBundleDBAL/ConditionHandler/SearchTermConditionHandler.php index e8f875b1a22..f5b3cd292b3 100644 --- a/engine/Shopware/Bundle/SearchBundleDBAL/ConditionHandler/SearchTermConditionHandler.php +++ b/engine/Shopware/Bundle/SearchBundleDBAL/ConditionHandler/SearchTermConditionHandler.php @@ -65,8 +65,8 @@ private function addCondition(SearchTermCondition $condition, QueryBuilder $quer { $searchQuery = $this->searchTermQueryBuilder->buildQuery($condition->getTerm()); - //no matching products found by the search query builder. - //add condition that the result contains no product. + // no matching products found by the search query builder. + // add condition that the result contains no product. if ($searchQuery === null) { $query->andWhere('0 = 1'); diff --git a/engine/Shopware/Bundle/SearchBundleDBAL/PriceHelper.php b/engine/Shopware/Bundle/SearchBundleDBAL/PriceHelper.php index 9871fbb6c11..f8f6c9c45ac 100644 --- a/engine/Shopware/Bundle/SearchBundleDBAL/PriceHelper.php +++ b/engine/Shopware/Bundle/SearchBundleDBAL/PriceHelper.php @@ -65,26 +65,26 @@ public function getSelection(ShopContextInterface $context) $taxCase = $this->buildTaxCase($context); - //rounded to filter this value correctly + // rounded to filter this value correctly // => 2,99999999 displayed as 3,- € but won't be displayed with a filter on price >= 3,- € return 'ROUND(' . - //customer group price (with fallback switch) + // customer group price (with fallback switch) $priceField . - //multiplied with the variant min purchase + // multiplied with the variant min purchase ($considerMinPurchase ? ' * availableVariant.minpurchase' : '') . - //multiplied with the percentage price group discount + // multiplied with the percentage price group discount ' * ((100 - IFNULL(priceGroup.discount, 0)) / 100)' . - //multiplied with the product tax if the current customer group should see gross prices + // multiplied with the product tax if the current customer group should see gross prices ($current->displayGrossPrices() ? ' * (( ' . $taxCase . ' + 100) / 100)' : '') . - //multiplied with the percentage discount of the current customer group + // multiplied with the percentage discount of the current customer group ($discount ? ' * ' . (100 - (float) $discount) / 100 : '') . - //multiplied with the shop currency factor + // multiplied with the shop currency factor ($currency->getFactor() ? ' * ' . $currency->getFactor() : '') . ', 2)'; diff --git a/engine/Shopware/Bundle/SearchBundleDBAL/SearchTerm/KeywordFinder.php b/engine/Shopware/Bundle/SearchBundleDBAL/SearchTerm/KeywordFinder.php index dc67826a13e..f1ecbea710a 100644 --- a/engine/Shopware/Bundle/SearchBundleDBAL/SearchTerm/KeywordFinder.php +++ b/engine/Shopware/Bundle/SearchBundleDBAL/SearchTerm/KeywordFinder.php @@ -162,11 +162,11 @@ private function findFuzzyMatches($term) if (\strlen($term1) < 4) { $relevance = $this->config->get('fuzzySearchMatchFactor', 5); - //ipod === ipods + // ipod === ipods } elseif (\strlen($term1) - \strlen($term2) <= 1) { $relevance = $this->config->get('fuzzySearchExactMatchFactor', 100); - //digital == digi + // digital == digi } elseif ((round(\strlen($term2) / \strlen($term1), 2) * 100) >= $this->config->get('fuzzySearchPartNameDistancen', 25)) { $relevance = $this->config->get('fuzzySearchPatternMatchFactor', 50); } diff --git a/engine/Shopware/Bundle/SearchBundleDBAL/SearchTerm/SearchTermQueryBuilder.php b/engine/Shopware/Bundle/SearchBundleDBAL/SearchTerm/SearchTermQueryBuilder.php index 4e6eaffdee1..bacb335e17c 100644 --- a/engine/Shopware/Bundle/SearchBundleDBAL/SearchTerm/SearchTermQueryBuilder.php +++ b/engine/Shopware/Bundle/SearchBundleDBAL/SearchTerm/SearchTermQueryBuilder.php @@ -186,7 +186,7 @@ private function addToleranceCondition(QueryBuilder $query) $distance = $this->config->get('fuzzySearchMinDistancenTop', 20); $query->select('MAX(' . $this->getRelevanceSelection() . ") / 100 * $distance"); - //calculates the tolerance limit + // calculates the tolerance limit if ($distance) { $query->andWhere('(' . $this->getRelevanceSelection() . ') > (' . $query->getSQL() . ')'); } diff --git a/engine/Shopware/Bundle/StoreFrontBundle/Gateway/DBAL/CategoryGateway.php b/engine/Shopware/Bundle/StoreFrontBundle/Gateway/DBAL/CategoryGateway.php index 36ecbd24d57..c8c44b98990 100644 --- a/engine/Shopware/Bundle/StoreFrontBundle/Gateway/DBAL/CategoryGateway.php +++ b/engine/Shopware/Bundle/StoreFrontBundle/Gateway/DBAL/CategoryGateway.php @@ -106,7 +106,7 @@ public function getList(array $ids, ShopContextInterface $context) { $data = $this->getQuery($ids, $context)->execute()->fetchAll(PDO::FETCH_ASSOC); - //use php usort instead of running mysql order by to prevent file-sort and temporary table statement + // use php usort instead of running mysql order by to prevent file-sort and temporary table statement usort($data, function ($a, $b) { if ($a['__category_position'] === $b['__category_position']) { return $a['__category_id'] <=> $b['__category_id']; diff --git a/engine/Shopware/Bundle/StoreFrontBundle/Gateway/DBAL/ManufacturerGateway.php b/engine/Shopware/Bundle/StoreFrontBundle/Gateway/DBAL/ManufacturerGateway.php index 701d469ee82..08548909258 100644 --- a/engine/Shopware/Bundle/StoreFrontBundle/Gateway/DBAL/ManufacturerGateway.php +++ b/engine/Shopware/Bundle/StoreFrontBundle/Gateway/DBAL/ManufacturerGateway.php @@ -105,7 +105,7 @@ public function getList(array $ids, ShopContextInterface $context) } } - //sort elements by provided ids, sorting is defined by other queries like `best term match` or `max articles` or `sort alphanumeric` + // sort elements by provided ids, sorting is defined by other queries like `best term match` or `max articles` or `sort alphanumeric` $sorted = []; foreach ($ids as $id) { if (!\array_key_exists($id, $manufacturers)) { diff --git a/engine/Shopware/Bundle/StoreFrontBundle/Service/Core/CheapestPriceService.php b/engine/Shopware/Bundle/StoreFrontBundle/Service/Core/CheapestPriceService.php index 5a6d2e0207e..e89bfc48017 100644 --- a/engine/Shopware/Bundle/StoreFrontBundle/Service/Core/CheapestPriceService.php +++ b/engine/Shopware/Bundle/StoreFrontBundle/Service/Core/CheapestPriceService.php @@ -70,7 +70,7 @@ public function getList($products, ShopContextInterface $context) $prices = $this->buildPrices($products, $rules, $group); - //check if one of the products have no assigned price within the prices variable. + // check if one of the products have no assigned price within the prices variable. $fallbackProducts = array_filter( $products, function (BaseProduct $product) use ($prices) { @@ -82,7 +82,7 @@ function (BaseProduct $product) use ($prices) { return $this->calculatePriceGroupDiscounts($products, $prices, $context); } - //if some product has no price, we have to load the fallback customer group prices for the fallbackProducts. + // if some product has no price, we have to load the fallback customer group prices for the fallbackProducts. $fallbackPrices = $this->cheapestPriceGateway->getList( $fallbackProducts, $context, @@ -95,7 +95,7 @@ function (BaseProduct $product) use ($prices) { $context->getFallbackCustomerGroup() ); - //Do not use array_merge here. Since it will reindex the numbers of fallbackPrices. + // Do not use array_merge here. Since it will reindex the numbers of fallbackPrices. $prices = $prices + $fallbackPrices; return $this->calculatePriceGroupDiscounts($products, $prices, $context); diff --git a/engine/Shopware/Bundle/StoreFrontBundle/Service/Core/GraduatedPricesService.php b/engine/Shopware/Bundle/StoreFrontBundle/Service/Core/GraduatedPricesService.php index 85239de6440..4d0069b4329 100644 --- a/engine/Shopware/Bundle/StoreFrontBundle/Service/Core/GraduatedPricesService.php +++ b/engine/Shopware/Bundle/StoreFrontBundle/Service/Core/GraduatedPricesService.php @@ -65,14 +65,14 @@ public function getList($products, ShopContextInterface $context) $group ); - //iterates the passed prices and products and assign the product unit to the prices and the passed customer group + // iterates the passed prices and products and assign the product unit to the prices and the passed customer group $prices = $this->buildPrices( $products, $specify, $group ); - //check if one of the products have no assigned price within the prices variable. + // check if one of the products have no assigned price within the prices variable. $fallbackProducts = array_filter( $products, function (ListProduct $product) use ($prices) { @@ -81,7 +81,7 @@ function (ListProduct $product) use ($prices) { ); if (!empty($fallbackProducts)) { - //if some product has no price, we have to load the fallback customer group prices for the fallbackProducts. + // if some product has no price, we have to load the fallback customer group prices for the fallbackProducts. $fallbackPrices = $this->graduatedPricesGateway->getList( $fallbackProducts, $context, @@ -94,7 +94,7 @@ function (ListProduct $product) use ($prices) { $context->getFallbackCustomerGroup() ); - //Do not use array_merge here. Since it will reindex the numbers of fallbackPrices. + // Do not use array_merge here. Since it will reindex the numbers of fallbackPrices. $prices = $prices + $fallbackPrices; } diff --git a/engine/Shopware/Bundle/StoreFrontBundle/Service/Core/VariantListingPriceService.php b/engine/Shopware/Bundle/StoreFrontBundle/Service/Core/VariantListingPriceService.php index 684c9fa49e3..6376a72d8f7 100644 --- a/engine/Shopware/Bundle/StoreFrontBundle/Service/Core/VariantListingPriceService.php +++ b/engine/Shopware/Bundle/StoreFrontBundle/Service/Core/VariantListingPriceService.php @@ -71,7 +71,7 @@ public function updatePrices(Criteria $criteria, ProductSearchResult $result, Sh return; } - //executed if no price condition included in search request + // executed if no price condition included in search request $this->loadPrices($criteria, $result, $context); } diff --git a/engine/Shopware/Bundle/StoreFrontBundle/Struct/Attribute.php b/engine/Shopware/Bundle/StoreFrontBundle/Struct/Attribute.php index a1cba989a5c..e8cd4f0777c 100644 --- a/engine/Shopware/Bundle/StoreFrontBundle/Struct/Attribute.php +++ b/engine/Shopware/Bundle/StoreFrontBundle/Struct/Attribute.php @@ -165,7 +165,7 @@ public function offsetUnset($offset) private function isValid($value): bool { - if ($value instanceof JsonSerializable || is_scalar($value) || $value === null) { + if ($value instanceof JsonSerializable || \is_scalar($value) || $value === null) { return true; } diff --git a/engine/Shopware/Commands/MigrateArticleAttributeTranslationsCommand.php b/engine/Shopware/Commands/MigrateArticleAttributeTranslationsCommand.php index 296cc35653a..9361bd46885 100644 --- a/engine/Shopware/Commands/MigrateArticleAttributeTranslationsCommand.php +++ b/engine/Shopware/Commands/MigrateArticleAttributeTranslationsCommand.php @@ -196,7 +196,7 @@ private function getUpdatedTranslations($rows, $columns) try { $updated = $this->filter(unserialize($row['objectdata'], ['allowed_classes' => false]), $columns); } catch (Exception $e) { - //serialize error - continue with next translation + // serialize error - continue with next translation continue; } diff --git a/engine/Shopware/Components/Api/Resource/Article.php b/engine/Shopware/Components/Api/Resource/Article.php index fb84fd5f601..98138e00dd1 100644 --- a/engine/Shopware/Components/Api/Resource/Article.php +++ b/engine/Shopware/Components/Api/Resource/Article.php @@ -1530,7 +1530,7 @@ protected function prepareRelatedAssociatedData($data, ProductModel $article) ); } - //no valid entity found, throw exception! + // no valid entity found, throw exception! if ($relatedProduct === null) { $property = $relatedData['number'] ?: $relatedData['id']; throw new CustomValidationException(sprintf('Related product by number/id "%s" not found', $property)); @@ -1677,8 +1677,8 @@ protected function preparePropertyValuesData($data, ProductModel $article) $query = $propertyRepository->getPropertyRelationQuery($filters, null, 1, 0); $relation = $query->getOneOrNullResult(self::HYDRATE_OBJECT); if (!$relation instanceof Relation) { - //checks if a new option was created - //because the new option is not written to the database at this point + // checks if a new option was created + // because the new option is not written to the database at this point $groupOption = $this->getCollectionElementByProperty( $propertyGroup->getOptions(), 'name', @@ -2249,7 +2249,7 @@ private function prepareDownloadsAssociatedData(array $data, ProductModel $produ $media->setDescription($downloadData['name']); } - try { //persist the model into the model manager + try { // persist the model into the model manager $this->getManager()->persist($media); } catch (ORMException $e) { throw new CustomValidationException(sprintf('Some error occurred while loading your image from link "%s"', $downloadData['link'])); diff --git a/engine/Shopware/Components/Api/Resource/PaymentMethods.php b/engine/Shopware/Components/Api/Resource/PaymentMethods.php index f74bb05d758..7c0fa7ffc80 100644 --- a/engine/Shopware/Components/Api/Resource/PaymentMethods.php +++ b/engine/Shopware/Components/Api/Resource/PaymentMethods.php @@ -87,10 +87,10 @@ public function getList($offset = 0, $limit = 25, array $filter = [], array $ord $paginator = $this->getManager()->createPaginator($query); - //returns the total count of the query + // returns the total count of the query $totalResult = $paginator->count(); - //returns the category data + // returns the category data $payments = $paginator->getIterator()->getArrayCopy(); return ['data' => $payments, 'total' => $totalResult]; diff --git a/engine/Shopware/Components/Api/Resource/Shop.php b/engine/Shopware/Components/Api/Resource/Shop.php index 07a4640a890..b485f4d4297 100644 --- a/engine/Shopware/Components/Api/Resource/Shop.php +++ b/engine/Shopware/Components/Api/Resource/Shop.php @@ -96,10 +96,10 @@ public function getList($offset = 0, $limit = 25, array $criteria = [], array $o $paginator = $this->getManager()->createPaginator($query); - //returns the total count of the query + // returns the total count of the query $totalResult = $paginator->count(); - //returns the category data + // returns the category data $shops = $paginator->getIterator()->getArrayCopy(); return ['data' => $shops, 'total' => $totalResult]; diff --git a/engine/Shopware/Components/CacheManager.php b/engine/Shopware/Components/CacheManager.php index 7c339426e59..310f21497cf 100644 --- a/engine/Shopware/Components/CacheManager.php +++ b/engine/Shopware/Components/CacheManager.php @@ -283,7 +283,7 @@ public function clearProxyCache() public function clearOpCache() { - if (\extension_loaded('Zend OPcache') && ini_get('opcache.enable')) { + if (\extension_loaded('Zend OPcache') && \ini_get('opcache.enable')) { opcache_reset(); } } @@ -414,7 +414,7 @@ public function getShopwareProxyCacheInfo() public function getOpCacheCacheInfo() { $info = []; - if (\extension_loaded('Zend OPcache') && ini_get('opcache.enable')) { + if (\extension_loaded('Zend OPcache') && \ini_get('opcache.enable')) { $status = opcache_get_status(false); $info['files'] = $status['opcache_statistics']['num_cached_scripts']; $info['size'] = $this->encodeSize($status['memory_usage']['used_memory']); diff --git a/engine/Shopware/Components/Cart/PaymentTokenService.php b/engine/Shopware/Components/Cart/PaymentTokenService.php index bdb109b81e8..c529b5f7348 100644 --- a/engine/Shopware/Components/Cart/PaymentTokenService.php +++ b/engine/Shopware/Components/Cart/PaymentTokenService.php @@ -52,7 +52,7 @@ public function generate(): string { $sessionId = $this->session->get('sessionId'); - return $this->optinService->add(self::TYPE_PAYMENT_TOKEN, (int) ini_get('session.gc_maxlifetime'), [ + return $this->optinService->add(self::TYPE_PAYMENT_TOKEN, (int) \ini_get('session.gc_maxlifetime'), [ 'name' => session_name(), 'value' => $sessionId, ]); diff --git a/engine/Shopware/Components/Cart/PaymentTokenSubscriber.php b/engine/Shopware/Components/Cart/PaymentTokenSubscriber.php index 25ee4b17069..ba8d243bb7a 100644 --- a/engine/Shopware/Components/Cart/PaymentTokenSubscriber.php +++ b/engine/Shopware/Components/Cart/PaymentTokenSubscriber.php @@ -83,7 +83,7 @@ public function onPreDispatchFrontend(Enlight_Event_EventArgs $args): void $restoreData->getSessionName(), $restoreData->getValue(), 0, - ini_get('session.cookie_path'), + \ini_get('session.cookie_path'), null, $request->isSecure() ) diff --git a/engine/Shopware/Components/Check/Requirements.php b/engine/Shopware/Components/Check/Requirements.php index 8aae1029112..e21bd6d97ac 100644 --- a/engine/Shopware/Components/Check/Requirements.php +++ b/engine/Shopware/Components/Check/Requirements.php @@ -159,7 +159,7 @@ private function getRuntimeValue(string $name, SimpleXMLElement $requirement) return true; } - $value = ini_get($name); + $value = \ini_get($name); if ($value !== '' && $value !== false) { if (strtolower($value) === 'off' || (is_numeric($value) && $value == 0)) { return false; @@ -252,29 +252,29 @@ private function checkOpcache(): array return []; } - $useCwdOption = $this->compare('opcache.use_cwd', ini_get('opcache.use_cwd'), '1'); + $useCwdOption = $this->compare('opcache.use_cwd', \ini_get('opcache.use_cwd'), '1'); $opcacheRequirements = [[ 'name' => 'opcache.use_cwd', 'group' => 'core', 'required' => 1, - 'version' => ini_get('opcache.use_cwd'), - 'result' => ini_get('opcache.use_cwd'), + 'version' => \ini_get('opcache.use_cwd'), + 'result' => \ini_get('opcache.use_cwd'), 'notice' => '', - 'check' => $this->compare('opcache.use_cwd', ini_get('opcache.use_cwd'), '1'), + 'check' => $this->compare('opcache.use_cwd', \ini_get('opcache.use_cwd'), '1'), 'error' => '', ]]; try { if (fileinode('/') > 2) { - $validateRootOption = $this->compare('opcache.validate_root', ini_get('opcache.validate_root'), '1'); + $validateRootOption = $this->compare('opcache.validate_root', \ini_get('opcache.validate_root'), '1'); $opcacheRequirements[] = [ 'name' => 'opcache.validate_root', 'group' => 'core', 'required' => 1, - 'version' => ini_get('opcache.validate_root'), - 'result' => ini_get('opcache.validate_root'), + 'version' => \ini_get('opcache.validate_root'), + 'result' => \ini_get('opcache.validate_root'), 'notice' => '', - 'check' => $this->compare('opcache.validate_root', ini_get('opcache.validate_root'), '1'), + 'check' => $this->compare('opcache.validate_root', \ini_get('opcache.validate_root'), '1'), 'error' => '', ]; } @@ -377,7 +377,7 @@ private function checkSessionSavePath(): bool return (bool) session_save_path(); } - if (ini_get('session.save_path')) { + if (\ini_get('session.save_path')) { return true; } @@ -406,7 +406,7 @@ private function checkDiskFreeSpace() */ private function checkSuhosinGetMaxValueLength(): int { - $length = (int) ini_get('suhosin.get.max_value_length'); + $length = (int) \ini_get('suhosin.get.max_value_length'); if ($length === 0) { return 2000; } diff --git a/engine/Shopware/Components/DependencyInjection/Bridge/Cache.php b/engine/Shopware/Components/DependencyInjection/Bridge/Cache.php index 84dec897c59..f61100e633d 100644 --- a/engine/Shopware/Components/DependencyInjection/Bridge/Cache.php +++ b/engine/Shopware/Components/DependencyInjection/Bridge/Cache.php @@ -114,7 +114,7 @@ private function isApcuAvailable() return false; } - if (!ini_get('apc.enabled')) { + if (!\ini_get('apc.enabled')) { return false; } diff --git a/engine/Shopware/Components/HttpCache/CacheRouteInstaller.php b/engine/Shopware/Components/HttpCache/CacheRouteInstaller.php index 6dcb3111f75..d82a3a25644 100644 --- a/engine/Shopware/Components/HttpCache/CacheRouteInstaller.php +++ b/engine/Shopware/Components/HttpCache/CacheRouteInstaller.php @@ -78,7 +78,7 @@ public function addHttpCacheRoute($route, $time, array $invalidateTags = []) */ public function removeHttpCacheRoute($route) { - //remove cached controller + // remove cached controller $cacheRoutes = $this->configWriter->get('cacheControllers', 'HttpCache'); if (empty($cacheRoutes)) { return false; @@ -92,7 +92,7 @@ public function removeHttpCacheRoute($route) $cacheRoutes = $this->implodeHttpCacheRoutes($cacheRoutes); $this->configWriter->save('cacheControllers', $cacheRoutes, 'HttpCache'); - //remove no cache tags + // remove no cache tags $noCacheRoutes = $this->configWriter->get('noCacheControllers', 'HttpCache'); $noCacheRoutes = $this->explodeHttpCacheRoutes($noCacheRoutes); $noCacheRoutes = array_filter($noCacheRoutes, function ($row) use ($route) { diff --git a/engine/Shopware/Components/Log/Formatter/HtmlFormatter.php b/engine/Shopware/Components/Log/Formatter/HtmlFormatter.php index 57950b9b87e..00a3406c13a 100644 --- a/engine/Shopware/Components/Log/Formatter/HtmlFormatter.php +++ b/engine/Shopware/Components/Log/Formatter/HtmlFormatter.php @@ -104,7 +104,7 @@ public function formatBatch(array $records) protected function convertToString($data) { - if ($data === null || is_scalar($data)) { + if ($data === null || \is_scalar($data)) { return (string) $data; } diff --git a/engine/Shopware/Components/MemoryLimit.php b/engine/Shopware/Components/MemoryLimit.php index 0aade30a9cd..844bbb438ce 100644 --- a/engine/Shopware/Components/MemoryLimit.php +++ b/engine/Shopware/Components/MemoryLimit.php @@ -33,7 +33,7 @@ class MemoryLimit */ public static function setMinimumMemoryLimit($bytes) { - $currentLimit = self::convertToBytes(@ini_get('memory_limit')); + $currentLimit = self::convertToBytes((string) @ini_get('memory_limit')); if ($currentLimit === -1) { return; } @@ -46,7 +46,7 @@ public static function setMinimumMemoryLimit($bytes) /** * @param string $memoryLimit * - * @return int|string + * @return int */ public static function convertToBytes($memoryLimit) { diff --git a/engine/Shopware/Components/Model/Generator.php b/engine/Shopware/Components/Model/Generator.php index 2a3296f4969..186f1fb4069 100644 --- a/engine/Shopware/Components/Model/Generator.php +++ b/engine/Shopware/Components/Model/Generator.php @@ -511,7 +511,7 @@ protected function getClassDefinition($table) // Check if the passed table is a Shopware attribute table. if (strpos($table->getName(), '_attributes')) { - //if the table is an attribute table we have to use the class name of the parent table. + // if the table is an attribute table we have to use the class name of the parent table. $parentClass = str_replace('_attributes', '', $table->getName()); $className = $this->getClassNameOfTableName($parentClass); diff --git a/engine/Shopware/Components/MultiEdit/Resource/Product/Filter.php b/engine/Shopware/Components/MultiEdit/Resource/Product/Filter.php index 535f0d24876..25d29ba8778 100644 --- a/engine/Shopware/Components/MultiEdit/Resource/Product/Filter.php +++ b/engine/Shopware/Components/MultiEdit/Resource/Product/Filter.php @@ -163,7 +163,7 @@ public function getArticleQueryBuilder($detailId) 'partial article.{id, name}', ]) ->from(Detail::class, 'detail') - //~ ->leftJoin('detail.article', 'article') + // ~ ->leftJoin('detail.article', 'article') ->where('detail.id = ?1') ->setParameter(1, $detailId); diff --git a/engine/Shopware/Components/Plugin/Bootstrap.php b/engine/Shopware/Components/Plugin/Bootstrap.php index c6fcec7f04d..afcb3ca63de 100644 --- a/engine/Shopware/Components/Plugin/Bootstrap.php +++ b/engine/Shopware/Components/Plugin/Bootstrap.php @@ -503,26 +503,26 @@ public function getDefaultControllerPath(Enlight_Event_EventArgs $arguments) throw new Enlight_Exception(sprintf('Controller "%s" can\'t load failure', $controller)); } - //register plugin model directory + // register plugin model directory if (file_exists($this->Path() . 'Models')) { $this->registerCustomModels(); } - //register plugin views directory + // register plugin views directory if (file_exists($this->Path() . 'Views')) { Shopware()->Template()->addTemplateDir( $this->Path() . 'Views/' ); } - //register plugin snippet directory + // register plugin snippet directory if (file_exists($this->Path() . 'Snippets')) { Shopware()->Snippets()->addConfigDir( $this->Path() . 'Snippets/' ); } - //register plugin component directory + // register plugin component directory if (file_exists($this->Path() . 'Components')) { Shopware()->Loader()->registerNamespace( 'Shopware_Components', diff --git a/engine/Shopware/Components/Plugin/FormSynchronizer.php b/engine/Shopware/Components/Plugin/FormSynchronizer.php index 8742907712d..75e79d97769 100644 --- a/engine/Shopware/Components/Plugin/FormSynchronizer.php +++ b/engine/Shopware/Components/Plugin/FormSynchronizer.php @@ -141,21 +141,21 @@ private function removeNotExistingElements(Plugin $plugin, array $names) return; } - //elements + // elements $query = $this->em->getConnection()->createQueryBuilder(); $query->delete('s_core_config_elements'); $query->where('id IN (:ids)'); $query->setParameter(':ids', $ids, Connection::PARAM_INT_ARRAY); $query->execute(); - //saved values + // saved values $query = $this->em->getConnection()->createQueryBuilder(); $query->delete('s_core_config_values'); $query->where('element_id IN (:ids)'); $query->setParameter(':ids', $ids, Connection::PARAM_INT_ARRAY); $query->execute(); - //translations + // translations $query = $this->em->getConnection()->createQueryBuilder(); $query->delete('s_core_config_element_translations'); $query->where('element_id IN (:ids)'); diff --git a/engine/Shopware/Components/Plugin/XmlReader/XmlConfigReader.php b/engine/Shopware/Components/Plugin/XmlReader/XmlConfigReader.php index 284765bf4a8..06fd655fed3 100644 --- a/engine/Shopware/Components/Plugin/XmlReader/XmlConfigReader.php +++ b/engine/Shopware/Components/Plugin/XmlReader/XmlConfigReader.php @@ -86,7 +86,7 @@ private function parseElementNodeList(DOMNodeList $list): array foreach ($list as $item) { $element = []; - //attributes + // attributes $element['scope'] = self::validateAttributeScope( $item->getAttribute('scope') ); @@ -101,7 +101,7 @@ private function parseElementNodeList(DOMNodeList $list): array 'text' ); - //elements + // elements if ($name = $item->getElementsByTagName('name')->item(0)) { $element['name'] = $name->nodeValue; } diff --git a/engine/Shopware/Components/Routing/Generators/RewriteGenerator.php b/engine/Shopware/Components/Routing/Generators/RewriteGenerator.php index 94e19da6930..6294006850a 100644 --- a/engine/Shopware/Components/Routing/Generators/RewriteGenerator.php +++ b/engine/Shopware/Components/Routing/Generators/RewriteGenerator.php @@ -121,7 +121,7 @@ public function generateList(array $list, Context $context) return $urls; } - //Add query / strtolower + // Add query / strtolower array_walk($urls, function (&$url, $key) use ($context, $list, $orgQueryList) { if (\is_string($url)) { if ($context->isUrlToLower()) { diff --git a/engine/Shopware/Components/Routing/Matchers/EventMatcher.php b/engine/Shopware/Components/Routing/Matchers/EventMatcher.php index 7c596e528d9..f829cf5b692 100644 --- a/engine/Shopware/Components/Routing/Matchers/EventMatcher.php +++ b/engine/Shopware/Components/Routing/Matchers/EventMatcher.php @@ -49,7 +49,7 @@ public function match($pathInfo, Context $context) if (str_starts_with($pathInfo, '/backend/') || str_starts_with($pathInfo, '/api/')) { return $pathInfo; } - if ($context->getShopId() === null) { //only frontend + if ($context->getShopId() === null) { // only frontend return $pathInfo; } diff --git a/engine/Shopware/Components/Routing/Router.php b/engine/Shopware/Components/Routing/Router.php index ee7486a163f..d05b74ca464 100644 --- a/engine/Shopware/Components/Routing/Router.php +++ b/engine/Shopware/Components/Routing/Router.php @@ -276,16 +276,16 @@ public function setPostFilters($postFilters) */ public function route(EnlightRequest $request) { - /* For enlight routing */ + /* For enlight routing */ $this->context->updateFromEnlightRequest($request); $params = $this->match($request->getPathInfo(), $this->context); if ($params !== false) { - /* For shopware routing (query === userParams) */ + /* For shopware routing (query === userParams) */ $request->setQuery($params); } - /* For enlight routing */ + /* For enlight routing */ $this->context->updateFromEnlightRequest($request); $this->context->setParams([]); diff --git a/engine/Shopware/Components/Session/PdoSessionHandler.php b/engine/Shopware/Components/Session/PdoSessionHandler.php index aa912c3e9ec..597a35e22b0 100644 --- a/engine/Shopware/Components/Session/PdoSessionHandler.php +++ b/engine/Shopware/Components/Session/PdoSessionHandler.php @@ -339,7 +339,7 @@ public function destroy($sessionId) */ public function write($sessionId, $data) { - $maxlifetime = (int) ini_get('session.gc_maxlifetime'); + $maxlifetime = (int) \ini_get('session.gc_maxlifetime'); try { // We use a single MERGE SQL query when supported by the database. @@ -429,7 +429,7 @@ public function close() protected function getConnection() { if ($this->pdo === null) { - $this->connect($this->dsn ?: ini_get('session.save_path')); + $this->connect($this->dsn ?: \ini_get('session.save_path')); } return $this->pdo; diff --git a/engine/Shopware/Components/SitePageMenu.php b/engine/Shopware/Components/SitePageMenu.php index 40fcfac697a..245e06859fe 100644 --- a/engine/Shopware/Components/SitePageMenu.php +++ b/engine/Shopware/Components/SitePageMenu.php @@ -170,7 +170,7 @@ private function buildSiteTree($parentId, $sites, $activeId) } $id = (int) $site['id']; - //call recursive for tree building + // call recursive for tree building $site['subPages'] = $this->buildSiteTree( $site['id'], $sites, diff --git a/engine/Shopware/Components/Snippet/Manager.php b/engine/Shopware/Components/Snippet/Manager.php index 2623d8138fc..15397f0cd60 100644 --- a/engine/Shopware/Components/Snippet/Manager.php +++ b/engine/Shopware/Components/Snippet/Manager.php @@ -313,7 +313,7 @@ private function getPluginDirs(): array ); foreach ($directories as $directory) { - //check valid directory + // check valid directory if ($directory->isDot() || !$directory->isDir() || $directory->getFilename() === '_cache') { continue; } @@ -340,7 +340,7 @@ private function getThemeDirs(?string $themeDir = null): array foreach (new DirectoryIterator( $themeDir ) as $directory) { - //check valid directory + // check valid directory if ($directory->isDot() || !$directory->isDir() || $directory->getFilename() === '_cache') { continue; } diff --git a/engine/Shopware/Components/Theme/Configurator.php b/engine/Shopware/Components/Theme/Configurator.php index 35b9a88b26f..3f515e39eb4 100644 --- a/engine/Shopware/Components/Theme/Configurator.php +++ b/engine/Shopware/Components/Theme/Configurator.php @@ -111,7 +111,7 @@ public function __construct( */ public function synchronize(Theme $theme) { - //prevents the theme configuration lazy loading + // prevents the theme configuration lazy loading $template = $this->getTemplate($theme); if (!$template instanceof Template) { $this->logger->error(sprintf('Could not synchronize theme. "%s" instance for theme "%s" not found', Template::class, $theme->getName())); @@ -119,10 +119,10 @@ public function synchronize(Theme $theme) return; } - //static main container which generated for each theme configuration. + // static main container which generated for each theme configuration. $container = new TabContainer('main_container'); - //inject the inheritance config container. + // inject the inheritance config container. $this->injectConfig($theme, $container); $this->eventManager->notify('Theme_Configurator_Container_Injected', [ @@ -141,7 +141,7 @@ public function synchronize(Theme $theme) 'container' => $container, ]); - //use the theme persister class to write the Shopware\Components\Form elements into the database + // use the theme persister class to write the Shopware\Components\Form elements into the database $this->persister->save($container, $template); $this->eventManager->notify('Theme_Configurator_Theme_Config_Saved', [ @@ -172,17 +172,17 @@ public function synchronize(Theme $theme) */ private function validateConfig(Container $container): void { - //check if the container implements the validation interface + // check if the container implements the validation interface if ($container instanceof Validate) { $container->validate(); } foreach ($container->getElements() as $element) { - //check recursive validation. + // check recursive validation. if ($element instanceof Container) { $this->validateConfig($element); - //check Form\Field validation + // check Form\Field validation } elseif ($element instanceof Validate) { $element->validate(); } @@ -239,9 +239,9 @@ private function synchronizeSets(Theme $theme, Template $template): void $synchronized[] = $existing; } - //iterates all sets of the template, file system and database + // iterates all sets of the template, file system and database foreach ($template->getConfigSets() as $existing) { - //check if the current set was synchronized in the foreach before + // check if the current set was synchronized in the foreach before $defined = $this->getExistingConfigSet( new ArrayCollection($synchronized), $existing->getName() @@ -251,7 +251,7 @@ private function synchronizeSets(Theme $theme, Template $template): void continue; } - //if it wasn't synchronized, the file system theme want to remove the set. + // if it wasn't synchronized, the file system theme want to remove the set. $this->entityManager->remove($existing); } @@ -436,7 +436,7 @@ private function injectConfig(Theme $theme, TabContainer $container): void return; } - //get Theme.php instance of the parent template + // get Theme.php instance of the parent template $parent = $this->util->getThemeByTemplate( $template->getParent() ); diff --git a/engine/Shopware/Components/Theme/Inheritance.php b/engine/Shopware/Components/Theme/Inheritance.php index 347f2c9e8dd..bee4dc3a44c 100644 --- a/engine/Shopware/Components/Theme/Inheritance.php +++ b/engine/Shopware/Components/Theme/Inheritance.php @@ -370,7 +370,7 @@ private function parseConfig(array $config, bool $lessCompatible = true): array return []; } - //creates a key value array for the configuration. + // creates a key value array for the configuration. $combinedArray = array_combine( array_column($config, 'name'), array_column($config, 'value') diff --git a/engine/Shopware/Components/Theme/Installer.php b/engine/Shopware/Components/Theme/Installer.php index c685177df7d..199b962ffab 100644 --- a/engine/Shopware/Components/Theme/Installer.php +++ b/engine/Shopware/Components/Theme/Installer.php @@ -267,7 +267,7 @@ private function synchronizePluginThemes() continue; } - //merge the plugin themes into the already detected plugin themes. + // merge the plugin themes into the already detected plugin themes. $themes = array_merge($themes, $pluginThemes); $this->entityManager->flush(); diff --git a/engine/Shopware/Components/Thumbnail/Generator/Basic.php b/engine/Shopware/Components/Thumbnail/Generator/Basic.php index 2d84735dd3f..63a4a22536c 100644 --- a/engine/Shopware/Components/Thumbnail/Generator/Basic.php +++ b/engine/Shopware/Components/Thumbnail/Generator/Basic.php @@ -180,7 +180,7 @@ private function calculateProportionalThumbnailSize(array $originalSize, int $wi $dstHeight = $srcHeight; $factor = 1; } else { - //Get the destination size + // Get the destination size $dstWidth = round($srcWidth * $factor); $dstHeight = round($srcHeight * $factor); } diff --git a/engine/Shopware/Components/Translation.php b/engine/Shopware/Components/Translation.php index f3ec8cb9e8b..b40a734e570 100644 --- a/engine/Shopware/Components/Translation.php +++ b/engine/Shopware/Components/Translation.php @@ -681,15 +681,15 @@ protected function fixArticleTranslation($languageId, $articleId, $data) ); foreach ($fallbacks as $id) { - //check if fallback ids contains an individual translation + // check if fallback ids contains an individual translation $existQuery->execute([':language' => $id, ':articleId' => $articleId]); $exist = $existQuery->fetch(PDO::FETCH_COLUMN); - //if shop translation of fallback exists, skip + // if shop translation of fallback exists, skip if ($exist) { continue; } - //add fallback translation to s_articles_translation for search requests. + // add fallback translation to s_articles_translation for search requests. $this->addProductTranslation($articleId, $id, $data); } } diff --git a/engine/Shopware/Components/UploadMaxSizeValidator.php b/engine/Shopware/Components/UploadMaxSizeValidator.php index b12d7e88a3c..43e61427066 100644 --- a/engine/Shopware/Components/UploadMaxSizeValidator.php +++ b/engine/Shopware/Components/UploadMaxSizeValidator.php @@ -115,7 +115,7 @@ public function getPostMaxSize() */ public function getNormalizedIniPostMaxSize() { - return strtoupper(trim((string) ini_get('post_max_size'))); + return strtoupper(trim((string) \ini_get('post_max_size'))); } /** diff --git a/engine/Shopware/Controllers/Backend/Analytics.php b/engine/Shopware/Controllers/Backend/Analytics.php index e2e612d3266..eec21b0b6e2 100644 --- a/engine/Shopware/Controllers/Backend/Analytics.php +++ b/engine/Shopware/Controllers/Backend/Analytics.php @@ -1228,14 +1228,14 @@ private function getFromDate(): DateTime private function getToDate(): DateTime { - //if a "to" date passed, format it over the \DateTime object. Otherwise, create a new date with today + // if a "to" date passed, format it over the \DateTime object. Otherwise, create a new date with today $toDate = $this->Request()->getParam('toDate'); if (empty($toDate)) { $toDate = new DateTime(); } else { $toDate = new DateTime($toDate); } - //to get the right value cause 2012-02-02 is smaller than 2012-02-02 15:33:12 + // to get the right value cause 2012-02-02 is smaller than 2012-02-02 15:33:12 $toDate = $toDate->add(new DateInterval('P1D')); return $toDate->sub(new DateInterval('PT1S')); diff --git a/engine/Shopware/Controllers/Backend/Application.php b/engine/Shopware/Controllers/Backend/Application.php index 32cf4a0eb09..9199bba6d4b 100644 --- a/engine/Shopware/Controllers/Backend/Application.php +++ b/engine/Shopware/Controllers/Backend/Application.php @@ -882,13 +882,13 @@ protected function resolveExtJsData($data) if ($data[$field]) { $associationModel = $this->getManager()->find($mapping['targetEntity'], $data[$field]); - //proxies need to be loaded, otherwise the validation will be failed. + // proxies need to be loaded, otherwise the validation will be failed. if ($associationModel instanceof Proxy && method_exists($associationModel, '__load')) { $associationModel->__load(); } $data[$mapping['fieldName']] = $associationModel; - //remove the foreign key data. + // remove the foreign key data. if ($field !== $mapping['fieldName']) { unset($data[$field]); } @@ -1029,12 +1029,12 @@ protected function getSortConditions($sort, $model, $alias, $whiteList = []) $fields = $this->getModelFields($model, $alias); $conditions = []; foreach ($sort as $condition) { - //check if the passed field is a valid doctrine model field of the configured model. + // check if the passed field is a valid doctrine model field of the configured model. if (!\array_key_exists($condition['property'], $fields)) { continue; } - //check if the developer limited the sortable fields and the passed property defined in the sort fields parameter. + // check if the developer limited the sortable fields and the passed property defined in the sort fields parameter. if (!empty($whiteList) && !\in_array($condition['property'], $whiteList, true)) { continue; } @@ -1091,7 +1091,7 @@ protected function getFilterConditions($filters, $model, $alias, $whiteList = [] foreach ($filters as $condition) { if ($condition['property'] === 'search') { foreach ($fields as $name => $field) { - //check if the developer limited the filterable fields and the passed property defined in the filter fields parameter. + // check if the developer limited the filterable fields and the passed property defined in the filter fields parameter. if (!empty($whiteList) && !\in_array($name, $whiteList, true)) { continue; } @@ -1105,7 +1105,7 @@ protected function getFilterConditions($filters, $model, $alias, $whiteList = [] ]; } } elseif (\array_key_exists($condition['property'], $fields)) { - //check if the developer limited the filterable fields and the passed property defined in the filter fields parameter. + // check if the developer limited the filterable fields and the passed property defined in the filter fields parameter. if (!empty($whiteList) && !\in_array($condition['property'], $whiteList, true)) { continue; } @@ -1166,7 +1166,7 @@ protected function formatSearchValue($value, array $field, $expression = null) break; case 'date': case 'datetime': - //validates the date value. If the value is no date value, return + // validates the date value. If the value is no date value, return $date = date_parse($value); if ($date['error_count'] > 0 || !checkdate((int) $date['month'], (int) $date['day'], (int) $date['year'])) { @@ -1179,7 +1179,7 @@ protected function formatSearchValue($value, array $field, $expression = null) return $value; } - //search values for date time should added the % wildcards to search for time values. + // search values for date time should added the % wildcards to search for time values. if ($field['type'] === 'datetime') { $value = '%' . $value . '%'; } diff --git a/engine/Shopware/Controllers/Backend/Article.php b/engine/Shopware/Controllers/Backend/Article.php index 57c280d0f92..e85f3b38823 100644 --- a/engine/Shopware/Controllers/Backend/Article.php +++ b/engine/Shopware/Controllers/Backend/Article.php @@ -752,7 +752,7 @@ public function getPropertyValuesAction() public function setPropertyListAction() { if (!$this->Request()->isPost()) { - //don't save the property list on a get request. This will only occur when there is an ext js problem + // don't save the property list on a get request. This will only occur when there is an ext js problem return; } $models = $this->get('models'); @@ -794,7 +794,7 @@ public function setPropertyListAction() $propertyValueModel = $propertyValueRepository->find($value['id']); } if ($propertyValueModel === null) { - //search for property value + // search for property value $propertyValueModel = $propertyValueRepository->findOneBy( [ 'value' => $value['value'], @@ -807,7 +807,7 @@ public function setPropertyListAction() $models->persist($propertyValueModel); } if (!$propertyValues->contains($propertyValueModel)) { - //add only new values + // add only new values $propertyValues->add($propertyValueModel); } } @@ -1595,10 +1595,10 @@ public function getEsdAction() $query->setHydrationMode(AbstractQuery::HYDRATE_ARRAY); $paginator = $this->getModelManager()->createPaginator($query); - //returns the total count of the query + // returns the total count of the query $totalResult = $paginator->count(); - //returns the customer data + // returns the customer data $result = $paginator->getIterator()->getArrayCopy(); $products = $this->buildListProducts($result); @@ -1626,13 +1626,13 @@ public function getEsdAction() $paginator = $this->getModelManager()->createPaginator($query); - //returns the total count of the query + // returns the total count of the query $totalResult = $paginator->count(); - //returns the customer data + // returns the customer data $result = $paginator->getIterator()->getArrayCopy(); - //inserts esd attributes into the result + // inserts esd attributes into the result $result = $this->getEsdListingAttributes($result); $this->View()->assign([ @@ -1660,10 +1660,10 @@ public function getSerialsAction() $paginator = $this->getModelManager()->createPaginator($query); - //returns the total count of the query + // returns the total count of the query $totalResult = $paginator->count(); - //returns the customer data + // returns the customer data $result = $paginator->getIterator()->getArrayCopy(); $this->View()->assign([ @@ -3450,7 +3450,7 @@ protected function prepareVariantData($variant, $detailData, &$counter, $depende return false; } - //create the new variant data + // create the new variant data $variantData = [ 'active' => 1, 'configuratorOptions' => $optionsModels, @@ -3957,7 +3957,7 @@ protected function prepareRelatedAssociatedData($data, $article) throw new ModelNotFoundException(Product::class, $relatedData['id']); } - //if the user select the cross + // if the user select the cross if ($relatedData['cross'] && !$relatedProduct->getRelated()->contains($article)) { $relatedProduct->getRelated()->add($article); $this->get('models')->persist($relatedProduct); @@ -4014,7 +4014,7 @@ protected function prepareSimilarAssociatedData($data, $article) throw new ModelNotFoundException(Product::class, $similarData['id']); } - //if the user select the cross + // if the user select the cross if ($similarData['cross'] && !$similarProduct->getSimilar()->contains($article)) { $similarProduct->getSimilar()->add($article); $this->get('models')->persist($similarProduct); @@ -4420,24 +4420,24 @@ protected function prepareNumberSyntax($syntax) */ protected function getCommandMapping($syntax) { - //we have to explode the current command to resolve the multiple properties. + // we have to explode the current command to resolve the multiple properties. $paths = explode('.', $syntax); - //we have to map the different properties to define the start cursor object. + // we have to map the different properties to define the start cursor object. switch ($paths[0]) { - //options are only available for the different product variants + // options are only available for the different product variants case 'options': $cursor = 'detail'; $paths[0] = 'configuratorOptions'; break; - //all other commands will rout to the product + // all other commands will rout to the product default: $cursor = 'article'; } $commands = []; - //now we convert the property names to the getter functions. + // now we convert the property names to the getter functions. foreach ($paths as $path) { $commands[] = ['origin' => $path, 'command' => 'get' . ucfirst($path)]; } diff --git a/engine/Shopware/Controllers/Backend/Config.php b/engine/Shopware/Controllers/Backend/Config.php index a166ffcdac4..1b9736ee250 100644 --- a/engine/Shopware/Controllers/Backend/Config.php +++ b/engine/Shopware/Controllers/Backend/Config.php @@ -397,7 +397,7 @@ public function getTableListAction() ]; $row['data'] = !\is_string($row['data']) ? var_export($row['data'], true) : $row['data']; } - //get the total count + // get the total count $select->reset(Zend_Db_Select::FROM); $select->reset(Zend_Db_Select::LIMIT_COUNT); $select->reset(Zend_Db_Select::LIMIT_OFFSET); diff --git a/engine/Shopware/Controllers/Backend/Customer.php b/engine/Shopware/Controllers/Backend/Customer.php index 8836a6f0b51..729256ed254 100644 --- a/engine/Shopware/Controllers/Backend/Customer.php +++ b/engine/Shopware/Controllers/Backend/Customer.php @@ -410,10 +410,10 @@ public function saveAction() */ public function deleteAction() { - //get posted customers + // get posted customers $customers = $this->Request()->getParam('customers', [['id' => $this->Request()->getParam('id')]]); - //iterate the customers and add the remove action + // iterate the customers and add the remove action foreach ($customers as $customer) { $entity = $this->getRepository()->find($customer['id']); if ($entity === null) { @@ -421,7 +421,7 @@ public function deleteAction() } $this->getManager()->remove($entity); } - //Performs all of the collected actions. + // Performs all of the collected actions. $this->getManager()->flush(); $this->View()->assign([ @@ -509,7 +509,7 @@ public function performOrderAction() ]); if ($shop->getHost()) { - //change the url to the subshop url + // change the url to the subshop url $url = str_replace('://' . $this->Request()->getHttpHost(), '://' . $shop->getHost(), $url); } diff --git a/engine/Shopware/Controllers/Backend/Index.php b/engine/Shopware/Controllers/Backend/Index.php index 1456b667c35..7514f0f2182 100644 --- a/engine/Shopware/Controllers/Backend/Index.php +++ b/engine/Shopware/Controllers/Backend/Index.php @@ -125,7 +125,7 @@ public function indexAction() $controller = Zend_Json::encode($controller); $this->View()->assign('controller', $controller, true); - $this->View()->assign('maxParameterLength', (int) ini_get('suhosin.get.max_value_length') + 0, true); + $this->View()->assign('maxParameterLength', (int) \ini_get('suhosin.get.max_value_length') + 0, true); $firstRunWizardEnabled = $this->isFirstRunWizardEnabled($identity); $sbpLogin = 0; diff --git a/engine/Shopware/Controllers/Backend/Notification.php b/engine/Shopware/Controllers/Backend/Notification.php index d343bf125ee..958e02ac78f 100644 --- a/engine/Shopware/Controllers/Backend/Notification.php +++ b/engine/Shopware/Controllers/Backend/Notification.php @@ -38,7 +38,7 @@ public function getArticleListAction() /** @var array $filter */ $filter = $this->Request()->getParam('filter', []); - //order data + // order data $order = (array) $this->Request()->getParam('sort', []); $repository = $this->get('models')->getRepository(Article::class); @@ -79,7 +79,7 @@ public function getCustomerListAction() /** @var array $filter */ $filter = $this->Request()->getParam('filter', []); - //order data + // order data $order = (array) $this->Request()->getParam('sort', []); $repository = $this->get('models')->getRepository(Article::class); diff --git a/engine/Shopware/Controllers/Backend/Order.php b/engine/Shopware/Controllers/Backend/Order.php index 77a970a17f0..486283b81b3 100644 --- a/engine/Shopware/Controllers/Backend/Order.php +++ b/engine/Shopware/Controllers/Backend/Order.php @@ -419,7 +419,7 @@ public function getStatusHistoryAction() $namespace = $this->get('snippets')->getNamespace('backend/order'); - //the backend order module have no function to create a new order so an order id must be passed. + // the backend order module have no function to create a new order so an order id must be passed. if (empty($orderId)) { $this->View()->assign([ 'success' => false, @@ -2085,7 +2085,7 @@ private function getAssociatedData(array $data): array if (!empty($data['customerId'])) { $data['customer'] = $this->getManager()->find(Customer::class, $data['customerId']); } else { - //if no customer id passed, we have to unset the array element, otherwise the existing customer model would be overwritten + // if no customer id passed, we have to unset the array element, otherwise the existing customer model would be overwritten unset($data['customer']); } diff --git a/engine/Shopware/Controllers/Backend/Partner.php b/engine/Shopware/Controllers/Backend/Partner.php index 950624c9558..34b340dc18a 100644 --- a/engine/Shopware/Controllers/Backend/Partner.php +++ b/engine/Shopware/Controllers/Backend/Partner.php @@ -351,7 +351,7 @@ protected function initAcl() */ private function getStatisticListTotalCount(Query $dataQuery): ?int { - //userCurrencyFactor has not to be part of the count parameters + // userCurrencyFactor has not to be part of the count parameters $originalParameters = $dataQuery->getParameters(); $countParameters = new ArrayCollection(); diff --git a/engine/Shopware/Controllers/Backend/Performance.php b/engine/Shopware/Controllers/Backend/Performance.php index f49c93bfd07..fc06acd24e5 100644 --- a/engine/Shopware/Controllers/Backend/Performance.php +++ b/engine/Shopware/Controllers/Backend/Performance.php @@ -619,13 +619,13 @@ protected function getPerformanceCheckData() 'id' => 1, 'name' => Shopware()->Snippets()->getNamespace('backend/performance/main')->get('cache/apc'), 'value' => \extension_loaded('apcu'), - 'valid' => \extension_loaded('apcu') === true && ini_get('apc.enabled') ? self::PERFORMANCE_VALID : self::PERFORMANCE_INVALID, + 'valid' => \extension_loaded('apcu') === true && \ini_get('apc.enabled') ? self::PERFORMANCE_VALID : self::PERFORMANCE_INVALID, ], [ 'id' => 3, 'name' => Shopware()->Snippets()->getNamespace('backend/performance/main')->get('cache/zend'), 'value' => \extension_loaded('Zend OPcache'), - 'valid' => \extension_loaded('Zend OPcache') === true && ini_get('opcache.enable') ? self::PERFORMANCE_VALID : self::PERFORMANCE_INVALID, + 'valid' => \extension_loaded('Zend OPcache') === true && \ini_get('opcache.enable') ? self::PERFORMANCE_VALID : self::PERFORMANCE_INVALID, ], [ 'id' => 4, diff --git a/engine/Shopware/Controllers/Backend/PluginInstaller.php b/engine/Shopware/Controllers/Backend/PluginInstaller.php index 996844d7f5c..595a237b412 100644 --- a/engine/Shopware/Controllers/Backend/PluginInstaller.php +++ b/engine/Shopware/Controllers/Backend/PluginInstaller.php @@ -88,7 +88,7 @@ public function updateAction() $plugin = $this->getPluginModel($technicalName); - //disable plugin and save state + // disable plugin and save state $active = $plugin->getActive(); $plugin->setActive(false); $this->get(ModelManager::class)->flush(); diff --git a/engine/Shopware/Controllers/Backend/Premium.php b/engine/Shopware/Controllers/Backend/Premium.php index 8a74b21e634..c013493adda 100644 --- a/engine/Shopware/Controllers/Backend/Premium.php +++ b/engine/Shopware/Controllers/Backend/Premium.php @@ -54,7 +54,7 @@ public function preDispatch() public function getSubShopsAction() { - //load shop repository + // load shop repository $repository = $this->get('models')->getRepository(Shop::class); $builder = $repository->createQueryBuilder('shops'); @@ -68,10 +68,10 @@ public function getSubShopsAction() $builder->leftJoin('shops.locale', 'shopLocale'); $query = $builder->getQuery(); - //select all shops as array + // select all shops as array $data = $query->getArrayResult(); - //return the data and total count + // return the data and total count $this->View()->assign(['success' => true, 'data' => $data]); } @@ -86,12 +86,12 @@ public function getPremiumArticlesAction() $start = $this->Request()->get('start'); $limit = $this->Request()->get('limit'); - //order data + // order data $order = (array) $this->Request()->getParam('sort', []); - //If a search-filter is set + // If a search-filter is set if ($this->Request()->get('filter')) { - //Get the value itself + // Get the value itself $filter = $this->Request()->get('filter'); $filter = $filter[\count($filter) - 1]; $filterValue = $filter['value']; @@ -136,10 +136,10 @@ public function createPremiumArticleAction() if (empty($params['orderNumber'])) { throw new Exception('No ordernumber was entered.'); } - //Fills the model by using the array $params + // Fills the model by using the array $params $premiumModel->fromArray($params); - //find the shop-model by using the subShopId + // find the shop-model by using the subShopId /** @var Shop $shop */ $shop = $this->get('models')->find(Shop::class, $params['shopId']); $premiumModel->setShop($shop); @@ -148,7 +148,7 @@ public function createPremiumArticleAction() $productVariant = $this->getArticleDetailRepository()->findOneBy(['number' => $params['orderNumber']]); $premiumModel->setArticleDetail($productVariant); - //If the product is already set as a premium-product + // If the product is already set as a premium-product $repository = $this->get('models')->getRepository(Premium::class); $result = $repository->findByOrderNumber($params['orderNumber']); $result = $this->get('models')->toArray($result); @@ -159,7 +159,7 @@ public function createPremiumArticleAction() return; } - //saves the model + // saves the model $this->get('models')->persist($premiumModel); $this->get('models')->flush(); @@ -190,7 +190,7 @@ public function editPremiumArticleAction() if (empty($params['orderNumberExport'])) { $params['orderNumberExport'] = $params['orderNumber']; } - //Replace a comma with a dot + // Replace a comma with a dot $params['startPrice'] = str_replace(',', '.', $params['startPrice']); $premiumModel->fromArray($params); diff --git a/engine/Shopware/Controllers/Backend/RiskManagement.php b/engine/Shopware/Controllers/Backend/RiskManagement.php index e0fc0fbf7fa..0c1c9b58be8 100644 --- a/engine/Shopware/Controllers/Backend/RiskManagement.php +++ b/engine/Shopware/Controllers/Backend/RiskManagement.php @@ -110,7 +110,7 @@ public function editRuleAction() unset($params['action']); unset($params['_dc']); - //2-dimensional array + // 2-dimensional array if ($params[0]) { $data = []; foreach ($params as $values) { diff --git a/engine/Shopware/Controllers/Backend/Site.php b/engine/Shopware/Controllers/Backend/Site.php index f2f78e5d87b..978b10cadb0 100644 --- a/engine/Shopware/Controllers/Backend/Site.php +++ b/engine/Shopware/Controllers/Backend/Site.php @@ -177,7 +177,7 @@ public function deleteGroupAction() // If the current site is associated with the requested group and has no other groups if (\in_array($key, $groups) && \count($groups) == 1) { - //set group to gDisabled to prevent orphanage + // set group to gDisabled to prevent orphanage Shopware()->Db()->query( 'UPDATE s_cms_static SET grouping = ? WHERE id = ?', ['disabled', $site['id']] @@ -210,13 +210,13 @@ public function deleteGroupAction() */ public function deleteSiteAction() { - //get id + // get id $params = $this->Request()->getParams(); $siteId = empty($params['siteId']) ? null : $params['siteId']; if (!empty($siteId)) { try { - //remove site + // remove site $model = $this->getSiteRepository()->find($siteId); if ($model !== null) { $this->getManager()->remove($model); @@ -224,15 +224,15 @@ public function deleteSiteAction() $this->getManager()->flush(); - //set the parentID of all children to 0 - //we don't want orphans + // set the parentID of all children to 0 + // we don't want orphans $sql = 'UPDATE s_cms_static SET parentID = 0 WHERE parentID = ?'; Shopware()->Db()->query($sql, [$siteId]); - //hand siteId to view + // hand siteId to view $this->View()->assign(['success' => true, 'data' => $siteId]); } catch (Exception $e) { - //catch all errors + // catch all errors $this->View()->assign(['success' => false, 'message' => $e->getMessage()]); } } @@ -245,7 +245,7 @@ public function deleteSiteAction() */ public function saveSiteAction() { - //get the id from the helperId field + // get the id from the helperId field $params = $this->Request()->getParams(); $siteId = empty($params['helperId']) ? null : $params['helperId']; diff --git a/engine/Shopware/Controllers/Backend/Vote.php b/engine/Shopware/Controllers/Backend/Vote.php index ba832ec2f3d..a0df4e07382 100644 --- a/engine/Shopware/Controllers/Backend/Vote.php +++ b/engine/Shopware/Controllers/Backend/Vote.php @@ -57,7 +57,7 @@ protected function getList($offset, $limit, $sort = [], $filter = [], array $who return $list; } - //assign shops over additional query to improve performance + // assign shops over additional query to improve performance $shops = $this->getShops($shopIds); return $this->assignShops($list, $shops); diff --git a/engine/Shopware/Controllers/Backend/Voucher.php b/engine/Shopware/Controllers/Backend/Voucher.php index 112625da011..9847403c47a 100644 --- a/engine/Shopware/Controllers/Backend/Voucher.php +++ b/engine/Shopware/Controllers/Backend/Voucher.php @@ -175,7 +175,7 @@ public function createVoucherCodesAction() $deletePreviousVoucherCodes = $this->Request()->deletePreviousVoucherCodes; $createdVoucherCodes = 0; - //verify the pattern of the code only the first time of batch processing batch + // verify the pattern of the code only the first time of batch processing batch if (!empty($codePattern) && $deletePreviousVoucherCodes === 'true') { if (!$this->validateCodePattern($codePattern, $numberOfUnits)) { $this->View()->assign(['success' => false, 'errorMsg' => 'CodePattern not complex enough']); @@ -183,7 +183,7 @@ public function createVoucherCodesAction() return; } } - //first delete available codes + // first delete available codes if ($deletePreviousVoucherCodes === 'true') { $this->deleteAllVoucherCodesById($voucherId); @@ -192,7 +192,7 @@ public function createVoucherCodesAction() return; } do { - //generate voucher codes till the numberOfUnits is reached + // generate voucher codes till the numberOfUnits is reached $this->generateVoucherCodes($voucherId, ($numberOfUnits - $createdVoucherCodes), $codePattern); $query = $this->getVoucherRepository()->getVoucherCodeCountQuery($voucherId); @@ -241,7 +241,7 @@ public function exportVoucherCodeAction() $this->Response()->headers->set('content-type', 'text/csv; charset=utf-8'); $this->Response()->headers->set('content-disposition', 'attachment;filename=voucherCodes.csv'); - //use this to set the BOM to show it in the right way for excel and stuff + // use this to set the BOM to show it in the right way for excel and stuff echo "\xEF\xBB\xBF"; $fp = fopen('php://output', 'w'); if (!\is_resource($fp)) { @@ -304,7 +304,7 @@ public function saveVoucherAction() if (!$this->_isAllowed('update', 'voucher')) { return; } - //edit voucher + // edit voucher $voucher = $this->getVoucherRepository()->find($voucherId); if (!$voucher instanceof Voucher) { throw new ModelNotFoundException(Voucher::class, $voucherId); @@ -313,11 +313,11 @@ public function saveVoucherAction() if (!$this->_isAllowed('create', 'voucher')) { return; } - //new voucher + // new voucher $voucher = new Voucher(); } - //save empty values + // save empty values $params = array_merge([ 'validFrom' => null, 'validTo' => null, @@ -432,7 +432,7 @@ protected function initAcl() protected function generateVoucherCodes($voucherId, $numberOfUnits, $codePattern) { $values = []; - //wrote in standard sql cause in this case its way faster than doctrine models + // wrote in standard sql cause in this case its way faster than doctrine models $sql = 'INSERT IGNORE INTO s_emarketing_voucher_codes (voucherID, code) VALUES'; for ($i = 1; $i <= $numberOfUnits; ++$i) { $code = $this->generateCode($codePattern); diff --git a/engine/Shopware/Controllers/Frontend/Blog.php b/engine/Shopware/Controllers/Frontend/Blog.php index 92f4a071945..fb5c7dcb2b6 100644 --- a/engine/Shopware/Controllers/Frontend/Blog.php +++ b/engine/Shopware/Controllers/Frontend/Blog.php @@ -458,7 +458,7 @@ public function ratingAction() $mail->addTo($this->Request()->getParam('eMail')); $mail->send(); } else { - //Save comment + // Save comment $commentData = $this->Request()->getPost(); $this->sSaveComment($commentData, $blogArticleId); } diff --git a/engine/Shopware/Controllers/Frontend/Checkout.php b/engine/Shopware/Controllers/Frontend/Checkout.php index 348cbe4f82d..736236bfe53 100644 --- a/engine/Shopware/Controllers/Frontend/Checkout.php +++ b/engine/Shopware/Controllers/Frontend/Checkout.php @@ -928,7 +928,7 @@ public function getUserData() if ($taxFree) { $system->sUSERGROUPDATA['tax'] = 0; - $system->sCONFIG['sARTICLESOUTPUTNETTO'] = 1; //Old template + $system->sCONFIG['sARTICLESOUTPUTNETTO'] = 1; // Old template Shopware()->Session()->set('sUserGroupData', $system->sUSERGROUPDATA); $userData['additional']['charge_vat'] = false; $userData['additional']['show_net'] = false; @@ -1533,7 +1533,7 @@ public function getSelectedPayment() $this->front->Request()->setPost('sPayment', (int) $payment['id']); $this->admin->sUpdatePayment(); - //if customer logged in and payment switched to fallback, display cart notice. Otherwise anonymous customers will see the message too + // if customer logged in and payment switched to fallback, display cart notice. Otherwise anonymous customers will see the message too if (Shopware()->Session()->get('sUserId')) { $this->flagPaymentBlocked(); } diff --git a/engine/Shopware/Controllers/Widgets/Emotion.php b/engine/Shopware/Controllers/Widgets/Emotion.php index 66c8435b46e..ea588b2b1b9 100644 --- a/engine/Shopware/Controllers/Widgets/Emotion.php +++ b/engine/Shopware/Controllers/Widgets/Emotion.php @@ -143,8 +143,8 @@ public function previewAction() $this->View()->assign($viewAssignments); - //fake to prevent rendering the templates with the widgets module. - //otherwise the template engine don't accept to load templates of the `frontend` module + // fake to prevent rendering the templates with the widgets module. + // otherwise the template engine don't accept to load templates of the `frontend` module $this->Request()->setModuleName('frontend'); } diff --git a/engine/Shopware/Core/sAdmin.php b/engine/Shopware/Core/sAdmin.php index 68918b3f33e..e2aa363e08e 100644 --- a/engine/Shopware/Core/sAdmin.php +++ b/engine/Shopware/Core/sAdmin.php @@ -915,7 +915,7 @@ public function sCheckUser() $passwordChangeDate, $userMail, $userId, - (int) ini_get('session.gc_maxlifetime'), + (int) \ini_get('session.gc_maxlifetime'), ] ); $getUser = $getUser ?: []; @@ -3268,7 +3268,7 @@ protected function loginUser($getUser, $email, $password, $isPreHashed, $encoder ] ); - //destroy cookie + // destroy cookie $this->front->Response()->setCookie('sUniqueID'); } diff --git a/engine/Shopware/Core/sArticles.php b/engine/Shopware/Core/sArticles.php index 87cb0823c7f..6a869479b30 100644 --- a/engine/Shopware/Core/sArticles.php +++ b/engine/Shopware/Core/sArticles.php @@ -1052,7 +1052,7 @@ public function sGetCheapestPrice( $getGroups = $this->db->fetchAll($sql, [$pricegroup, $this->sSYSTEM->sUSERGROUP]); - //if there are no discounts for this customergroup don't show "ab:" + // if there are no discounts for this customergroup don't show "ab:" if (empty($getGroups)) { return $cheapestPrice; } @@ -2398,8 +2398,8 @@ private function getPromotion(?int $category, string $number) $promotion['linkDetails'] .= "&sCategory=$category"; } - //check if the product has a configured property set which stored in s_filter. - //the mini product doesn't contains this data so we have to load this lazy. + // check if the product has a configured property set which stored in s_filter. + // the mini product doesn't contains this data so we have to load this lazy. if (!$product->hasProperties()) { return $promotion; } @@ -2627,7 +2627,7 @@ private function getLinksOfProduct(ListProduct $product, $categoryId, $addNumber */ private function getDescriptionKeywords($longDescription) { - //sDescriptionKeywords + // sDescriptionKeywords $string = strip_tags(html_entity_decode($longDescription, ENT_COMPAT | ENT_HTML401, 'UTF-8')); $string = str_replace(',', '', $string); $words = preg_split('/ /', $string, -1, PREG_SPLIT_NO_EMPTY); diff --git a/engine/Shopware/Core/sArticlesComparisons.php b/engine/Shopware/Core/sArticlesComparisons.php index 0c5c89dbd44..950bb7222c0 100644 --- a/engine/Shopware/Core/sArticlesComparisons.php +++ b/engine/Shopware/Core/sArticlesComparisons.php @@ -236,7 +236,7 @@ public function sGetComparisonProperties($articles) $properties = []; foreach ($articles as $product) { - //get all properties in the right order + // get all properties in the right order $sql = "SELECT options.id, options.name, @@ -269,7 +269,7 @@ public function sGetComparisonProperties($articles) foreach ($productProperties as $productProperty) { if (!\array_key_exists($productProperty['id'], $properties)) { - //the key is not part of the array so add it to the end + // the key is not part of the array so add it to the end $properties[$productProperty['id']] = $this->extractPropertyTranslation($productProperty); } } diff --git a/engine/Shopware/Core/sBasket.php b/engine/Shopware/Core/sBasket.php index de56cd64586..d9055603a58 100644 --- a/engine/Shopware/Core/sBasket.php +++ b/engine/Shopware/Core/sBasket.php @@ -2741,7 +2741,7 @@ private function getBasketProducts(array $getProducts): array $getProducts[$key]['amount'] = $quantity * round($price, 2); - //reset purchaseunit and save the original value in purchaseunitTemp + // reset purchaseunit and save the original value in purchaseunitTemp if ($getProducts[$key]['purchaseunit'] > 0) { $getProducts[$key]['purchaseunitTemp'] = $getProducts[$key]['purchaseunit']; $getProducts[$key]['purchaseunit'] = 1; diff --git a/engine/Shopware/Core/sExport.php b/engine/Shopware/Core/sExport.php index 02b1f6c7646..9b19c5765c8 100644 --- a/engine/Shopware/Core/sExport.php +++ b/engine/Shopware/Core/sExport.php @@ -2026,7 +2026,7 @@ private function hasMediaUrl(): bool private function ensurePHPTimeLimit(): void { - $maxExecutionTime = (int) ini_get('max_execution_time'); + $maxExecutionTime = (int) \ini_get('max_execution_time'); if ($maxExecutionTime <= self::DISABLED_MAX_EXECUTION_TIME || $maxExecutionTime >= self::DEFAULT_MAX_EXECUTION_TIME) { return; } diff --git a/engine/Shopware/Core/sOrder.php b/engine/Shopware/Core/sOrder.php index 9ffc1aa3189..830a42afca7 100644 --- a/engine/Shopware/Core/sOrder.php +++ b/engine/Shopware/Core/sOrder.php @@ -659,7 +659,7 @@ public function sSaveOrder() ); } } catch (Exception $e) { - //Payment method code failure + // Payment method code failure } $attributeData = $this->eventManager->filter( @@ -733,7 +733,7 @@ public function sSaveOrder() // Check for individual voucher - code if ($basketRow['modus'] == CartPositionsMode::VOUCHER) { - //reserve the basket voucher for the current user. + // reserve the basket voucher for the current user. $this->reserveVoucher( $basketRow['ordernumber'], $this->sUserData['additional']['user']['id'], diff --git a/engine/Shopware/Core/sRewriteTable.php b/engine/Shopware/Core/sRewriteTable.php index 823ce9650a6..8e397fd2992 100644 --- a/engine/Shopware/Core/sRewriteTable.php +++ b/engine/Shopware/Core/sRewriteTable.php @@ -542,7 +542,7 @@ public function sCreateRewriteTableBlog($offset = null, $limit = null, ShopConte ->getBlogCategoriesByParentQuery(Shopware()->Shop()->get('parentID')); $blogCategories = $query->getArrayResult(); - //get all blog category ids + // get all blog category ids $blogCategoryIds = []; foreach ($blogCategories as $blogCategory) { $blogCategoryIds[] = $blogCategory['id']; @@ -696,10 +696,10 @@ public function sCreateRewriteTableForSingleCampaign( */ public function sCreateRewriteTableContent($offset = null, $limit = null, ShopContextInterface $context = null) { - //form urls + // form urls $this->insertFormUrls($offset, $limit, $context); - //static pages urls + // static pages urls $this->insertStaticPageUrls($offset, $limit, $context); } diff --git a/engine/Shopware/Kernel.php b/engine/Shopware/Kernel.php index 8ee2106672f..06db524adc3 100644 --- a/engine/Shopware/Kernel.php +++ b/engine/Shopware/Kernel.php @@ -289,7 +289,7 @@ public function setPhpSettings(array $settings, $prefix = '') { foreach ($settings as $key => $value) { $key = empty($prefix) ? $key : $prefix . $key; - if (is_scalar($value)) { + if (\is_scalar($value)) { ini_set($key, (string) $value); } elseif (\is_array($value)) { $this->setPhpSettings($value, $key . '.'); @@ -550,7 +550,7 @@ protected function initializeContainer() $cache = new ConfigCache( $this->config['hook']['proxyDir'] . '/' . $class . '.php', - true //always check for file modified time + true // always check for file modified time ); if (!$cache->isFresh()) { diff --git a/engine/Shopware/Models/Article/Repository.php b/engine/Shopware/Models/Article/Repository.php index 4498e4aabe9..becb09bd0de 100644 --- a/engine/Shopware/Models/Article/Repository.php +++ b/engine/Shopware/Models/Article/Repository.php @@ -1995,12 +1995,12 @@ public function getSupplierListQueryBuilder($filter, array $orderBy) $builder->groupBy('supplier.id'); if (\is_array($filter) && ($filter[0]['property'] === 'name')) { - //filter the displayed columns with the passed filter + // filter the displayed columns with the passed filter $builder - ->where('supplier.name LIKE ?1') //Search only the beginning of the customer number. - ->orWhere('supplier.description LIKE ?1'); //Full text search for the first name of the customer + ->where('supplier.name LIKE ?1') // Search only the beginning of the customer number. + ->orWhere('supplier.description LIKE ?1'); // Full text search for the first name of the customer - //set the filter parameter for the different columns. + // set the filter parameter for the different columns. $builder->setParameter(1, '%' . $filter[0]['value'] . '%'); } diff --git a/engine/Shopware/Models/Category/Repository.php b/engine/Shopware/Models/Category/Repository.php index d9438b3233d..7d3890da15d 100644 --- a/engine/Shopware/Models/Category/Repository.php +++ b/engine/Shopware/Models/Category/Repository.php @@ -734,7 +734,7 @@ protected function getActiveQueryBuilder($customerGroupId = null, $shopId = null ->andHaving('COUNT(cg.id) = 0'); } - //to prevent a temporary table and file sort we have to set the same sort and group by condition + // to prevent a temporary table and file sort we have to set the same sort and group by condition $builder->groupBy('c.parentId') ->addGroupBy('c.position') ->addGroupBy('c.id') diff --git a/engine/Shopware/Models/Dispatch/Repository.php b/engine/Shopware/Models/Dispatch/Repository.php index 18d5879b024..5a2a4dae6af 100644 --- a/engine/Shopware/Models/Dispatch/Repository.php +++ b/engine/Shopware/Models/Dispatch/Repository.php @@ -460,7 +460,7 @@ public function getDispatchWithDeletedShopsQuery() */ protected function sortOrderQuery(\Doctrine\ORM\QueryBuilder $builder, $modelPrefix, $orderBy) { - //order the query with the passed orderBy parameter + // order the query with the passed orderBy parameter if (!empty($orderBy)) { foreach ($orderBy as $order) { if (!isset($order['direction'])) { diff --git a/engine/Shopware/Models/Document/Order.php b/engine/Shopware/Models/Document/Order.php index fb5cf3a2e56..63ac09f3b87 100644 --- a/engine/Shopware/Models/Document/Order.php +++ b/engine/Shopware/Models/Document/Order.php @@ -964,14 +964,14 @@ private function getTaxRateByApproximateTaxRate( $taxRate = Shopware()->Db()->fetchOne($sql, [ $approximateTaxRate, // p.e. 19.971195391 (approx. 20% VAT) $approximateTaxRate, - $maxDiff, //default: 0.1 + $maxDiff, // default: 0.1 $approximateTaxRate, $approximateTaxRate, $maxDiff, - $areaId, //p.e. 3 (Europe) + $areaId, // p.e. 3 (Europe) $countryId, // p.e. 23 (AT) - $stateId, //p.e. 0 - $customerGroupId, //p.e. 1 (EK) + $stateId, // p.e. 0 + $customerGroupId, // p.e. 1 (EK) ]); if ($taxRate === false) { diff --git a/engine/Shopware/Models/Media/Media.php b/engine/Shopware/Models/Media/Media.php index d318ec41806..b3de308a16b 100644 --- a/engine/Shopware/Models/Media/Media.php +++ b/engine/Shopware/Models/Media/Media.php @@ -716,7 +716,7 @@ public function onLoad() public function onRemove() { $mediaService = Shopware()->Container()->get(MediaServiceInterface::class); - //check if file exist and remove it + // check if file exist and remove it if ($mediaService->has($this->path)) { $mediaService->delete($this->path); } diff --git a/engine/Shopware/Models/Order/Document/Repository.php b/engine/Shopware/Models/Order/Document/Repository.php index dfa60062356..417449cb827 100644 --- a/engine/Shopware/Models/Order/Document/Repository.php +++ b/engine/Shopware/Models/Order/Document/Repository.php @@ -81,7 +81,7 @@ public function getListQuery($orderId, $filter = null, $orderBy = null, $limit = */ protected function selectListQuery(\Doctrine\ORM\QueryBuilder $builder) { - //select the different entities + // select the different entities $builder->select([ 'documents.id as id', 'documents.date as date', @@ -94,7 +94,7 @@ protected function selectListQuery(\Doctrine\ORM\QueryBuilder $builder) 'type.name as typeName', ]); - //join the required tables for the order list + // join the required tables for the order list $builder->from('Shopware\Models\Order\Document\Document', 'documents') ->join('documents.type', 'type'); diff --git a/engine/Shopware/Models/Shop/Repository.php b/engine/Shopware/Models/Shop/Repository.php index 27fa926f427..43578b4b2b6 100644 --- a/engine/Shopware/Models/Shop/Repository.php +++ b/engine/Shopware/Models/Shop/Repository.php @@ -402,7 +402,7 @@ public function getActiveShopByRequestAsArray(Enlight_Controller_Request_Request $shops = $this->getShopsArrayByHost($host); - //returns the right shop depending on the url + // returns the right shop depending on the url $shop = $this->findShopForRequest($shops, $requestPath); if ($shop !== null) { @@ -494,7 +494,7 @@ protected function findShopForRequest($shops, $requestPath) { $shop = null; foreach ($shops as $currentShop) { - //if the base url matches exactly the basePath we have found the main shop but the loop will continue + // if the base url matches exactly the basePath we have found the main shop but the loop will continue if ($currentShop['base_url'] === $currentShop['base_path']) { if ($shop === null) { $shop = $currentShop; diff --git a/engine/Shopware/Plugins/Default/Backend/SwagUpdate/Components/FeedbackCollector.php b/engine/Shopware/Plugins/Default/Backend/SwagUpdate/Components/FeedbackCollector.php index 445d1efefbf..94ce4d7b7a0 100644 --- a/engine/Shopware/Plugins/Default/Backend/SwagUpdate/Components/FeedbackCollector.php +++ b/engine/Shopware/Plugins/Default/Backend/SwagUpdate/Components/FeedbackCollector.php @@ -118,8 +118,8 @@ private function gatherData() 'shopware_version' => $this->release->getVersion(), 'shopware_version_text' => $this->release->getVersionText(), 'shopware_version_revision' => $this->release->getRevision(), - 'max_execution_time' => ini_get('max_execution_time'), - 'memory_limit' => ini_get('memory_limit'), + 'max_execution_time' => \ini_get('max_execution_time'), + 'memory_limit' => \ini_get('memory_limit'), 'serverSoftware' => $serverSoftware, 'mysql_version' => $db->fetchColumn('SELECT VERSION()'), 'extension' => get_loaded_extensions(), diff --git a/engine/Shopware/Plugins/Default/Core/CronBirthday/Bootstrap.php b/engine/Shopware/Plugins/Default/Core/CronBirthday/Bootstrap.php index 175f03d7b19..1de9b2735e7 100644 --- a/engine/Shopware/Plugins/Default/Core/CronBirthday/Bootstrap.php +++ b/engine/Shopware/Plugins/Default/Core/CronBirthday/Bootstrap.php @@ -144,7 +144,7 @@ public function onRun(Shopware_Components_Cron_CronJob $job) $shop = $repository->getActiveById($shopId); $this->get(ShopRegistrationServiceInterface::class)->registerShop($shop); - //language subshopID + // language subshopID $context = [ 'sUser' => $user, 'sVoucher' => $voucher, diff --git a/engine/Shopware/Plugins/Default/Core/HttpCache/CacheControl.php b/engine/Shopware/Plugins/Default/Core/HttpCache/CacheControl.php index fb5c88ca54b..863fc737b50 100644 --- a/engine/Shopware/Plugins/Default/Core/HttpCache/CacheControl.php +++ b/engine/Shopware/Plugins/Default/Core/HttpCache/CacheControl.php @@ -285,7 +285,7 @@ public function useNoCacheParameterForEsi(Request $request, $targetName) */ public function setContextCacheKey(Request $request, ShopContextInterface $context, Response $response) { - //not logged in => reset global context cookie + // not logged in => reset global context cookie if (!$this->session->offsetGet('sUserGroup')) { $this->resetCookies($request, $response); diff --git a/engine/Shopware/Plugins/Default/Core/MarketingAggregate/Components/SimilarShown.php b/engine/Shopware/Plugins/Default/Core/MarketingAggregate/Components/SimilarShown.php index e10c8f59029..5243a4bdd9d 100644 --- a/engine/Shopware/Plugins/Default/Core/MarketingAggregate/Components/SimilarShown.php +++ b/engine/Shopware/Plugins/Default/Core/MarketingAggregate/Components/SimilarShown.php @@ -85,13 +85,13 @@ public function initSimilarShown($offset = null, $limit = null) VALUES (:article_id, :related_article_id, :viewed, :init_date) '); - //iterate all selected articles which has to be initialed + // iterate all selected articles which has to be initialed foreach ($articles as $articleId) { - //now we select all similar articles of the s_emarketing_lastarticles table + // now we select all similar articles of the s_emarketing_lastarticles table $preparedSelect->execute(['articleId' => $articleId]); $combinations = $preparedSelect->fetchAll(); - //at least we have to insert each combination in the aggregate s_articles_similar_shown_ro table. + // at least we have to insert each combination in the aggregate s_articles_similar_shown_ro table. foreach ($combinations as $combination) { $preparedInsert->execute($combination); } @@ -142,10 +142,10 @@ public function updateElapsedSimilarShownArticles($limit = null) */ public function getSimilarShownValidationTime() { - //get similar shown validation time + // get similar shown validation time $interval = Shopware()->Config()->get('similarValidationTime', 10); - //create a new date time object to create the current date subtract the configured date interval. + // create a new date time object to create the current date subtract the configured date interval. $orderTime = new DateTime(); $orderTime->sub(new DateInterval('P' . $interval . 'D')); diff --git a/engine/Shopware/Plugins/Default/Core/PaymentMethods/Bootstrap.php b/engine/Shopware/Plugins/Default/Core/PaymentMethods/Bootstrap.php index 37f3c2c3222..164f668d4cb 100644 --- a/engine/Shopware/Plugins/Default/Core/PaymentMethods/Bootstrap.php +++ b/engine/Shopware/Plugins/Default/Core/PaymentMethods/Bootstrap.php @@ -123,7 +123,7 @@ public function onBackendOrderPostDispatch(Enlight_Event_EventArgs $args) /** @var Enlight_View_Default $view */ $view = $args->getSubject()->View(); - //if the controller action name equals "load" we have to load all application components + // if the controller action name equals "load" we have to load all application components if ($args->getRequest()->getActionName() === 'load') { $view->addTemplateDir($this->Path() . 'Views/emotion/'); $view->extendsTemplate( diff --git a/engine/Shopware/Plugins/Default/Core/PaymentMethods/Components/GenericPaymentMethod.php b/engine/Shopware/Plugins/Default/Core/PaymentMethods/Components/GenericPaymentMethod.php index 44d54bf39fd..6af2091c894 100644 --- a/engine/Shopware/Plugins/Default/Core/PaymentMethods/Components/GenericPaymentMethod.php +++ b/engine/Shopware/Plugins/Default/Core/PaymentMethods/Components/GenericPaymentMethod.php @@ -45,7 +45,7 @@ public function validate($paymentData) */ public function savePaymentData($userId, Enlight_Controller_Request_Request $request) { - //nothing to do, no return expected + // nothing to do, no return expected } /** @@ -53,7 +53,7 @@ public function savePaymentData($userId, Enlight_Controller_Request_Request $req */ public function getCurrentPaymentDataAsArray($userId) { - //nothing to do, array expected + // nothing to do, array expected return []; } diff --git a/engine/Shopware/Plugins/Default/Core/PaymentMethods/Components/SepaPaymentMethod.php b/engine/Shopware/Plugins/Default/Core/PaymentMethods/Components/SepaPaymentMethod.php index a392b8c939b..3346f0fa02d 100644 --- a/engine/Shopware/Plugins/Default/Core/PaymentMethods/Components/SepaPaymentMethod.php +++ b/engine/Shopware/Plugins/Default/Core/PaymentMethods/Components/SepaPaymentMethod.php @@ -299,7 +299,7 @@ private function sendSepaEmail($orderNumber, $userId, $data) try { $mail->send(); } catch (Exception $e) { - //TODO: Handle email sending failure + // TODO: Handle email sending failure } } } diff --git a/engine/Shopware/Plugins/Default/Core/PostFilter/Bootstrap.php b/engine/Shopware/Plugins/Default/Core/PostFilter/Bootstrap.php index f56883749ef..957483c39ac 100644 --- a/engine/Shopware/Plugins/Default/Core/PostFilter/Bootstrap.php +++ b/engine/Shopware/Plugins/Default/Core/PostFilter/Bootstrap.php @@ -87,9 +87,9 @@ public function onFilterRender(Enlight_Event_EventArgs $args) // Remove comments '#/\*.*?\*/#ms' => '', '#^\s*//.*$#m' => '', - //'#\n\s+#ms' => '', + // '#\n\s+#ms' => '', '#^\s+#ms' => '', - //'#\s+$#ms' => '', + // '#\s+$#ms' => '', ]; return preg_replace(array_keys($expressions), array_values($expressions), $source); diff --git a/engine/Shopware/Plugins/Default/Core/Router/Bootstrap.php b/engine/Shopware/Plugins/Default/Core/Router/Bootstrap.php index 05344d165d4..c6c4d91d4fa 100644 --- a/engine/Shopware/Plugins/Default/Core/Router/Bootstrap.php +++ b/engine/Shopware/Plugins/Default/Core/Router/Bootstrap.php @@ -237,7 +237,7 @@ protected function upgradeShop($request, $response) } } - //currency switch + // currency switch if ($cookieKey === 'currency') { $path = rtrim((string) $shop->getBasePath(), '/') . '/'; $response->headers->setCookie(new Cookie($cookieKey, $cookieValue, 0, $path, null, $request->isSecure())); @@ -389,7 +389,7 @@ protected function getNewShopUrl(Request $request, Shop $newShop) $url = '/' . $url; } - //build full redirect url to allow host switches + // build full redirect url to allow host switches return sprintf( '%s://%s%s%s', $request->getScheme(), @@ -406,13 +406,13 @@ protected function getNewShopUrl(Request $request, Shop $newShop) */ protected function shouldRedirect(Request $request, Shop $shop) { - return //for example: template preview, direct shop selection via url + return // for example: template preview, direct shop selection via url ( $request->isGet() && $request->getQuery('__shop') !== null && (int) $request->getQuery('__shop') !== (int) $shop->getId() ) - //for example: shop language switch + // for example: shop language switch || ( $request->isPost() && $request->getPost('__shop') !== null diff --git a/engine/Shopware/Plugins/Default/Core/System/Bootstrap.php b/engine/Shopware/Plugins/Default/Core/System/Bootstrap.php index fc1d5bbc9a5..f9b56d3f609 100644 --- a/engine/Shopware/Plugins/Default/Core/System/Bootstrap.php +++ b/engine/Shopware/Plugins/Default/Core/System/Bootstrap.php @@ -124,7 +124,7 @@ public function onInitResourceSystem(Enlight_Event_EventArgs $args) ', [$system->sUSERGROUP]); } if (empty($system->sUSERGROUPDATA['tax']) && !empty($system->sUSERGROUPDATA['id'])) { - $config['sARTICLESOUTPUTNETTO'] = 1; //Old template + $config['sARTICLESOUTPUTNETTO'] = 1; // Old template Shopware()->Session()->set('sOutputNet', true); } else { Shopware()->Session()->set('sOutputNet', false); diff --git a/engine/Shopware/Plugins/Default/Frontend/CronRefresh/Bootstrap.php b/engine/Shopware/Plugins/Default/Frontend/CronRefresh/Bootstrap.php index 6d40c722137..f5394edcba0 100644 --- a/engine/Shopware/Plugins/Default/Frontend/CronRefresh/Bootstrap.php +++ b/engine/Shopware/Plugins/Default/Frontend/CronRefresh/Bootstrap.php @@ -115,7 +115,7 @@ private function deleteOldReferrerData($maximumReferrerAge) if ($maximumReferrerAge === 0) { $maximumReferrerAge = 90; } - //negate the value and quote it for the sql statement + // negate the value and quote it for the sql statement $maximumReferrerAge = (int) $maximumReferrerAge * -1; $sql = ' DELETE FROM s_statistics_referer WHERE `datum` < date_add(current_date, INTERVAL ' . $maximumReferrerAge . ' DAY) @@ -139,7 +139,7 @@ private function deleteOldArticleImpressionData($maximumAge) if ($maximumAge === 0) { $maximumAge = 90; } - //negate the value and quote it for the sql statement + // negate the value and quote it for the sql statement $maximumAge = (int) $maximumAge * -1; $sql = ' DELETE FROM s_statistics_article_impression WHERE `date` < date_add(current_date, INTERVAL ' . $maximumAge . ' DAY) diff --git a/recovery/common/src/HttpClient/CurlClient.php b/recovery/common/src/HttpClient/CurlClient.php index 3cd6c32b710..1cb6732889e 100644 --- a/recovery/common/src/HttpClient/CurlClient.php +++ b/recovery/common/src/HttpClient/CurlClient.php @@ -93,7 +93,7 @@ private function call($url, $method = self::METHOD_GET, array $header = [], $dat throw new ClientException('Invalid URL given'); } - //Initializes the cURL instance + // Initializes the cURL instance $curl = curl_init(); curl_setopt($curl, CURLOPT_HTTPHEADER, $header); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); diff --git a/recovery/install/index.php b/recovery/install/index.php index f325b767f7e..d725cffd68f 100644 --- a/recovery/install/index.php +++ b/recovery/install/index.php @@ -59,7 +59,7 @@ return $application->run($input); } -//the execution time will be increased, because the import can take a while +// the execution time will be increased, because the import can take a while ini_set('max_execution_time', 120); // Redirect to no mod rewrite path diff --git a/recovery/install/ping.php b/recovery/install/ping.php index 3b7f324ab59..9b3cf1c6d43 100644 --- a/recovery/install/ping.php +++ b/recovery/install/ping.php @@ -23,7 +23,7 @@ */ header('HTTP/1.1 200 OK'); -//no cache headers +// no cache headers header('Expires: Mon, 26 Jul 1990 05:00:00 GMT'); header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); header('Cache-Control: no-store, no-cache, must-revalidate'); diff --git a/recovery/install/src/Requirements.php b/recovery/install/src/Requirements.php index 4a8d13c5889..fed375f9c41 100644 --- a/recovery/install/src/Requirements.php +++ b/recovery/install/src/Requirements.php @@ -160,7 +160,7 @@ private function getRuntimeValue($name) return true; } elseif (\function_exists($name)) { return true; - } elseif (($value = ini_get($name)) !== null) { + } elseif (($value = \ini_get($name)) !== null) { if (strtolower($value) == 'off' || (is_numeric($value) && $value == 0)) { return false; } elseif (strtolower($value) == 'on' || (is_numeric($value) && $value == 1)) { @@ -235,10 +235,10 @@ private function checkOpcache() 'name' => 'opcache.use_cwd', 'group' => 'core', 'required' => 1, - 'version' => ini_get('opcache.use_cwd'), - 'result' => ini_get('opcache.use_cwd'), + 'version' => \ini_get('opcache.use_cwd'), + 'result' => \ini_get('opcache.use_cwd'), 'notice' => '', - 'check' => $this->compare('opcache.use_cwd', ini_get('opcache.use_cwd'), '1'), + 'check' => $this->compare('opcache.use_cwd', \ini_get('opcache.use_cwd'), '1'), 'error' => '', ]]; @@ -248,10 +248,10 @@ private function checkOpcache() 'name' => 'opcache.validate_root', 'group' => 'core', 'required' => 1, - 'version' => ini_get('opcache.validate_root'), - 'result' => ini_get('opcache.validate_root'), + 'version' => \ini_get('opcache.validate_root'), + 'result' => \ini_get('opcache.validate_root'), 'notice' => '', - 'check' => $this->compare('opcache.validate_root', ini_get('opcache.validate_root'), '1'), + 'check' => $this->compare('opcache.validate_root', \ini_get('opcache.validate_root'), '1'), 'error' => '', ]; } @@ -358,7 +358,7 @@ private function checkSessionSavePath() { if (\function_exists('session_save_path')) { return (bool) session_save_path(); - } elseif (ini_get('session.save_path')) { + } elseif (\ini_get('session.save_path')) { return true; } @@ -372,7 +372,7 @@ private function checkSessionSavePath() */ private function checkSuhosinGetMaxValueLength() { - $length = (int) ini_get('suhosin.get.max_value_length'); + $length = (int) \ini_get('suhosin.get.max_value_length'); if ($length === 0) { return 2000; } diff --git a/tests/Functional/Bundle/AccountBundle/Controller/AccountTest.php b/tests/Functional/Bundle/AccountBundle/Controller/AccountTest.php index 38844f05cc3..fc427091f27 100644 --- a/tests/Functional/Bundle/AccountBundle/Controller/AccountTest.php +++ b/tests/Functional/Bundle/AccountBundle/Controller/AccountTest.php @@ -126,7 +126,7 @@ public function testNormalLogin(): void */ public function testHashPostLogin(): void { - //test with md5 password and without the ignoreAccountMode parameter + // test with md5 password and without the ignoreAccountMode parameter static::assertEmpty($this->session->offsetGet('sUserId')); $this->setUserDataToPost(); @@ -145,7 +145,7 @@ public function testHashPostLogin(): void */ public function testWithoutIgnoreLogin(): void { - //test the internal call of the method with the $ignoreAccountMode parameter + // test the internal call of the method with the $ignoreAccountMode parameter $this->setUserDataToPost(); $this->dispatch('/'); @@ -163,7 +163,7 @@ public function testWithoutIgnoreLogin(): void static::assertEmpty($result['sErrorMessages']); $this->logoutUser(); - //test the internal call of the method without the $ignoreAccountMode parameter + // test the internal call of the method without the $ignoreAccountMode parameter $this->setUserDataToPost(); @@ -184,7 +184,7 @@ public function testWithoutIgnoreLogin(): void */ public function testWithIgnoreLogin(): void { - //test the internal call of the method without the $ignoreAccountMode parameter + // test the internal call of the method without the $ignoreAccountMode parameter $this->setUserDataToPost(); $this->dispatch('/'); @@ -207,11 +207,11 @@ public function testWithIgnoreLogin(): void */ private function logoutUser(): void { - //reset the request + // reset the request $this->reset(); $this->Request()->setMethod('POST'); $this->dispatch('/account/logout'); - //reset the request + // reset the request $this->reset(); } diff --git a/tests/Functional/Bundle/SearchBundle/Condition/PriceConditionTest.php b/tests/Functional/Bundle/SearchBundle/Condition/PriceConditionTest.php index 8a58c01e779..1184f9af2ae 100644 --- a/tests/Functional/Bundle/SearchBundle/Condition/PriceConditionTest.php +++ b/tests/Functional/Bundle/SearchBundle/Condition/PriceConditionTest.php @@ -148,7 +148,7 @@ public function testPriceGroup(): void [ 'first' => ['EK' => 10], - //20,- € - 10% price group discount = 18,- € + // 20,- € - 10% price group discount = 18,- € 'second' => ['prices' => ['EK' => 20], 'priceGroup' => $priceGroup], 'third' => ['EK' => 30], ], @@ -177,7 +177,7 @@ public function testPriceGroupWithLastGraduation(): void $this->search( [ 'first' => ['EK' => 10], - //20,- € - 30% price group discount = 14,- € + // 20,- € - 30% price group discount = 14,- € 'second' => ['prices' => ['EK' => 20], 'priceGroup' => $priceGroup], 'third' => ['EK' => 30], ], diff --git a/tests/Functional/Bundle/SearchBundle/Condition/VoteAverageConditionTest.php b/tests/Functional/Bundle/SearchBundle/Condition/VoteAverageConditionTest.php index 1169be73a6f..984014bf552 100644 --- a/tests/Functional/Bundle/SearchBundle/Condition/VoteAverageConditionTest.php +++ b/tests/Functional/Bundle/SearchBundle/Condition/VoteAverageConditionTest.php @@ -72,16 +72,16 @@ public function testSubShopVotes(): void $this->search( [ 'first' => [ - 1 => [1], //shop = 1 1x vote with 1 point - 2 => [3], //shop = 2 1x vote with 3 point + 1 => [1], // shop = 1 1x vote with 1 point + 2 => [3], // shop = 2 1x vote with 3 point ], 'second' => [ - 1 => [4], //shop = 1 1x vote with 4 points - 2 => [4], //shop = 2 1x vote with 4 points + 1 => [4], // shop = 1 1x vote with 4 points + 2 => [4], // shop = 2 1x vote with 4 points ], 'third' => [ - 1 => [4], //shop = 1 1x vote with 4 points - 2 => [2], //shop = 2 1x vote with 2 points + 1 => [4], // shop = 1 1x vote with 4 points + 2 => [2], // shop = 2 1x vote with 2 points ], ], ['first', 'second'], @@ -101,18 +101,18 @@ public function testMixedVotes(): void $this->search( [ 'first' => [ - null => [5], //no assignment to shop - 1 => [1], //shop = 1 1x vote with 1 point - 2 => [4], //shop = 2 1x vote with 4 point + null => [5], // no assignment to shop + 1 => [1], // shop = 1 1x vote with 1 point + 2 => [4], // shop = 2 1x vote with 4 point ], 'second' => [ null => [5], - 1 => [4], //shop = 1 1x vote with 4 points - 2 => [3], //shop = 2 1x vote with 2 points + 1 => [4], // shop = 1 1x vote with 4 points + 2 => [3], // shop = 2 1x vote with 2 points ], 'third' => [ - 1 => [4], //shop = 1 1x vote with 4 points - 2 => [5], //shop = 2 1x vote with 2 points + 1 => [4], // shop = 1 1x vote with 4 points + 2 => [5], // shop = 2 1x vote with 2 points ], ], ['first', 'third'], @@ -132,18 +132,18 @@ public function testMixedVotesWithDisabledConfig(): void $this->search( [ 'first' => [ - null => [5], //no assignment to shop - 1 => [1], //shop = 1 1x vote with 1 point - 2 => [4], //shop = 2 1x vote with 4 point + null => [5], // no assignment to shop + 1 => [1], // shop = 1 1x vote with 1 point + 2 => [4], // shop = 2 1x vote with 4 point ], 'second' => [ null => [5], - 1 => [4], //shop = 1 1x vote with 4 points - 2 => [3], //shop = 2 1x vote with 2 points + 1 => [4], // shop = 1 1x vote with 4 points + 2 => [3], // shop = 2 1x vote with 2 points ], 'third' => [ - 1 => [4], //shop = 1 1x vote with 4 points - 2 => [5], //shop = 2 1x vote with 2 points + 1 => [4], // shop = 1 1x vote with 4 points + 2 => [5], // shop = 2 1x vote with 2 points ], ], ['second', 'third'], diff --git a/tests/Functional/Bundle/SearchBundle/Facet/VoteAverageFacetTest.php b/tests/Functional/Bundle/SearchBundle/Facet/VoteAverageFacetTest.php index 069ef77ba9d..4e1a0491e6a 100644 --- a/tests/Functional/Bundle/SearchBundle/Facet/VoteAverageFacetTest.php +++ b/tests/Functional/Bundle/SearchBundle/Facet/VoteAverageFacetTest.php @@ -47,7 +47,7 @@ public function testVoteAverageFacet(): void $result = $this->search( [ 'first' => [ - 1 => [1, 2], //shop = 1 1x vote with 1 point 1x vote with 2 points + 1 => [1, 2], // shop = 1 1x vote with 1 point 1x vote with 2 points ], 'second' => [ 1 => [4, 5], @@ -83,7 +83,7 @@ public function testVoteFacetWithoutSubshopVotes(): void $result = $this->search( [ 'first' => [ - 1 => [1, 2], //shop = 1 1x vote with 1 point 1x vote with 2 points + 1 => [1, 2], // shop = 1 1x vote with 1 point 1x vote with 2 points ], ], ['first'], @@ -107,7 +107,7 @@ public function testVoteFacetWithSubshopVotes(): void $result = $this->search( [ 'first' => [ - 2 => [1, 2], //shop = 1 1x vote with 1 point 1x vote with 2 points + 2 => [1, 2], // shop = 1 1x vote with 1 point 1x vote with 2 points ], ], ['first'], @@ -129,8 +129,8 @@ public function testVoteFacetWithNotAssignedSubShop(): void $result = $this->search( [ 'first' => [ - null => [1, 2], //shop = 1 1x vote with 1 point 1x vote with 2 points - 1 => [1, 2], //shop = null 1x vote with 1 point 1x vote with 2 points + null => [1, 2], // shop = 1 1x vote with 1 point 1x vote with 2 points + 1 => [1, 2], // shop = null 1x vote with 1 point 1x vote with 2 points ], ], ['first'], diff --git a/tests/Functional/Bundle/StoreFrontBundle/Helper.php b/tests/Functional/Bundle/StoreFrontBundle/Helper.php index 33fc20d290b..c4d53657ddd 100644 --- a/tests/Functional/Bundle/StoreFrontBundle/Helper.php +++ b/tests/Functional/Bundle/StoreFrontBundle/Helper.php @@ -513,8 +513,8 @@ public function createCustomerGroup(array $data = []): CustomerGroup 'name' => 'Unit test', 'tax' => true, 'taxInput' => true, - 'mode' => false, //use discounts? - 'discount' => 0, //percentage discount + 'mode' => false, // use discounts? + 'discount' => 0, // percentage discount ], $data ); diff --git a/tests/Functional/Bundle/StoreFrontBundle/VoteTest.php b/tests/Functional/Bundle/StoreFrontBundle/VoteTest.php index 71cb5872c6d..92b20c16eac 100644 --- a/tests/Functional/Bundle/StoreFrontBundle/VoteTest.php +++ b/tests/Functional/Bundle/StoreFrontBundle/VoteTest.php @@ -92,10 +92,10 @@ public function testAverage(): void { $this->assertShopVotes( __FUNCTION__, - //generate 2x vote entries for shop "1" with points 1 and 5 + // generate 2x vote entries for shop "1" with points 1 and 5 [1 => [1, 5]], - //expects shop "1" has a count of 3 votes and an average of 6 + // expects shop "1" has a count of 3 votes and an average of 6 [1 => ['count' => 2, 'average' => 6]] ); } @@ -104,10 +104,10 @@ public function testSimpleShopVotes(): void { $this->assertShopVotes( __FUNCTION__, - //generate 3x vote entries for shop "1" with points 3,4,5 + // generate 3x vote entries for shop "1" with points 3,4,5 [1 => [3, 4, 5]], - //expects shop "1" has a count of 3 votes and an average of 8 (average*2) + // expects shop "1" has a count of 3 votes and an average of 8 (average*2) [1 => ['count' => 3, 'average' => 8, 'points' => [3 => 1, 4 => 1, 5 => 1]]] ); } @@ -116,10 +116,10 @@ public function testShopVotes(): void { $this->assertShopVotes( __FUNCTION__, - //generate 3x vote entries for shop "1" with points 3,4,5 + // generate 3x vote entries for shop "1" with points 3,4,5 [1 => [3, 4, 5], 2 => [4, 4, 4]], - //expects shop "1" has a count of 3 votes and an average of 8 (average*2) + // expects shop "1" has a count of 3 votes and an average of 8 (average*2) [ 1 => ['count' => 3, 'average' => 8, 'points' => [3 => 1, 4 => 1, 5 => 1]], 2 => ['count' => 3, 'average' => 8, 'points' => [4 => 3]], @@ -132,13 +132,13 @@ public function testLegacyVotes(): void { $this->assertShopVotes( __FUNCTION__, - //generate 3x vote entries for shop "null" with points 3,4,5 and shop "1" three times with 4 points + // generate 3x vote entries for shop "null" with points 3,4,5 and shop "1" three times with 4 points [ null => [3, 4, 5], 1 => [4, 4, 4], ], - //expects shop "1" has a count of 6 votes and an average of 8 (average*2) + // expects shop "1" has a count of 6 votes and an average of 8 (average*2) [ 1 => ['count' => 6, 'average' => 8, 'points' => [3 => 1, 4 => 4, 5 => 1]], 2 => ['count' => 3, 'average' => 8, 'points' => [3 => 1, 4 => 1, 5 => 1]], @@ -188,7 +188,7 @@ public function testDisabledConfig(): void */ private function assertShopVotes(string $number, array $points = [], array $expected = [], array $configs = []): void { - //switch config values + // switch config values $config = Shopware()->Container()->get(Shopware_Components_Config::class); $originals = []; foreach ($configs as $key => $value) { @@ -196,38 +196,38 @@ private function assertShopVotes(string $number, array $points = [], array $expe $config->offsetSet($key, $value); } - //generate simple product + // generate simple product $context = $this->getContext(); $data = $this->getProduct($number, $context); $product = $this->helper->createProduct($data); - //generate shop specified votes generated + // generate shop specified votes generated foreach ($points as $shopId => $shopPoints) { - //fix for shop id = null as array key + // fix for shop id = null as array key if (!\is_int($shopId)) { $shopId = null; } $this->helper->createVotes($product->getId(), $shopPoints, $shopId); } - //load product struct + // load product struct $factory = Shopware()->Container()->get('shopware_storefront.base_product_factory'); $product = $factory->createBaseProduct($number); static::assertInstanceOf(BaseProduct::class, $product); $service = Shopware()->Container()->get(VoteServiceInterface::class); - //iterate all expected shop votes/averages + // iterate all expected shop votes/averages foreach ($expected as $shopId => $data) { $context = $this->getContext($shopId); - //validate vote count of provided shop + // validate vote count of provided shop if (\array_key_exists('count', $data)) { $votes = $service->get($product, $context); static::assertIsArray($votes); static::assertCount($data['count'], $votes, sprintf('Vote count %s for shop %s of product %s not match', $data['count'], $shopId, $product->getNumber())); } - //validates provided average value of provided shop + // validates provided average value of provided shop if (\array_key_exists('average', $data)) { $average = $service->getAverage($product, $context); static::assertInstanceOf(VoteAverage::class, $average); @@ -250,7 +250,7 @@ private function assertShopVotes(string $number, array $points = [], array $expe } } - //reset config values + // reset config values foreach ($originals as $key => $value) { $config->offsetSet($key, $value); } diff --git a/tests/Functional/Components/Api/ArticleTest.php b/tests/Functional/Components/Api/ArticleTest.php index 51fdecc61d7..75b7d6fcb47 100644 --- a/tests/Functional/Components/Api/ArticleTest.php +++ b/tests/Functional/Components/Api/ArticleTest.php @@ -2213,15 +2213,15 @@ public function testCreateWithMultiplePropertiesAndNewGroup(): void $this->resource->delete($articleId); - //delete test values in s_filter_values + // delete test values in s_filter_values $sql = 'DELETE FROM `s_filter_values` WHERE `optionId` = ?'; Shopware()->Db()->query($sql, [$databaseValuesOptions[0]['id']]); - //delete test values in s_filter_relations + // delete test values in s_filter_relations $sql = 'DELETE FROM `s_filter_relations` WHERE `optionId` = ?'; Shopware()->Db()->query($sql, [$databaseValuesOptions[0]['id']]); - //delete test values in s_filter_options + // delete test values in s_filter_options $builder->delete(\Shopware\Models\Property\Option::class, 'option')->andWhere( 'option.name = :optionName' )->setParameter('optionName', $optionName)->getQuery()->execute(); @@ -2334,15 +2334,15 @@ public function testUpdateWithMultiplePropertiesAndNewGroup(): void $this->resource->delete($articleId); - //delete test values in s_filter_values + // delete test values in s_filter_values $sql = 'DELETE FROM `s_filter_values` WHERE `optionId` = ?'; Shopware()->Db()->query($sql, [$databaseValuesOptions[0]['id']]); - //delete test values in s_filter_relations + // delete test values in s_filter_relations $sql = 'DELETE FROM `s_filter_relations` WHERE `optionId` = ?'; Shopware()->Db()->query($sql, [$databaseValuesOptions[0]['id']]); - //delete test values in s_filter_options + // delete test values in s_filter_options $builder->delete(\Shopware\Models\Property\Option::class, 'option')->andWhere( 'option.name = :optionName' )->setParameter('optionName', $optionName)->getQuery()->execute(); diff --git a/tests/Functional/Components/Api/CustomerTest.php b/tests/Functional/Components/Api/CustomerTest.php index 8fef00c79d3..814d44fdf57 100644 --- a/tests/Functional/Components/Api/CustomerTest.php +++ b/tests/Functional/Components/Api/CustomerTest.php @@ -198,7 +198,7 @@ public function testCreateShouldBeSuccessful(): int static::assertEquals($customer->getDefaultBillingAddress()->getAttribute()->getText1(), $testData['billing']['attribute']['text1']); static::assertEquals($customer->getDefaultShippingAddress()->getAttribute()->getText1(), $testData['shipping']['attribute']['text1']); - //test additional address lines + // test additional address lines static::assertEquals($customer->getDefaultShippingAddress()->getAdditionalAddressLine1(), $testData['shipping']['additionalAddressLine1']); static::assertEquals($customer->getDefaultShippingAddress()->getAdditionalAddressLine2(), $testData['shipping']['additionalAddressLine2']); static::assertEquals($customer->getDefaultBillingAddress()->getAdditionalAddressLine1(), $testData['billing']['additionalAddressLine1']); @@ -342,7 +342,7 @@ public function testUpdateShouldBeSuccessful(int $id): int static::assertInstanceOf(Address::class, $customer->getDefaultShippingAddress()); static::assertEquals($customer->getDefaultBillingAddress()->getFirstname(), $testData['billing']['firstname']); - //test additional fields + // test additional fields static::assertEquals($customer->getDefaultBillingAddress()->getAdditionalAddressLine1(), $testData['billing']['additionalAddressLine1']); static::assertEquals($customer->getDefaultBillingAddress()->getAdditionalAddressLine2(), $testData['billing']['additionalAddressLine2']); diff --git a/tests/Functional/Components/Api/MediaTest.php b/tests/Functional/Components/Api/MediaTest.php index 1364342e98a..ed506f37d03 100644 --- a/tests/Functional/Components/Api/MediaTest.php +++ b/tests/Functional/Components/Api/MediaTest.php @@ -48,7 +48,7 @@ public function testUploadName(): void $source = __DIR__ . '/fixtures/test-bild.jpg'; $dest = __DIR__ . '/fixtures/test-bild-used.jpg'; - //copy image to execute test case multiple times. + // copy image to execute test case multiple times. @unlink($dest); copy($source, $dest); @@ -62,7 +62,7 @@ public function testUploadName(): void $this->resource->create($data); static::assertTrue($mediaService->has($path)); - //check if the thumbnails are generated + // check if the thumbnails are generated $path = Shopware()->DocPath('media_image_thumbnail') . 'test-bild-used_140x140.jpg'; static::assertTrue($mediaService->has($path)); @@ -75,7 +75,7 @@ public function testUploadNameWithOver50Characters(): void $source = __DIR__ . '/fixtures/test-bild.jpg'; $dest = __DIR__ . '/fixtures/test-bild-with-more-than-50-characaters-more-more-more-more-used.jpg'; - //copy image to execute test case multiple times. + // copy image to execute test case multiple times. @unlink($dest); copy($source, $dest); @@ -86,7 +86,7 @@ public function testUploadNameWithOver50Characters(): void $mediaService = Shopware()->Container()->get(MediaServiceInterface::class); static::assertTrue($mediaService->has($pathPicture)); - //check if the thumbnails are generated + // check if the thumbnails are generated $path = Shopware()->DocPath('media_image_thumbnail') . $media->getName() . '_140x140.jpg'; static::assertTrue($mediaService->has($path)); @@ -134,7 +134,7 @@ public function testReplaceMedia(): void $source = __DIR__ . '/fixtures/test-bild.jpg'; $dest = __DIR__ . '/fixtures/test-bild-used.jpg'; - //copy image to execute test case multiple times. + // copy image to execute test case multiple times. @unlink($dest); copy($source, $dest); @@ -149,7 +149,7 @@ public function testReplaceMedia(): void $media = $this->resource->create($data); - //check if the thumbnails are generated + // check if the thumbnails are generated $this->resource->update($media->getId(), $updateData); $mediaPath = $mediaService->read($readPath); @@ -168,7 +168,7 @@ public function testUploadMediaWithNonWhitelistedExtension(): void $source = __DIR__ . '/fixtures/test-bild.jpg'; $dest = __DIR__ . '/fixtures/test-bild-used.foo'; - //copy image to execute test case multiple times. + // copy image to execute test case multiple times. @unlink($dest); copy($source, $dest); diff --git a/tests/Functional/Components/Api/TranslationTest.php b/tests/Functional/Components/Api/TranslationTest.php index e657bd692cc..2d17107419b 100644 --- a/tests/Functional/Components/Api/TranslationTest.php +++ b/tests/Functional/Components/Api/TranslationTest.php @@ -178,7 +178,7 @@ public function testCreateArticleByNumber(): int public function testCreateVariantTranslationByNumber(): void { $data = $this->getDummyData('variant'); - //Artikel mit Standardkonfigurator rot / 39 + // Artikel mit Standardkonfigurator rot / 39 $article = Shopware()->Db()->fetchRow("SELECT id, ordernumber, articleID FROM s_articles_details WHERE ordernumber = 'SW10201.11'"); $data['key'] = $article['ordernumber']; diff --git a/tests/Functional/Components/Cart/PaymentTokenServiceTest.php b/tests/Functional/Components/Cart/PaymentTokenServiceTest.php index 2daaf8dcd92..582269fd120 100644 --- a/tests/Functional/Components/Cart/PaymentTokenServiceTest.php +++ b/tests/Functional/Components/Cart/PaymentTokenServiceTest.php @@ -72,7 +72,7 @@ public function testPaymentTokenValidRequest(): void static::assertArrayHasKey($key, $cookies); static::assertNotNull($this->Response()->getHeader('Location')); - static::assertEquals(ini_get('session.cookie_path'), $cookies[$key]['path']); + static::assertEquals(\ini_get('session.cookie_path'), $cookies[$key]['path']); $request = Shopware()->Front()->Request(); static::assertNotNull($request); @@ -138,7 +138,7 @@ public function testPaymentTokenPath(string $virtualUrl, string $path): void $cookies = $this->Response()->getCookies(); static::assertArrayHasKey($key, $cookies); static::assertNotNull($this->Response()->getHeader('Location')); - static::assertEquals(ini_get('session.cookie_path'), $cookies[$key]['path']); + static::assertEquals(\ini_get('session.cookie_path'), $cookies[$key]['path']); Shopware()->Shop()->setBaseUrl($currentUrl); Shopware()->Shop()->setBasePath($currentPath); diff --git a/tests/Functional/Components/Theme/InstallerTest.php b/tests/Functional/Components/Theme/InstallerTest.php index cace2a13915..286cb7c7fdd 100644 --- a/tests/Functional/Components/Theme/InstallerTest.php +++ b/tests/Functional/Components/Theme/InstallerTest.php @@ -64,7 +64,7 @@ public function testSynchronizeThemeDirectory() $this->getSnippetHandler(), Shopware()->Container()->get(\Shopware\Components\Theme\Service::class), ); - //creates a directory iterator for the default theme directory (engine/Shopware/Themes) + // creates a directory iterator for the default theme directory (engine/Shopware/Themes) $directories = new DirectoryIterator( __DIR__ . '/Themes/' ); diff --git a/tests/Functional/Controllers/Backend/ArticleTest.php b/tests/Functional/Controllers/Backend/ArticleTest.php index 208d74524d8..e0c03132294 100644 --- a/tests/Functional/Controllers/Backend/ArticleTest.php +++ b/tests/Functional/Controllers/Backend/ArticleTest.php @@ -198,7 +198,7 @@ public function testSaveNetRegulationPrice(): void $regulationPrice = $this->getContainer()->get(Connection::class)->fetchOne('SELECT regulation_price FROM s_articles_prices WHERE articleID = ' . $firstArticle['id']); - //(119 / 119) * 100 + // (119 / 119) * 100 static::assertEquals(100, (float) $regulationPrice); } } diff --git a/tests/Functional/Controllers/Backend/PartnerTest.php b/tests/Functional/Controllers/Backend/PartnerTest.php index 56f1ed66b64..13c1a1ebb84 100644 --- a/tests/Functional/Controllers/Backend/PartnerTest.php +++ b/tests/Functional/Controllers/Backend/PartnerTest.php @@ -94,7 +94,7 @@ public function setUp(): void */ public function testGetList(): void { - //delete old data + // delete old data $repositoryData = $this->repository->findBy(['company' => $this->dummyData['company']]); foreach ($repositoryData as $testDummy) { $this->manager->remove($testDummy); @@ -128,14 +128,14 @@ public function testGetList(): void public function testSavePartner(): int { $params = $this->dummyData; - //test new partner + // test new partner $this->Request()->setParams($params); $this->dispatch('backend/Partner/savePartner'); static::assertTrue($this->View()->getAssign('success')); static::assertCount(19, $this->View()->getAssign('data')); static::assertEquals('streetDummy', $this->View()->getAssign('data')['street']); - //test update partner + // test update partner $params['id'] = $this->View()->getAssign('data')['id']; $params['street'] = $this->updateStreet; $this->Request()->setParams($params); @@ -210,7 +210,7 @@ public function testValidateTrackingCode(int $id): int $body = $this->Response()->getBody(); static::assertEmpty($body); - //delete the new dummy + // delete the new dummy $this->manager->remove($newDummy); $this->manager->flush(); diff --git a/tests/Functional/Controllers/Backend/UserManagerTest.php b/tests/Functional/Controllers/Backend/UserManagerTest.php index c9cd7fbb531..ebe6c8a7926 100644 --- a/tests/Functional/Controllers/Backend/UserManagerTest.php +++ b/tests/Functional/Controllers/Backend/UserManagerTest.php @@ -99,14 +99,14 @@ public function testWrongAdminLogin(): void */ public function testCreateAdminUser(): void { - //Delete the user in case the username is duplicated + // Delete the user in case the username is duplicated $this->deleteUserByUsername($this->temporaryAdminUserData['username']); $this->Request()->setParams($this->temporaryAdminUserData); $this->dispatch('/backend/UserManager/updateUser'); - //Verify that the admin user creation was successful + // Verify that the admin user creation was successful static::assertTrue($this->View()->getAssign('success')); } @@ -396,7 +396,7 @@ private function getUserByUsername(string $username): array */ private function deleteUserByUsername(string $name): void { - //Delete the admin user if it exists before attempting to create it (else we will have a duplicate user error) + // Delete the admin user if it exists before attempting to create it (else we will have a duplicate user error) Shopware()->Container() ->get(Connection::class) ->executeQuery( diff --git a/tests/Functional/Controllers/Frontend/SearchTest.php b/tests/Functional/Controllers/Frontend/SearchTest.php index 00ca943e45d..585f549c723 100644 --- a/tests/Functional/Controllers/Frontend/SearchTest.php +++ b/tests/Functional/Controllers/Frontend/SearchTest.php @@ -74,7 +74,7 @@ public function testAjaxSearch() static::assertStringNotContainsStringIgnoringCase('an error has occured', $body); // Check for error-handler response as well, which would fake a HTTP 200 OK response static::assertStringNotContainsStringIgnoringCase('ein fehler ist aufgetreten', $body); - //search for an emoji, might not be displayed correctly in IDE + // search for an emoji, might not be displayed correctly in IDE $this->Response()->clearBody(); $this->dispatch('ajax_search?sSearch=👨‍🚒'); diff --git a/tests/Functional/Core/AdminTest.php b/tests/Functional/Core/AdminTest.php index 4c0334e5253..28771a31591 100644 --- a/tests/Functional/Core/AdminTest.php +++ b/tests/Functional/Core/AdminTest.php @@ -874,7 +874,7 @@ public function testsGetCountryList(): void Shopware()->Db()->insert('s_core_translations', $demoStateData); } - //Hack current context, so next test works + // Hack current context, so next test works $context = Shopware()->Container()->get('shopware_storefront.context_service')->getShopContext(); $context->getShop()->setIsDefault(false); diff --git a/tests/Functional/Core/BasketTest.php b/tests/Functional/Core/BasketTest.php index c0e302df036..f86f8d1b89c 100644 --- a/tests/Functional/Core/BasketTest.php +++ b/tests/Functional/Core/BasketTest.php @@ -566,18 +566,18 @@ public function testPremiumOrderNumberExport(): void $ordernumberExport = 'test' . random_int(1000, 9999); - //Insert a new Premium product that has a ordernumber_export different from the ordernumber + // Insert a new Premium product that has a ordernumber_export different from the ordernumber $this->connection->insert('s_addon_premiums', ['startprice' => 0, 'ordernumber' => 'SW10137', 'ordernumber_export' => $ordernumberExport, 'subshopID' => 0]); - //sInsertPremium gets the premium to add from the Request, therefore we do set it here + // sInsertPremium gets the premium to add from the Request, therefore we do set it here $front = $this->getContainer()->get('front'); static::assertInstanceOf(Enlight_Controller_Request_Request::class, $front->Request()); $front->Request()->setQuery('sAddPremium', 'SW10137'); - //add the premium item to the basket + // add the premium item to the basket $this->module->sInsertPremium(); - //check if the ordernumber_export from s_addon_premiums has been added to s_order_basket as ordernumber + // check if the ordernumber_export from s_addon_premiums has been added to s_order_basket as ordernumber static::assertEquals( $ordernumberExport, $this->connection->fetchOne( diff --git a/tests/Functional/Core/sCategoriesTest.php b/tests/Functional/Core/sCategoriesTest.php index 5e6f1d08944..ed4e44374a8 100644 --- a/tests/Functional/Core/sCategoriesTest.php +++ b/tests/Functional/Core/sCategoriesTest.php @@ -74,7 +74,7 @@ public function testGetCategoriesWithSubcategory() */ public function testsGetCategoryIdByArticleId() { - //first category which assigned to the product 2 + // first category which assigned to the product 2 static::assertEquals(14, $this->module->sGetCategoryIdByArticleId(2)); // Check that searching in default category or with null is the same @@ -231,28 +231,28 @@ public function testsGetCategoryPath() */ public function testGetWholeCategoryTree() { - //set Category "Tees und Zubehör" to inactive so the childs should not be displayed + // set Category "Tees und Zubehör" to inactive so the childs should not be displayed $sql = "UPDATE `s_categories` SET `active` = '0' WHERE `id` =11"; Shopware()->Db()->exec($sql); $allCategories = $this->module->sGetWholeCategoryTree(3, 3); - //get "Genusswelten" this category should not have the inactive category "Tees and Zubehör" as subcategory + // get "Genusswelten" this category should not have the inactive category "Tees and Zubehör" as subcategory $category = $this->getCategoryById($allCategories, 5); static::assertIsArray($category); - //search for Tees und Zubehör + // search for Tees und Zubehör $result = $this->getCategoryById($category['sub'], 11); static::assertEmpty($result); - //if the parent category is inactive the child's should not be displayed - //category = "Genusswelten" the active child "Tees" and "Tees und Zubehör" should not be return because the father ist inactive + // if the parent category is inactive the child's should not be displayed + // category = "Genusswelten" the active child "Tees" and "Tees und Zubehör" should not be return because the father ist inactive $result = $this->getCategoryById($category['sub'], 12); static::assertEmpty($result); $result = $this->getCategoryById($category['sub'], 13); static::assertEmpty($result); - //set Category "Tees und Zubehör" to inactive so the childs should not be displayed + // set Category "Tees und Zubehör" to inactive so the childs should not be displayed $sql = "UPDATE `s_categories` SET `active` = '1' WHERE `id` = 11"; Shopware()->Db()->exec($sql); } diff --git a/tests/Functional/Helper/Utils.php b/tests/Functional/Helper/Utils.php index 8bdb8b4bb7e..4067071f0fd 100644 --- a/tests/Functional/Helper/Utils.php +++ b/tests/Functional/Helper/Utils.php @@ -41,7 +41,7 @@ public static function bindAndCall(Closure $fn, object $newThis) throw new RuntimeException('Could not create closure function'); } - return $func(); //faster + return $func(); // faster } /** diff --git a/tests/Functional/Models/Shop/ShopRepositoryTest.php b/tests/Functional/Models/Shop/ShopRepositoryTest.php index d7dad507479..a541356fd3b 100644 --- a/tests/Functional/Models/Shop/ShopRepositoryTest.php +++ b/tests/Functional/Models/Shop/ShopRepositoryTest.php @@ -103,22 +103,22 @@ public function testGetActiveByRequest(): void // Tests copied for SW-6768 $this->callGetActiveShopByRequest($this->mainShop['base_path'] . '/en', 'testShop3'); - //check virtual url with superfluous / like localhost/en/ + // check virtual url with superfluous / like localhost/en/ $this->callGetActiveShopByRequest($this->mainShop['base_path'] . '/en/', 'testShop3'); - //check virtual url with direct controller call like localhost/en/blog + // check virtual url with direct controller call like localhost/en/blog $this->callGetActiveShopByRequest($this->mainShop['base_path'] . '/en/blog', 'testShop3'); - //check base shop with direct controller call like localhost/en/blog + // check base shop with direct controller call like localhost/en/blog $this->callGetActiveShopByRequest($this->mainShop['base_path'] . '/blog', $this->mainShop['name']); - //check without virtual url but an url with the same beginning like localhost/entsorgung + // check without virtual url but an url with the same beginning like localhost/entsorgung $this->callGetActiveShopByRequest($this->mainShop['base_path'] . '/entsorgung', $this->mainShop['name']); - //check different virtual url with like localhost/ente + // check different virtual url with like localhost/ente $this->callGetActiveShopByRequest($this->mainShop['base_path'] . '/en/uk', 'testShop2'); - //check without virtual url it has to choose the main shop instead of the language shop without the virtual url + // check without virtual url it has to choose the main shop instead of the language shop without the virtual url $this->callGetActiveShopByRequest($this->mainShop['base_path'], $this->mainShop['name']); // These are just some basic urls diff --git a/tests/Functional/Plugins/Core/MarketingAggregate/Components/SimilarShownTest.php b/tests/Functional/Plugins/Core/MarketingAggregate/Components/SimilarShownTest.php index 273baa61cf2..4ec288d8803 100644 --- a/tests/Functional/Plugins/Core/MarketingAggregate/Components/SimilarShownTest.php +++ b/tests/Functional/Plugins/Core/MarketingAggregate/Components/SimilarShownTest.php @@ -126,7 +126,7 @@ public function testSimilarCronJobRefresh() $cron = $this->Db()->fetchRow("SELECT * FROM s_crontab WHERE action = 'RefreshSimilarShown'"); static::assertNotEmpty($cron); - //the cron plugin isn't installed, so we can't use a dispatch on /backend/cron + // the cron plugin isn't installed, so we can't use a dispatch on /backend/cron $this->Plugin()->refreshSimilarShown(new Enlight_Event_EventArgs(['subject' => $this])); $articles = $this->getAllSimilarShown(" WHERE init_date > '2010-01-01' "); diff --git a/tests/Functional/Plugins/Core/MarketingAggregate/Components/TopSellerTest.php b/tests/Functional/Plugins/Core/MarketingAggregate/Components/TopSellerTest.php index 827ec279e6f..c8bec418f3f 100644 --- a/tests/Functional/Plugins/Core/MarketingAggregate/Components/TopSellerTest.php +++ b/tests/Functional/Plugins/Core/MarketingAggregate/Components/TopSellerTest.php @@ -48,27 +48,27 @@ public function testInitTopSeller() public function testUpdateElapsedTopSeller() { - //init top seller to be sure that all articles has a row + // init top seller to be sure that all articles has a row $this->resetTopSeller(); $this->TopSeller()->initTopSeller(); $this->Db()->query("UPDATE s_articles_top_seller_ro SET last_cleared = '2010-01-01'"); - //check if the update script was successfully + // check if the update script was successfully $topSeller = $this->getAllTopSeller(" WHERE last_cleared > '2010-01-01' "); static::assertCount(0, $topSeller); - //update only 50 top seller articles to test the limit function + // update only 50 top seller articles to test the limit function $this->TopSeller()->updateElapsedTopSeller(50); - //check if only 50 top seller was updated. + // check if only 50 top seller was updated. $topSeller = $this->getAllTopSeller(" WHERE last_cleared > '2010-01-01' "); static::assertCount( 50, $topSeller ); - //now we can update the all other top seller data + // now we can update the all other top seller data $this->TopSeller()->updateElapsedTopSeller(); static::assertCount( \count($this->getAllTopSeller()), @@ -149,7 +149,7 @@ public function testTopSellerCronJobRefresh() $cron = $this->Db()->fetchRow("SELECT * FROM s_crontab WHERE action = 'RefreshTopSeller'"); static::assertNotEmpty($cron); - //the cron plugin isn't installed, so we can't use a dispatch on /backend/cron + // the cron plugin isn't installed, so we can't use a dispatch on /backend/cron $this->Plugin()->refreshTopSeller(); $topSeller = $this->getAllTopSeller(" WHERE last_cleared > '2010-01-01' "); @@ -175,7 +175,7 @@ public function testTopSellerManualRefresh() $topSeller = $this->getAllTopSeller(" WHERE last_cleared > '2010-01-01' "); static::assertCount(0, $topSeller); - //the cron plugin isn't installed, so we can't use a dispatch on /backend/cron + // the cron plugin isn't installed, so we can't use a dispatch on /backend/cron $this->Plugin()->refreshTopSeller(); $topSeller = $this->getAllTopSeller(" WHERE last_cleared > '2010-01-01' "); diff --git a/tests/Functional/Plugins/Core/MarketingAggregate/Modules/ArticleTest.php b/tests/Functional/Plugins/Core/MarketingAggregate/Modules/ArticleTest.php index abc1feb1338..8389eca0eae 100644 --- a/tests/Functional/Plugins/Core/MarketingAggregate/Modules/ArticleTest.php +++ b/tests/Functional/Plugins/Core/MarketingAggregate/Modules/ArticleTest.php @@ -62,8 +62,8 @@ public function testTopSellerSelection(): void $topSeller = array_values($topSeller); - //the article "2" pseudo sales are set to 1000 so we expect that this will be the first article - //in the top seller slider. + // the article "2" pseudo sales are set to 1000 so we expect that this will be the first article + // in the top seller slider. static::assertEquals(4, $topSeller[0]['articleID']); static::assertEquals(3, $topSeller[1]['articleID']); diff --git a/tests/Functional/Plugins/Core/PaymentMethods/Components/SepaPaymentMethodTest.php b/tests/Functional/Plugins/Core/PaymentMethods/Components/SepaPaymentMethodTest.php index 889b5f0aa09..14cec5f311b 100644 --- a/tests/Functional/Plugins/Core/PaymentMethods/Components/SepaPaymentMethodTest.php +++ b/tests/Functional/Plugins/Core/PaymentMethods/Components/SepaPaymentMethodTest.php @@ -53,7 +53,7 @@ public static function setUpBeforeClass(): void $pluginDir . '/Components/' ); - //SEPA needs to be active for this. Also, we need to save existing status to later restore it + // SEPA needs to be active for this. Also, we need to save existing status to later restore it $sepaPaymentMean = Shopware()->Models()->getRepository(Payment::class)->findOneBy(['name' => 'Sepa']); static::assertNotNull($sepaPaymentMean); @@ -147,7 +147,7 @@ public function testCreatePaymentInstanceWithNoPaymentData(): void $paymentId = 6; Shopware()->Session()->set('sUserId', $userId); - //for now, don't test email + // for now, don't test email Shopware()->Config()->offsetSet('sepaSendEmail', false); self::$sepaPaymentMethod->createPaymentInstance($orderId, $userId, $paymentId); @@ -218,7 +218,7 @@ public function testCreatePaymentInstance(): void $paymentId = 6; Shopware()->Session()->set('sUserId', $userId); - //for now, don't test email + // for now, don't test email Shopware()->Config()->offsetSet('sepaSendEmail', false); self::$sepaPaymentMethod->createPaymentInstance($orderId, $userId, $paymentId); diff --git a/tests/Mink/features/bootstrap/Element/BlogArticle.php b/tests/Mink/features/bootstrap/Element/BlogArticle.php index c9c581a1ff3..e624e9b35cc 100644 --- a/tests/Mink/features/bootstrap/Element/BlogArticle.php +++ b/tests/Mink/features/bootstrap/Element/BlogArticle.php @@ -161,11 +161,11 @@ protected function getUniqueTitle(array $titles) $title = array_unique($titles); switch (\count($title)) { - //normal case + // normal case case 1: return current($title); - //if blog article name is too long, it will be cut. So it's different from the other and has to be checked separately + // if blog article name is too long, it will be cut. So it's different from the other and has to be checked separately case 2: $check = [$title]; $result = Helper::checkArray($check); diff --git a/tests/Mink/features/bootstrap/Element/CartPosition.php b/tests/Mink/features/bootstrap/Element/CartPosition.php index d08d66d1366..c4cd326a370 100644 --- a/tests/Mink/features/bootstrap/Element/CartPosition.php +++ b/tests/Mink/features/bootstrap/Element/CartPosition.php @@ -129,11 +129,11 @@ protected function getUniqueName(array $names) $name = array_unique($names); switch (\count($name)) { - //normal case + // normal case case 1: return current($name); - //if articleName is too long, it will be cut. So it's different from the other and has to be checked separately + // if articleName is too long, it will be cut. So it's different from the other and has to be checked separately case 2: $check = [$name]; $result = Helper::checkArray($check); diff --git a/tests/Mink/features/bootstrap/Element/Paging.php b/tests/Mink/features/bootstrap/Element/Paging.php index 668df7c20e5..4fe29411917 100644 --- a/tests/Mink/features/bootstrap/Element/Paging.php +++ b/tests/Mink/features/bootstrap/Element/Paging.php @@ -108,9 +108,9 @@ public function moveToPage($page) */ public function noElement($locator, $throwException = true) { - if (Helper::getRequiredSelector($this, $locator)) { //previous or next + if (Helper::getRequiredSelector($this, $locator)) { // previous or next $result = Helper::countElements($this, $locator); - } else { //page number (1, 2, 3, 4, ...) + } else { // page number (1, 2, 3, 4, ...) $result = !$this->hasLink($locator); } diff --git a/tests/Mink/features/bootstrap/FeatureContext.php b/tests/Mink/features/bootstrap/FeatureContext.php index 5ca092a6677..0454a83059b 100644 --- a/tests/Mink/features/bootstrap/FeatureContext.php +++ b/tests/Mink/features/bootstrap/FeatureContext.php @@ -175,7 +175,7 @@ public function saveScreenshot(?string $filename = null, ?string $filepath = nul // Under Cygwin, uniqid with more_entropy must be set to true. // No effect in other environments. $filename = $filename ?: sprintf('%s_%s_%s.%s', $this->getMinkParameter('browser_name'), date('c'), uniqid('', true), 'png'); - $filepath = $filepath ?: (ini_get('upload_tmp_dir') ?: sys_get_temp_dir()); + $filepath = $filepath ?: (\ini_get('upload_tmp_dir') ?: sys_get_temp_dir()); file_put_contents($filepath . '/' . $filename, $this->getSession()->getScreenshot()); } @@ -316,12 +316,12 @@ private function prepare(): void $em = $this->getService(ModelManager::class); $em->generateAttributeModels(); - //refresh s_core_templates + // refresh s_core_templates $this->registerErrorHandler(); $this->getService(Installer::class)->synchronize(); restore_error_handler(); - //get the template id + // get the template id $sql = sprintf( 'SELECT id FROM `s_core_templates` WHERE template = "%s"', self::$suite->getSetting('template') @@ -332,7 +332,7 @@ private function prepare(): void throw new RuntimeException(sprintf('Unable to find template by name %s', self::$suite->getSetting('template'))); } - //set the template for shop "Deutsch" and activate SEPA payment method + // set the template for shop "Deutsch" and activate SEPA payment method $sql = <<<"EOD" UPDATE `s_core_shops` SET `template_id`= $templateId WHERE `id` = 1; UPDATE `s_core_paymentmeans` SET `active`= 1; diff --git a/tests/Mink/features/bootstrap/Helper.php b/tests/Mink/features/bootstrap/Helper.php index 44e8288fd11..dc69b0516be 100644 --- a/tests/Mink/features/bootstrap/Helper.php +++ b/tests/Mink/features/bootstrap/Helper.php @@ -631,21 +631,21 @@ public static function fillForm(HelperSelectorInterface $parent, $formKey, $valu return false; } - //Select + // Select if (empty($fieldType)) { $field->selectOption($fieldValue); return true; } - //Checkbox + // Checkbox if ($fieldType === 'checkbox') { $field->check(); return true; } - //Text + // Text $field->setValue($fieldValue); return true; diff --git a/tests/Mink/features/bootstrap/ShopwareContext.php b/tests/Mink/features/bootstrap/ShopwareContext.php index 247fa7ac056..0e2218a6dd5 100644 --- a/tests/Mink/features/bootstrap/ShopwareContext.php +++ b/tests/Mink/features/bootstrap/ShopwareContext.php @@ -178,19 +178,19 @@ public function iConfirmTheLinkInTheEmail($limit = 1) $link = substr($link, 0, $anchor); } - //Blogartikel-Bewertung + // Blogartikel-Bewertung if (empty($query)) { $mask = '%s/sConfirmation/%s'; } else { parse_str($query, $args); switch ($args['action']) { - //Artikel-Benachrichtigungen + // Artikel-Benachrichtigungen case 'notify': $mask = '%s&sNotificationConfirmation=%s&sNotify=1&action=notifyConfirm'; break; - //Artikel-Bewertungen + // Artikel-Bewertungen default: $mask = '%s&sConfirmation=%s'; break; diff --git a/tests/Unit/Components/Hook/HookManagerTest.php b/tests/Unit/Components/Hook/HookManagerTest.php index bf2a5c9a697..4fd40ae0e90 100644 --- a/tests/Unit/Components/Hook/HookManagerTest.php +++ b/tests/Unit/Components/Hook/HookManagerTest.php @@ -960,11 +960,11 @@ function (Enlight_Hook_HookArgs $args) use ($classArg, $methodArg, $contextArg, /** * Uncomment with 5.8 */ - //public function testFalseClassThrowsException() - //{ + // public function testFalseClassThrowsException() + // { // self::expectException(\Enlight_Hook_Exception::class); // $this->hookManager->getProxy(HookManagerTestNoTarget::class); - //} + // } /** * @param string $methodName diff --git a/tests/Unit/Components/HttpCache/StoreTest.php b/tests/Unit/Components/HttpCache/StoreTest.php index 7d0856eedbc..f26c9ae304b 100644 --- a/tests/Unit/Components/HttpCache/StoreTest.php +++ b/tests/Unit/Components/HttpCache/StoreTest.php @@ -36,7 +36,7 @@ public function setUp(): void 'test', [], true, - [ //Set of parameters that must be ignored in the url + [ // Set of parameters that must be ignored in the url 'foo', '_foo', '__foo', diff --git a/tests/Unit/Components/Plugin/XmlReader/XmlConfigReaderTest.php b/tests/Unit/Components/Plugin/XmlReader/XmlConfigReaderTest.php index 5e32df83cb8..5a7963130c1 100644 --- a/tests/Unit/Components/Plugin/XmlReader/XmlConfigReaderTest.php +++ b/tests/Unit/Components/Plugin/XmlReader/XmlConfigReaderTest.php @@ -46,7 +46,7 @@ public function testReadFile(): void { $result = $this->readFile('config.xml'); - //form label + // form label static::assertArrayHasKey('label', $result); static::assertCount(2, $result['label']); static::assertArrayHasKey('en', $result['label']); @@ -54,7 +54,7 @@ public function testReadFile(): void static::assertEquals('My Form Label', $result['label']['en']); static::assertEquals('Meine Form', $result['label']['de']); - //form description + // form description static::assertArrayHasKey('description', $result); static::assertCount(2, $result['description']); static::assertArrayHasKey('en', $result['description']); @@ -62,10 +62,10 @@ public function testReadFile(): void static::assertEquals('My Form description', $result['description']['en']); static::assertEquals('Meine Form Beschreibung', $result['description']['de']); - //elements + // elements static::assertArrayHasKey('elements', $result); - //first element + // first element $element1 = $result['elements'][0]; static::assertArrayHasKey('options', $element1); @@ -75,10 +75,10 @@ public function testReadFile(): void static::assertEquals('1', $element1['options']['minValue']); static::assertEquals('2', $element1['options']['maxValue']); - //second element store + // second element store $element2 = $result['elements'][1]; - //element label + // element label static::assertArrayHasKey('label', $element2); static::assertCount(2, $element2['label']); static::assertArrayHasKey('en', $element2['label']); @@ -86,7 +86,7 @@ public function testReadFile(): void static::assertEquals('My Textfield', $element2['label']['en']); static::assertEquals('Mein textfeld', $element2['label']['de']); - //element description + // element description static::assertArrayHasKey('description', $element2); static::assertCount(2, $element2['description']); static::assertArrayHasKey('en', $element2['description']); @@ -143,19 +143,19 @@ public function testParseElementNodeListEmpty(): void public function testValidateAttributeScope(): void { - //default value SCOPE_LOCALE + // default value SCOPE_LOCALE static::assertEquals( XmlReaderBase::SCOPE_LOCALE, XmlConfigReader::validateAttributeScope('') ); - //SCOPE_LOCALE + // SCOPE_LOCALE static::assertEquals( XmlReaderBase::SCOPE_LOCALE, XmlConfigReader::validateAttributeScope('locale') ); - //SCOPE_SHOP + // SCOPE_SHOP static::assertEquals( XmlReaderBase::SCOPE_SHOP, XmlConfigReader::validateAttributeScope('shop') diff --git a/tests/Unit/Components/Plugin/XmlReader/XmlReaderBaseTest.php b/tests/Unit/Components/Plugin/XmlReader/XmlReaderBaseTest.php index 3fe79433afe..18ddc634b2f 100644 --- a/tests/Unit/Components/Plugin/XmlReader/XmlReaderBaseTest.php +++ b/tests/Unit/Components/Plugin/XmlReader/XmlReaderBaseTest.php @@ -131,7 +131,7 @@ public function testGetFirstItemOfNodeList(): void public function testValidateBooleanAttribute(): void { - //required="true" + // required="true" $element1 = $this->xpath->query('//config/elements/element'); static::assertInstanceOf(DOMNodeList::class, $element1); $element1 = $element1->item(0); @@ -143,7 +143,7 @@ public function testValidateBooleanAttribute(): void static::assertIsBool($element1Result); static::assertTrue($element1Result); - //required not given - passed default value + // required not given - passed default value $element2 = $this->xpath->query('//config/elements/element'); static::assertInstanceOf(DOMNodeList::class, $element2); $element2 = $element2->item(1); @@ -158,7 +158,7 @@ public function testValidateBooleanAttribute(): void public function testParseStoreNodeList(): void { - //ExtJs Store + // ExtJs Store $store1 = $this->xpath->query('//config/elements/element[3]/store'); static::assertInstanceOf(DOMNodeList::class, $store1); $store1Result = XmlReaderBase::parseStoreNodeList($store1); @@ -166,7 +166,7 @@ public function testParseStoreNodeList(): void static::assertIsString($store1Result); static::assertEquals('EXTJS-STORE', $store1Result); - //Xml Store + // Xml Store $store2 = $this->xpath->query('//config/elements/element[4]/store'); static::assertInstanceOf(DOMNodeList::class, $store2); $store2Result = XmlReaderBase::parseStoreNodeList($store2); @@ -176,7 +176,7 @@ public function testParseStoreNodeList(): void static::assertEquals('value2', $store2Result[1][0]); static::assertEquals('label2', $store2Result[1][1]['en']); - //No store found + // No store found $store3 = $this->xpath->query('//config/elements/element[5]/store'); static::assertInstanceOf(DOMNodeList::class, $store3); $store3Result = XmlReaderBase::parseStoreNodeList($store3); @@ -200,7 +200,7 @@ public function testParseOptionsNodeList(): void public function testParseOptionsNodeListNoOptions(): void { - //cannot test with file because of the xsd validation + // cannot test with file because of the xsd validation $dom = new DOMDocument(); $dom->loadXML(''); @@ -212,7 +212,7 @@ public function testParseOptionsNodeListNoOptions(): void public function testParseOptionsNodeListEmptyOptions(): void { - //cannot test with file because of the xsd validation + // cannot test with file because of the xsd validation $dom = new DOMDocument(); $dom->loadXML(''); diff --git a/vendor-bin/cs-fixer/composer.json b/vendor-bin/cs-fixer/composer.json index 65b33fecad7..c5f01a8b9cf 100644 --- a/vendor-bin/cs-fixer/composer.json +++ b/vendor-bin/cs-fixer/composer.json @@ -1,7 +1,7 @@ { "require-dev": { - "friendsofphp/php-cs-fixer": "3.5.0", - "kubawerlos/php-cs-fixer-custom-fixers": "3.6.3" + "friendsofphp/php-cs-fixer": "3.8.0", + "kubawerlos/php-cs-fixer-custom-fixers": "3.11.0" }, "sort-packages": true } diff --git a/vendor-bin/cs-fixer/composer.lock b/vendor-bin/cs-fixer/composer.lock index 00469c9c625..1a4b27034fc 100644 --- a/vendor-bin/cs-fixer/composer.lock +++ b/vendor-bin/cs-fixer/composer.lock @@ -4,35 +4,35 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "1cccc6de4c31c5406389f2d8b56ee452", + "content-hash": "c73d2aa36b6f28acfea62dd96ff45381", "packages": [], "packages-dev": [ { "name": "composer/pcre", - "version": "1.0.0", + "version": "3.0.0", "source": { "type": "git", "url": "https://github.com/composer/pcre.git", - "reference": "3d322d715c43a1ac36c7fe215fa59336265500f2" + "reference": "e300eb6c535192decd27a85bc72a9290f0d6b3bd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/pcre/zipball/3d322d715c43a1ac36c7fe215fa59336265500f2", - "reference": "3d322d715c43a1ac36c7fe215fa59336265500f2", + "url": "https://api.github.com/repos/composer/pcre/zipball/e300eb6c535192decd27a85bc72a9290f0d6b3bd", + "reference": "e300eb6c535192decd27a85bc72a9290f0d6b3bd", "shasum": "" }, "require": { - "php": "^5.3.2 || ^7.0 || ^8.0" + "php": "^7.4 || ^8.0" }, "require-dev": { - "phpstan/phpstan": "^1", + "phpstan/phpstan": "^1.3", "phpstan/phpstan-strict-rules": "^1.1", - "symfony/phpunit-bridge": "^4.2 || ^5" + "symfony/phpunit-bridge": "^5" }, "type": "library", "extra": { "branch-alias": { - "dev-main": "1.x-dev" + "dev-main": "3.x-dev" } }, "autoload": { @@ -60,7 +60,7 @@ ], "support": { "issues": "https://github.com/composer/pcre/issues", - "source": "https://github.com/composer/pcre/tree/1.0.0" + "source": "https://github.com/composer/pcre/tree/3.0.0" }, "funding": [ { @@ -76,27 +76,27 @@ "type": "tidelift" } ], - "time": "2021-12-06T15:17:27+00:00" + "time": "2022-02-25T20:21:48+00:00" }, { "name": "composer/semver", - "version": "3.2.7", + "version": "3.3.2", "source": { "type": "git", "url": "https://github.com/composer/semver.git", - "reference": "deac27056b57e46faf136fae7b449eeaa71661ee" + "reference": "3953f23262f2bff1919fc82183ad9acb13ff62c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/deac27056b57e46faf136fae7b449eeaa71661ee", - "reference": "deac27056b57e46faf136fae7b449eeaa71661ee", + "url": "https://api.github.com/repos/composer/semver/zipball/3953f23262f2bff1919fc82183ad9acb13ff62c9", + "reference": "3953f23262f2bff1919fc82183ad9acb13ff62c9", "shasum": "" }, "require": { "php": "^5.3.2 || ^7.0 || ^8.0" }, "require-dev": { - "phpstan/phpstan": "^0.12.54", + "phpstan/phpstan": "^1.4", "symfony/phpunit-bridge": "^4.2 || ^5" }, "type": "library", @@ -141,7 +141,7 @@ "support": { "irc": "irc://irc.freenode.org/composer", "issues": "https://github.com/composer/semver/issues", - "source": "https://github.com/composer/semver/tree/3.2.7" + "source": "https://github.com/composer/semver/tree/3.3.2" }, "funding": [ { @@ -157,24 +157,24 @@ "type": "tidelift" } ], - "time": "2022-01-04T09:57:54+00:00" + "time": "2022-04-01T19:23:25+00:00" }, { "name": "composer/xdebug-handler", - "version": "3.0.1", + "version": "3.0.3", "source": { "type": "git", "url": "https://github.com/composer/xdebug-handler.git", - "reference": "12f1b79476638a5615ed00ea6adbb269cec96fd8" + "reference": "ced299686f41dce890debac69273b47ffe98a40c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/12f1b79476638a5615ed00ea6adbb269cec96fd8", - "reference": "12f1b79476638a5615ed00ea6adbb269cec96fd8", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/ced299686f41dce890debac69273b47ffe98a40c", + "reference": "ced299686f41dce890debac69273b47ffe98a40c", "shasum": "" }, "require": { - "composer/pcre": "^1", + "composer/pcre": "^1 || ^2 || ^3", "php": "^7.2.5 || ^8.0", "psr/log": "^1 || ^2 || ^3" }, @@ -207,7 +207,7 @@ "support": { "irc": "irc://irc.freenode.org/composer", "issues": "https://github.com/composer/xdebug-handler/issues", - "source": "https://github.com/composer/xdebug-handler/tree/3.0.1" + "source": "https://github.com/composer/xdebug-handler/tree/3.0.3" }, "funding": [ { @@ -223,7 +223,7 @@ "type": "tidelift" } ], - "time": "2022-01-04T18:29:42+00:00" + "time": "2022-02-25T21:32:43+00:00" }, { "name": "doctrine/annotations", @@ -299,16 +299,16 @@ }, { "name": "doctrine/lexer", - "version": "1.2.2", + "version": "1.2.3", "source": { "type": "git", "url": "https://github.com/doctrine/lexer.git", - "reference": "9c50f840f257bbb941e6f4a0e94ccf5db5c3f76c" + "reference": "c268e882d4dbdd85e36e4ad69e02dc284f89d229" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/9c50f840f257bbb941e6f4a0e94ccf5db5c3f76c", - "reference": "9c50f840f257bbb941e6f4a0e94ccf5db5c3f76c", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/c268e882d4dbdd85e36e4ad69e02dc284f89d229", + "reference": "c268e882d4dbdd85e36e4ad69e02dc284f89d229", "shasum": "" }, "require": { @@ -316,7 +316,7 @@ }, "require-dev": { "doctrine/coding-standard": "^9.0", - "phpstan/phpstan": "1.3", + "phpstan/phpstan": "^1.3", "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", "vimeo/psalm": "^4.11" }, @@ -355,7 +355,7 @@ ], "support": { "issues": "https://github.com/doctrine/lexer/issues", - "source": "https://github.com/doctrine/lexer/tree/1.2.2" + "source": "https://github.com/doctrine/lexer/tree/1.2.3" }, "funding": [ { @@ -371,25 +371,25 @@ "type": "tidelift" } ], - "time": "2022-01-12T08:27:12+00:00" + "time": "2022-02-28T11:07:21+00:00" }, { "name": "friendsofphp/php-cs-fixer", - "version": "v3.5.0", + "version": "v3.8.0", "source": { "type": "git", "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", - "reference": "333f15e07c866e33e2765e84ba1e0b88e6a3af3b" + "reference": "cbad1115aac4b5c3c5540e7210d3c9fba2f81fa3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/333f15e07c866e33e2765e84ba1e0b88e6a3af3b", - "reference": "333f15e07c866e33e2765e84ba1e0b88e6a3af3b", + "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/cbad1115aac4b5c3c5540e7210d3c9fba2f81fa3", + "reference": "cbad1115aac4b5c3c5540e7210d3c9fba2f81fa3", "shasum": "" }, "require": { "composer/semver": "^3.2", - "composer/xdebug-handler": "^3.0", + "composer/xdebug-handler": "^3.0.3", "doctrine/annotations": "^1.13", "ext-json": "*", "ext-tokenizer": "*", @@ -401,8 +401,8 @@ "symfony/finder": "^5.4 || ^6.0", "symfony/options-resolver": "^5.4 || ^6.0", "symfony/polyfill-mbstring": "^1.23", - "symfony/polyfill-php80": "^1.23", - "symfony/polyfill-php81": "^1.23", + "symfony/polyfill-php80": "^1.25", + "symfony/polyfill-php81": "^1.25", "symfony/process": "^5.4 || ^6.0", "symfony/stopwatch": "^5.4 || ^6.0" }, @@ -452,7 +452,7 @@ "description": "A tool to automatically fix PHP code style", "support": { "issues": "https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues", - "source": "https://github.com/FriendsOfPHP/PHP-CS-Fixer/tree/v3.5.0" + "source": "https://github.com/FriendsOfPHP/PHP-CS-Fixer/tree/v3.8.0" }, "funding": [ { @@ -460,31 +460,32 @@ "type": "github" } ], - "time": "2022-01-14T00:29:20+00:00" + "time": "2022-03-18T17:20:59+00:00" }, { "name": "kubawerlos/php-cs-fixer-custom-fixers", - "version": "v3.6.3", + "version": "v3.11.0", "source": { "type": "git", "url": "https://github.com/kubawerlos/php-cs-fixer-custom-fixers.git", - "reference": "0d3367ac5f3576c18726ff5bb153fa2e9c1c67be" + "reference": "a1e78f0c1ffeb1addcef94c334c5e56e3c53dbe8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/kubawerlos/php-cs-fixer-custom-fixers/zipball/0d3367ac5f3576c18726ff5bb153fa2e9c1c67be", - "reference": "0d3367ac5f3576c18726ff5bb153fa2e9c1c67be", + "url": "https://api.github.com/repos/kubawerlos/php-cs-fixer-custom-fixers/zipball/a1e78f0c1ffeb1addcef94c334c5e56e3c53dbe8", + "reference": "a1e78f0c1ffeb1addcef94c334c5e56e3c53dbe8", "shasum": "" }, "require": { "ext-filter": "*", "ext-tokenizer": "*", - "friendsofphp/php-cs-fixer": "^3.1.0", - "php": "^7.2 || ^8.0", - "symfony/finder": "^4.0 || ^5.0 || ^6.0" + "php": "^7.4 || ^8.0" + }, + "conflict": { + "friendsofphp/php-cs-fixer": "<3.6.0" }, "require-dev": { - "phpunit/phpunit": "^8.5.3 || ^9.1.1" + "phpunit/phpunit": "^9.5.20" }, "type": "library", "autoload": { @@ -505,9 +506,9 @@ "description": "A set of custom fixers for PHP CS Fixer", "support": { "issues": "https://github.com/kubawerlos/php-cs-fixer-custom-fixers/issues", - "source": "https://github.com/kubawerlos/php-cs-fixer-custom-fixers/tree/v3.6.3" + "source": "https://github.com/kubawerlos/php-cs-fixer-custom-fixers/tree/v3.11.0" }, - "time": "2022-01-16T18:56:13+00:00" + "time": "2022-05-19T16:59:35+00:00" }, { "name": "php-cs-fixer/diff", @@ -760,16 +761,16 @@ }, { "name": "symfony/console", - "version": "v5.4.2", + "version": "v5.4.9", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "a2c6b7ced2eb7799a35375fb9022519282b5405e" + "reference": "829d5d1bf60b2efeb0887b7436873becc71a45eb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/a2c6b7ced2eb7799a35375fb9022519282b5405e", - "reference": "a2c6b7ced2eb7799a35375fb9022519282b5405e", + "url": "https://api.github.com/repos/symfony/console/zipball/829d5d1bf60b2efeb0887b7436873becc71a45eb", + "reference": "829d5d1bf60b2efeb0887b7436873becc71a45eb", "shasum": "" }, "require": { @@ -839,7 +840,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.4.2" + "source": "https://github.com/symfony/console/tree/v5.4.9" }, "funding": [ { @@ -855,20 +856,20 @@ "type": "tidelift" } ], - "time": "2021-12-20T16:11:12+00:00" + "time": "2022-05-18T06:17:34+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v2.5.0", + "version": "v2.5.1", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "6f981ee24cf69ee7ce9736146d1c57c2780598a8" + "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/6f981ee24cf69ee7ce9736146d1c57c2780598a8", - "reference": "6f981ee24cf69ee7ce9736146d1c57c2780598a8", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e8b495ea28c1d97b5e0c121748d6f9b53d075c66", + "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66", "shasum": "" }, "require": { @@ -906,7 +907,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.0" + "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.1" }, "funding": [ { @@ -922,20 +923,20 @@ "type": "tidelift" } ], - "time": "2021-07-12T14:48:14+00:00" + "time": "2022-01-02T09:53:40+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v5.4.0", + "version": "v5.4.9", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "27d39ae126352b9fa3be5e196ccf4617897be3eb" + "reference": "8e6ce1cc0279e3ff3c8ff0f43813bc88d21ca1bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/27d39ae126352b9fa3be5e196ccf4617897be3eb", - "reference": "27d39ae126352b9fa3be5e196ccf4617897be3eb", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/8e6ce1cc0279e3ff3c8ff0f43813bc88d21ca1bc", + "reference": "8e6ce1cc0279e3ff3c8ff0f43813bc88d21ca1bc", "shasum": "" }, "require": { @@ -991,7 +992,7 @@ "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v5.4.0" + "source": "https://github.com/symfony/event-dispatcher/tree/v5.4.9" }, "funding": [ { @@ -1007,20 +1008,20 @@ "type": "tidelift" } ], - "time": "2021-11-23T10:19:22+00:00" + "time": "2022-05-05T16:45:39+00:00" }, { "name": "symfony/event-dispatcher-contracts", - "version": "v2.5.0", + "version": "v2.5.1", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher-contracts.git", - "reference": "66bea3b09be61613cd3b4043a65a8ec48cfa6d2a" + "reference": "f98b54df6ad059855739db6fcbc2d36995283fe1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/66bea3b09be61613cd3b4043a65a8ec48cfa6d2a", - "reference": "66bea3b09be61613cd3b4043a65a8ec48cfa6d2a", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/f98b54df6ad059855739db6fcbc2d36995283fe1", + "reference": "f98b54df6ad059855739db6fcbc2d36995283fe1", "shasum": "" }, "require": { @@ -1070,7 +1071,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v2.5.0" + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v2.5.1" }, "funding": [ { @@ -1086,20 +1087,20 @@ "type": "tidelift" } ], - "time": "2021-07-12T14:48:14+00:00" + "time": "2022-01-02T09:53:40+00:00" }, { "name": "symfony/filesystem", - "version": "v5.4.0", + "version": "v5.4.9", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "731f917dc31edcffec2c6a777f3698c33bea8f01" + "reference": "36a017fa4cce1eff1b8e8129ff53513abcef05ba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/731f917dc31edcffec2c6a777f3698c33bea8f01", - "reference": "731f917dc31edcffec2c6a777f3698c33bea8f01", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/36a017fa4cce1eff1b8e8129ff53513abcef05ba", + "reference": "36a017fa4cce1eff1b8e8129ff53513abcef05ba", "shasum": "" }, "require": { @@ -1134,7 +1135,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v5.4.0" + "source": "https://github.com/symfony/filesystem/tree/v5.4.9" }, "funding": [ { @@ -1150,20 +1151,20 @@ "type": "tidelift" } ], - "time": "2021-10-28T13:39:27+00:00" + "time": "2022-05-20T13:55:35+00:00" }, { "name": "symfony/finder", - "version": "v5.4.2", + "version": "v5.4.8", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "e77046c252be48c48a40816187ed527703c8f76c" + "reference": "9b630f3427f3ebe7cd346c277a1408b00249dad9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/e77046c252be48c48a40816187ed527703c8f76c", - "reference": "e77046c252be48c48a40816187ed527703c8f76c", + "url": "https://api.github.com/repos/symfony/finder/zipball/9b630f3427f3ebe7cd346c277a1408b00249dad9", + "reference": "9b630f3427f3ebe7cd346c277a1408b00249dad9", "shasum": "" }, "require": { @@ -1197,7 +1198,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v5.4.2" + "source": "https://github.com/symfony/finder/tree/v5.4.8" }, "funding": [ { @@ -1213,20 +1214,20 @@ "type": "tidelift" } ], - "time": "2021-12-15T11:06:13+00:00" + "time": "2022-04-15T08:07:45+00:00" }, { "name": "symfony/options-resolver", - "version": "v5.4.0", + "version": "v5.4.3", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "b0fb78576487af19c500aaddb269fd36701d4847" + "reference": "cc1147cb11af1b43f503ac18f31aa3bec213aba8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/b0fb78576487af19c500aaddb269fd36701d4847", - "reference": "b0fb78576487af19c500aaddb269fd36701d4847", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/cc1147cb11af1b43f503ac18f31aa3bec213aba8", + "reference": "cc1147cb11af1b43f503ac18f31aa3bec213aba8", "shasum": "" }, "require": { @@ -1266,7 +1267,7 @@ "options" ], "support": { - "source": "https://github.com/symfony/options-resolver/tree/v5.4.0" + "source": "https://github.com/symfony/options-resolver/tree/v5.4.3" }, "funding": [ { @@ -1282,11 +1283,11 @@ "type": "tidelift" } ], - "time": "2021-11-23T10:19:22+00:00" + "time": "2022-01-02T09:53:40+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.24.0", + "version": "v1.25.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", @@ -1318,12 +1319,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1348,7 +1349,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.24.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.25.0" }, "funding": [ { @@ -1368,7 +1369,7 @@ }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.24.0", + "version": "v1.25.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", @@ -1397,12 +1398,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Intl\\Grapheme\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Grapheme\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1429,7 +1430,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.24.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.25.0" }, "funding": [ { @@ -1449,7 +1450,7 @@ }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.24.0", + "version": "v1.25.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", @@ -1478,12 +1479,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Intl\\Normalizer\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -1513,7 +1514,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.24.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.25.0" }, "funding": [ { @@ -1533,7 +1534,7 @@ }, { "name": "symfony/polyfill-mbstring", - "version": "v1.24.0", + "version": "v1.25.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", @@ -1565,12 +1566,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1596,7 +1597,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.24.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.25.0" }, "funding": [ { @@ -1616,7 +1617,7 @@ }, { "name": "symfony/polyfill-php73", - "version": "v1.24.0", + "version": "v1.25.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", @@ -1642,12 +1643,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php73\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Php73\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -1675,7 +1676,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.24.0" + "source": "https://github.com/symfony/polyfill-php73/tree/v1.25.0" }, "funding": [ { @@ -1695,16 +1696,16 @@ }, { "name": "symfony/polyfill-php80", - "version": "v1.24.0", + "version": "v1.25.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "57b712b08eddb97c762a8caa32c84e037892d2e9" + "reference": "4407588e0d3f1f52efb65fbe92babe41f37fe50c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/57b712b08eddb97c762a8caa32c84e037892d2e9", - "reference": "57b712b08eddb97c762a8caa32c84e037892d2e9", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/4407588e0d3f1f52efb65fbe92babe41f37fe50c", + "reference": "4407588e0d3f1f52efb65fbe92babe41f37fe50c", "shasum": "" }, "require": { @@ -1721,12 +1722,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php80\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -1758,7 +1759,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.24.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.25.0" }, "funding": [ { @@ -1774,11 +1775,11 @@ "type": "tidelift" } ], - "time": "2021-09-13T13:58:33+00:00" + "time": "2022-03-04T08:16:47+00:00" }, { "name": "symfony/polyfill-php81", - "version": "v1.24.0", + "version": "v1.25.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php81.git", @@ -1804,12 +1805,12 @@ } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php81\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Php81\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -1837,7 +1838,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php81/tree/v1.24.0" + "source": "https://github.com/symfony/polyfill-php81/tree/v1.25.0" }, "funding": [ { @@ -1857,16 +1858,16 @@ }, { "name": "symfony/process", - "version": "v5.4.2", + "version": "v5.4.8", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "2b3ba8722c4aaf3e88011be5e7f48710088fb5e4" + "reference": "597f3fff8e3e91836bb0bd38f5718b56ddbde2f3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/2b3ba8722c4aaf3e88011be5e7f48710088fb5e4", - "reference": "2b3ba8722c4aaf3e88011be5e7f48710088fb5e4", + "url": "https://api.github.com/repos/symfony/process/zipball/597f3fff8e3e91836bb0bd38f5718b56ddbde2f3", + "reference": "597f3fff8e3e91836bb0bd38f5718b56ddbde2f3", "shasum": "" }, "require": { @@ -1899,7 +1900,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v5.4.2" + "source": "https://github.com/symfony/process/tree/v5.4.8" }, "funding": [ { @@ -1915,26 +1916,26 @@ "type": "tidelift" } ], - "time": "2021-12-27T21:01:00+00:00" + "time": "2022-04-08T05:07:18+00:00" }, { "name": "symfony/service-contracts", - "version": "v2.5.0", + "version": "v2.5.1", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "1ab11b933cd6bc5464b08e81e2c5b07dec58b0fc" + "reference": "24d9dc654b83e91aa59f9d167b131bc3b5bea24c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/1ab11b933cd6bc5464b08e81e2c5b07dec58b0fc", - "reference": "1ab11b933cd6bc5464b08e81e2c5b07dec58b0fc", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/24d9dc654b83e91aa59f9d167b131bc3b5bea24c", + "reference": "24d9dc654b83e91aa59f9d167b131bc3b5bea24c", "shasum": "" }, "require": { "php": ">=7.2.5", "psr/container": "^1.1", - "symfony/deprecation-contracts": "^2.1" + "symfony/deprecation-contracts": "^2.1|^3" }, "conflict": { "ext-psr": "<1.1|>=2" @@ -1982,7 +1983,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v2.5.0" + "source": "https://github.com/symfony/service-contracts/tree/v2.5.1" }, "funding": [ { @@ -1998,20 +1999,20 @@ "type": "tidelift" } ], - "time": "2021-11-04T16:48:04+00:00" + "time": "2022-03-13T20:07:29+00:00" }, { "name": "symfony/stopwatch", - "version": "v5.4.0", + "version": "v5.4.5", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "208ef96122bfed82a8f3a61458a07113a08bdcfe" + "reference": "4d04b5c24f3c9a1a168a131f6cbe297155bc0d30" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/208ef96122bfed82a8f3a61458a07113a08bdcfe", - "reference": "208ef96122bfed82a8f3a61458a07113a08bdcfe", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/4d04b5c24f3c9a1a168a131f6cbe297155bc0d30", + "reference": "4d04b5c24f3c9a1a168a131f6cbe297155bc0d30", "shasum": "" }, "require": { @@ -2044,7 +2045,7 @@ "description": "Provides a way to profile code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/stopwatch/tree/v5.4.0" + "source": "https://github.com/symfony/stopwatch/tree/v5.4.5" }, "funding": [ { @@ -2060,20 +2061,20 @@ "type": "tidelift" } ], - "time": "2021-11-23T10:19:22+00:00" + "time": "2022-02-18T16:06:09+00:00" }, { "name": "symfony/string", - "version": "v5.4.2", + "version": "v5.4.9", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "e6a5d5ecf6589c5247d18e0e74e30b11dfd51a3d" + "reference": "985e6a9703ef5ce32ba617c9c7d97873bb7b2a99" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/e6a5d5ecf6589c5247d18e0e74e30b11dfd51a3d", - "reference": "e6a5d5ecf6589c5247d18e0e74e30b11dfd51a3d", + "url": "https://api.github.com/repos/symfony/string/zipball/985e6a9703ef5ce32ba617c9c7d97873bb7b2a99", + "reference": "985e6a9703ef5ce32ba617c9c7d97873bb7b2a99", "shasum": "" }, "require": { @@ -2095,12 +2096,12 @@ }, "type": "library", "autoload": { - "psr-4": { - "Symfony\\Component\\String\\": "" - }, "files": [ "Resources/functions.php" ], + "psr-4": { + "Symfony\\Component\\String\\": "" + }, "exclude-from-classmap": [ "/Tests/" ] @@ -2130,7 +2131,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.4.2" + "source": "https://github.com/symfony/string/tree/v5.4.9" }, "funding": [ { @@ -2146,7 +2147,7 @@ "type": "tidelift" } ], - "time": "2021-12-16T21:52:00+00:00" + "time": "2022-04-19T10:40:37+00:00" } ], "aliases": [], @@ -2156,5 +2157,5 @@ "prefer-lowest": false, "platform": [], "platform-dev": [], - "plugin-api-version": "2.2.0" + "plugin-api-version": "2.3.0" } From 703158c64150bffc1f57a7554674025b3ba3f33f Mon Sep 17 00:00:00 2001 From: Michael Telgmann Date: Tue, 31 May 2022 11:13:07 +0200 Subject: [PATCH 025/730] SW-26706 - Update PHPStan Doctrine plugin --- composer.json | 2 +- composer.lock | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/composer.json b/composer.json index 938475ac43c..35cef882b6b 100644 --- a/composer.json +++ b/composer.json @@ -107,7 +107,7 @@ "phpspec/prophecy-phpunit": "^2.0", "phpstan/extension-installer": "1.1.0", "phpstan/phpstan": "1.7.1", - "phpstan/phpstan-doctrine": "1.3.5", + "phpstan/phpstan-doctrine": "1.3.6", "phpstan/phpstan-phpunit": "1.1.1", "phpstan/phpstan-symfony": "1.1.8", "phpunit/phpunit": "^9.4", diff --git a/composer.lock b/composer.lock index 153932ffe33..1fbaa931c4d 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "0d0be9d9b3cca2bd56c8f51d9477e658", + "content-hash": "b710fe9bdbd36286988fbf1ddb550352", "packages": [ { "name": "aws/aws-crt-php", @@ -8227,16 +8227,16 @@ }, { "name": "phpstan/phpstan-doctrine", - "version": "1.3.5", + "version": "1.3.6", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-doctrine.git", - "reference": "73979203c9cb56efd2dfcce1c795254f3b55ce39" + "reference": "317e47b31bb92df5b344ed208dd358a6099c8507" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-doctrine/zipball/73979203c9cb56efd2dfcce1c795254f3b55ce39", - "reference": "73979203c9cb56efd2dfcce1c795254f3b55ce39", + "url": "https://api.github.com/repos/phpstan/phpstan-doctrine/zipball/317e47b31bb92df5b344ed208dd358a6099c8507", + "reference": "317e47b31bb92df5b344ed208dd358a6099c8507", "shasum": "" }, "require": { @@ -8289,9 +8289,9 @@ "description": "Doctrine extensions for PHPStan", "support": { "issues": "https://github.com/phpstan/phpstan-doctrine/issues", - "source": "https://github.com/phpstan/phpstan-doctrine/tree/1.3.5" + "source": "https://github.com/phpstan/phpstan-doctrine/tree/1.3.6" }, - "time": "2022-05-23T13:09:30+00:00" + "time": "2022-05-27T18:47:50+00:00" }, { "name": "phpstan/phpstan-phpunit", From 73704364cfc7fc60f817453ddd10773691ff1424 Mon Sep 17 00:00:00 2001 From: Michael Telgmann Date: Tue, 31 May 2022 11:27:25 +0200 Subject: [PATCH 026/730] SW-26706 - Update PHPStan Symfony plugin --- .phpstan-baseline.neon | 20 ++++++++++++++++++++ composer.json | 2 +- composer.lock | 21 +++++++++------------ 3 files changed, 30 insertions(+), 13 deletions(-) diff --git a/.phpstan-baseline.neon b/.phpstan-baseline.neon index a8f0456385c..fa4ae80f3b5 100644 --- a/.phpstan-baseline.neon +++ b/.phpstan-baseline.neon @@ -16810,6 +16810,21 @@ parameters: count: 1 path: engine/Shopware/Components/DependencyInjection/Bridge/Router.php + - + message: "#^Offset 'save_handler' on array\\{cookie_lifetime\\: int, cookie_httponly\\: int, gc_probability\\: int, gc_divisor\\: int, save_handler\\: string, use_trans_sid\\: int, locking\\: bool\\} in isset\\(\\) always exists and is not nullable\\.$#" + count: 1 + path: engine/Shopware/Components/DependencyInjection/Bridge/Session.php + + - + message: "#^Offset 'save_path' on array\\{cookie_lifetime\\: int, cookie_httponly\\: int, gc_probability\\: int, gc_divisor\\: int, save_handler\\?\\: string, use_trans_sid\\: int, name\\: non\\-empty\\-string, cookie_secure\\?\\: true, \\.\\.\\.\\} in isset\\(\\) does not exist\\.$#" + count: 1 + path: engine/Shopware/Components/DependencyInjection/Bridge/Session.php + + - + message: "#^Offset 'unitTestEnabled' on array\\{cookie_lifetime\\: int, cookie_httponly\\: int, gc_probability\\: int, gc_divisor\\: int, save_handler\\?\\: string, use_trans_sid\\: int, name\\: non\\-empty\\-string, cookie_secure\\?\\: true, \\.\\.\\.\\} in empty\\(\\) does not exist\\.$#" + count: 1 + path: engine/Shopware/Components/DependencyInjection/Bridge/Session.php + - message: "#^Parameter \\#2 \\$resource of method Shopware\\\\Components\\\\DependencyInjection\\\\Container\\:\\:set\\(\\) expects object\\|null, string given\\.$#" count: 1 @@ -38775,6 +38790,11 @@ parameters: count: 1 path: engine/Shopware/Plugins/Default/Backend/SwagUpdate/Components/Validation.php + - + message: "#^Call to function array_key_exists\\(\\) with 'SwagSecurity' and array\\{ErrorHandler\\: string, Router\\: string, System\\: string, ViewportForward\\: string, Shop\\: string, PostFilter\\: string, ControllerBase\\: string, RouterRewrite\\: string, \\.\\.\\.\\} will always evaluate to false\\.$#" + count: 1 + path: engine/Shopware/Plugins/Default/Backend/SwagUpdate/Controllers/Backend/SwagUpdate.php + - message: "#^Cannot access property \\$version on ShopwarePlugins\\\\SwagUpdate\\\\Components\\\\Struct\\\\Version\\|null\\.$#" count: 2 diff --git a/composer.json b/composer.json index 35cef882b6b..f589fbbad0f 100644 --- a/composer.json +++ b/composer.json @@ -109,7 +109,7 @@ "phpstan/phpstan": "1.7.1", "phpstan/phpstan-doctrine": "1.3.6", "phpstan/phpstan-phpunit": "1.1.1", - "phpstan/phpstan-symfony": "1.1.8", + "phpstan/phpstan-symfony": "1.2.2", "phpunit/phpunit": "^9.4", "sensiolabs/behat-page-object-extension": "2.3.4", "symfony/browser-kit": "~4.4.27", diff --git a/composer.lock b/composer.lock index 1fbaa931c4d..8b132c5b808 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "b710fe9bdbd36286988fbf1ddb550352", + "content-hash": "c268850de8501e4434ac49f9adefcfcd", "packages": [ { "name": "aws/aws-crt-php", @@ -8347,22 +8347,22 @@ }, { "name": "phpstan/phpstan-symfony", - "version": "1.1.8", + "version": "1.2.2", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-symfony.git", - "reference": "4bdffcf1033b6c60662a28419d0192e0dda5684f" + "reference": "30f12aeab960c7f324eee3b39645655cf8a84146" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-symfony/zipball/4bdffcf1033b6c60662a28419d0192e0dda5684f", - "reference": "4bdffcf1033b6c60662a28419d0192e0dda5684f", + "url": "https://api.github.com/repos/phpstan/phpstan-symfony/zipball/30f12aeab960c7f324eee3b39645655cf8a84146", + "reference": "30f12aeab960c7f324eee3b39645655cf8a84146", "shasum": "" }, "require": { "ext-simplexml": "*", - "php": "^7.1 || ^8.0", - "phpstan/phpstan": "^1.4" + "php": "^7.2 || ^8.0", + "phpstan/phpstan": "^1.6" }, "conflict": { "symfony/framework-bundle": "<3.0" @@ -8386,9 +8386,6 @@ }, "type": "phpstan-extension", "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - }, "phpstan": { "includes": [ "extension.neon", @@ -8415,9 +8412,9 @@ "description": "Symfony Framework extensions and rules for PHPStan", "support": { "issues": "https://github.com/phpstan/phpstan-symfony/issues", - "source": "https://github.com/phpstan/phpstan-symfony/tree/1.1.8" + "source": "https://github.com/phpstan/phpstan-symfony/tree/1.2.2" }, - "time": "2022-03-24T07:56:03+00:00" + "time": "2022-05-28T15:18:51+00:00" }, { "name": "phpunit/php-code-coverage", From f9e73cd9de8ddad0b1b6940675f91038ba716047 Mon Sep 17 00:00:00 2001 From: Michael Telgmann Date: Tue, 31 May 2022 11:28:02 +0200 Subject: [PATCH 027/730] SW-26706 - Add missing versions in UPGRADE-5.7.md file --- UPGRADE-5.7.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/UPGRADE-5.7.md b/UPGRADE-5.7.md index ffb9903ecea..8d0f5199b06 100644 --- a/UPGRADE-5.7.md +++ b/UPGRADE-5.7.md @@ -2,9 +2,9 @@ This changelog references changes done in Shopware 5.7 patch versions. -## 5.7.10 +## 5.7.12 -[View all changes from v5.7.9...v5.7.10](https://github.com/shopware/shopware/compare/v5.7.9...v5.7.10) +[View all changes from v5.7.11...v5.7.12](https://github.com/shopware/shopware/compare/v5.7.11...v5.7.12) ### Deprecations @@ -50,6 +50,13 @@ This changelog references changes done in Shopware 5.7 patch versions. ### Removals +## 5.7.11 + +[View all changes from v5.7.10...v5.7.11](https://github.com/shopware/shopware/compare/v5.7.10...v5.7.11) + +## 5.7.10 + +[View all changes from v5.7.9...v5.7.10](https://github.com/shopware/shopware/compare/v5.7.9...v5.7.10) ## 5.7.9 From 0a813873066f3af25bac2e0c73690cf84646d78b Mon Sep 17 00:00:00 2001 From: Michael Telgmann Date: Wed, 1 Jun 2022 08:02:56 +0200 Subject: [PATCH 028/730] SW-26706 - Update PHPStan --- .phpstan-baseline.neon | 9 +++++++-- composer.json | 2 +- composer.lock | 14 +++++++------- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/.phpstan-baseline.neon b/.phpstan-baseline.neon index fa4ae80f3b5..37dbd34e992 100644 --- a/.phpstan-baseline.neon +++ b/.phpstan-baseline.neon @@ -16810,18 +16810,23 @@ parameters: count: 1 path: engine/Shopware/Components/DependencyInjection/Bridge/Router.php + - + message: "#^Offset 'save_handler' on array\\{cookie_lifetime\\: int, cookie_httponly\\: int, gc_probability\\: int, gc_divisor\\: int, save_handler\\: string, use_trans_sid\\: int, locking\\: bool, name\\: non\\-empty\\-string, \\.\\.\\.\\} in isset\\(\\) always exists and is not nullable\\.$#" + count: 1 + path: engine/Shopware/Components/DependencyInjection/Bridge/Session.php + - message: "#^Offset 'save_handler' on array\\{cookie_lifetime\\: int, cookie_httponly\\: int, gc_probability\\: int, gc_divisor\\: int, save_handler\\: string, use_trans_sid\\: int, locking\\: bool\\} in isset\\(\\) always exists and is not nullable\\.$#" count: 1 path: engine/Shopware/Components/DependencyInjection/Bridge/Session.php - - message: "#^Offset 'save_path' on array\\{cookie_lifetime\\: int, cookie_httponly\\: int, gc_probability\\: int, gc_divisor\\: int, save_handler\\?\\: string, use_trans_sid\\: int, name\\: non\\-empty\\-string, cookie_secure\\?\\: true, \\.\\.\\.\\} in isset\\(\\) does not exist\\.$#" + message: "#^Offset 'save_path' on array\\{cookie_lifetime\\: int, cookie_httponly\\: int, gc_probability\\: int, gc_divisor\\: int, save_handler\\: string, use_trans_sid\\: int, locking\\: bool, name\\: non\\-empty\\-string, \\.\\.\\.\\} in isset\\(\\) does not exist\\.$#" count: 1 path: engine/Shopware/Components/DependencyInjection/Bridge/Session.php - - message: "#^Offset 'unitTestEnabled' on array\\{cookie_lifetime\\: int, cookie_httponly\\: int, gc_probability\\: int, gc_divisor\\: int, save_handler\\?\\: string, use_trans_sid\\: int, name\\: non\\-empty\\-string, cookie_secure\\?\\: true, \\.\\.\\.\\} in empty\\(\\) does not exist\\.$#" + message: "#^Offset 'unitTestEnabled' on array\\{cookie_lifetime\\: int, cookie_httponly\\: int, gc_probability\\: int, gc_divisor\\: int, save_handler\\: string, use_trans_sid\\: int, locking\\: bool, name\\: non\\-empty\\-string, \\.\\.\\.\\} in empty\\(\\) does not exist\\.$#" count: 1 path: engine/Shopware/Components/DependencyInjection/Bridge/Session.php diff --git a/composer.json b/composer.json index f589fbbad0f..cfaeff6a4f8 100644 --- a/composer.json +++ b/composer.json @@ -106,7 +106,7 @@ "php-parallel-lint/php-var-dump-check": "^0.5", "phpspec/prophecy-phpunit": "^2.0", "phpstan/extension-installer": "1.1.0", - "phpstan/phpstan": "1.7.1", + "phpstan/phpstan": "1.7.8", "phpstan/phpstan-doctrine": "1.3.6", "phpstan/phpstan-phpunit": "1.1.1", "phpstan/phpstan-symfony": "1.2.2", diff --git a/composer.lock b/composer.lock index 8b132c5b808..615fa0f1944 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "c268850de8501e4434ac49f9adefcfcd", + "content-hash": "8e74f864ddd05175f34ddb1e6d3ab1fd", "packages": [ { "name": "aws/aws-crt-php", @@ -8168,16 +8168,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.7.1", + "version": "1.7.8", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "e3baed2ee2ef322e0f9b8fe8f87fdbe024c7c719" + "reference": "2bf3d43015d56abac4d002a4d2d6c3a7d6fa627a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e3baed2ee2ef322e0f9b8fe8f87fdbe024c7c719", - "reference": "e3baed2ee2ef322e0f9b8fe8f87fdbe024c7c719", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/2bf3d43015d56abac4d002a4d2d6c3a7d6fa627a", + "reference": "2bf3d43015d56abac4d002a4d2d6c3a7d6fa627a", "shasum": "" }, "require": { @@ -8203,7 +8203,7 @@ "description": "PHPStan - PHP Static Analysis Tool", "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.7.1" + "source": "https://github.com/phpstan/phpstan/tree/1.7.8" }, "funding": [ { @@ -8223,7 +8223,7 @@ "type": "tidelift" } ], - "time": "2022-05-24T09:05:09+00:00" + "time": "2022-06-01T13:43:17+00:00" }, { "name": "phpstan/phpstan-doctrine", From b4870e674bae2819113296dd43e7635a6ce081fd Mon Sep 17 00:00:00 2001 From: Michael Telgmann Date: Wed, 1 Jun 2022 15:59:54 +0200 Subject: [PATCH 029/730] SW-26706 - Activate bleeding edge features of PHPStan --- .phpstan-baseline.neon | 25 ------------------- .phpstan.neon | 6 ++++- .../Compiler/LegacyApiResourcesPass.php | 2 +- .../HttpCache/UrlProvider/FormProvider.php | 4 +-- .../Shopware/Controllers/Backend/Config.php | 8 ++---- .../features/bootstrap/Element/HeaderCart.php | 7 ------ tests/Mink/features/bootstrap/Helper.php | 6 +++-- .../Mink/features/bootstrap/Page/Listing.php | 2 +- 8 files changed, 15 insertions(+), 45 deletions(-) diff --git a/.phpstan-baseline.neon b/.phpstan-baseline.neon index 37dbd34e992..1f2abfeaf1c 100644 --- a/.phpstan-baseline.neon +++ b/.phpstan-baseline.neon @@ -46910,21 +46910,11 @@ parameters: count: 1 path: tests/Mink/features/bootstrap/Element/HeaderCart.php - - - message: "#^Method Shopware\\\\Tests\\\\Mink\\\\Element\\\\HeaderCart\\:\\:clickCart\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Mink/features/bootstrap/Element/HeaderCart.php - - message: "#^Method Shopware\\\\Tests\\\\Mink\\\\Element\\\\HeaderCart\\:\\:getNamedSelectors\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 path: tests/Mink/features/bootstrap/Element/HeaderCart.php - - - message: "#^Parameter \\#2 \\$keys of static method Shopware\\\\Tests\\\\Mink\\\\Helper\\:\\:findElements\\(\\) expects array, string given\\.$#" - count: 1 - path: tests/Mink/features/bootstrap/Element/HeaderCart.php - - message: "#^Property Shopware\\\\Tests\\\\Mink\\\\Element\\\\HeaderCart\\:\\:\\$selector type has no value type specified in iterable type array\\.$#" count: 1 @@ -47370,11 +47360,6 @@ parameters: count: 1 path: tests/Mink/features/bootstrap/Helper.php - - - message: "#^Method Shopware\\\\Tests\\\\Mink\\\\Helper\\:\\:findElements\\(\\) has parameter \\$keys with no value type specified in iterable type array\\.$#" - count: 1 - path: tests/Mink/features/bootstrap/Helper.php - - message: "#^Method Shopware\\\\Tests\\\\Mink\\\\Helper\\:\\:floatArray\\(\\) has parameter \\$keys with no value type specified in iterable type array\\.$#" count: 1 @@ -47410,16 +47395,6 @@ parameters: count: 1 path: tests/Mink/features/bootstrap/Helper.php - - - message: "#^Method Shopware\\\\Tests\\\\Mink\\\\Helper\\:\\:getRequiredSelectors\\(\\) has parameter \\$keys with no value type specified in iterable type array\\.$#" - count: 1 - path: tests/Mink/features/bootstrap/Helper.php - - - - message: "#^Method Shopware\\\\Tests\\\\Mink\\\\Helper\\:\\:getRequiredSelectors\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: tests/Mink/features/bootstrap/Helper.php - - message: "#^Method Shopware\\\\Tests\\\\Mink\\\\Helper\\:\\:getUnique\\(\\) has parameter \\$array with no value type specified in iterable type array\\.$#" count: 1 diff --git a/.phpstan.neon b/.phpstan.neon index b3540c918ca..99987db73a7 100644 --- a/.phpstan.neon +++ b/.phpstan.neon @@ -1,5 +1,6 @@ includes: - - .phpstan-baseline.neon + - .phpstan-baseline.neon + - vendor/phpstan/phpstan/conf/bleedingEdge.neon services: - @@ -183,3 +184,6 @@ parameters: - # The doctrine extension has problems with detecting the select within an if condition. see https://github.com/phpstan/phpstan-doctrine/issues/331 message: '#Error: Expected Doctrine\\ORM\\Query\\Lexer::T_FROM, got end of string#' path: engine/Shopware/Components/Api/Resource/EmotionPreset.php + + # This is a bleeding edge feature and not working well since now. See https://github.com/phpstan/phpstan-doctrine/issues/332 + - '#Parameter .* of method Doctrine\\ORM\\.*::.*\(\) expects .*literal-string.* given#' diff --git a/engine/Shopware/Components/DependencyInjection/Compiler/LegacyApiResourcesPass.php b/engine/Shopware/Components/DependencyInjection/Compiler/LegacyApiResourcesPass.php index 3c0902873b9..1c8ecbb2873 100644 --- a/engine/Shopware/Components/DependencyInjection/Compiler/LegacyApiResourcesPass.php +++ b/engine/Shopware/Components/DependencyInjection/Compiler/LegacyApiResourcesPass.php @@ -31,7 +31,7 @@ /** * This class adds to all shopware.api services the tag shopware.api_resource * - * @depracted in 5.6 and will be removed with Shopware 5.8. Please use the tag `shopware.api_resource` instead. + * @deprecated in 5.6 and will be removed with Shopware 5.8. Please use the tag `shopware.api_resource` instead. */ class LegacyApiResourcesPass implements CompilerPassInterface { diff --git a/engine/Shopware/Components/HttpCache/UrlProvider/FormProvider.php b/engine/Shopware/Components/HttpCache/UrlProvider/FormProvider.php index 58e7efbae19..11ba3dc44b7 100644 --- a/engine/Shopware/Components/HttpCache/UrlProvider/FormProvider.php +++ b/engine/Shopware/Components/HttpCache/UrlProvider/FormProvider.php @@ -79,12 +79,12 @@ public function getUrls(Context $context, $limit = null, $offset = null): array } return $this->router->generateList( - array_filter(array_map( + array_map( function ($custom) { return ['sViewport' => 'forms', 'sFid' => $custom['id']]; }, $result - )), + ), $context ); } diff --git a/engine/Shopware/Controllers/Backend/Config.php b/engine/Shopware/Controllers/Backend/Config.php index 1b9736ee250..c7d7929e517 100644 --- a/engine/Shopware/Controllers/Backend/Config.php +++ b/engine/Shopware/Controllers/Backend/Config.php @@ -261,10 +261,7 @@ public function saveFormAction() */ public function getListAction() { - /** @var string $name */ - $name = $this->Request()->get('_repositoryClass'); - - /** @var QueryBuilder $builder */ + $name = (string) $this->Request()->get('_repositoryClass'); $builder = $this->getRepository($name)->createQueryBuilder($name); switch ($name) { @@ -458,8 +455,7 @@ public function getTableListAction() */ public function getValuesAction() { - $name = $this->Request()->get('_repositoryClass'); - /** @var QueryBuilder $builder */ + $name = (string) $this->Request()->get('_repositoryClass'); $builder = $this->getRepository($name)->createQueryBuilder($name); switch ($name) { diff --git a/tests/Mink/features/bootstrap/Element/HeaderCart.php b/tests/Mink/features/bootstrap/Element/HeaderCart.php index 873b84310fe..bf73251a1fc 100644 --- a/tests/Mink/features/bootstrap/Element/HeaderCart.php +++ b/tests/Mink/features/bootstrap/Element/HeaderCart.php @@ -89,11 +89,4 @@ public function checkCart($quantity, $amount) Helper::throwException($message); } } - - public function clickCart() - { - $element = Helper::findElements($this, 'link'); - - $element['link']->click(); - } } diff --git a/tests/Mink/features/bootstrap/Helper.php b/tests/Mink/features/bootstrap/Helper.php index dc69b0516be..10b8955fba2 100644 --- a/tests/Mink/features/bootstrap/Helper.php +++ b/tests/Mink/features/bootstrap/Helper.php @@ -223,11 +223,12 @@ public static function compareArrays($array1, $array2) * Finds elements by their selectors * * @param Page|Element|HelperSelectorInterface $parent + * @param array $keys * @param bool $throwExceptions * * @throws Exception|PendingException * - * @return Element[] + * @return array */ public static function findElements(HelperSelectorInterface $parent, array $keys, $throwExceptions = true) { @@ -307,12 +308,13 @@ public static function findAllOfElements(HelperSelectorInterface $parent, array * Returns the requested element css selectors * * @param Page|Element|HelperSelectorInterface $parent + * @param array $keys * @param bool $throwExceptions * * @throws Exception * @throws PendingException * - * @return array + * @return array */ public static function getRequiredSelectors(HelperSelectorInterface $parent, array $keys, $throwExceptions = true) { diff --git a/tests/Mink/features/bootstrap/Page/Listing.php b/tests/Mink/features/bootstrap/Page/Listing.php index 5b96efb46ba..247d2b901b7 100644 --- a/tests/Mink/features/bootstrap/Page/Listing.php +++ b/tests/Mink/features/bootstrap/Page/Listing.php @@ -154,7 +154,7 @@ public function filter(FilterGroup $filterGroups, array $properties) */ public function checkView($view) { - $elements = array_filter(Helper::findElements($this, ['viewTable', 'viewList'], false)); + $elements = Helper::findElements($this, ['viewTable', 'viewList'], false); if (key($elements) !== $view) { $message = sprintf('"%s" is active! (should be "%s")', key($elements), $view); From 86a8b33bd01243f3043ea4105d42dc20e5e984d0 Mon Sep 17 00:00:00 2001 From: Michael Telgmann Date: Thu, 2 Jun 2022 10:11:20 +0200 Subject: [PATCH 030/730] SW-26706 - Update PHPStan Doctrine plugin again --- composer.json | 2 +- composer.lock | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/composer.json b/composer.json index cfaeff6a4f8..9d187d1d780 100644 --- a/composer.json +++ b/composer.json @@ -107,7 +107,7 @@ "phpspec/prophecy-phpunit": "^2.0", "phpstan/extension-installer": "1.1.0", "phpstan/phpstan": "1.7.8", - "phpstan/phpstan-doctrine": "1.3.6", + "phpstan/phpstan-doctrine": "1.3.7", "phpstan/phpstan-phpunit": "1.1.1", "phpstan/phpstan-symfony": "1.2.2", "phpunit/phpunit": "^9.4", diff --git a/composer.lock b/composer.lock index 615fa0f1944..1b9d6faf4fa 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "8e74f864ddd05175f34ddb1e6d3ab1fd", + "content-hash": "c247ccdda253d97c68ad3851acf5e190", "packages": [ { "name": "aws/aws-crt-php", @@ -8227,21 +8227,21 @@ }, { "name": "phpstan/phpstan-doctrine", - "version": "1.3.6", + "version": "1.3.7", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-doctrine.git", - "reference": "317e47b31bb92df5b344ed208dd358a6099c8507" + "reference": "85339d71b2dde4871d84bc369002fa1a3b460b07" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-doctrine/zipball/317e47b31bb92df5b344ed208dd358a6099c8507", - "reference": "317e47b31bb92df5b344ed208dd358a6099c8507", + "url": "https://api.github.com/repos/phpstan/phpstan-doctrine/zipball/85339d71b2dde4871d84bc369002fa1a3b460b07", + "reference": "85339d71b2dde4871d84bc369002fa1a3b460b07", "shasum": "" }, "require": { "php": "^7.2 || ^8.0", - "phpstan/phpstan": "^1.7.0" + "phpstan/phpstan": "^1.7.3" }, "conflict": { "doctrine/collections": "<1.0", @@ -8289,9 +8289,9 @@ "description": "Doctrine extensions for PHPStan", "support": { "issues": "https://github.com/phpstan/phpstan-doctrine/issues", - "source": "https://github.com/phpstan/phpstan-doctrine/tree/1.3.6" + "source": "https://github.com/phpstan/phpstan-doctrine/tree/1.3.7" }, - "time": "2022-05-27T18:47:50+00:00" + "time": "2022-06-01T13:19:10+00:00" }, { "name": "phpstan/phpstan-phpunit", From 5b1bca60e9acdbd8978c1242ebd04a28761418e4 Mon Sep 17 00:00:00 2001 From: Michael Telgmann Date: Thu, 2 Jun 2022 15:23:41 +0200 Subject: [PATCH 031/730] SW-26686 - Update Symfony and indirect dependencies --- UPGRADE-5.7.md | 22 ++-- composer.lock | 334 +++++++++++++++++++++++++------------------------ 2 files changed, 181 insertions(+), 175 deletions(-) diff --git a/UPGRADE-5.7.md b/UPGRADE-5.7.md index 8d0f5199b06..b2e51fd9243 100644 --- a/UPGRADE-5.7.md +++ b/UPGRADE-5.7.md @@ -29,21 +29,21 @@ This changelog references changes done in Shopware 5.7 patch versions. * Updated `mpdf/mpdf` to version 8.1.1 * Updated `phpunit/phpunit` to version 9.5.20 * Updated `symfony/browser-kit` to version 4.4.37 -* Updated `symfony/config` to version 4.4.41 -* Updated `symfony/console` to version 4.4.41 -* Updated `symfony/dependency-injection` to version 4.4.41 -* Updated `symfony/dom-crawler` to version 4.4.39 +* Updated `symfony/config` to version 4.4.42 +* Updated `symfony/console` to version 4.4.42 +* Updated `symfony/dependency-injection` to version 4.4.42 +* Updated `symfony/dom-crawler` to version 4.4.42 * Updated `symfony/expression-language` to version 4.4.41 -* Updated `symfony/filesystem` to version 4.4.39 +* Updated `symfony/filesystem` to version 4.4.42 * Updated `symfony/finder` to version 4.4.41 -* Updated `symfony/form` to version 4.4.41 -* Updated `symfony/http-foundation` to version 4.4.41 -* Updated `symfony/http-kernel` to version 4.4.41 +* Updated `symfony/form` to version 4.4.42 +* Updated `symfony/http-foundation` to version 4.4.42 +* Updated `symfony/http-kernel` to version 4.4.42 * Updated `symfony/options-resolver` to version 4.4.37 -* Updated `symfony/polyfill-php80` to version 1.25.0 -* Updated `symfony/polyfill-php81` to version 1.25.0 +* Updated `symfony/polyfill-php80` to version 1.26.0 +* Updated `symfony/polyfill-php81` to version 1.26.0 * Updated `symfony/process` to version 4.4.41 -* Updated `symfony/serializer` to version 5.4.8 +* Updated `symfony/serializer` to version 5.4.9 * Updated `symfony/validator` to version 4.4.41 * Updated `symfony/web-link` to version 4.4.37 * Updated several indirect dependencies diff --git a/composer.lock b/composer.lock index 1b9d6faf4fa..27dd4e3ebdc 100644 --- a/composer.lock +++ b/composer.lock @@ -58,16 +58,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.222.0", + "version": "3.224.2", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "0074bca70bf023f049532b177bf90d3a75e425cd" + "reference": "a2e6461261a92570128e6c2b6fb1896f3d16b424" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/0074bca70bf023f049532b177bf90d3a75e425cd", - "reference": "0074bca70bf023f049532b177bf90d3a75e425cd", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/a2e6461261a92570128e6c2b6fb1896f3d16b424", + "reference": "a2e6461261a92570128e6c2b6fb1896f3d16b424", "shasum": "" }, "require": { @@ -143,9 +143,9 @@ "support": { "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "issues": "https://github.com/aws/aws-sdk-php/issues", - "source": "https://github.com/aws/aws-sdk-php/tree/3.222.0" + "source": "https://github.com/aws/aws-sdk-php/tree/3.224.2" }, - "time": "2022-04-27T18:36:42+00:00" + "time": "2022-06-01T18:17:06+00:00" }, { "name": "bcremer/line-reader", @@ -1689,23 +1689,28 @@ }, { "name": "firebase/php-jwt", - "version": "v6.1.2", + "version": "v6.2.0", "source": { "type": "git", "url": "https://github.com/firebase/php-jwt.git", - "reference": "c297139da7c6873dbd67cbd1093f09ec0bbd0c50" + "reference": "d28e6df83830252650da4623c78aaaf98fb385f3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/firebase/php-jwt/zipball/c297139da7c6873dbd67cbd1093f09ec0bbd0c50", - "reference": "c297139da7c6873dbd67cbd1093f09ec0bbd0c50", + "url": "https://api.github.com/repos/firebase/php-jwt/zipball/d28e6df83830252650da4623c78aaaf98fb385f3", + "reference": "d28e6df83830252650da4623c78aaaf98fb385f3", "shasum": "" }, "require": { "php": "^7.1||^8.0" }, "require-dev": { - "phpunit/phpunit": "^7.5||9.5" + "guzzlehttp/guzzle": "^6.5||^7.4", + "phpspec/prophecy-phpunit": "^1.1", + "phpunit/phpunit": "^7.5||^9.5", + "psr/cache": "^1.0||^2.0", + "psr/http-client": "^1.0", + "psr/http-factory": "^1.0" }, "suggest": { "paragonie/sodium_compat": "Support EdDSA (Ed25519) signatures when libsodium is not present" @@ -1740,9 +1745,9 @@ ], "support": { "issues": "https://github.com/firebase/php-jwt/issues", - "source": "https://github.com/firebase/php-jwt/tree/v6.1.2" + "source": "https://github.com/firebase/php-jwt/tree/v6.2.0" }, - "time": "2022-04-21T14:37:18+00:00" + "time": "2022-05-13T20:54:50+00:00" }, { "name": "friendsofphp/proxy-manager-lts", @@ -1886,16 +1891,16 @@ }, { "name": "google/cloud-core", - "version": "v1.44.3", + "version": "v1.45.0", "source": { "type": "git", "url": "https://github.com/googleapis/google-cloud-php-core.git", - "reference": "eac417a907beaa3bc2783a17b90c0113b7aa86e6" + "reference": "28181b5ec2d40e9c9cdf2085096b33bac1f237fd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-cloud-php-core/zipball/eac417a907beaa3bc2783a17b90c0113b7aa86e6", - "reference": "eac417a907beaa3bc2783a17b90c0113b7aa86e6", + "url": "https://api.github.com/repos/googleapis/google-cloud-php-core/zipball/28181b5ec2d40e9c9cdf2085096b33bac1f237fd", + "reference": "28181b5ec2d40e9c9cdf2085096b33bac1f237fd", "shasum": "" }, "require": { @@ -1914,8 +1919,9 @@ "google/gax": "^1.9", "opis/closure": "^3", "phpdocumentor/reflection": "^3.0", - "phpunit/phpunit": "^4.8|^5.0", - "squizlabs/php_codesniffer": "2.*" + "phpunit/phpunit": "^4.8|^5.0|^8.0", + "squizlabs/php_codesniffer": "2.*", + "yoast/phpunit-polyfills": "^1.0" }, "suggest": { "opis/closure": "May be used to serialize closures to process jobs in the batch daemon. Please require version ^3.", @@ -1944,9 +1950,9 @@ ], "description": "Google Cloud PHP shared dependency, providing functionality useful to all components.", "support": { - "source": "https://github.com/googleapis/google-cloud-php-core/tree/v1.44.3" + "source": "https://github.com/googleapis/google-cloud-php-core/tree/v1.45.0" }, - "time": "2022-04-27T23:24:15+00:00" + "time": "2022-05-13T22:51:50+00:00" }, { "name": "google/cloud-storage", @@ -4036,16 +4042,16 @@ }, { "name": "symfony/cache", - "version": "v5.4.8", + "version": "v5.4.9", "source": { "type": "git", "url": "https://github.com/symfony/cache.git", - "reference": "4c6747cf7e56c6b8e3094dd24852bd3e364375b1" + "reference": "a50b7249bea81ddd6d3b799ce40c5521c2f72f0b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/cache/zipball/4c6747cf7e56c6b8e3094dd24852bd3e364375b1", - "reference": "4c6747cf7e56c6b8e3094dd24852bd3e364375b1", + "url": "https://api.github.com/repos/symfony/cache/zipball/a50b7249bea81ddd6d3b799ce40c5521c2f72f0b", + "reference": "a50b7249bea81ddd6d3b799ce40c5521c2f72f0b", "shasum": "" }, "require": { @@ -4113,7 +4119,7 @@ "psr6" ], "support": { - "source": "https://github.com/symfony/cache/tree/v5.4.8" + "source": "https://github.com/symfony/cache/tree/v5.4.9" }, "funding": [ { @@ -4129,7 +4135,7 @@ "type": "tidelift" } ], - "time": "2022-04-26T13:19:20+00:00" + "time": "2022-05-21T10:24:18+00:00" }, { "name": "symfony/cache-contracts", @@ -4212,16 +4218,16 @@ }, { "name": "symfony/config", - "version": "v4.4.41", + "version": "v4.4.42", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "9d031eb2d4292aed117b0f7fafd5c436dcf3dfd7" + "reference": "83cdafd1bd3370de23e3dc2ed01026908863be81" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/9d031eb2d4292aed117b0f7fafd5c436dcf3dfd7", - "reference": "9d031eb2d4292aed117b0f7fafd5c436dcf3dfd7", + "url": "https://api.github.com/repos/symfony/config/zipball/83cdafd1bd3370de23e3dc2ed01026908863be81", + "reference": "83cdafd1bd3370de23e3dc2ed01026908863be81", "shasum": "" }, "require": { @@ -4270,7 +4276,7 @@ "description": "Helps you find, load, combine, autofill and validate configuration values of any kind", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/config/tree/v4.4.41" + "source": "https://github.com/symfony/config/tree/v4.4.42" }, "funding": [ { @@ -4286,20 +4292,20 @@ "type": "tidelift" } ], - "time": "2022-04-12T15:19:55+00:00" + "time": "2022-05-17T07:10:14+00:00" }, { "name": "symfony/console", - "version": "v4.4.41", + "version": "v4.4.42", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "0e1e62083b20ccb39c2431293de060f756af905c" + "reference": "cce7a9f99e22937a71a16b23afa762558808d587" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/0e1e62083b20ccb39c2431293de060f756af905c", - "reference": "0e1e62083b20ccb39c2431293de060f756af905c", + "url": "https://api.github.com/repos/symfony/console/zipball/cce7a9f99e22937a71a16b23afa762558808d587", + "reference": "cce7a9f99e22937a71a16b23afa762558808d587", "shasum": "" }, "require": { @@ -4360,7 +4366,7 @@ "description": "Eases the creation of beautiful and testable command line interfaces", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/console/tree/v4.4.41" + "source": "https://github.com/symfony/console/tree/v4.4.42" }, "funding": [ { @@ -4376,7 +4382,7 @@ "type": "tidelift" } ], - "time": "2022-04-12T15:19:55+00:00" + "time": "2022-05-14T12:35:33+00:00" }, { "name": "symfony/debug", @@ -4448,16 +4454,16 @@ }, { "name": "symfony/dependency-injection", - "version": "v4.4.41", + "version": "v4.4.42", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "74c7f55de0eced4d3c9654809b1871870386a577" + "reference": "f6fdbf252765a09c7ac243617f79f1babef792c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/74c7f55de0eced4d3c9654809b1871870386a577", - "reference": "74c7f55de0eced4d3c9654809b1871870386a577", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/f6fdbf252765a09c7ac243617f79f1babef792c9", + "reference": "f6fdbf252765a09c7ac243617f79f1babef792c9", "shasum": "" }, "require": { @@ -4514,7 +4520,7 @@ "description": "Allows you to standardize and centralize the way objects are constructed in your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/dependency-injection/tree/v4.4.41" + "source": "https://github.com/symfony/dependency-injection/tree/v4.4.42" }, "funding": [ { @@ -4530,7 +4536,7 @@ "type": "tidelift" } ], - "time": "2022-04-12T15:19:55+00:00" + "time": "2022-05-24T15:15:52+00:00" }, { "name": "symfony/deprecation-contracts", @@ -4669,16 +4675,16 @@ }, { "name": "symfony/event-dispatcher", - "version": "v4.4.37", + "version": "v4.4.42", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "3ccfcfb96ecce1217d7b0875a0736976bc6e63dc" + "reference": "708e761740c16b02c86e3f0c932018a06b895d40" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/3ccfcfb96ecce1217d7b0875a0736976bc6e63dc", - "reference": "3ccfcfb96ecce1217d7b0875a0736976bc6e63dc", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/708e761740c16b02c86e3f0c932018a06b895d40", + "reference": "708e761740c16b02c86e3f0c932018a06b895d40", "shasum": "" }, "require": { @@ -4733,7 +4739,7 @@ "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v4.4.37" + "source": "https://github.com/symfony/event-dispatcher/tree/v4.4.42" }, "funding": [ { @@ -4749,7 +4755,7 @@ "type": "tidelift" } ], - "time": "2022-01-02T09:41:36+00:00" + "time": "2022-05-05T15:33:49+00:00" }, { "name": "symfony/event-dispatcher-contracts", @@ -4895,16 +4901,16 @@ }, { "name": "symfony/filesystem", - "version": "v4.4.39", + "version": "v4.4.42", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "72a5b35fecaa670b13954e6eaf414acbe2a67b35" + "reference": "815412ee8971209bd4c1eecd5f4f481eacd44bf5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/72a5b35fecaa670b13954e6eaf414acbe2a67b35", - "reference": "72a5b35fecaa670b13954e6eaf414acbe2a67b35", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/815412ee8971209bd4c1eecd5f4f481eacd44bf5", + "reference": "815412ee8971209bd4c1eecd5f4f481eacd44bf5", "shasum": "" }, "require": { @@ -4938,7 +4944,7 @@ "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/filesystem/tree/v4.4.39" + "source": "https://github.com/symfony/filesystem/tree/v4.4.42" }, "funding": [ { @@ -4954,7 +4960,7 @@ "type": "tidelift" } ], - "time": "2022-02-25T10:38:15+00:00" + "time": "2022-05-20T08:49:14+00:00" }, { "name": "symfony/finder", @@ -5020,16 +5026,16 @@ }, { "name": "symfony/form", - "version": "v4.4.41", + "version": "v4.4.42", "source": { "type": "git", "url": "https://github.com/symfony/form.git", - "reference": "d874bd4208741fd88bd5a1c6d22f2b30a28dc47e" + "reference": "b19668b10c18deb56ff8068070afa5300f01f500" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/form/zipball/d874bd4208741fd88bd5a1c6d22f2b30a28dc47e", - "reference": "d874bd4208741fd88bd5a1c6d22f2b30a28dc47e", + "url": "https://api.github.com/repos/symfony/form/zipball/b19668b10c18deb56ff8068070afa5300f01f500", + "reference": "b19668b10c18deb56ff8068070afa5300f01f500", "shasum": "" }, "require": { @@ -5098,7 +5104,7 @@ "description": "Allows to easily create, process and reuse HTML forms", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/form/tree/v4.4.41" + "source": "https://github.com/symfony/form/tree/v4.4.42" }, "funding": [ { @@ -5114,7 +5120,7 @@ "type": "tidelift" } ], - "time": "2022-04-22T17:25:21+00:00" + "time": "2022-05-21T14:03:14+00:00" }, { "name": "symfony/http-client-contracts", @@ -5196,16 +5202,16 @@ }, { "name": "symfony/http-foundation", - "version": "v4.4.41", + "version": "v4.4.42", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "27441220aebeb096b4eb8267acaaa7feb5e4266c" + "reference": "8e87b3ec23ebbcf7440d91dec8f7ca70dd591eb3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/27441220aebeb096b4eb8267acaaa7feb5e4266c", - "reference": "27441220aebeb096b4eb8267acaaa7feb5e4266c", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/8e87b3ec23ebbcf7440d91dec8f7ca70dd591eb3", + "reference": "8e87b3ec23ebbcf7440d91dec8f7ca70dd591eb3", "shasum": "" }, "require": { @@ -5244,7 +5250,7 @@ "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-foundation/tree/v4.4.41" + "source": "https://github.com/symfony/http-foundation/tree/v4.4.42" }, "funding": [ { @@ -5260,20 +5266,20 @@ "type": "tidelift" } ], - "time": "2022-04-21T07:22:34+00:00" + "time": "2022-05-17T11:15:18+00:00" }, { "name": "symfony/http-kernel", - "version": "v4.4.41", + "version": "v4.4.42", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "7f8ce5bffc3939c63b7da32de5a546c98eb67698" + "reference": "04181de9459df639512dadf83d544ce12edd6776" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/7f8ce5bffc3939c63b7da32de5a546c98eb67698", - "reference": "7f8ce5bffc3939c63b7da32de5a546c98eb67698", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/04181de9459df639512dadf83d544ce12edd6776", + "reference": "04181de9459df639512dadf83d544ce12edd6776", "shasum": "" }, "require": { @@ -5348,7 +5354,7 @@ "description": "Provides a structured process for converting a Request into a Response", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-kernel/tree/v4.4.41" + "source": "https://github.com/symfony/http-kernel/tree/v4.4.42" }, "funding": [ { @@ -5364,7 +5370,7 @@ "type": "tidelift" } ], - "time": "2022-04-27T17:13:11+00:00" + "time": "2022-05-27T07:04:21+00:00" }, { "name": "symfony/intl", @@ -5456,16 +5462,16 @@ }, { "name": "symfony/mime", - "version": "v5.4.8", + "version": "v5.4.9", "source": { "type": "git", "url": "https://github.com/symfony/mime.git", - "reference": "af49bc163ec3272f677bde3bc44c0d766c1fd662" + "reference": "2b3802a24e48d0cfccf885173d2aac91e73df92e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mime/zipball/af49bc163ec3272f677bde3bc44c0d766c1fd662", - "reference": "af49bc163ec3272f677bde3bc44c0d766c1fd662", + "url": "https://api.github.com/repos/symfony/mime/zipball/2b3802a24e48d0cfccf885173d2aac91e73df92e", + "reference": "2b3802a24e48d0cfccf885173d2aac91e73df92e", "shasum": "" }, "require": { @@ -5519,7 +5525,7 @@ "mime-type" ], "support": { - "source": "https://github.com/symfony/mime/tree/v5.4.8" + "source": "https://github.com/symfony/mime/tree/v5.4.9" }, "funding": [ { @@ -5535,7 +5541,7 @@ "type": "tidelift" } ], - "time": "2022-04-12T15:48:08+00:00" + "time": "2022-05-21T10:24:18+00:00" }, { "name": "symfony/options-resolver", @@ -5606,16 +5612,16 @@ }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.25.0", + "version": "v1.26.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "81b86b50cf841a64252b439e738e97f4a34e2783" + "reference": "433d05519ce6990bf3530fba6957499d327395c2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/81b86b50cf841a64252b439e738e97f4a34e2783", - "reference": "81b86b50cf841a64252b439e738e97f4a34e2783", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/433d05519ce6990bf3530fba6957499d327395c2", + "reference": "433d05519ce6990bf3530fba6957499d327395c2", "shasum": "" }, "require": { @@ -5627,7 +5633,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.26-dev" }, "thanks": { "name": "symfony/polyfill", @@ -5667,7 +5673,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.25.0" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.26.0" }, "funding": [ { @@ -5683,20 +5689,20 @@ "type": "tidelift" } ], - "time": "2021-11-23T21:10:46+00:00" + "time": "2022-05-24T11:49:31+00:00" }, { "name": "symfony/polyfill-intl-idn", - "version": "v1.25.0", + "version": "v1.26.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-idn.git", - "reference": "749045c69efb97c70d25d7463abba812e91f3a44" + "reference": "59a8d271f00dd0e4c2e518104cc7963f655a1aa8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/749045c69efb97c70d25d7463abba812e91f3a44", - "reference": "749045c69efb97c70d25d7463abba812e91f3a44", + "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/59a8d271f00dd0e4c2e518104cc7963f655a1aa8", + "reference": "59a8d271f00dd0e4c2e518104cc7963f655a1aa8", "shasum": "" }, "require": { @@ -5710,7 +5716,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.26-dev" }, "thanks": { "name": "symfony/polyfill", @@ -5754,7 +5760,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.25.0" + "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.26.0" }, "funding": [ { @@ -5770,20 +5776,20 @@ "type": "tidelift" } ], - "time": "2021-09-14T14:02:44+00:00" + "time": "2022-05-24T11:49:31+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.25.0", + "version": "v1.26.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8" + "reference": "219aa369ceff116e673852dce47c3a41794c14bd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8590a5f561694770bdcd3f9b5c69dde6945028e8", - "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/219aa369ceff116e673852dce47c3a41794c14bd", + "reference": "219aa369ceff116e673852dce47c3a41794c14bd", "shasum": "" }, "require": { @@ -5795,7 +5801,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.26-dev" }, "thanks": { "name": "symfony/polyfill", @@ -5838,7 +5844,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.25.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.26.0" }, "funding": [ { @@ -5854,20 +5860,20 @@ "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2022-05-24T11:49:31+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.25.0", + "version": "v1.26.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825" + "reference": "9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/0abb51d2f102e00a4eefcf46ba7fec406d245825", - "reference": "0abb51d2f102e00a4eefcf46ba7fec406d245825", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e", + "reference": "9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e", "shasum": "" }, "require": { @@ -5882,7 +5888,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.26-dev" }, "thanks": { "name": "symfony/polyfill", @@ -5921,7 +5927,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.25.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.26.0" }, "funding": [ { @@ -5937,20 +5943,20 @@ "type": "tidelift" } ], - "time": "2021-11-30T18:21:41+00:00" + "time": "2022-05-24T11:49:31+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.25.0", + "version": "v1.26.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "4407588e0d3f1f52efb65fbe92babe41f37fe50c" + "reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/4407588e0d3f1f52efb65fbe92babe41f37fe50c", - "reference": "4407588e0d3f1f52efb65fbe92babe41f37fe50c", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/cfa0ae98841b9e461207c13ab093d76b0fa7bace", + "reference": "cfa0ae98841b9e461207c13ab093d76b0fa7bace", "shasum": "" }, "require": { @@ -5959,7 +5965,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.26-dev" }, "thanks": { "name": "symfony/polyfill", @@ -6004,7 +6010,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.25.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.26.0" }, "funding": [ { @@ -6020,20 +6026,20 @@ "type": "tidelift" } ], - "time": "2022-03-04T08:16:47+00:00" + "time": "2022-05-10T07:21:04+00:00" }, { "name": "symfony/polyfill-php81", - "version": "v1.25.0", + "version": "v1.26.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php81.git", - "reference": "5de4ba2d41b15f9bd0e19b2ab9674135813ec98f" + "reference": "13f6d1271c663dc5ae9fb843a8f16521db7687a1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/5de4ba2d41b15f9bd0e19b2ab9674135813ec98f", - "reference": "5de4ba2d41b15f9bd0e19b2ab9674135813ec98f", + "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/13f6d1271c663dc5ae9fb843a8f16521db7687a1", + "reference": "13f6d1271c663dc5ae9fb843a8f16521db7687a1", "shasum": "" }, "require": { @@ -6042,7 +6048,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "1.23-dev" + "dev-main": "1.26-dev" }, "thanks": { "name": "symfony/polyfill", @@ -6083,7 +6089,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php81/tree/v1.25.0" + "source": "https://github.com/symfony/polyfill-php81/tree/v1.26.0" }, "funding": [ { @@ -6099,7 +6105,7 @@ "type": "tidelift" } ], - "time": "2021-09-13T13:58:11+00:00" + "time": "2022-05-24T11:49:31+00:00" }, { "name": "symfony/process", @@ -6246,16 +6252,16 @@ }, { "name": "symfony/property-info", - "version": "v5.4.7", + "version": "v5.4.9", "source": { "type": "git", "url": "https://github.com/symfony/property-info.git", - "reference": "0fc07795712972b9792f203d0fe0e77c26c3281d" + "reference": "6f0a452aaba45e763f89e328df437f73a720e18e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/property-info/zipball/0fc07795712972b9792f203d0fe0e77c26c3281d", - "reference": "0fc07795712972b9792f203d0fe0e77c26c3281d", + "url": "https://api.github.com/repos/symfony/property-info/zipball/6f0a452aaba45e763f89e328df437f73a720e18e", + "reference": "6f0a452aaba45e763f89e328df437f73a720e18e", "shasum": "" }, "require": { @@ -6317,7 +6323,7 @@ "validator" ], "support": { - "source": "https://github.com/symfony/property-info/tree/v5.4.7" + "source": "https://github.com/symfony/property-info/tree/v5.4.9" }, "funding": [ { @@ -6333,20 +6339,20 @@ "type": "tidelift" } ], - "time": "2022-03-30T13:40:48+00:00" + "time": "2022-05-17T09:47:20+00:00" }, { "name": "symfony/serializer", - "version": "v5.4.8", + "version": "v5.4.9", "source": { "type": "git", "url": "https://github.com/symfony/serializer.git", - "reference": "a806b1031c45bf2ee583beee6df734ecf34d5cfc" + "reference": "b54815117a06a8120604bdf00219e3a55288ee1e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/serializer/zipball/a806b1031c45bf2ee583beee6df734ecf34d5cfc", - "reference": "a806b1031c45bf2ee583beee6df734ecf34d5cfc", + "url": "https://api.github.com/repos/symfony/serializer/zipball/b54815117a06a8120604bdf00219e3a55288ee1e", + "reference": "b54815117a06a8120604bdf00219e3a55288ee1e", "shasum": "" }, "require": { @@ -6420,7 +6426,7 @@ "description": "Handles serializing and deserializing data structures, including object graphs, into array structures or other formats like XML and JSON.", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/serializer/tree/v5.4.8" + "source": "https://github.com/symfony/serializer/tree/v5.4.9" }, "funding": [ { @@ -6436,7 +6442,7 @@ "type": "tidelift" } ], - "time": "2022-04-12T16:02:29+00:00" + "time": "2022-05-10T09:18:46+00:00" }, { "name": "symfony/service-contracts", @@ -6523,16 +6529,16 @@ }, { "name": "symfony/string", - "version": "v5.4.8", + "version": "v5.4.9", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "3c061a76bff6d6ea427d85e12ad1bb8ed8cd43e8" + "reference": "985e6a9703ef5ce32ba617c9c7d97873bb7b2a99" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/3c061a76bff6d6ea427d85e12ad1bb8ed8cd43e8", - "reference": "3c061a76bff6d6ea427d85e12ad1bb8ed8cd43e8", + "url": "https://api.github.com/repos/symfony/string/zipball/985e6a9703ef5ce32ba617c9c7d97873bb7b2a99", + "reference": "985e6a9703ef5ce32ba617c9c7d97873bb7b2a99", "shasum": "" }, "require": { @@ -6589,7 +6595,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.4.8" + "source": "https://github.com/symfony/string/tree/v5.4.9" }, "funding": [ { @@ -6793,16 +6799,16 @@ }, { "name": "symfony/var-dumper", - "version": "v5.4.8", + "version": "v5.4.9", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "cdcadd343d31ad16fc5e006b0de81ea307435053" + "reference": "af52239a330fafd192c773795520dc2dd62b5657" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/cdcadd343d31ad16fc5e006b0de81ea307435053", - "reference": "cdcadd343d31ad16fc5e006b0de81ea307435053", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/af52239a330fafd192c773795520dc2dd62b5657", + "reference": "af52239a330fafd192c773795520dc2dd62b5657", "shasum": "" }, "require": { @@ -6862,7 +6868,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v5.4.8" + "source": "https://github.com/symfony/var-dumper/tree/v5.4.9" }, "funding": [ { @@ -6878,20 +6884,20 @@ "type": "tidelift" } ], - "time": "2022-04-26T13:19:20+00:00" + "time": "2022-05-21T10:24:18+00:00" }, { "name": "symfony/var-exporter", - "version": "v5.4.8", + "version": "v5.4.9", "source": { "type": "git", "url": "https://github.com/symfony/var-exporter.git", - "reference": "7e132a3fcd4b57add721b4207236877b6017ec93" + "reference": "63249ebfca4e75a357679fa7ba2089cfb898aa67" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-exporter/zipball/7e132a3fcd4b57add721b4207236877b6017ec93", - "reference": "7e132a3fcd4b57add721b4207236877b6017ec93", + "url": "https://api.github.com/repos/symfony/var-exporter/zipball/63249ebfca4e75a357679fa7ba2089cfb898aa67", + "reference": "63249ebfca4e75a357679fa7ba2089cfb898aa67", "shasum": "" }, "require": { @@ -6935,7 +6941,7 @@ "serialize" ], "support": { - "source": "https://github.com/symfony/var-exporter/tree/v5.4.8" + "source": "https://github.com/symfony/var-exporter/tree/v5.4.9" }, "funding": [ { @@ -6951,7 +6957,7 @@ "type": "tidelift" } ], - "time": "2022-04-26T13:19:20+00:00" + "time": "2022-05-21T10:24:18+00:00" }, { "name": "symfony/web-link", @@ -7624,16 +7630,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.13.2", + "version": "v4.14.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "210577fe3cf7badcc5814d99455df46564f3c077" + "reference": "34bea19b6e03d8153165d8f30bba4c3be86184c1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/210577fe3cf7badcc5814d99455df46564f3c077", - "reference": "210577fe3cf7badcc5814d99455df46564f3c077", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/34bea19b6e03d8153165d8f30bba4c3be86184c1", + "reference": "34bea19b6e03d8153165d8f30bba4c3be86184c1", "shasum": "" }, "require": { @@ -7674,9 +7680,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.13.2" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.14.0" }, - "time": "2021-11-30T19:35:32+00:00" + "time": "2022-05-31T20:59:12+00:00" }, { "name": "phar-io/manifest", @@ -10017,16 +10023,16 @@ }, { "name": "symfony/dom-crawler", - "version": "v4.4.39", + "version": "v4.4.42", "source": { "type": "git", "url": "https://github.com/symfony/dom-crawler.git", - "reference": "4e9215a8b533802ba84a3cc5bd3c43103e7a6dc3" + "reference": "be5a04618e5d44e71d013f177df80d3ec4b192a0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/4e9215a8b533802ba84a3cc5bd3c43103e7a6dc3", - "reference": "4e9215a8b533802ba84a3cc5bd3c43103e7a6dc3", + "url": "https://api.github.com/repos/symfony/dom-crawler/zipball/be5a04618e5d44e71d013f177df80d3ec4b192a0", + "reference": "be5a04618e5d44e71d013f177df80d3ec4b192a0", "shasum": "" }, "require": { @@ -10071,7 +10077,7 @@ "description": "Eases DOM navigation for HTML and XML documents", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/dom-crawler/tree/v4.4.39" + "source": "https://github.com/symfony/dom-crawler/tree/v4.4.42" }, "funding": [ { @@ -10087,7 +10093,7 @@ "type": "tidelift" } ], - "time": "2022-02-25T10:38:15+00:00" + "time": "2022-04-30T18:34:00+00:00" }, { "name": "symfony/translation", From 253897b70e7703c350fd55e5d17fded818b04194 Mon Sep 17 00:00:00 2001 From: Michael Telgmann Date: Thu, 2 Jun 2022 15:48:59 +0200 Subject: [PATCH 032/730] SW-26686 - Update doctrine dependencies --- UPGRADE-5.7.md | 4 ++- composer.json | 6 ++--- composer.lock | 70 ++++++++++++++++++++++++++++++-------------------- 3 files changed, 48 insertions(+), 32 deletions(-) diff --git a/UPGRADE-5.7.md b/UPGRADE-5.7.md index b2e51fd9243..f0510bd07c0 100644 --- a/UPGRADE-5.7.md +++ b/UPGRADE-5.7.md @@ -17,9 +17,11 @@ This changelog references changes done in Shopware 5.7 patch versions. * Updated `bamarni/composer-bin-plugin` to version 1.5.0 * Updated `behat/mink` to version 1.10.0 * Updated `behat/mink-selenium2-driver` to version 1.6.0 +* Updated `doctrine/cache` to version 1.13.0 * Updated `doctrine/common` to version 3.3.0 * Updated `doctrine/dbal` to version 2.13.8 -* Updated `doctrine/persistence` to version 2.5.1 +* Updated `doctrine/orm` to version 2.12.2 +* Updated `doctrine/persistence` to version 2.5.3 * Updated `elasticsearch/elasticsearch` to version 7.17.0 * Updated `friendsofphp/proxy-manager-lts` to version 1.0.7 * Updated `google/cloud-storage` to version 1.26.2 diff --git a/composer.json b/composer.json index 9d187d1d780..6126c347b49 100644 --- a/composer.json +++ b/composer.json @@ -41,13 +41,13 @@ "beberlei/doctrineextensions": "1.3.0", "cocur/slugify": "4.1.0", "doctrine/annotations": "1.13.2", - "doctrine/cache": "1.12.1", + "doctrine/cache": "1.13.0", "doctrine/collections": "1.6.8", "doctrine/common": "3.3.0", "doctrine/dbal": "2.13.8", "doctrine/event-manager": "1.1.1", - "doctrine/orm": "2.12.1", - "doctrine/persistence": "2.5.1", + "doctrine/orm": "2.12.2", + "doctrine/persistence": "2.5.3", "elasticsearch/elasticsearch": "^7", "fig/link-util": "1.1.2", "friendsofphp/proxy-manager-lts": "1.0.7", diff --git a/composer.lock b/composer.lock index 27dd4e3ebdc..615c9ebea14 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "c247ccdda253d97c68ad3851acf5e190", + "content-hash": "8e92d789ab108cca1a8171f5cdae0fa4", "packages": [ { "name": "aws/aws-crt-php", @@ -523,16 +523,16 @@ }, { "name": "doctrine/cache", - "version": "1.12.1", + "version": "1.13.0", "source": { "type": "git", "url": "https://github.com/doctrine/cache.git", - "reference": "4cf401d14df219fa6f38b671f5493449151c9ad8" + "reference": "56cd022adb5514472cb144c087393c1821911d09" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/cache/zipball/4cf401d14df219fa6f38b671f5493449151c9ad8", - "reference": "4cf401d14df219fa6f38b671f5493449151c9ad8", + "url": "https://api.github.com/repos/doctrine/cache/zipball/56cd022adb5514472cb144c087393c1821911d09", + "reference": "56cd022adb5514472cb144c087393c1821911d09", "shasum": "" }, "require": { @@ -544,13 +544,13 @@ "require-dev": { "alcaeus/mongo-php-adapter": "^1.1", "cache/integration-tests": "dev-master", - "doctrine/coding-standard": "^8.0", + "doctrine/coding-standard": "^9", "mongodb/mongodb": "^1.1", - "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", "predis/predis": "~1.0", "psr/cache": "^1.0 || ^2.0 || ^3.0", - "symfony/cache": "^4.4 || ^5.2 || ^6.0@dev", - "symfony/var-exporter": "^4.4 || ^5.2 || ^6.0@dev" + "symfony/cache": "^4.4 || ^5.4 || ^6", + "symfony/var-exporter": "^4.4 || ^5.4 || ^6" }, "suggest": { "alcaeus/mongo-php-adapter": "Required to use legacy MongoDB driver" @@ -602,7 +602,7 @@ ], "support": { "issues": "https://github.com/doctrine/cache/issues", - "source": "https://github.com/doctrine/cache/tree/1.12.1" + "source": "https://github.com/doctrine/cache/tree/1.13.0" }, "funding": [ { @@ -618,7 +618,7 @@ "type": "tidelift" } ], - "time": "2021-07-17T14:39:21+00:00" + "time": "2022-05-20T20:06:54+00:00" }, { "name": "doctrine/collections", @@ -1264,16 +1264,16 @@ }, { "name": "doctrine/orm", - "version": "2.12.1", + "version": "2.12.2", "source": { "type": "git", "url": "https://github.com/doctrine/orm.git", - "reference": "2e4a8722721b934149ff53b191522a6829b6d73b" + "reference": "8291a7f09b12d14783ed6537b4586583d155869e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/orm/zipball/2e4a8722721b934149ff53b191522a6829b6d73b", - "reference": "2e4a8722721b934149ff53b191522a6829b6d73b", + "url": "https://api.github.com/repos/doctrine/orm/zipball/8291a7f09b12d14783ed6537b4586583d155869e", + "reference": "8291a7f09b12d14783ed6537b4586583d155869e", "shasum": "" }, "require": { @@ -1282,7 +1282,7 @@ "doctrine/collections": "^1.5", "doctrine/common": "^3.0.3", "doctrine/dbal": "^2.13.1 || ^3.2", - "doctrine/deprecations": "^0.5.3", + "doctrine/deprecations": "^0.5.3 || ^1", "doctrine/event-manager": "^1.1", "doctrine/inflector": "^1.4 || ^2.0", "doctrine/instantiator": "^1.3", @@ -1302,13 +1302,13 @@ "doctrine/annotations": "^1.13", "doctrine/coding-standard": "^9.0", "phpbench/phpbench": "^0.16.10 || ^1.0", - "phpstan/phpstan": "~1.4.10 || 1.5.0", - "phpunit/phpunit": "^7.5 || ^8.5 || ^9.4", + "phpstan/phpstan": "~1.4.10 || 1.6.3", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", "psr/log": "^1 || ^2 || ^3", "squizlabs/php_codesniffer": "3.6.2", "symfony/cache": "^4.4 || ^5.4 || ^6.0", "symfony/yaml": "^3.4 || ^4.0 || ^5.0 || ^6.0", - "vimeo/psalm": "4.22.0" + "vimeo/psalm": "4.23.0" }, "suggest": { "symfony/cache": "Provides cache support for Setup Tool with doctrine/cache 2.0", @@ -1357,28 +1357,28 @@ ], "support": { "issues": "https://github.com/doctrine/orm/issues", - "source": "https://github.com/doctrine/orm/tree/2.12.1" + "source": "https://github.com/doctrine/orm/tree/2.12.2" }, - "time": "2022-04-22T17:46:03+00:00" + "time": "2022-05-02T19:10:07+00:00" }, { "name": "doctrine/persistence", - "version": "2.5.1", + "version": "2.5.3", "source": { "type": "git", "url": "https://github.com/doctrine/persistence.git", - "reference": "4473480044c88f30e0e8288e7123b60c7eb9efa3" + "reference": "d7edf274b6d35ad82328e223439cc2bb2f92bd9e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/persistence/zipball/4473480044c88f30e0e8288e7123b60c7eb9efa3", - "reference": "4473480044c88f30e0e8288e7123b60c7eb9efa3", + "url": "https://api.github.com/repos/doctrine/persistence/zipball/d7edf274b6d35ad82328e223439cc2bb2f92bd9e", + "reference": "d7edf274b6d35ad82328e223439cc2bb2f92bd9e", "shasum": "" }, "require": { "doctrine/cache": "^1.11 || ^2.0", "doctrine/collections": "^1.0", - "doctrine/deprecations": "^0.5.3", + "doctrine/deprecations": "^0.5.3 || ^1", "doctrine/event-manager": "^1.0", "php": "^7.1 || ^8.0", "psr/cache": "^1.0 || ^2.0 || ^3.0" @@ -1445,9 +1445,23 @@ ], "support": { "issues": "https://github.com/doctrine/persistence/issues", - "source": "https://github.com/doctrine/persistence/tree/2.5.1" + "source": "https://github.com/doctrine/persistence/tree/2.5.3" }, - "time": "2022-04-14T21:47:17+00:00" + "funding": [ + { + "url": "https://www.doctrine-project.org/sponsorship.html", + "type": "custom" + }, + { + "url": "https://www.patreon.com/phpdoctrine", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/doctrine%2Fpersistence", + "type": "tidelift" + } + ], + "time": "2022-05-03T09:16:53+00:00" }, { "name": "elasticsearch/elasticsearch", From 9dcda4156586b775388107186ac8c9dbcf40f351 Mon Sep 17 00:00:00 2001 From: Michael Telgmann Date: Thu, 2 Jun 2022 16:22:57 +0200 Subject: [PATCH 033/730] SW-26686 - Update ProxyManager, Google Cloud storage and monolog dependencies --- UPGRADE-5.7.md | 6 ++--- composer.json | 6 ++--- composer.lock | 62 +++++++++++++++++++++++++++----------------------- 3 files changed, 40 insertions(+), 34 deletions(-) diff --git a/UPGRADE-5.7.md b/UPGRADE-5.7.md index f0510bd07c0..0fb61a17120 100644 --- a/UPGRADE-5.7.md +++ b/UPGRADE-5.7.md @@ -23,11 +23,11 @@ This changelog references changes done in Shopware 5.7 patch versions. * Updated `doctrine/orm` to version 2.12.2 * Updated `doctrine/persistence` to version 2.5.3 * Updated `elasticsearch/elasticsearch` to version 7.17.0 -* Updated `friendsofphp/proxy-manager-lts` to version 1.0.7 -* Updated `google/cloud-storage` to version 1.26.2 +* Updated `friendsofphp/proxy-manager-lts` to version 1.0.12 +* Updated `google/cloud-storage` to version 1.27.1 * Updated `guzzlehttp/guzzle` to version 7.4.2 * Updated `laminas/laminas-escaper` to version 2.10.0 -* Updated `monolog/monolog` to version 2.5.0 +* Updated `monolog/monolog` to version 2.6.0 * Updated `mpdf/mpdf` to version 8.1.1 * Updated `phpunit/phpunit` to version 9.5.20 * Updated `symfony/browser-kit` to version 4.4.37 diff --git a/composer.json b/composer.json index 6126c347b49..401c1f8436f 100644 --- a/composer.json +++ b/composer.json @@ -50,15 +50,15 @@ "doctrine/persistence": "2.5.3", "elasticsearch/elasticsearch": "^7", "fig/link-util": "1.1.2", - "friendsofphp/proxy-manager-lts": "1.0.7", - "google/cloud-storage": "1.26.2", + "friendsofphp/proxy-manager-lts": "1.0.12", + "google/cloud-storage": "1.27.1", "guzzlehttp/guzzle": "7.4.3", "guzzlehttp/psr7": "2.2.1", "laminas/laminas-code": "4.5.1", "laminas/laminas-escaper": "2.10.0", "league/flysystem": "~1.1.4", "league/flysystem-aws-s3-v3": "1.0.29", - "monolog/monolog": "2.5.0", + "monolog/monolog": "2.6.0", "mpdf/mpdf": "8.1.1", "ongr/elasticsearch-dsl": "7.2.2", "psr/link": "1.0.0", diff --git a/composer.lock b/composer.lock index 615c9ebea14..34b945a6cdd 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "8e92d789ab108cca1a8171f5cdae0fa4", + "content-hash": "6ba0011c11fa8435a00814e37c91dc78", "packages": [ { "name": "aws/aws-crt-php", @@ -1765,16 +1765,16 @@ }, { "name": "friendsofphp/proxy-manager-lts", - "version": "v1.0.7", + "version": "v1.0.12", "source": { "type": "git", "url": "https://github.com/FriendsOfPHP/proxy-manager-lts.git", - "reference": "c828ced1f932094ab79e4120a106a666565e4d9c" + "reference": "8419f0158715b30d4b99a5bd37c6a39671994ad7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FriendsOfPHP/proxy-manager-lts/zipball/c828ced1f932094ab79e4120a106a666565e4d9c", - "reference": "c828ced1f932094ab79e4120a106a666565e4d9c", + "url": "https://api.github.com/repos/FriendsOfPHP/proxy-manager-lts/zipball/8419f0158715b30d4b99a5bd37c6a39671994ad7", + "reference": "8419f0158715b30d4b99a5bd37c6a39671994ad7", "shasum": "" }, "require": { @@ -1831,7 +1831,7 @@ ], "support": { "issues": "https://github.com/FriendsOfPHP/proxy-manager-lts/issues", - "source": "https://github.com/FriendsOfPHP/proxy-manager-lts/tree/v1.0.7" + "source": "https://github.com/FriendsOfPHP/proxy-manager-lts/tree/v1.0.12" }, "funding": [ { @@ -1843,7 +1843,7 @@ "type": "tidelift" } ], - "time": "2022-03-02T09:29:19+00:00" + "time": "2022-05-05T09:31:05+00:00" }, { "name": "google/auth", @@ -1970,16 +1970,16 @@ }, { "name": "google/cloud-storage", - "version": "v1.26.2", + "version": "v1.27.1", "source": { "type": "git", "url": "https://github.com/googleapis/google-cloud-php-storage.git", - "reference": "a515dc6f80bee00ded6364626953b3b8de15c303" + "reference": "f66d228d5991674c015bd32e5ed8d857d9d8352d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-cloud-php-storage/zipball/a515dc6f80bee00ded6364626953b3b8de15c303", - "reference": "a515dc6f80bee00ded6364626953b3b8de15c303", + "url": "https://api.github.com/repos/googleapis/google-cloud-php-storage/zipball/f66d228d5991674c015bd32e5ed8d857d9d8352d", + "reference": "f66d228d5991674c015bd32e5ed8d857d9d8352d", "shasum": "" }, "require": { @@ -1989,10 +1989,11 @@ "require-dev": { "erusev/parsedown": "^1.6", "google/cloud-pubsub": "^1.0", - "phpdocumentor/reflection": "^3.0", - "phpseclib/phpseclib": "^2", - "phpunit/phpunit": "^4.8|^5.0", - "squizlabs/php_codesniffer": "2.*" + "phpdocumentor/reflection": "^3.0||^4.0", + "phpseclib/phpseclib": "^2.0||^3.0", + "phpunit/phpunit": "^4.8|^5.0|^8.0", + "squizlabs/php_codesniffer": "2.*", + "yoast/phpunit-polyfills": "^1.0" }, "suggest": { "google/cloud-pubsub": "May be used to register a topic to receive bucket notifications.", @@ -2018,9 +2019,9 @@ ], "description": "Cloud Storage Client for PHP", "support": { - "source": "https://github.com/googleapis/google-cloud-php-storage/tree/v1.26.2" + "source": "https://github.com/googleapis/google-cloud-php-storage/tree/v1.27.1" }, - "time": "2022-04-20T18:34:50+00:00" + "time": "2022-06-02T21:53:43+00:00" }, { "name": "google/crc32", @@ -2722,16 +2723,16 @@ }, { "name": "monolog/monolog", - "version": "2.5.0", + "version": "2.6.0", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "4192345e260f1d51b365536199744b987e160edc" + "reference": "247918972acd74356b0a91dfaa5adcaec069b6c0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/4192345e260f1d51b365536199744b987e160edc", - "reference": "4192345e260f1d51b365536199744b987e160edc", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/247918972acd74356b0a91dfaa5adcaec069b6c0", + "reference": "247918972acd74356b0a91dfaa5adcaec069b6c0", "shasum": "" }, "require": { @@ -2744,18 +2745,23 @@ "require-dev": { "aws/aws-sdk-php": "^2.4.9 || ^3.0", "doctrine/couchdb": "~1.0@dev", - "elasticsearch/elasticsearch": "^7", + "elasticsearch/elasticsearch": "^7 || ^8", + "ext-json": "*", "graylog2/gelf-php": "^1.4.2", + "guzzlehttp/guzzle": "^7.4", + "guzzlehttp/psr7": "^2.2", "mongodb/mongodb": "^1.8", "php-amqplib/php-amqplib": "~2.4 || ^3", "php-console/php-console": "^3.1.3", - "phpspec/prophecy": "^1.6.1", + "phpspec/prophecy": "^1.15", "phpstan/phpstan": "^0.12.91", - "phpunit/phpunit": "^8.5", + "phpunit/phpunit": "^8.5.14", "predis/predis": "^1.1", "rollbar/rollbar": "^1.3 || ^2 || ^3", - "ruflin/elastica": ">=0.90@dev", - "swiftmailer/swiftmailer": "^5.3|^6.0" + "ruflin/elastica": "^7", + "swiftmailer/swiftmailer": "^5.3|^6.0", + "symfony/mailer": "^5.4 || ^6", + "symfony/mime": "^5.4 || ^6" }, "suggest": { "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB", @@ -2805,7 +2811,7 @@ ], "support": { "issues": "https://github.com/Seldaek/monolog/issues", - "source": "https://github.com/Seldaek/monolog/tree/2.5.0" + "source": "https://github.com/Seldaek/monolog/tree/2.6.0" }, "funding": [ { @@ -2817,7 +2823,7 @@ "type": "tidelift" } ], - "time": "2022-04-08T15:43:54+00:00" + "time": "2022-05-10T09:36:00+00:00" }, { "name": "mpdf/mpdf", From 1fc0a93b3a55b975bc7d2800a570607d0ee27c4f Mon Sep 17 00:00:00 2001 From: Tino Vogel Date: Fri, 6 May 2022 08:24:13 +0200 Subject: [PATCH 034/730] SW-26721 - Fix redirect to external links configured in categories fixes https://github.com/shopware/shopware/pull/2494 --- .../Shopware/Controllers/Frontend/Listing.php | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/engine/Shopware/Controllers/Frontend/Listing.php b/engine/Shopware/Controllers/Frontend/Listing.php index c81064a75aa..8981b38f7a5 100644 --- a/engine/Shopware/Controllers/Frontend/Listing.php +++ b/engine/Shopware/Controllers/Frontend/Listing.php @@ -118,7 +118,7 @@ public function indexAction(Request $request, ShopContextInterface $shopContext) ); $location = $this->getRedirectLocation($categoryContent, $emotionConfiguration['hasEmotion'], $shopContext); - if (!empty($location)) { + if (null !== $location) { $this->redirect($location, ['code' => 301]); return; @@ -331,19 +331,21 @@ private function hasProducts(int $categoryId, ShopContextInterface $context, ?in /** * @param array $categoryContent * - * @return array{controller?: string, sArticle?: int} + * @return string|null */ - private function getRedirectLocation(array $categoryContent, bool $hasEmotion, ShopContextInterface $context): array + private function getRedirectLocation(array $categoryContent, bool $hasEmotion, ShopContextInterface $context): ?string { - $location = []; + if (!empty($categoryContent['external'])) { + return $categoryContent['external']; + } + + if ($this->isShopsBaseCategoryPage($categoryContent['id'])) { + return $this->Front()->Router()->assemble(['controller' => 'index']); + } $checkRedirect = ($hasEmotion && $this->Request()->getParam('sPage')) || (!$hasEmotion); - if (!empty($categoryContent['external'])) { - $location = $categoryContent['external']; - } elseif ($this->isShopsBaseCategoryPage($categoryContent['id'])) { - $location = ['controller' => 'index']; - } elseif ($checkRedirect && $this->config->get('categoryDetailLink')) { + if ($checkRedirect && $this->config->get('categoryDetailLink')) { $criteria = $this->storeFrontCriteriaFactory->createListingCriteria($this->Request(), $context); $criteria->resetFacets() @@ -358,11 +360,15 @@ private function getRedirectLocation(array $categoryContent, bool $hasEmotion, S if (\count($result->getProducts()) === 1) { $products = $result->getProducts(); $first = array_shift($products); - $location = ['controller' => 'detail', 'sArticle' => $first->getId()]; + + return $this->Front()->Router()->assemble([ + 'controller' => 'detail', + 'sArticle' => $first->getId() + ]); } } - return $location; + return null; } /** From 17876827647f9c626acfacb297bea92599298c4e Mon Sep 17 00:00:00 2001 From: Rafael Prukop Date: Tue, 10 May 2022 14:48:09 +0200 Subject: [PATCH 035/730] SW-26723 - Fix typo in modernizr path in template fixes https://github.com/shopware/shopware/pull/2496 --- themes/Frontend/Bare/frontend/index/header.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/themes/Frontend/Bare/frontend/index/header.tpl b/themes/Frontend/Bare/frontend/index/header.tpl index 59343dd2089..d76fa89fb6b 100644 --- a/themes/Frontend/Bare/frontend/index/header.tpl +++ b/themes/Frontend/Bare/frontend/index/header.tpl @@ -106,7 +106,7 @@ {* Add Modernizr in the ""-element to have all the classes before the page was rendered *} {block name="frontend_index_header_javascript_modernizr_lib"} {if !$theme.asyncJavascriptLoading} - + {/if} {/block} From 692995544cb64229cc756620ebe37f68d80a1967 Mon Sep 17 00:00:00 2001 From: Michael Telgmann Date: Fri, 3 Jun 2022 10:45:36 +0200 Subject: [PATCH 036/730] SW-26721 - Add tests and improve code quality --- .phpstan-baseline.neon | 215 ------------------ .../Enlight/Components/Test/TestCase.php | 2 +- .../Shopware/Controllers/Frontend/Listing.php | 82 ++++--- engine/Shopware/Core/sCategories.php | 2 +- .../AccountBundle/Controller/RegisterTest.php | 172 +++++++------- .../Controllers/Backend/NewsletterTest.php | 16 +- .../Controllers/Frontend/ListingTest.php | 110 +++++++-- 7 files changed, 238 insertions(+), 361 deletions(-) diff --git a/.phpstan-baseline.neon b/.phpstan-baseline.neon index 1f2abfeaf1c..c583c197533 100644 --- a/.phpstan-baseline.neon +++ b/.phpstan-baseline.neon @@ -28000,41 +28000,6 @@ parameters: count: 1 path: engine/Shopware/Controllers/Frontend/Index.php - - - message: "#^Cannot call method getId\\(\\) on Shopware\\\\Models\\\\Category\\\\Category\\|null\\.$#" - count: 2 - path: engine/Shopware/Controllers/Frontend/Listing.php - - - - message: "#^Method Shopware_Controllers_Frontend_Listing\\:\\:filterListingEmotions\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: engine/Shopware/Controllers/Frontend/Listing.php - - - - message: "#^Method Shopware_Controllers_Frontend_Listing\\:\\:getBreadcrumb\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: engine/Shopware/Controllers/Frontend/Listing.php - - - - message: "#^Method Shopware_Controllers_Frontend_Listing\\:\\:getEmotionConfiguration\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: engine/Shopware/Controllers/Frontend/Listing.php - - - - message: "#^Method Shopware_Controllers_Frontend_Listing\\:\\:hasListing\\(\\) has parameter \\$devicesWithEmotion with no value type specified in iterable type array\\.$#" - count: 1 - path: engine/Shopware/Controllers/Frontend/Listing.php - - - - message: "#^Offset 'streamId' does not exist on array\\|null\\.$#" - count: 1 - path: engine/Shopware/Controllers/Frontend/Listing.php - - - - message: "#^Variable \\$showListing in empty\\(\\) always exists and is not falsy\\.$#" - count: 1 - path: engine/Shopware/Controllers/Frontend/Listing.php - - message: "#^Method Shopware_Controllers_Frontend_Media\\:\\:fallbackAction\\(\\) has no return type specified\\.$#" count: 1 @@ -30205,11 +30170,6 @@ parameters: count: 1 path: engine/Shopware/Core/sCategories.php - - - message: "#^Method sCategories\\:\\:sGetCategoriesByParent\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: engine/Shopware/Core/sCategories.php - - message: "#^Method sCategories\\:\\:sGetCategoriesByParentId\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 @@ -40245,176 +40205,6 @@ parameters: count: 1 path: tests/Functional/Bundle/AccountBundle/Controller/AddressTest.php - - - message: "#^Cannot access offset 'data' on array\\\\|false\\.$#" - count: 2 - path: tests/Functional/Bundle/AccountBundle/Controller/RegisterTest.php - - - - message: "#^Cannot access offset 'doubleOptinEmailSen…' on array\\\\|false\\.$#" - count: 2 - path: tests/Functional/Bundle/AccountBundle/Controller/RegisterTest.php - - - - message: "#^Cannot access offset 'hash' on array\\\\|false\\.$#" - count: 1 - path: tests/Functional/Bundle/AccountBundle/Controller/RegisterTest.php - - - - message: "#^Cannot access offset 'id' on array\\\\|false\\.$#" - count: 1 - path: tests/Functional/Bundle/AccountBundle/Controller/RegisterTest.php - - - - message: "#^Cannot access offset 'type' on array\\\\|false\\.$#" - count: 1 - path: tests/Functional/Bundle/AccountBundle/Controller/RegisterTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Bundle\\\\AccountBundle\\\\Controller\\\\RegisterTest\\:\\:assertAddress\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Bundle/AccountBundle/Controller/RegisterTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Bundle\\\\AccountBundle\\\\Controller\\\\RegisterTest\\:\\:assertAddress\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#" - count: 1 - path: tests/Functional/Bundle/AccountBundle/Controller/RegisterTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Bundle\\\\AccountBundle\\\\Controller\\\\RegisterTest\\:\\:deleteCustomer\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Bundle/AccountBundle/Controller/RegisterTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Bundle\\\\AccountBundle\\\\Controller\\\\RegisterTest\\:\\:deleteCustomer\\(\\) has parameter \\$email with no type specified\\.$#" - count: 1 - path: tests/Functional/Bundle/AccountBundle/Controller/RegisterTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Bundle\\\\AccountBundle\\\\Controller\\\\RegisterTest\\:\\:doubleOptinSet\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Bundle/AccountBundle/Controller/RegisterTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Bundle\\\\AccountBundle\\\\Controller\\\\RegisterTest\\:\\:getBillingData\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Bundle/AccountBundle/Controller/RegisterTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Bundle\\\\AccountBundle\\\\Controller\\\\RegisterTest\\:\\:getBillingData\\(\\) has parameter \\$data with no type specified\\.$#" - count: 1 - path: tests/Functional/Bundle/AccountBundle/Controller/RegisterTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Bundle\\\\AccountBundle\\\\Controller\\\\RegisterTest\\:\\:getPersonalData\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#" - count: 1 - path: tests/Functional/Bundle/AccountBundle/Controller/RegisterTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Bundle\\\\AccountBundle\\\\Controller\\\\RegisterTest\\:\\:getPersonalData\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: tests/Functional/Bundle/AccountBundle/Controller/RegisterTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Bundle\\\\AccountBundle\\\\Controller\\\\RegisterTest\\:\\:getShippingData\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Bundle/AccountBundle/Controller/RegisterTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Bundle\\\\AccountBundle\\\\Controller\\\\RegisterTest\\:\\:getShippingData\\(\\) has parameter \\$data with no type specified\\.$#" - count: 1 - path: tests/Functional/Bundle/AccountBundle/Controller/RegisterTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Bundle\\\\AccountBundle\\\\Controller\\\\RegisterTest\\:\\:sendRequestAndAssertCustomer\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Bundle/AccountBundle/Controller/RegisterTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Bundle\\\\AccountBundle\\\\Controller\\\\RegisterTest\\:\\:sendRequestAndAssertCustomer\\(\\) has parameter \\$billing with no type specified\\.$#" - count: 1 - path: tests/Functional/Bundle/AccountBundle/Controller/RegisterTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Bundle\\\\AccountBundle\\\\Controller\\\\RegisterTest\\:\\:sendRequestAndAssertCustomer\\(\\) has parameter \\$email with no type specified\\.$#" - count: 1 - path: tests/Functional/Bundle/AccountBundle/Controller/RegisterTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Bundle\\\\AccountBundle\\\\Controller\\\\RegisterTest\\:\\:sendRequestAndAssertCustomer\\(\\) has parameter \\$personal with no type specified\\.$#" - count: 1 - path: tests/Functional/Bundle/AccountBundle/Controller/RegisterTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Bundle\\\\AccountBundle\\\\Controller\\\\RegisterTest\\:\\:sendRequestAndAssertCustomer\\(\\) has parameter \\$shipping with no type specified\\.$#" - count: 1 - path: tests/Functional/Bundle/AccountBundle/Controller/RegisterTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Bundle\\\\AccountBundle\\\\Controller\\\\RegisterTest\\:\\:sendRequestAndAssertCustomerWithDoubleOptIn\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Bundle/AccountBundle/Controller/RegisterTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Bundle\\\\AccountBundle\\\\Controller\\\\RegisterTest\\:\\:sendRequestAndAssertCustomerWithDoubleOptIn\\(\\) has parameter \\$email with no type specified\\.$#" - count: 1 - path: tests/Functional/Bundle/AccountBundle/Controller/RegisterTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Bundle\\\\AccountBundle\\\\Controller\\\\RegisterTest\\:\\:sendRequestAndAssertDOIConfirmation\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Bundle/AccountBundle/Controller/RegisterTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Bundle\\\\AccountBundle\\\\Controller\\\\RegisterTest\\:\\:sendRequestAndAssertDOIConfirmation\\(\\) has parameter \\$email with no type specified\\.$#" - count: 1 - path: tests/Functional/Bundle/AccountBundle/Controller/RegisterTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Bundle\\\\AccountBundle\\\\Controller\\\\RegisterTest\\:\\:sendRequestAndAssertDOIConfirmation\\(\\) has parameter \\$hash with no type specified\\.$#" - count: 1 - path: tests/Functional/Bundle/AccountBundle/Controller/RegisterTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Bundle\\\\AccountBundle\\\\Controller\\\\RegisterTest\\:\\:testCompanyRegistration\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Bundle/AccountBundle/Controller/RegisterTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Bundle\\\\AccountBundle\\\\Controller\\\\RegisterTest\\:\\:testDefaultPayment\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Bundle/AccountBundle/Controller/RegisterTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Bundle\\\\AccountBundle\\\\Controller\\\\RegisterTest\\:\\:testDoubleOptInRegistration\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Bundle/AccountBundle/Controller/RegisterTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Bundle\\\\AccountBundle\\\\Controller\\\\RegisterTest\\:\\:testFastRegistration\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Bundle/AccountBundle/Controller/RegisterTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Bundle\\\\AccountBundle\\\\Controller\\\\RegisterTest\\:\\:testRegistrationWithShipping\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Bundle/AccountBundle/Controller/RegisterTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Bundle\\\\AccountBundle\\\\Controller\\\\RegisterTest\\:\\:testSimpleRegistration\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Bundle/AccountBundle/Controller/RegisterTest.php - - - - message: "#^Parameter \\#2 \\$array of static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertArrayHasKey\\(\\) expects array\\|ArrayAccess, array\\\\|false given\\.$#" - count: 2 - path: tests/Functional/Bundle/AccountBundle/Controller/RegisterTest.php - - - - message: "#^Parameter \\#2 \\$string of static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertStringEndsWith\\(\\) expects string, string\\|null given\\.$#" - count: 1 - path: tests/Functional/Bundle/AccountBundle/Controller/RegisterTest.php - - message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertNull\\(\\) with int will always evaluate to false\\.$#" count: 1 @@ -43985,11 +43775,6 @@ parameters: count: 1 path: tests/Functional/Controllers/Backend/MediaManagerTest.php - - - message: "#^Parameter \\#2 \\$string of static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertMatchesRegularExpression\\(\\) expects string, array\\|string\\|null given\\.$#" - count: 2 - path: tests/Functional/Controllers/Backend/NewsletterTest.php - - message: "#^Access to an undefined property Enlight_View_Default\\:\\:\\$data\\.$#" count: 1 diff --git a/engine/Library/Enlight/Components/Test/TestCase.php b/engine/Library/Enlight/Components/Test/TestCase.php index 6da3b1c39f9..729d28c4e69 100644 --- a/engine/Library/Enlight/Components/Test/TestCase.php +++ b/engine/Library/Enlight/Components/Test/TestCase.php @@ -50,7 +50,7 @@ protected function tearDown(): void /** * Allows to set a Shopware config * - * @param bool|string|null $value + * @param bool|float|int|string|null $value */ protected function setConfig(string $name, $value): void { diff --git a/engine/Shopware/Controllers/Frontend/Listing.php b/engine/Shopware/Controllers/Frontend/Listing.php index 8981b38f7a5..2a82a3913e3 100644 --- a/engine/Shopware/Controllers/Frontend/Listing.php +++ b/engine/Shopware/Controllers/Frontend/Listing.php @@ -40,9 +40,11 @@ use Shopware\Components\ProductStream\CriteriaFactoryInterface; use Shopware\Components\ProductStream\FacetFilterInterface; use Shopware\Components\ProductStream\RepositoryInterface as ProductStreamRepositoryInterface; +use Shopware\Models\Category\Category; use Shopware\Models\Category\Repository as CategoryRepository; use Shopware\Models\CustomerStream\CustomerStreamRepositoryInterface; use Shopware\Models\Emotion\Emotion; +use Symfony\Component\HttpFoundation\Response; class Shopware_Controllers_Frontend_Listing extends Enlight_Controller_Action { @@ -118,8 +120,8 @@ public function indexAction(Request $request, ShopContextInterface $shopContext) ); $location = $this->getRedirectLocation($categoryContent, $emotionConfiguration['hasEmotion'], $shopContext); - if (null !== $location) { - $this->redirect($location, ['code' => 301]); + if (\is_string($location)) { + $this->redirect($location, ['code' => Response::HTTP_MOVED_PERMANENTLY]); return; } @@ -156,7 +158,7 @@ public function layoutAction(Request $request) $categoryContent = Shopware()->Modules()->Categories()->sGetCategoryContent($categoryId); - $config = $this->getEmotionConfiguration($categoryId, true, $categoryContent['streamId']); + $config = $this->getEmotionConfiguration($categoryId, true, $categoryContent['streamId'] ?? null); $config = array_merge($config, [ 'sBanner' => Shopware()->Modules()->Marketing()->sBanner($categoryId), @@ -257,7 +259,7 @@ public function manufacturerAction(ShopContextInterface $context) * * @param int $categoryId * - * @return array listing breadcrumb + * @return array listing breadcrumb * * @deprecated in 5.6, will be private in 5.8 */ @@ -275,7 +277,7 @@ public function getBreadcrumb($categoryId) * @param bool $withStreams * @param int $streamId * - * @return array{emotions: array, hasEmotion: bool, showListing: bool, isHomePage: bool, showListingButton: bool} + * @return array{emotions: array>, hasEmotion: bool, showListing: bool, isHomePage: bool, showListingButton: bool} */ protected function getEmotionConfiguration($categoryId, $withStreams = false, $streamId = null) { @@ -330,12 +332,10 @@ private function hasProducts(int $categoryId, ShopContextInterface $context, ?in /** * @param array $categoryContent - * - * @return string|null */ private function getRedirectLocation(array $categoryContent, bool $hasEmotion, ShopContextInterface $context): ?string { - if (!empty($categoryContent['external'])) { + if (\is_string($categoryContent['external']) && $categoryContent['external'] !== '') { return $categoryContent['external']; } @@ -345,30 +345,29 @@ private function getRedirectLocation(array $categoryContent, bool $hasEmotion, S $checkRedirect = ($hasEmotion && $this->Request()->getParam('sPage')) || (!$hasEmotion); - if ($checkRedirect && $this->config->get('categoryDetailLink')) { - $criteria = $this->storeFrontCriteriaFactory->createListingCriteria($this->Request(), $context); - - $criteria->resetFacets() - ->resetConditions() - ->resetSorting() - ->offset(0) - ->limit(2) - ->setFetchCount(false); - - $result = $this->productNumberSearch->search($criteria, $context); - - if (\count($result->getProducts()) === 1) { - $products = $result->getProducts(); - $first = array_shift($products); + if (!$checkRedirect || !$this->config->get('categoryDetailLink')) { + return null; + } - return $this->Front()->Router()->assemble([ - 'controller' => 'detail', - 'sArticle' => $first->getId() - ]); - } + $criteria = $this->storeFrontCriteriaFactory->createListingCriteria($this->Request(), $context); + $criteria->resetFacets() + ->resetConditions() + ->resetSorting() + ->offset(0) + ->limit(2) + ->setFetchCount(false); + $result = $this->productNumberSearch->search($criteria, $context); + if (\count($result->getProducts()) !== 1) { + return null; } - return null; + $products = $result->getProducts(); + $firstProducts = array_shift($products); + + return $this->Front()->Router()->assemble([ + 'controller' => 'detail', + 'sArticle' => $firstProducts->getId(), + ]); } /** @@ -404,7 +403,12 @@ private function getSeoDataOfManufacturer(Manufacturer $manufacturer): array */ private function isValidCategoryPath(int $categoryId): bool { - $defaultShopCategoryId = Shopware()->Shop()->getCategory()->getId(); + $category = $this->get('shop')->getCategory(); + if (!$category instanceof Category) { + return false; + } + + $defaultShopCategoryId = $category->getId(); $categoryPath = $this->categoryRepository->getPathById($categoryId); @@ -414,7 +418,7 @@ private function isValidCategoryPath(int $categoryId): bool if (!\array_key_exists($defaultShopCategoryId, $categoryPath)) { $this->Request()->setQuery('sCategory', $defaultShopCategoryId); - $this->Response()->setStatusCode(404); + $this->Response()->setStatusCode(Response::HTTP_NOT_FOUND); return false; } @@ -428,7 +432,12 @@ private function isValidCategoryPath(int $categoryId): bool */ private function isShopsBaseCategoryPage(int $categoryId): bool { - $defaultShopCategoryId = Shopware()->Shop()->getCategory()->getId(); + $category = $this->get('shop')->getCategory(); + if (!$category instanceof Category) { + return false; + } + + $defaultShopCategoryId = $category->getId(); $queryParamsWhiteList = ['controller', 'action', 'sCategory', 'sViewport', 'rewriteUrl', 'module']; $queryParamsNames = array_keys($this->Request()->getParams()); @@ -440,7 +449,8 @@ private function isShopsBaseCategoryPage(int $categoryId): bool /** * Determines if the product listing has to be loaded/shown at all * - * @param array $emotions + * @param array> $emotions + * @param array $devicesWithEmotion */ private function hasListing(array $emotions, array $devicesWithEmotion): bool { @@ -482,7 +492,7 @@ private function hasListing(array $emotions, array $devicesWithEmotion): bool * * @param array $emotions * - * @return int[] + * @return array */ private function getDevicesWithListing(array $emotions): array { @@ -659,7 +669,9 @@ private function loadListing(array $emotionConfiguration, Request $request): boo } /** - * @param array $emotions + * @param array> $emotions + * + * @return array> */ private function filterListingEmotions(array $emotions): array { diff --git a/engine/Shopware/Core/sCategories.php b/engine/Shopware/Core/sCategories.php index 1c278ea11ac..0a34b4d64d8 100644 --- a/engine/Shopware/Core/sCategories.php +++ b/engine/Shopware/Core/sCategories.php @@ -275,7 +275,7 @@ public function sGetMainCategories() * * @param int $id Id of the category * - * @return array Array of categories in path + * @return array Array of categories in path */ public function sGetCategoriesByParent($id) { diff --git a/tests/Functional/Bundle/AccountBundle/Controller/RegisterTest.php b/tests/Functional/Bundle/AccountBundle/Controller/RegisterTest.php index c0ab8c43df7..aa6991578ad 100644 --- a/tests/Functional/Bundle/AccountBundle/Controller/RegisterTest.php +++ b/tests/Functional/Bundle/AccountBundle/Controller/RegisterTest.php @@ -1,4 +1,6 @@ Container()->get(\Doctrine\DBAL\Connection::class)->beginTransaction(); - $this->deleteCustomer(self::TEST_MAIL); - Shopware()->Container()->get(\Shopware\Components\Model\ModelManager::class)->clear(); + $this->getContainer()->get(Connection::class)->beginTransaction(); + $this->deleteCustomer(); + $this->getContainer()->get(ModelManager::class)->clear(); } protected function tearDown(): void { parent::tearDown(); - Shopware()->Container()->get(\Doctrine\DBAL\Connection::class)->rollback(); - $this->deleteCustomer(self::TEST_MAIL); - Shopware()->Container()->get(\Shopware\Components\Model\ModelManager::class)->clear(); + $this->getContainer()->get(Connection::class)->rollBack(); + $this->deleteCustomer(); + $this->getContainer()->get(ModelManager::class)->clear(); } - public function testSimpleRegistration() + public function testSimpleRegistration(): void { $this->Request()->setMethod('POST'); $this->Request()->setPost([ @@ -71,7 +75,6 @@ public function testSimpleRegistration() ]); $this->sendRequestAndAssertCustomer( - self::TEST_MAIL, [ 'firstname' => 'first name', 'lastname' => 'last name', @@ -93,7 +96,7 @@ public function testSimpleRegistration() ); } - public function testDoubleOptInRegistration() + public function testDoubleOptInRegistration(): void { $this->Request()->setMethod('POST'); $this->Request()->setPost([ @@ -103,10 +106,10 @@ public function testDoubleOptInRegistration() ], ]); - $this->sendRequestAndAssertCustomerWithDoubleOptIn(self::TEST_MAIL); + $this->sendRequestAndAssertCustomerWithDoubleOptIn(); } - public function testRegistrationWithShipping() + public function testRegistrationWithShipping(): void { $this->Request()->setMethod('POST'); $this->Request()->setPost([ @@ -120,7 +123,6 @@ public function testRegistrationWithShipping() ]); $this->sendRequestAndAssertCustomer( - self::TEST_MAIL, ['firstname' => 'first name'], ['street' => 'street'], [ @@ -137,7 +139,7 @@ public function testRegistrationWithShipping() ); } - public function testCompanyRegistration() + public function testCompanyRegistration(): void { $this->Request()->setMethod('POST'); $this->Request()->setPost([ @@ -154,7 +156,6 @@ public function testCompanyRegistration() ]); $this->sendRequestAndAssertCustomer( - self::TEST_MAIL, [ 'firstname' => 'first name', ], @@ -167,7 +168,7 @@ public function testCompanyRegistration() ); } - public function testFastRegistration() + public function testFastRegistration(): void { $this->Request()->setMethod('POST'); $this->Request()->setPost([ @@ -181,7 +182,6 @@ public function testFastRegistration() ]); $this->sendRequestAndAssertCustomer( - self::TEST_MAIL, [ 'firstname' => 'first name', 'lastname' => 'last name', @@ -198,9 +198,9 @@ public function testFastRegistration() ); } - public function testDefaultPayment() + public function testDefaultPayment(): void { - Shopware()->Session()->offsetSet('sPaymentID', 6); + $this->getContainer()->get('session')->offsetSet('sPaymentID', 6); $this->Request()->setMethod('POST'); $this->Request()->setPost([ @@ -211,7 +211,6 @@ public function testDefaultPayment() ]); $this->sendRequestAndAssertCustomer( - self::TEST_MAIL, [ 'firstname' => 'first name', 'paymentID' => 6, @@ -228,26 +227,31 @@ public function testDefaultPayment() ); } - private function sendRequestAndAssertCustomer($email, $personal, $billing = [], $shipping = []) + /** + * @param array $personal + * @param array $billing + * @param array $shipping + */ + private function sendRequestAndAssertCustomer(array $personal, array $billing = [], array $shipping = []): void { - $this->doubleOptinSet(false); + $this->doubleOptInSet(false); $response = $this->dispatch(self::SAVE_URL); static::assertEquals(302, $response->getHttpResponseCode()); static::assertStringEndsWith( '/account', - $this->getHeaderLocation($response) + $this->getHeaderLocation($response) ?? '' ); - $session = Shopware()->Container()->get('session'); - static::assertNotEmpty($session->offsetGet('sUserId')); + $session = $this->getContainer()->get('session'); + static::assertNotEmpty($session->get('sUserId')); - $customer = Shopware()->Container()->get(\Doctrine\DBAL\Connection::class)->fetchAssoc( + $customer = $this->getContainer()->get(Connection::class)->fetchAssociative( 'SELECT * FROM s_user WHERE email = :mail AND active = 1 AND doubleOptinEmailSentDate IS NULL LIMIT 1', - [':mail' => $email] + [':mail' => self::TEST_MAIL] ); - static::assertNotEmpty($customer); + static::assertIsArray($customer); if (!empty($personal)) { foreach ($personal as $key => $value) { @@ -257,99 +261,98 @@ private function sendRequestAndAssertCustomer($email, $personal, $billing = [], } if (!empty($billing)) { - $this->assertAddress($email, $billing); + $this->assertAddress(self::TEST_MAIL, $billing); } if (!empty($shipping)) { - $this->assertAddress($email, $shipping, 'shipping'); + $this->assertAddress(self::TEST_MAIL, $shipping, 'shipping'); } } - private function sendRequestAndAssertCustomerWithDoubleOptIn($email) + private function sendRequestAndAssertCustomerWithDoubleOptIn(): void { - $this->doubleOptinSet(true); + $this->doubleOptInSet(true); $this->dispatch(self::SAVE_URL); - /** @var Connection $connection */ - $connection = Shopware()->Container()->get(\Doctrine\DBAL\Connection::class); + $connection = $this->getContainer()->get(Connection::class); - $customer = $connection->fetchAssoc( + $customer = $connection->fetchAssociative( 'SELECT id, doubleOptinEmailSentDate FROM s_user WHERE email = :mail AND active = 0 AND doubleOptinEmailSentDate IS NOT NULL LIMIT 1', - [':mail' => $email] + [':mail' => self::TEST_MAIL] ); - static::assertNotEmpty($customer); + static::assertIsArray($customer); - $optin = $connection->fetchAssoc( + $optIn = $connection->fetchAssociative( 'SELECT type, data, hash FROM s_core_optin WHERE datum = :datum LIMIT 1', [':datum' => $customer['doubleOptinEmailSentDate']] ); + static::assertIsArray($optIn); - static::assertNotEmpty($optin); - static::assertEquals('swRegister', $optin['type']); - static::assertNotEmpty($optin['data']); + static::assertNotEmpty($optIn); + static::assertEquals('swRegister', $optIn['type']); + static::assertNotEmpty($optIn['data']); - $data = unserialize($optin['data']); + $data = unserialize($optIn['data']); static::assertEquals($customer['id'], $data['customerId']); - $this->sendRequestAndAssertDOIConfirmation($email, $optin['hash']); + $this->sendRequestAndAssertDOIConfirmation($optIn['hash']); } - private function sendRequestAndAssertDOIConfirmation($email, $hash) + private function sendRequestAndAssertDOIConfirmation(string $hash): void { - /** @var Connection $connection */ - $connection = Shopware()->Container()->get(\Doctrine\DBAL\Connection::class); + $connection = $this->getContainer()->get(Connection::class); // Create broken data $connection->executeQuery( 'INSERT INTO s_core_optin (type, datum, hash, data) - SELECT type, (datum - INTERVAL 1 MINUTE), CONCAT(hash,\'X\'), \'I am definitly not working\' + SELECT type, (datum - INTERVAL 1 MINUTE), CONCAT(hash,\'X\'), \'I am definitely not working\' FROM s_core_optin WHERE hash = :hash', [':hash' => $hash] ); $this->reset(); - $this->doubleOptinSet(true); + $this->doubleOptInSet(true); $this->dispatch(self::CONFIRM_URL_PREFIX . $hash); - $customer = $connection->fetchAssoc( + $customer = $connection->fetchAssociative( 'SELECT doubleOptinEmailSentDate FROM s_user WHERE email = :mail AND active = 1 AND doubleOptinEmailSentDate IS NOT NULL AND doubleOptinConfirmDate IS NOT NULL LIMIT 1', - [':mail' => $email] + [':mail' => self::TEST_MAIL] ); - static::assertNotEmpty($customer); + static::assertIsArray($customer); - $optin = $connection->fetchAssoc( + $optIn = $connection->fetchAssociative( 'SELECT * FROM s_core_optin WHERE datum = :datum LIMIT 1', [':datum' => $customer['doubleOptinEmailSentDate']] ); - static::assertEmpty($optin); + static::assertFalse($optIn); // Test broken data $this->reset(); - $this->doubleOptinSet(true); + $this->doubleOptInSet(true); $this->expectException(InvalidArgumentException::class); $this->dispatch(self::CONFIRM_URL_PREFIX . $hash . 'X'); } - private function deleteCustomer($email) + private function deleteCustomer(): void { - Shopware()->Container()->get(\Doctrine\DBAL\Connection::class)->executeQuery( + $this->getContainer()->get(Connection::class)->executeQuery( 'DELETE FROM s_user WHERE email = :mail', - [':mail' => $email] + [':mail' => self::TEST_MAIL] ); } /** - * @param array $data + * @param array $data * - * @return array + * @return array */ - private function getPersonalData($data = []) + private function getPersonalData(array $data = []): array { return array_merge([ 'salutation' => 'mr', 'customer_type' => Customer::CUSTOMER_TYPE_PRIVATE, - 'password' => 'defaultpassword', + 'password' => 'defaultPassword', 'email' => self::TEST_MAIL, 'firstname' => 'first name', 'lastname' => 'last name', @@ -357,7 +360,12 @@ private function getPersonalData($data = []) ], $data); } - private function getShippingData($data = []) + /** + * @param array $data + * + * @return array + */ + private function getShippingData(array $data = []): array { return array_merge([ 'salutation' => 'ms', @@ -372,7 +380,12 @@ private function getShippingData($data = []) ], $data); } - private function getBillingData($data = []) + /** + * @param array $data + * + * @return array + */ + private function getBillingData(array $data = []): array { return array_merge([ 'street' => 'street', @@ -384,23 +397,21 @@ private function getBillingData($data = []) } /** - * @param string $email - * @param array $data - * @param string $type + * @param array $data */ - private function assertAddress($email, $data, $type = 'billing') + private function assertAddress(string $email, array $data, string $type = 'billing'): void { $column = 'default_billing_address_id'; if ($type !== 'billing') { $column = 'default_shipping_address_id'; } - $address = Shopware()->Container()->get(\Doctrine\DBAL\Connection::class)->fetchAssoc( + $address = $this->getContainer()->get(Connection::class)->fetchAssociative( 'SELECT address.* FROM s_user_addresses address, s_user user WHERE user.' . $column . ' = address.id AND user.email = :mail', [':mail' => $email] ); - static::assertNotEmpty($address); + static::assertIsArray($address); foreach ($data as $key => $value) { static::assertArrayHasKey($key, $address); @@ -408,13 +419,9 @@ private function assertAddress($email, $data, $type = 'billing') } } - /** - * @return string|null - */ - private function getHeaderLocation(Enlight_Controller_Response_Response $response) + private function getHeaderLocation(Enlight_Controller_Response_Response $response): ?string { - $headers = $response->getHeaders(); - foreach ($headers as $header) { + foreach ($response->getHeaders() as $header) { if ($header['name'] === 'Location') { return $header['value']; } @@ -423,13 +430,8 @@ private function getHeaderLocation(Enlight_Controller_Response_Response $respons return null; } - /** - * @param bool $switch - */ - private function doubleOptinSet($switch) + private function doubleOptInSet(bool $switch): void { - Shopware()->Container()->get(\Shopware\Components\ConfigWriter::class)->save('optinregister', $switch, null, Shopware()->Shop()->getId()); - Shopware()->Container()->get(Shopware_Components_Config::class)->setShop(Shopware()->Shop()); - Shopware()->Container()->get(Zend_Cache_Core::class)->clean(); + $this->setConfig('optinregister', $switch); } } diff --git a/tests/Functional/Controllers/Backend/NewsletterTest.php b/tests/Functional/Controllers/Backend/NewsletterTest.php index 20c6af1688e..bf896108615 100644 --- a/tests/Functional/Controllers/Backend/NewsletterTest.php +++ b/tests/Functional/Controllers/Backend/NewsletterTest.php @@ -1,4 +1,6 @@ Plugins()->Backend()->Auth()->setNoAuth(); Shopware()->Plugins()->Backend()->Auth()->setNoAcl(); - /** @var string $sql */ $sql = file_get_contents(__DIR__ . '/_fixtures/newsletter/mail.sql'); static::assertIsString($sql); - Shopware()->Models()->getConnection()->exec($sql); + $this->getContainer()->get(Connection::class)->executeStatement($sql); } /** @@ -51,14 +53,18 @@ public function setUp(): void public function testNewsletterLock(): void { $this->Front()->setParam('noViewRenderer', false); - Shopware()->Config()->offsetSet('MailCampaignsPerCall', 1); + $this->setConfig('MailCampaignsPerCall', 1); $this->dispatch('/backend/newsletter/cron'); - static::assertMatchesRegularExpression('#[0-9]+ Recipients fetched#', $this->Response()->getBody()); + $responseBody = $this->Response()->getBody(); + static::assertIsString($responseBody); + static::assertMatchesRegularExpression('#\d+ Recipients fetched#', $responseBody); $this->reset(); $this->dispatch('/backend/newsletter/cron'); - static::assertMatchesRegularExpression('#Wait [0-9]+ seconds ...#', $this->Response()->getBody()); + $responseBody = $this->Response()->getBody(); + static::assertIsString($responseBody); + static::assertMatchesRegularExpression('#Wait \d+ seconds ...#', $responseBody); $this->reset(); } diff --git a/tests/Functional/Controllers/Frontend/ListingTest.php b/tests/Functional/Controllers/Frontend/ListingTest.php index df961aaf014..dc1d1bdac67 100644 --- a/tests/Functional/Controllers/Frontend/ListingTest.php +++ b/tests/Functional/Controllers/Frontend/ListingTest.php @@ -1,7 +1,6 @@ modelManager = $this->getContainer()->get(ModelManager::class); + } + /** * Test that requesting an existing category-id is successful */ public function testDispatchExistingCategory(): void { - $this->dispatch('/cat/?sCategory=14'); - static::assertEquals(200, $this->Response()->getHttpResponseCode()); + $this->dispatch(sprintf(self::CATEGORY_LINK, 14)); + static::assertSame(Response::HTTP_OK, $this->Response()->getHttpResponseCode()); } public function testDispatchExistingCategoryWithPageNotAvailable(): void { $this->expectException(Enlight_Controller_Exception::class); - $this->dispatch('/cat/?sCategory=14&sPage=2'); - static::assertEquals(200, $this->Response()->getHttpResponseCode()); + $this->dispatch(sprintf(self::CATEGORY_LINK . '&sPage=2', 14)); + static::assertSame(Response::HTTP_OK, $this->Response()->getHttpResponseCode()); } /** @@ -61,8 +73,8 @@ public function testDispatchExistingCategoryWithPageNotAvailable(): void public function testDispatchNonExistingCategory(): void { $this->expectException('Enlight_Exception'); - $this->dispatch('/cat/?sCategory=4711'); - static::assertEquals(404, $this->Response()->getHttpResponseCode()); + $this->dispatch(sprintf(self::CATEGORY_LINK, 4711)); + static::assertSame(Response::HTTP_NOT_FOUND, $this->Response()->getHttpResponseCode()); static::assertTrue($this->Response()->isRedirect()); } @@ -72,8 +84,8 @@ public function testDispatchNonExistingCategory(): void public function testDispatchEmptyCategoryId(): void { $this->expectException('Enlight_Exception'); - $this->dispatch('/cat/?sCategory='); - static::assertEquals(404, $this->Response()->getHttpResponseCode()); + $this->dispatch(sprintf(self::CATEGORY_LINK, '')); + static::assertSame(Response::HTTP_NOT_FOUND, $this->Response()->getHttpResponseCode()); static::assertTrue($this->Response()->isRedirect()); } @@ -83,8 +95,8 @@ public function testDispatchEmptyCategoryId(): void public function testDispatchSubshopCategoryId(): void { $this->expectException('Enlight_Exception'); - $this->dispatch('/cat/?sCategory=43'); - static::assertEquals(404, $this->Response()->getHttpResponseCode()); + $this->dispatch(sprintf(self::CATEGORY_LINK, 43)); + static::assertSame(Response::HTTP_NOT_FOUND, $this->Response()->getHttpResponseCode()); static::assertTrue($this->Response()->isRedirect()); } @@ -94,9 +106,56 @@ public function testDispatchSubshopCategoryId(): void public function testDispatchBlogCategory(): void { $this->expectException('Enlight_Exception'); - $this->dispatch('/cat/?sCategory=17'); - static::assertEquals(404, $this->Response()->getHttpResponseCode()); + $this->dispatch(sprintf(self::CATEGORY_LINK, 17)); + static::assertSame(Response::HTTP_NOT_FOUND, $this->Response()->getHttpResponseCode()); + static::assertTrue($this->Response()->isRedirect()); + } + + public function testExternalLink(): void + { + $externalLink = 'https://www.google.com'; + + $category = $this->createNewCategory(); + $category->setExternal($externalLink); + $this->modelManager->persist($category); + $this->modelManager->flush($category); + + $this->dispatch(sprintf(self::CATEGORY_LINK, $category->getId())); + + static::assertSame(Response::HTTP_MOVED_PERMANENTLY, $this->Response()->getHttpResponseCode()); static::assertTrue($this->Response()->isRedirect()); + + static::assertStringContainsString($externalLink, $this->Response()->getHeader('location')); + } + + public function testCategoryRedirectToProductDetailPageDirectly(): void + { + $this->setConfig('categoryDetailLink', true); + + $category = $this->createNewCategory(); + $this->modelManager->persist($category); + $this->modelManager->flush($category); + + $product = $this->modelManager->getRepository(Product::class)->findOneBy(['active' => true]); + static::assertInstanceOf(Product::class, $product); + + $productCategories = $product->getCategories(); + $productCategories->add($category); + $product->setCategories($productCategories); + + $this->modelManager->persist($product); + $this->modelManager->flush($product); + $this->modelManager->clear(); + + $this->dispatch(sprintf(self::CATEGORY_LINK, $category->getId())); + + static::assertSame(Response::HTTP_MOVED_PERMANENTLY, $this->Response()->getHttpResponseCode()); + static::assertTrue($this->Response()->isRedirect()); + + $firstSpace = strpos($product->getName(), ' '); + static::assertIsInt($firstSpace); + $firstPartOfProductName = strtolower(substr($product->getName(), 0, $firstSpace)); + static::assertStringContainsString($firstPartOfProductName, $this->Response()->getHeader('location')); } /** @@ -111,9 +170,9 @@ public function testHomeRedirect(): void static::assertInstanceOf(Category::class, $mainCategory); $mainCategoryId = $mainCategory->getId(); - $this->dispatch(sprintf('/cat/index/sCategory/%s', $mainCategoryId)); + $this->dispatch(sprintf(self::CATEGORY_LINK, $mainCategoryId)); - static::assertEquals(301, $this->Response()->getHttpResponseCode()); + static::assertSame(Response::HTTP_MOVED_PERMANENTLY, $this->Response()->getHttpResponseCode()); } public function testManufacturerPage(): void @@ -158,11 +217,24 @@ public function testCategoryWithProductStream(): void $connection->executeStatement($createCategoryWithStreamSQL, ['streamId' => $streamId]); $categoryId = (int) $connection->lastInsertId(); - $this->dispatch(sprintf('/cat/?sCategory=%d', $categoryId)); + $this->dispatch(sprintf(self::CATEGORY_LINK, $categoryId)); - static::assertEquals(200, $this->Response()->getHttpResponseCode()); + static::assertSame(Response::HTTP_OK, $this->Response()->getHttpResponseCode()); $responseBody = $this->Response()->getBody(); static::assertIsString($responseBody); static::assertStringContainsString('filter-panel--content', $responseBody, 'No filters available in the HTML'); } + + private function createNewCategory(): Category + { + $mainCategory = $this->modelManager->find(Category::class, 3); + static::assertInstanceOf(Category::class, $mainCategory); + + $category = new Category(); + $category->setName('Test'); + $category->setParent($mainCategory); + $category->setActive(true); + + return $category; + } } From 4b3a5c5aa56a486112d9773fbed089710eefd709 Mon Sep 17 00:00:00 2001 From: Michael Telgmann Date: Wed, 8 Jun 2022 10:20:21 +0200 Subject: [PATCH 037/730] SW-26685 - Fix HasPseudoPriceConditionHandler to consider customer group specific prices correctly --- .../HasPseudoPriceConditionHandler.php | 31 ++++- .../DependencyInjection/services.xml | 1 + ...sPseudoPriceConditionCustomerGroupTest.php | 126 ++++++++++++++++++ .../Bundle/StoreFrontBundle/TestContext.php | 6 +- 4 files changed, 157 insertions(+), 7 deletions(-) create mode 100644 tests/Functional/Bundle/SearchBundle/Condition/HasPseudoPriceConditionCustomerGroupTest.php diff --git a/engine/Shopware/Bundle/SearchBundleDBAL/ConditionHandler/HasPseudoPriceConditionHandler.php b/engine/Shopware/Bundle/SearchBundleDBAL/ConditionHandler/HasPseudoPriceConditionHandler.php index 2fe33bd677e..9dd05bce2f0 100644 --- a/engine/Shopware/Bundle/SearchBundleDBAL/ConditionHandler/HasPseudoPriceConditionHandler.php +++ b/engine/Shopware/Bundle/SearchBundleDBAL/ConditionHandler/HasPseudoPriceConditionHandler.php @@ -1,4 +1,6 @@ listingPriceSwitcher = $listingPriceSwitcher; $this->variantHelper = $variantHelper; + $this->listingPriceHelper = $listingPriceHelper; } /** @@ -75,7 +84,7 @@ public function generateCondition( if (!$query->hasState(self::STATE_INCLUDES_PSEUDO_PRICE_VARIANTS)) { if (empty($conditions)) { $this->variantHelper->joinVariants($query); - $query->leftJoin('allVariants', 's_articles_prices', 'variantPrices', 'variantPrices.articledetailsID = allVariants.id'); + $this->joinPrices($query, $context); $query->andWhere('variantPrices.pseudoprice > 0'); } else { $this->listingPriceSwitcher->joinPrice($query, $this->criteria, $context); @@ -89,4 +98,20 @@ public function setCriteria(Criteria $criteria) { $this->criteria = $criteria; } + + private function joinPrices(QueryBuilder $query, ShopContextInterface $context): void + { + $priceTable = $this->listingPriceHelper->getPriceTable($context); + $query->innerJoin( + 'allVariants', + '(' . $priceTable->getSQL() . ')', + 'variantPrices', + 'variantPrices.articledetailsID = allVariants.id' + ); + + $query->setParameter(':fallbackCustomerGroup', $context->getFallbackCustomerGroup()->getKey()); + if ($context->getCurrentCustomerGroup()->getId() !== $context->getFallbackCustomerGroup()->getId()) { + $query->setParameter(':currentCustomerGroup', $context->getCurrentCustomerGroup()->getKey()); + } + } } diff --git a/engine/Shopware/Bundle/SearchBundleDBAL/DependencyInjection/services.xml b/engine/Shopware/Bundle/SearchBundleDBAL/DependencyInjection/services.xml index 35de7204506..eed4e1b2165 100644 --- a/engine/Shopware/Bundle/SearchBundleDBAL/DependencyInjection/services.xml +++ b/engine/Shopware/Bundle/SearchBundleDBAL/DependencyInjection/services.xml @@ -147,6 +147,7 @@ + diff --git a/tests/Functional/Bundle/SearchBundle/Condition/HasPseudoPriceConditionCustomerGroupTest.php b/tests/Functional/Bundle/SearchBundle/Condition/HasPseudoPriceConditionCustomerGroupTest.php new file mode 100644 index 00000000000..1c41d1206e7 --- /dev/null +++ b/tests/Functional/Bundle/SearchBundle/Condition/HasPseudoPriceConditionCustomerGroupTest.php @@ -0,0 +1,126 @@ + $expectedNumber + */ + public function testPseudoPriceOnlyAvailableForSpecificCustomerGroup( + bool $hasCurrentCustomerGroupPseudoPrice, + bool $hasFallbackCustomerGroupPseudoPrice, + array $expectedNumber + ): void { + $context = $this->getContext(); + $fallbackCustomerGroup = $this->converter->convertCustomerGroup($this->helper->createCustomerGroup(['key' => self::FALLBACK_CUSTOMER_GROUP])); + $context->setFallbackCustomerGroup($fallbackCustomerGroup); + $this->search( + [ + self::PRODUCT_NUMBER => compact('hasCurrentCustomerGroupPseudoPrice', 'hasFallbackCustomerGroupPseudoPrice'), + ], + $expectedNumber, + null, + [new HasPseudoPriceCondition()], + [], + [], + $context + ); + } + + public function customerGroupPseudoPrices(): Generator + { + yield 'No customer group has pseudo price' => [ + false, + false, + [], + ]; + yield 'Only current customer group has pseudo price' => [ + true, + false, + [self::PRODUCT_NUMBER], + ]; + yield 'Only fallback customer group has pseudo price' => [ + false, + true, + [], + ]; + yield 'Current and fallback customer groups have pseudo price' => [ + true, + true, + [self::PRODUCT_NUMBER], + ]; + } + + protected function getProduct( + string $number, + ShopContext $context, + Category $category = null, + $additionally = [] + ): array { + static::assertIsArray($additionally); + + $product = parent::getProduct($number, $context, $category, $additionally); + + $currentCustomerGroupPrice = [ + 'from' => 1, + 'to' => 'beliebig', + 'price' => 7, + 'customerGroupKey' => self::CURRENT_CUSTOMER_GROUP, + 'pseudoPrice' => $additionally['hasCurrentCustomerGroupPseudoPrice'] ? 10 : 0, + ]; + $fallbackCustomerGroupPrice = [ + 'from' => 1, + 'to' => 'beliebig', + 'price' => 8, + 'customerGroupKey' => self::FALLBACK_CUSTOMER_GROUP, + 'pseudoPrice' => $additionally['hasFallbackCustomerGroupPseudoPrice'] ? 10 : 0, + ]; + $product['mainDetail']['prices'] = [ + $currentCustomerGroupPrice, + $fallbackCustomerGroupPrice, + ]; + + return $product; + } +} diff --git a/tests/Functional/Bundle/StoreFrontBundle/TestContext.php b/tests/Functional/Bundle/StoreFrontBundle/TestContext.php index 6b024de611d..b4cf38ad210 100644 --- a/tests/Functional/Bundle/StoreFrontBundle/TestContext.php +++ b/tests/Functional/Bundle/StoreFrontBundle/TestContext.php @@ -58,14 +58,12 @@ public function setCurrency(Currency $currency): void $this->currency = $currency; } - public function setCurrentCustomerGroup( - Group $currentCustomerGroup): void + public function setCurrentCustomerGroup(Group $currentCustomerGroup): void { $this->currentCustomerGroup = $currentCustomerGroup; } - public function setFallbackCustomerGroup( - Group $fallbackCustomerGroup): void + public function setFallbackCustomerGroup(Group $fallbackCustomerGroup): void { $this->fallbackCustomerGroup = $fallbackCustomerGroup; } From a14921a6340ece4b9abe0bccb46ba6594beff3ac Mon Sep 17 00:00:00 2001 From: Michael Telgmann Date: Tue, 7 Jun 2022 10:06:49 +0200 Subject: [PATCH 038/730] SW-26637 - Fix using of the voucher module if PHP8.1 is used --- tests/phpunit.xml.dist | 3 +- tests/phpunit_unit.xml.dist | 28 +++++++++---------- .../backend/voucher/view/voucher/list.js | 1 + 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/tests/phpunit.xml.dist b/tests/phpunit.xml.dist index 7c7b852de8b..752c7e0f2a6 100644 --- a/tests/phpunit.xml.dist +++ b/tests/phpunit.xml.dist @@ -11,10 +11,11 @@ ../engine/Shopware/ + ../engine/Library/Enlight/ ../engine/Shopware/Plugins/Community - ../engine/Shopware/Components/Xml + ../engine/Shopware/Plugins/Local diff --git a/tests/phpunit_unit.xml.dist b/tests/phpunit_unit.xml.dist index 298738258c6..de26d28aa43 100644 --- a/tests/phpunit_unit.xml.dist +++ b/tests/phpunit_unit.xml.dist @@ -9,18 +9,18 @@ beStrictAboutOutputDuringTests="true" beStrictAboutTodoAnnotatedTests="true" verbose="true"> - - - ../engine/Shopware/ - ../engine/Library/Enlight/ - - - - - - - - ./Unit - - + + + ../engine/Shopware/ + ../engine/Library/Enlight/ + + + + + + + + ./Unit + + diff --git a/themes/Backend/ExtJs/backend/voucher/view/voucher/list.js b/themes/Backend/ExtJs/backend/voucher/view/voucher/list.js index 0e61cf9bb57..a675584bf21 100644 --- a/themes/Backend/ExtJs/backend/voucher/view/voucher/list.js +++ b/themes/Backend/ExtJs/backend/voucher/view/voucher/list.js @@ -327,6 +327,7 @@ Ext.define('Shopware.apps.Voucher.view.voucher.List', { * @param value */ valueRenderer: function (value, p, r) { + value = String(value); if (r.data.percental == 1){ return value.replace(/[.,]/, Ext.util.Format.decimalSeparator) + " %"; } From 543a4b0be5799b0db825ac3350f6253172553944 Mon Sep 17 00:00:00 2001 From: Elias Lackner Date: Thu, 9 Jun 2022 09:25:54 +0200 Subject: [PATCH 039/730] SW-26453 - Fix translation update API fixes https://github.com/shopware/shopware/pull/2500 --- engine/Shopware/Components/Api/Resource/Translation.php | 1 - 1 file changed, 1 deletion(-) diff --git a/engine/Shopware/Components/Api/Resource/Translation.php b/engine/Shopware/Components/Api/Resource/Translation.php index 3aa651450dc..00a614040b0 100644 --- a/engine/Shopware/Components/Api/Resource/Translation.php +++ b/engine/Shopware/Components/Api/Resource/Translation.php @@ -432,7 +432,6 @@ protected function saveTranslation(array $data) $existing = []; } else { $existing['data'] = unserialize($existing['data'], ['allowed_classes' => false]); - $this->delete($data['key'], $data); } $data = array_replace_recursive( From b74eedc355f35c4a4cce40da24ad42ce493d4830 Mon Sep 17 00:00:00 2001 From: Michael Telgmann Date: Fri, 10 Jun 2022 10:35:02 +0200 Subject: [PATCH 040/730] SW-26736 - Update guzzle dependencies --- UPGRADE-5.7.md | 3 ++- composer.json | 4 ++-- composer.lock | 28 ++++++++++++++-------------- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/UPGRADE-5.7.md b/UPGRADE-5.7.md index 0fb61a17120..8237f678fbb 100644 --- a/UPGRADE-5.7.md +++ b/UPGRADE-5.7.md @@ -25,7 +25,8 @@ This changelog references changes done in Shopware 5.7 patch versions. * Updated `elasticsearch/elasticsearch` to version 7.17.0 * Updated `friendsofphp/proxy-manager-lts` to version 1.0.12 * Updated `google/cloud-storage` to version 1.27.1 -* Updated `guzzlehttp/guzzle` to version 7.4.2 +* Updated `guzzlehttp/guzzle` to version 7.4.4 +* Updated `guzzlehttp/psr7` to version 2.3.0 * Updated `laminas/laminas-escaper` to version 2.10.0 * Updated `monolog/monolog` to version 2.6.0 * Updated `mpdf/mpdf` to version 8.1.1 diff --git a/composer.json b/composer.json index 401c1f8436f..2ab564bfa67 100644 --- a/composer.json +++ b/composer.json @@ -52,8 +52,8 @@ "fig/link-util": "1.1.2", "friendsofphp/proxy-manager-lts": "1.0.12", "google/cloud-storage": "1.27.1", - "guzzlehttp/guzzle": "7.4.3", - "guzzlehttp/psr7": "2.2.1", + "guzzlehttp/guzzle": "~7.4.4", + "guzzlehttp/psr7": "2.3.0", "laminas/laminas-code": "4.5.1", "laminas/laminas-escaper": "2.10.0", "league/flysystem": "~1.1.4", diff --git a/composer.lock b/composer.lock index 34b945a6cdd..82508481626 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "6ba0011c11fa8435a00814e37c91dc78", + "content-hash": "41e35b633a6658b1eaf0dc5b8809ab3d", "packages": [ { "name": "aws/aws-crt-php", @@ -2071,16 +2071,16 @@ }, { "name": "guzzlehttp/guzzle", - "version": "7.4.3", + "version": "7.4.4", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "74a8602c6faec9ef74b7a9391ac82c5e65b1cdab" + "reference": "e3ff079b22820c2029d4c2a87796b6a0b8716ad8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/74a8602c6faec9ef74b7a9391ac82c5e65b1cdab", - "reference": "74a8602c6faec9ef74b7a9391ac82c5e65b1cdab", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/e3ff079b22820c2029d4c2a87796b6a0b8716ad8", + "reference": "e3ff079b22820c2029d4c2a87796b6a0b8716ad8", "shasum": "" }, "require": { @@ -2175,7 +2175,7 @@ ], "support": { "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/7.4.3" + "source": "https://github.com/guzzle/guzzle/tree/7.4.4" }, "funding": [ { @@ -2191,7 +2191,7 @@ "type": "tidelift" } ], - "time": "2022-05-25T13:24:33+00:00" + "time": "2022-06-09T21:39:15+00:00" }, { "name": "guzzlehttp/promises", @@ -2279,16 +2279,16 @@ }, { "name": "guzzlehttp/psr7", - "version": "2.2.1", + "version": "2.3.0", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "c94a94f120803a18554c1805ef2e539f8285f9a2" + "reference": "83260bb50b8fc753c72d14dc1621a2dac31877ee" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/c94a94f120803a18554c1805ef2e539f8285f9a2", - "reference": "c94a94f120803a18554c1805ef2e539f8285f9a2", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/83260bb50b8fc753c72d14dc1621a2dac31877ee", + "reference": "83260bb50b8fc753c72d14dc1621a2dac31877ee", "shasum": "" }, "require": { @@ -2312,7 +2312,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.2-dev" + "dev-master": "2.3-dev" } }, "autoload": { @@ -2374,7 +2374,7 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/2.2.1" + "source": "https://github.com/guzzle/psr7/tree/2.3.0" }, "funding": [ { @@ -2390,7 +2390,7 @@ "type": "tidelift" } ], - "time": "2022-03-20T21:55:58+00:00" + "time": "2022-06-09T08:26:02+00:00" }, { "name": "laminas/laminas-code", From b0f132a771845823f14023e38822a8c96a380df3 Mon Sep 17 00:00:00 2001 From: Michael Telgmann Date: Fri, 10 Jun 2022 10:49:41 +0200 Subject: [PATCH 041/730] SW-26736 - Update monolog dependency and third party dependencies --- UPGRADE-5.7.md | 3 +- composer.json | 2 +- composer.lock | 59 ++++++++++++++------------- engine/Shopware/Components/Logger.php | 5 ++- 4 files changed, 36 insertions(+), 33 deletions(-) diff --git a/UPGRADE-5.7.md b/UPGRADE-5.7.md index 8237f678fbb..3f184806709 100644 --- a/UPGRADE-5.7.md +++ b/UPGRADE-5.7.md @@ -11,6 +11,7 @@ This changelog references changes done in Shopware 5.7 patch versions. ### Additions * Added missing dependency `doctrine/annotations`, which was an indirect dependency before +* Added new optional parameter `dateTime` to `\Shopware\Components\Logger::addRecord` method to be compatible with parent `\Monolog\Logger::addRecord` method ### Changes @@ -28,7 +29,7 @@ This changelog references changes done in Shopware 5.7 patch versions. * Updated `guzzlehttp/guzzle` to version 7.4.4 * Updated `guzzlehttp/psr7` to version 2.3.0 * Updated `laminas/laminas-escaper` to version 2.10.0 -* Updated `monolog/monolog` to version 2.6.0 +* Updated `monolog/monolog` to version 2.7.0 * Updated `mpdf/mpdf` to version 8.1.1 * Updated `phpunit/phpunit` to version 9.5.20 * Updated `symfony/browser-kit` to version 4.4.37 diff --git a/composer.json b/composer.json index 2ab564bfa67..111400e8561 100644 --- a/composer.json +++ b/composer.json @@ -58,7 +58,7 @@ "laminas/laminas-escaper": "2.10.0", "league/flysystem": "~1.1.4", "league/flysystem-aws-s3-v3": "1.0.29", - "monolog/monolog": "2.6.0", + "monolog/monolog": "2.7.0", "mpdf/mpdf": "8.1.1", "ongr/elasticsearch-dsl": "7.2.2", "psr/link": "1.0.0", diff --git a/composer.lock b/composer.lock index 82508481626..c91936db8ab 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "41e35b633a6658b1eaf0dc5b8809ab3d", + "content-hash": "04af69417e3a2d261d9f0c8ea6c5854c", "packages": [ { "name": "aws/aws-crt-php", @@ -58,16 +58,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.224.2", + "version": "3.225.1", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "a2e6461261a92570128e6c2b6fb1896f3d16b424" + "reference": "b795c9c14997dac771f66d1f6cbadb62c742373a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/a2e6461261a92570128e6c2b6fb1896f3d16b424", - "reference": "a2e6461261a92570128e6c2b6fb1896f3d16b424", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/b795c9c14997dac771f66d1f6cbadb62c742373a", + "reference": "b795c9c14997dac771f66d1f6cbadb62c742373a", "shasum": "" }, "require": { @@ -143,9 +143,9 @@ "support": { "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "issues": "https://github.com/aws/aws-sdk-php/issues", - "source": "https://github.com/aws/aws-sdk-php/tree/3.224.2" + "source": "https://github.com/aws/aws-sdk-php/tree/3.225.1" }, - "time": "2022-06-01T18:17:06+00:00" + "time": "2022-06-09T18:19:43+00:00" }, { "name": "bcremer/line-reader", @@ -1905,21 +1905,21 @@ }, { "name": "google/cloud-core", - "version": "v1.45.0", + "version": "v1.46.0", "source": { "type": "git", "url": "https://github.com/googleapis/google-cloud-php-core.git", - "reference": "28181b5ec2d40e9c9cdf2085096b33bac1f237fd" + "reference": "784a1d361c7dbc5de133feac590f549798c80f5e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-cloud-php-core/zipball/28181b5ec2d40e9c9cdf2085096b33bac1f237fd", - "reference": "28181b5ec2d40e9c9cdf2085096b33bac1f237fd", + "url": "https://api.github.com/repos/googleapis/google-cloud-php-core/zipball/784a1d361c7dbc5de133feac590f549798c80f5e", + "reference": "784a1d361c7dbc5de133feac590f549798c80f5e", "shasum": "" }, "require": { "google/auth": "^1.18", - "guzzlehttp/guzzle": "^5.3|^6.0|^7.0", + "guzzlehttp/guzzle": "^5.3|^6.5.6|^7.4.3", "guzzlehttp/promises": "^1.3", "guzzlehttp/psr7": "^1.7|^2.0", "monolog/monolog": "^1.1|^2.0", @@ -1932,7 +1932,7 @@ "google/common-protos": "^1.0||^2.0", "google/gax": "^1.9", "opis/closure": "^3", - "phpdocumentor/reflection": "^3.0", + "phpdocumentor/reflection": "^3.0||^4.0", "phpunit/phpunit": "^4.8|^5.0|^8.0", "squizlabs/php_codesniffer": "2.*", "yoast/phpunit-polyfills": "^1.0" @@ -1964,9 +1964,9 @@ ], "description": "Google Cloud PHP shared dependency, providing functionality useful to all components.", "support": { - "source": "https://github.com/googleapis/google-cloud-php-core/tree/v1.45.0" + "source": "https://github.com/googleapis/google-cloud-php-core/tree/v1.46.0" }, - "time": "2022-05-13T22:51:50+00:00" + "time": "2022-06-02T21:53:43+00:00" }, { "name": "google/cloud-storage", @@ -2723,16 +2723,16 @@ }, { "name": "monolog/monolog", - "version": "2.6.0", + "version": "2.7.0", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "247918972acd74356b0a91dfaa5adcaec069b6c0" + "reference": "5579edf28aee1190a798bfa5be8bc16c563bd524" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/247918972acd74356b0a91dfaa5adcaec069b6c0", - "reference": "247918972acd74356b0a91dfaa5adcaec069b6c0", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/5579edf28aee1190a798bfa5be8bc16c563bd524", + "reference": "5579edf28aee1190a798bfa5be8bc16c563bd524", "shasum": "" }, "require": { @@ -2811,7 +2811,7 @@ ], "support": { "issues": "https://github.com/Seldaek/monolog/issues", - "source": "https://github.com/Seldaek/monolog/tree/2.6.0" + "source": "https://github.com/Seldaek/monolog/tree/2.7.0" }, "funding": [ { @@ -2823,7 +2823,7 @@ "type": "tidelift" } ], - "time": "2022-05-10T09:36:00+00:00" + "time": "2022-06-09T08:59:12+00:00" }, { "name": "mpdf/mpdf", @@ -4470,6 +4470,7 @@ "type": "tidelift" } ], + "abandoned": "symfony/error-handler", "time": "2022-04-12T15:19:55+00:00" }, { @@ -10331,21 +10332,21 @@ }, { "name": "webmozart/assert", - "version": "1.10.0", + "version": "1.11.0", "source": { "type": "git", "url": "https://github.com/webmozarts/assert.git", - "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25" + "reference": "11cb2199493b2f8a3b53e7f19068fc6aac760991" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozarts/assert/zipball/6964c76c7804814a842473e0c8fd15bab0f18e25", - "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/11cb2199493b2f8a3b53e7f19068fc6aac760991", + "reference": "11cb2199493b2f8a3b53e7f19068fc6aac760991", "shasum": "" }, "require": { - "php": "^7.2 || ^8.0", - "symfony/polyfill-ctype": "^1.8" + "ext-ctype": "*", + "php": "^7.2 || ^8.0" }, "conflict": { "phpstan/phpstan": "<0.12.20", @@ -10383,9 +10384,9 @@ ], "support": { "issues": "https://github.com/webmozarts/assert/issues", - "source": "https://github.com/webmozarts/assert/tree/1.10.0" + "source": "https://github.com/webmozarts/assert/tree/1.11.0" }, - "time": "2021-03-09T10:59:23+00:00" + "time": "2022-06-03T18:03:27+00:00" } ], "aliases": [], diff --git a/engine/Shopware/Components/Logger.php b/engine/Shopware/Components/Logger.php index 0523d5f6931..410c7ffb370 100644 --- a/engine/Shopware/Components/Logger.php +++ b/engine/Shopware/Components/Logger.php @@ -24,6 +24,7 @@ namespace Shopware\Components; +use Monolog\DateTimeImmutable; use Monolog\Logger as BaseLogger; class Logger extends BaseLogger @@ -49,10 +50,10 @@ public function trace($label) $this->log(BaseLogger::DEBUG, $label, ['trace' => true]); } - public function addRecord(int $level, string $message, array $context = []): bool + public function addRecord(int $level, string $message, array $context = [], DateTimeImmutable $datetime = null): bool { $message = str_replace(['[', ']'], ['(', ')'], $message); - return parent::addRecord($level, $message, $context); + return parent::addRecord($level, $message, $context, $datetime); } } From 437c021cbdd17036aef184fd25da2b622e648df7 Mon Sep 17 00:00:00 2001 From: Michael Telgmann Date: Thu, 9 Jun 2022 15:53:29 +0200 Subject: [PATCH 042/730] SW-26453 - Improve code quality, refactor and fix translation API resource test --- .phpstan-baseline.neon | 60 -- .../Components/Api/BatchInterface.php | 6 +- .../Components/Api/Resource/Article.php | 5 - .../Components/Api/Resource/Cache.php | 3 - .../Components/Api/Resource/Translation.php | 53 +- .../Components/Api/Resource/Variant.php | 5 - .../Components/Model/ModelRepository.php | 4 +- .../Components/Model/QueryBuilder.php | 2 +- .../Components/Api/TranslationTest.php | 550 ++++++++++-------- 9 files changed, 337 insertions(+), 351 deletions(-) diff --git a/.phpstan-baseline.neon b/.phpstan-baseline.neon index c583c197533..d9426cf3d0c 100644 --- a/.phpstan-baseline.neon +++ b/.phpstan-baseline.neon @@ -13905,11 +13905,6 @@ parameters: count: 1 path: engine/Shopware/Components/AddLinkHeaderSubscriber.php - - - message: "#^Method Shopware\\\\Components\\\\Api\\\\BatchInterface\\:\\:getIdByData\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#" - count: 1 - path: engine/Shopware/Components/Api/BatchInterface.php - - message: "#^Cannot call method setAcl\\(\\) on object\\|null\\.$#" count: 1 @@ -14080,11 +14075,6 @@ parameters: count: 1 path: engine/Shopware/Components/Api/Resource/Article.php - - - message: "#^Method Shopware\\\\Components\\\\Api\\\\Resource\\\\Article\\:\\:getIdByData\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#" - count: 1 - path: engine/Shopware/Components/Api/Resource/Article.php - - message: "#^Method Shopware\\\\Components\\\\Api\\\\Resource\\\\Article\\:\\:getList\\(\\) has parameter \\$criteria with no value type specified in iterable type array\\.$#" count: 1 @@ -14420,11 +14410,6 @@ parameters: count: 1 path: engine/Shopware/Components/Api/Resource/Cache.php - - - message: "#^Method Shopware\\\\Components\\\\Api\\\\Resource\\\\Cache\\:\\:getIdByData\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#" - count: 1 - path: engine/Shopware/Components/Api/Resource/Cache.php - - message: "#^Method Shopware\\\\Components\\\\Api\\\\Resource\\\\Cache\\:\\:getList\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 @@ -15125,21 +15110,6 @@ parameters: count: 1 path: engine/Shopware/Components/Api/Resource/Shop.php - - - message: "#^Method Shopware\\\\Components\\\\Api\\\\Resource\\\\Translation\\:\\:checkRequirements\\(\\) has no return type specified\\.$#" - count: 1 - path: engine/Shopware/Components/Api/Resource/Translation.php - - - - message: "#^Method Shopware\\\\Components\\\\Api\\\\Resource\\\\Translation\\:\\:checkRequirements\\(\\) has parameter \\$checkData with no type specified\\.$#" - count: 1 - path: engine/Shopware/Components/Api/Resource/Translation.php - - - - message: "#^Method Shopware\\\\Components\\\\Api\\\\Resource\\\\Translation\\:\\:checkRequirements\\(\\) has parameter \\$data with no type specified\\.$#" - count: 1 - path: engine/Shopware/Components/Api/Resource/Translation.php - - message: "#^Method Shopware\\\\Components\\\\Api\\\\Resource\\\\Translation\\:\\:create\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#" count: 1 @@ -15160,31 +15130,16 @@ parameters: count: 1 path: engine/Shopware/Components/Api/Resource/Translation.php - - - message: "#^Method Shopware\\\\Components\\\\Api\\\\Resource\\\\Translation\\:\\:getIdByData\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#" - count: 1 - path: engine/Shopware/Components/Api/Resource/Translation.php - - message: "#^Method Shopware\\\\Components\\\\Api\\\\Resource\\\\Translation\\:\\:getObjectTranslation\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 path: engine/Shopware/Components/Api/Resource/Translation.php - - - message: "#^Method Shopware\\\\Components\\\\Api\\\\Resource\\\\Translation\\:\\:getRepository\\(\\) has no return type specified\\.$#" - count: 1 - path: engine/Shopware/Components/Api/Resource/Translation.php - - message: "#^Method Shopware\\\\Components\\\\Api\\\\Resource\\\\Translation\\:\\:saveTranslation\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#" count: 1 path: engine/Shopware/Components/Api/Resource/Translation.php - - - message: "#^Method Shopware\\\\Components\\\\Api\\\\Resource\\\\Translation\\:\\:setTranslationComponent\\(\\) has no return type specified\\.$#" - count: 1 - path: engine/Shopware/Components/Api/Resource/Translation.php - - message: "#^Method Shopware\\\\Components\\\\Api\\\\Resource\\\\Translation\\:\\:update\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#" count: 1 @@ -15195,11 +15150,6 @@ parameters: count: 1 path: engine/Shopware/Components/Api/Resource/Translation.php - - - message: "#^Property Shopware\\\\Components\\\\Api\\\\Resource\\\\Translation\\:\\:\\$repository with generic class Doctrine\\\\ORM\\\\EntityRepository does not specify its types\\: TEntityClass$#" - count: 1 - path: engine/Shopware/Components/Api/Resource/Translation.php - - message: "#^Method Shopware\\\\Components\\\\Api\\\\Resource\\\\User\\:\\:create\\(\\) has parameter \\$params with no value type specified in iterable type array\\.$#" count: 1 @@ -15325,11 +15275,6 @@ parameters: count: 1 path: engine/Shopware/Components/Api/Resource/Variant.php - - - message: "#^Method Shopware\\\\Components\\\\Api\\\\Resource\\\\Variant\\:\\:getIdByData\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#" - count: 1 - path: engine/Shopware/Components/Api/Resource/Variant.php - - message: "#^Method Shopware\\\\Components\\\\Api\\\\Resource\\\\Variant\\:\\:getList\\(\\) has parameter \\$criteria with no value type specified in iterable type array\\.$#" count: 1 @@ -42230,11 +42175,6 @@ parameters: count: 1 path: tests/Functional/Components/Api/PropertyGroupTest.php - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Components\\\\Api\\\\TranslationTest\\:\\:getDummyData\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: tests/Functional/Components/Api/TranslationTest.php - - message: "#^Cannot access offset 'configuratorOptions' on array\\|Shopware\\\\Models\\\\Article\\\\Detail\\.$#" count: 2 diff --git a/engine/Shopware/Components/Api/BatchInterface.php b/engine/Shopware/Components/Api/BatchInterface.php index a507cad75df..8bd48b55c2d 100644 --- a/engine/Shopware/Components/Api/BatchInterface.php +++ b/engine/Shopware/Components/Api/BatchInterface.php @@ -38,10 +38,10 @@ interface BatchInterface * If your resource supports other kinds of IDs, too, you should identify * your entity by these IDs and return the primary ID of that entity. * - * @param array $data + * @param array $data * - * @return int|bool Return the primary ID of the entity, if it exists - * Return false, if no existing entity matches $data + * @return int|false Return the primary ID of the entity, if it exists + * Return false, if no existing entity matches $data */ public function getIdByData($data); } diff --git a/engine/Shopware/Components/Api/Resource/Article.php b/engine/Shopware/Components/Api/Resource/Article.php index 98138e00dd1..faebde22838 100644 --- a/engine/Shopware/Components/Api/Resource/Article.php +++ b/engine/Shopware/Components/Api/Resource/Article.php @@ -657,11 +657,6 @@ public function writeTranslations($articleId, $translations) } } - /** - * Returns the primary ID of any data set. - * - * {@inheritdoc} - */ public function getIdByData($data) { $id = null; diff --git a/engine/Shopware/Components/Api/Resource/Cache.php b/engine/Shopware/Components/Api/Resource/Cache.php index 697c75f592f..e3cbe177c97 100644 --- a/engine/Shopware/Components/Api/Resource/Cache.php +++ b/engine/Shopware/Components/Api/Resource/Cache.php @@ -130,9 +130,6 @@ public function delete($id) return true; } - /** - * {@inheritdoc} - */ public function getIdByData($data) { return $data['id'] ?? false; diff --git a/engine/Shopware/Components/Api/Resource/Translation.php b/engine/Shopware/Components/Api/Resource/Translation.php index 00a614040b0..f126120f20c 100644 --- a/engine/Shopware/Components/Api/Resource/Translation.php +++ b/engine/Shopware/Components/Api/Resource/Translation.php @@ -25,13 +25,14 @@ namespace Shopware\Components\Api\Resource; use Doctrine\ORM\AbstractQuery; -use Doctrine\ORM\EntityRepository; +use Doctrine\ORM\Query; use Exception; use Shopware\Components\Api\BatchInterface; use Shopware\Components\Api\Exception\CustomValidationException; use Shopware\Components\Api\Exception\NotFoundException; use Shopware\Components\Api\Exception\ParameterMissingException; use Shopware\Components\Model\Exception\ModelNotFoundException; +use Shopware\Components\Model\ModelRepository; use Shopware\Components\Model\QueryBuilder; use Shopware\Models\Article\Configurator\Group as ConfiguratorGroup; use Shopware\Models\Article\Configurator\Option as ConfiguratorOption; @@ -73,7 +74,7 @@ class Translation extends Resource implements BatchInterface protected $translationWriter; /** - * @var EntityRepository|null + * @var ModelRepository|null */ protected $repository; @@ -87,17 +88,6 @@ public function __construct(Shopware_Components_Translation $translationComponen $this->translationComponent = $translationComponent ?: Shopware()->Container()->get(Shopware_Components_Translation::class); } - /** - * This methods needs to return an ID for the current resource. - * The ID needs to be the primary ID of the resource (in most cases `id`). - * If your resource supports other kinds of IDs, too, you should identify - * your entity by these IDs and return the primary ID of that entity. - * - * @param array $data - * - * @return int|bool Return the primary ID of the entity, if it exists - * Return false, if no existing entity matches $data - */ public function getIdByData($data) { if ($data['useNumberAsId']) { @@ -120,6 +110,8 @@ public function getTranslationComponent() /** * @param Shopware_Components_Translation $translationWriter + * + * @return void */ public function setTranslationComponent($translationWriter) { @@ -184,12 +176,12 @@ public function create(array $data) { $this->checkPrivilege('create'); - $this->checkRequirements($data); - - if (!isset($data['key']) || empty($data['key'])) { - throw new ParameterMissingException('The parameter key is required for a object translation.'); + if (empty($data['key'])) { + throw new ParameterMissingException('The parameter key is required for an object translation.'); } + $this->checkRequirements($data); + return $this->saveTranslation($data); } @@ -375,6 +367,9 @@ public function deleteByNumber($number, $data) return $this->delete($id, $data); } + /** + * @return ModelRepository + */ protected function getRepository() { if ($this->repository === null) { @@ -455,6 +450,8 @@ protected function saveTranslation(array $data) if (!$translation instanceof TranslationModel) { throw new ModelNotFoundException(TranslationModel::class, $data['key'], 'key'); } + // The model needs to be refreshed after reading, otherwise it will not load the updated translation correctly + $this->getManager()->refresh($translation); return $translation; } @@ -462,10 +459,10 @@ protected function saveTranslation(array $data) /** * Helper function which returns a language translation for a single object type. * - * @param string $type - Type of the translatable object, see class constants - * @param int $key - Identifier of the translatable object. (s_articles.id) - * @param int $shopId - Identifier of the shop object. (s_core_shops.id) - * @param int $resultMode - Flag which handles the return value between array and \Shopware\Models\Translation\Translation + * @param string $type - Type of the translatable object, see class constants + * @param int $key - Identifier of the translatable object. (s_articles.id) + * @param int $shopId - Identifier of the shop object. (s_core_shops.id) + * @param AbstractQuery::HYDRATE_* $resultMode - Flag which handles the return value between array and \Shopware\Models\Translation\Translation * * @return array|TranslationModel|null */ @@ -908,7 +905,7 @@ protected function getConfiguratorOptionIdByNumber($number) { $numbers = explode('|', $number); - if (\count($numbers) < 2) { + if (!\is_array($numbers) || \count($numbers) < 2) { throw new CustomValidationException(sprintf('Passed configurator option name %s contains not the full path: group|option', $number)); } @@ -933,9 +930,15 @@ protected function getConfiguratorOptionIdByNumber($number) return $option->getId(); } + /** + * @param array $data + * @param bool $checkData + * + * @return void + */ protected function checkRequirements($data, $checkData = true) { - if (!isset($data['type']) || empty($data['type'])) { + if (empty($data['type'])) { throw new ParameterMissingException('Passed translation contains no object type'); } @@ -944,8 +947,8 @@ protected function checkRequirements($data, $checkData = true) } if ($checkData) { - if (!isset($data['data']) || empty($data['data'])) { - throw new ParameterMissingException('The parameter data is required for a object translation'); + if (empty($data['data'])) { + throw new ParameterMissingException('The parameter data is required for an object translation'); } if (!\is_array($data['data'])) { diff --git a/engine/Shopware/Components/Api/Resource/Variant.php b/engine/Shopware/Components/Api/Resource/Variant.php index 12a821aa575..e01aca7012a 100644 --- a/engine/Shopware/Components/Api/Resource/Variant.php +++ b/engine/Shopware/Components/Api/Resource/Variant.php @@ -428,11 +428,6 @@ public function createImageMappingForOptions($options, Image $image) return $mapping; } - /** - * Returns the primary ID of any data set. - * - * {@inheritdoc} - */ public function getIdByData($data) { $id = null; diff --git a/engine/Shopware/Components/Model/ModelRepository.php b/engine/Shopware/Components/Model/ModelRepository.php index f46aba30aaf..031f1893571 100644 --- a/engine/Shopware/Components/Model/ModelRepository.php +++ b/engine/Shopware/Components/Model/ModelRepository.php @@ -34,11 +34,11 @@ * These standard function must later be implemented in the various models. * * - * $modelRepository = new Shopware\Components\Models\ModelRepository; + * $modelRepository = new \Shopware\Components\Models\ModelRepository(); * $modelRepository->createQueryBuilder(); * * - * @template TEntityClass of object + * @template TEntityClass of ModelEntity * @extends EntityRepository */ class ModelRepository extends EntityRepository implements Enlight_Hook diff --git a/engine/Shopware/Components/Model/QueryBuilder.php b/engine/Shopware/Components/Model/QueryBuilder.php index f990c002363..bb2585749e1 100644 --- a/engine/Shopware/Components/Model/QueryBuilder.php +++ b/engine/Shopware/Components/Model/QueryBuilder.php @@ -164,7 +164,7 @@ public function addParameters(array $parameters) * ))); * * - * @param array|array $filter + * @param array|array $filter * * @return QueryBuilder */ diff --git a/tests/Functional/Components/Api/TranslationTest.php b/tests/Functional/Components/Api/TranslationTest.php index 2d17107419b..d4452da8884 100644 --- a/tests/Functional/Components/Api/TranslationTest.php +++ b/tests/Functional/Components/Api/TranslationTest.php @@ -26,24 +26,37 @@ namespace Shopware\Tests\Functional\Components\Api; +use Doctrine\DBAL\Connection; use Shopware\Components\Api\Exception\CustomValidationException; use Shopware\Components\Api\Exception\NotFoundException; use Shopware\Components\Api\Exception\ParameterMissingException; use Shopware\Components\Api\Resource\Translation as TranslationResource; -use Shopware\Models\Article\Article; +use Shopware\Models\Article\Article as ProductModel; use Shopware\Models\Translation\Translation; +use Shopware\Tests\Functional\Traits\ContainerTrait; +use Shopware\Tests\Functional\Traits\DatabaseTransactionBehaviour; class TranslationTest extends TestCase { + use ContainerTrait; + use DatabaseTransactionBehaviour; + + private const PRODUCT_TYPE = 'article'; + /** * @var TranslationResource */ protected $resource; - /** - * @return TranslationResource - */ - public function createResource() + private Connection $connection; + + protected function setUp(): void + { + parent::setUp(); + $this->connection = $this->getContainer()->get(Connection::class); + } + + public function createResource(): TranslationResource { return new TranslationResource(); } @@ -58,7 +71,7 @@ public function testList(): void } } - public function testArticleTranslationList(): void + public function testProductTranslationList(): void { $list = $this->resource->getList(0, 5, [ [ @@ -68,18 +81,13 @@ public function testArticleTranslationList(): void ]); foreach ($list['data'] as $item) { - $article = Shopware()->Models()->find(Article::class, $item['key']); - - static::assertInstanceOf(Article::class, $article); - - static::assertEquals( - TranslationResource::TYPE_PRODUCT, - $item['type'] - ); + $product = $this->getContainer()->get('models')->find(ProductModel::class, $item['key']); + static::assertInstanceOf(ProductModel::class, $product); + static::assertSame(TranslationResource::TYPE_PRODUCT, $item['type']); } } - public function testSingleArticleTranslation(): void + public function testSingleProductTranslation(): void { $list = $this->resource->getList(0, 1, [ [ @@ -88,7 +96,10 @@ public function testSingleArticleTranslation(): void ], [ 'property' => 'translation.key', - 'value' => Shopware()->Db()->fetchOne("SELECT objectkey FROM s_core_translations WHERE objecttype='article' LIMIT 1"), + 'value' => $this->connection->fetchOne( + 'SELECT objectkey FROM s_core_translations WHERE objecttype=:type LIMIT 1', + ['type' => self::PRODUCT_TYPE] + ), ], [ 'property' => 'translation.shopId', @@ -99,77 +110,11 @@ public function testSingleArticleTranslation(): void static::assertCount(1, $list['data']); $data = $list['data'][0]; - static::assertEquals( - TranslationResource::TYPE_PRODUCT, - $data['type'] - ); - + static::assertSame(TranslationResource::TYPE_PRODUCT, $data['type']); static::assertArrayHasKey('name', $data['data']); static::assertArrayHasKey('descriptionLong', $data['data']); } - public function testCreateArticle(): int - { - $data = $this->getDummyData('article'); - - $translation = $this->resource->create($data); - - static::assertInstanceOf(Translation::class, $translation); - static::assertEquals( - $data['key'], - $translation->getKey(), - 'Translation key do not match' - ); - static::assertEquals( - $data['type'], - $translation->getType(), - 'Translation type do not match' - ); - static::assertEquals( - $data['data'], - $this->resource->getTranslationComponent()->unFilterData( - 'article', - $translation->getData() - ), - 'Translation data do not match' - ); - - return $translation->getKey(); - } - - public function testCreateArticleByNumber(): int - { - $data = $this->getDummyData('article'); - $article = Shopware()->Db()->fetchRow('SELECT ordernumber, articleID FROM s_articles_details LIMIT 1'); - $data['key'] = $article['ordernumber']; - - $translation = $this->resource->createByNumber($data); - - static::assertInstanceOf(Translation::class, $translation); - - static::assertEquals( - $article['articleID'], - $translation->getKey(), - 'Translation key do not match' - ); - - static::assertEquals( - $data['type'], - $translation->getType(), - 'Translation type do not match' - ); - static::assertEquals( - $data['data'], - $this->resource->getTranslationComponent()->unFilterData( - 'article', - $translation->getData() - ), - 'Translation data do not match' - ); - - return (int) $article['articleID']; - } - /** * Checks if variants can be translated * @@ -179,86 +124,64 @@ public function testCreateVariantTranslationByNumber(): void { $data = $this->getDummyData('variant'); // Artikel mit Standardkonfigurator rot / 39 - $article = Shopware()->Db()->fetchRow("SELECT id, ordernumber, articleID FROM s_articles_details WHERE ordernumber = 'SW10201.11'"); - $data['key'] = $article['ordernumber']; + $product = $this->connection->fetchAssociative("SELECT id, ordernumber, articleID FROM s_articles_details WHERE ordernumber = 'SW10201.11'"); + static::assertIsArray($product); + $data['key'] = $product['ordernumber']; $translation = $this->resource->createByNumber($data); static::assertInstanceOf(Translation::class, $translation); - static::assertEquals( - $article['id'], - $translation->getKey(), - 'Translation key do not match' - ); - - static::assertEquals( - $data['type'], - $translation->getType(), - 'Translation type do not match' - ); - static::assertEquals( + static::assertSame((int) $product['id'], $translation->getKey(), 'Translation key do not match'); + static::assertSame($data['type'], $translation->getType()); + static::assertSame( $data['data'], $this->resource->getTranslationComponent()->unFilterData( - 'article', + self::PRODUCT_TYPE, $translation->getData() ), 'Translation data do not match' ); } - /** - * @depends testCreateArticle - */ - public function testArticleUpdateOverride(int $key): int + public function testProductTranslationUpdateOverride(): void { + $productId = $this->createProduct(); $this->resource->setResultMode(2); $translation = $this->resource->getList(0, 1, [ - ['property' => 'translation.type', 'value' => 'article'], - ['property' => 'translation.key', 'value' => $key], + ['property' => 'translation.type', 'value' => self::PRODUCT_TYPE], + ['property' => 'translation.key', 'value' => $productId], ['property' => 'translation.shopId', 'value' => 2], ]); - $translation = $translation['data'][0]; foreach ($translation['data'] as &$fieldTranslation) { $fieldTranslation = 'UPDATE - ' . $fieldTranslation; } + unset($fieldTranslation); - $updated = $this->resource->update($key, $translation); - - static::assertEquals( - $translation['key'], - $updated->getKey(), - 'Translation key do not match' - ); - static::assertEquals( - $translation['type'], - $updated->getType(), - 'Translation type do not match' - ); + $updateResult = $this->resource->update($productId, $translation); + static::assertInstanceOf(Translation::class, $updateResult); - static::assertEquals( - $translation['data'], - $this->resource->getTranslationComponent()->unFilterData( - 'article', - $updated->getData() - ), - 'Translation data do not match' - ); + $updatedTranslation = $this->resource->getList(0, 1, [ + ['property' => 'translation.type', 'value' => self::PRODUCT_TYPE], + ['property' => 'translation.key', 'value' => $productId], + ['property' => 'translation.shopId', 'value' => 2], + ]); + $updatedTranslation = $updatedTranslation['data'][0]; - return $key; + static::assertSame($translation['key'], $updatedTranslation['key'], 'Translation key do not match'); + static::assertSame($translation['type'], $updatedTranslation['type'], 'Translation type do not match'); + static::assertSame($translation['data'], $updatedTranslation['data'], 'Translation data do not match'); } - /** - * @depends testArticleUpdateOverride - */ - public function testArticleUpdateMerge(int $key): void + public function testProductTranslationUpdateMerge(): void { + $productId = $this->createProduct(); $this->resource->setResultMode(2); $translation = $this->resource->getList(0, 1, [ - ['property' => 'translation.type', 'value' => 'article'], - ['property' => 'translation.key', 'value' => $key], + ['property' => 'translation.type', 'value' => self::PRODUCT_TYPE], + ['property' => 'translation.key', 'value' => $productId], ['property' => 'translation.shopId', 'value' => 2], ]); @@ -267,34 +190,25 @@ public function testArticleUpdateMerge(int $key): void 'txtArtikel' => 'Update-2', ]; - $updated = $this->resource->update($key, $translation); + $updateResult = $this->resource->update($productId, $translation); + static::assertInstanceOf(Translation::class, $updateResult); - static::assertEquals( - $translation['key'], - $updated->getKey(), - 'Translation key do not match' - ); - static::assertEquals( - $translation['type'], - $updated->getType(), - 'Translation type do not match' - ); + $updatedTranslation = $this->resource->getList(0, 1, [ + ['property' => 'translation.type', 'value' => self::PRODUCT_TYPE], + ['property' => 'translation.key', 'value' => $productId], + ['property' => 'translation.shopId', 'value' => 2], + ]); - $dataTranslation = unserialize($updated->getData()); - static::assertEquals( - $translation['data']['txtArtikel'], - $dataTranslation['txtArtikel'] - ); + $updatedTranslation = $updatedTranslation['data'][0]; - static::assertEquals( - 'UPDATE - Dummy Translation', - $dataTranslation['txtlangbeschreibung'] - ); + static::assertSame($translation['key'], $updatedTranslation['key'], 'Translation key do not match'); + static::assertSame($translation['type'], $updatedTranslation['type'], 'Translation type do not match'); + static::assertSame($translation['data']['txtArtikel'], $updatedTranslation['data']['name']); } public function testRecursiveMerge(): void { - $create = $this->getDummyData('article'); + $create = $this->getDummyData(self::PRODUCT_TYPE); $create['type'] = 'recursive'; $create['data'] = [ @@ -323,84 +237,136 @@ public function testRecursiveMerge(): void ], ]; - $updated = $this->resource->update($created->getKey(), $update); + $updateResult = $this->resource->update($created->getKey(), $update); + static::assertInstanceOf(Translation::class, $updateResult); - $updateData = $update['data']; - $updatedData = unserialize($updated->getData()); - - static::assertEquals( - $updateData['a1'], - $updatedData['a1'], - 'First level not updated' - ); - - static::assertEquals( - $updateData['b1']['a2'], - $updatedData['b1']['a2'], - 'Second level not updated' - ); + $updatedTranslation = $this->resource->getList(0, 1, [ + ['property' => 'translation.key', 'value' => $created->getKey()], + ]); + $updatedTranslation = $updatedTranslation['data'][0]; - static::assertEquals( - $updateData['b1']['b2']['a3'], - $updatedData['b1']['b2']['a3'], - 'Third level not updated' - ); + $updateData = $update['data']; + $updatedData = $updatedTranslation['data']; - static::assertEquals( - $create['data']['b1']['b2']['b3']['a4'], - $updatedData['b1']['b2']['b3']['a4'], - 'Fourth level not updated' - ); + static::assertSame($updateData['a1'], $updatedData['a1'], 'First level not updated'); + static::assertSame($updateData['b1']['a2'], $updatedData['b1']['a2'], 'Second level not updated'); + static::assertSame($updateData['b1']['b2']['a3'], $updatedData['b1']['b2']['a3'], 'Third level not updated'); + static::assertSame($create['data']['b1']['b2']['b3']['a4'], $updatedData['b1']['b2']['b3']['a4'], 'Fourth level not updated'); } public function testBatch(): void { $translations = []; for ($i = 0; $i < 4; ++$i) { - $translations[] = $this->getDummyData('article'); + $translations[] = $this->getDummyData(self::PRODUCT_TYPE); } - $article = Shopware()->Db()->fetchRow( + $product = $this->connection->fetchAssociative( 'SELECT ordernumber, articleID FROM s_articles_details LIMIT 1' ); - $translations[0]['key'] = $article['ordernumber']; + static::assertIsArray($product); + $translations[0]['key'] = $product['ordernumber']; $translations[0]['useNumberAsId'] = true; - $results = $this->resource->batch($translations); - - foreach ($results as $result) { + foreach ($this->resource->batch($translations) as $result) { static::assertTrue($result['success']); - static::assertEquals('update', $result['operation']); + static::assertSame('update', $result['operation']); static::assertNotEmpty($result['data']); - static::assertEquals(2, $result['data']['shopId']); + static::assertSame(2, $result['data']['shopId']); } } - /** - * @depends testCreateArticleByNumber - */ - public function testUpdateByNumber(int $productId): void + public function testBatchUpdate(): void + { + $productId1 = $this->createProduct(); + $productId2 = $this->createProduct(); + + $this->resource->setResultMode(2); + $translations = $this->resource->getList( + 0, + 2, + [ + ['property' => 'translation.type', 'value' => self::PRODUCT_TYPE], + ['property' => 'translation.shopId', 'value' => 2], + ], + [ + ['property' => 'translation.id', 'direction' => 'DESC'], + ] + ); + $translations = $translations['data']; + + foreach ($translations as &$translation) { + static::assertContains($translation['key'], [$productId1, $productId2]); + foreach ($translation['data'] as &$fieldTranslation) { + $fieldTranslation = 'UPDATE - ' . $fieldTranslation; + } + unset($fieldTranslation); + } + unset($translation); + + foreach ($this->resource->batch($translations) as $operation) { + static::assertTrue($operation['success']); + static::assertSame('update', $operation['operation']); + } + + $updatedTranslations = $this->resource->getList( + 0, + 2, + [ + ['property' => 'translation.type', 'value' => self::PRODUCT_TYPE], + ['property' => 'translation.shopId', 'value' => 2], + ], + [ + ['property' => 'translation.id', 'direction' => 'DESC'], + ] + ); + $updatedTranslations = $updatedTranslations['data']; + + foreach ($updatedTranslations as $key => $updatedTranslation) { + static::assertSame( + $translations[$key]['key'], + $updatedTranslation['key'], + 'Translation key do not match' + ); + static::assertSame( + $translations[$key]['type'], + $updatedTranslation['type'], + 'Translation type do not match' + ); + + $dataTranslation = $updatedTranslation['data']; + static::assertSame( + $translations[$key]['data']['name'], + $dataTranslation['name'] + ); + } + } + + public function testUpdateByNumber(): void { - $translation = $this->getDummyData('article'); - $product = Shopware()->Db()->fetchRow( + $productId = $this->createProductByNumber(); + $translation = $this->getDummyData(self::PRODUCT_TYPE); + $product = $this->connection->fetchAssociative( 'SELECT ordernumber, articleID FROM s_articles_details - WHERE articleID = :articleId + WHERE articleID = :productId LIMIT 1', - [':articleId' => $productId] + ['productId' => $productId] ); + static::assertIsArray($product); $translation['key'] = $product['ordernumber']; foreach ($translation['data'] as &$data) { $data .= '-UpdateByNumber'; } + unset($data); $result = $this->resource->updateByNumber($product['ordernumber'], $translation); static::assertInstanceOf(Translation::class, $result); - static::assertEquals($result->getKey(), $product['articleID']); + static::assertSame($result->getKey(), (int) $product['articleID']); $data = unserialize($result->getData()); foreach ($data as $item) { @@ -411,7 +377,7 @@ public function testUpdateByNumber(int $productId): void public function testDelete(): void { - $data = $this->getDummyData('article'); + $data = $this->getDummyData(self::PRODUCT_TYPE); $translation = $this->resource->create($data); static::assertInstanceOf(Translation::class, $translation); @@ -419,20 +385,26 @@ public function testDelete(): void unset($data['data']); $result = $this->resource->delete($data['key'], $data); - static::assertTrue($result); + + $translation = $this->resource->getList(0, 1, [ + ['property' => 'translation.key', 'value' => $data['key']], + ['property' => 'translation.type', 'value' => self::PRODUCT_TYPE], + ]); + static::assertCount(0, $translation['data']); } public function testDeleteByNumber(): void { - $data = $this->getDummyData('article'); + $data = $this->getDummyData(self::PRODUCT_TYPE); - $article = Shopware()->Db()->fetchRow( + $product = $this->connection->fetchAssociative( 'SELECT ordernumber, articleID FROM s_articles_details LIMIT 1' ); - $data['key'] = $article['articleID']; + static::assertIsArray($product); + $data['key'] = $product['articleID']; $translation = $this->resource->create($data); @@ -440,9 +412,14 @@ public function testDeleteByNumber(): void unset($data['data']); - $result = $this->resource->deleteByNumber($article['ordernumber'], $data); - + $result = $this->resource->deleteByNumber($product['ordernumber'], $data); static::assertTrue($result); + + $translation = $this->resource->getList(0, 1, [ + ['property' => 'translation.key', 'value' => $data['key']], + ['property' => 'translation.type', 'value' => self::PRODUCT_TYPE], + ]); + static::assertCount(0, $translation['data']); } public function testLinkNumber(): void @@ -461,7 +438,8 @@ public function testDownloadNumber(): void public function testManufacturerNumber(): void { - $entity = Shopware()->Db()->fetchRow('SELECT * FROM s_articles_supplier LIMIT 1'); + $entity = $this->connection->fetchAssociative('SELECT * FROM s_articles_supplier LIMIT 1'); + static::assertIsArray($entity); $this->numberCreate('supplier', (int) $entity['id'], $entity['name']); $this->numberUpdate('supplier', (int) $entity['id'], $entity['name']); $this->numberDelete('supplier', $entity['name']); @@ -469,7 +447,8 @@ public function testManufacturerNumber(): void public function testCountryName(): void { - $entity = Shopware()->Db()->fetchRow('SELECT * FROM s_core_countries LIMIT 1'); + $entity = $this->connection->fetchAssociative('SELECT * FROM s_core_countries LIMIT 1'); + static::assertIsArray($entity); $this->numberCreate('config_countries', (int) $entity['id'], $entity['countryname']); $this->numberUpdate('config_countries', (int) $entity['id'], $entity['countryname']); $this->numberDelete('config_countries', $entity['countryname']); @@ -477,7 +456,8 @@ public function testCountryName(): void public function testCountryIso(): void { - $entity = Shopware()->Db()->fetchRow('SELECT * FROM s_core_countries LIMIT 1'); + $entity = $this->connection->fetchAssociative('SELECT * FROM s_core_countries LIMIT 1'); + static::assertIsArray($entity); $this->numberCreate('config_countries', (int) $entity['id'], $entity['countryiso']); $this->numberUpdate('config_countries', (int) $entity['id'], $entity['countryiso']); $this->numberDelete('config_countries', $entity['countryiso']); @@ -485,7 +465,8 @@ public function testCountryIso(): void public function testCountryStateName(): void { - $entity = Shopware()->Db()->fetchRow('SELECT * FROM s_core_countries_states LIMIT 1'); + $entity = $this->connection->fetchAssociative('SELECT * FROM s_core_countries_states LIMIT 1'); + static::assertIsArray($entity); $this->numberCreate('config_country_states', (int) $entity['id'], $entity['name']); $this->numberUpdate('config_country_states', (int) $entity['id'], $entity['name']); $this->numberDelete('config_country_states', $entity['name']); @@ -493,7 +474,8 @@ public function testCountryStateName(): void public function testCountryStateCode(): void { - $entity = Shopware()->Db()->fetchRow('SELECT * FROM s_core_countries_states LIMIT 1'); + $entity = $this->connection->fetchAssociative('SELECT * FROM s_core_countries_states LIMIT 1'); + static::assertIsArray($entity); $this->numberCreate('config_country_states', (int) $entity['id'], $entity['shortcode']); $this->numberUpdate('config_country_states', (int) $entity['id'], $entity['shortcode']); $this->numberDelete('config_country_states', $entity['shortcode']); @@ -501,7 +483,8 @@ public function testCountryStateCode(): void public function testDispatchName(): void { - $entity = Shopware()->Db()->fetchRow('SELECT * FROM s_premium_dispatch LIMIT 1'); + $entity = $this->connection->fetchAssociative('SELECT * FROM s_premium_dispatch LIMIT 1'); + static::assertIsArray($entity); $this->numberCreate('config_dispatch', (int) $entity['id'], $entity['name']); $this->numberUpdate('config_dispatch', (int) $entity['id'], $entity['name']); $this->numberDelete('config_dispatch', $entity['name']); @@ -509,7 +492,8 @@ public function testDispatchName(): void public function testPaymentName(): void { - $entity = Shopware()->Db()->fetchRow('SELECT * FROM s_core_paymentmeans LIMIT 1'); + $entity = $this->connection->fetchAssociative('SELECT * FROM s_core_paymentmeans LIMIT 1'); + static::assertIsArray($entity); $this->numberCreate('config_payment', (int) $entity['id'], $entity['name']); $this->numberUpdate('config_payment', (int) $entity['id'], $entity['name']); $this->numberDelete('config_payment', $entity['name']); @@ -517,7 +501,8 @@ public function testPaymentName(): void public function testPaymentDescription(): void { - $entity = Shopware()->Db()->fetchRow('SELECT * FROM s_core_paymentmeans LIMIT 1'); + $entity = $this->connection->fetchAssociative('SELECT * FROM s_core_paymentmeans LIMIT 1'); + static::assertIsArray($entity); $this->numberCreate('config_payment', (int) $entity['id'], $entity['description']); $this->numberUpdate('config_payment', (int) $entity['id'], $entity['description']); $this->numberDelete('config_payment', $entity['description']); @@ -525,8 +510,8 @@ public function testPaymentDescription(): void public function testFilterSetNumber(): void { - $entity = Shopware()->Db()->fetchRow('SELECT * FROM s_filter LIMIT 1'); - + $entity = $this->connection->fetchAssociative('SELECT * FROM s_filter LIMIT 1'); + static::assertIsArray($entity); $this->numberCreate('propertygroup', (int) $entity['id'], $entity['name']); $this->numberUpdate('propertygroup', (int) $entity['id'], $entity['name']); $this->numberDelete('propertygroup', $entity['name']); @@ -535,7 +520,7 @@ public function testFilterSetNumber(): void public function testFilterGroupNumber(): void { $entity = $this->getFilterGroupName(); - + static::assertIsArray($entity); $this->numberCreate('propertyoption', (int) $entity['id'], $entity['name']); $this->numberUpdate('propertyoption', (int) $entity['id'], $entity['name']); $this->numberDelete('propertyoption', $entity['name']); @@ -544,7 +529,7 @@ public function testFilterGroupNumber(): void public function testFilterOptionNumber(): void { $entity = $this->getFilterOptionName(); - + static::assertIsArray($entity); $this->numberCreate('propertyvalue', (int) $entity['id'], $entity['name']); $this->numberUpdate('propertyvalue', (int) $entity['id'], $entity['name']); $this->numberDelete('propertyvalue', $entity['name']); @@ -552,10 +537,8 @@ public function testFilterOptionNumber(): void public function testConfiguratorGroupNumber(): void { - $entity = Shopware()->Db()->fetchRow(' - SELECT * FROM s_article_configurator_groups - '); - + $entity = $this->connection->fetchAssociative('SELECT * FROM s_article_configurator_groups'); + static::assertIsArray($entity); $this->numberCreate('configuratorgroup', (int) $entity['id'], $entity['name']); $this->numberUpdate('configuratorgroup', (int) $entity['id'], $entity['name']); $this->numberDelete('configuratorgroup', $entity['name']); @@ -564,7 +547,7 @@ public function testConfiguratorGroupNumber(): void public function testConfiguratorOptionNumber(): void { $entity = $this->getConfiguratorOptionName(); - + static::assertIsArray($entity); $this->numberCreate('configuratoroption', (int) $entity['id'], $entity['name']); $this->numberUpdate('configuratoroption', (int) $entity['id'], $entity['name']); $this->numberDelete('configuratoroption', $entity['name']); @@ -573,7 +556,7 @@ public function testConfiguratorOptionNumber(): void public function testCreateMissingKey(): void { $this->expectException(ParameterMissingException::class); - $data = $this->getDummyData('article'); + $data = $this->getDummyData(self::PRODUCT_TYPE); unset($data['key']); $this->resource->create($data); } @@ -581,7 +564,7 @@ public function testCreateMissingKey(): void public function testCreateByNumberMissingKey(): void { $this->expectException(ParameterMissingException::class); - $data = $this->getDummyData('article'); + $data = $this->getDummyData(self::PRODUCT_TYPE); unset($data['key']); $this->resource->createByNumber($data); } @@ -589,65 +572,66 @@ public function testCreateByNumberMissingKey(): void public function testUpdateMissingId(): void { $this->expectException(ParameterMissingException::class); - $data = $this->getDummyData('article'); + $data = $this->getDummyData(self::PRODUCT_TYPE); $this->resource->update(0, $data); } public function testUpdateByNumberMissingId(): void { $this->expectException(ParameterMissingException::class); - $data = $this->getDummyData('article'); + $data = $this->getDummyData(self::PRODUCT_TYPE); $this->resource->updateByNumber('', $data); } public function testDeleteMissingId(): void { $this->expectException(ParameterMissingException::class); - $data = $this->getDummyData('article'); + $data = $this->getDummyData(self::PRODUCT_TYPE); $this->resource->delete(0, $data); } public function testDeleteByNumberMissingId(): void { $this->expectException(ParameterMissingException::class); - $data = $this->getDummyData('article'); + $data = $this->getDummyData(self::PRODUCT_TYPE); $this->resource->deleteByNumber('', $data); } public function testDeleteInvalidTranslation(): void { $this->expectException(NotFoundException::class); - $data = $this->getDummyData('article'); + $data = $this->getDummyData(self::PRODUCT_TYPE); $this->resource->delete(-200, $data); } public function testDeleteByNumberInvalidTranslation(): void { $this->expectException(NotFoundException::class); - $data = $this->getDummyData('article'); + $data = $this->getDummyData(self::PRODUCT_TYPE); - $article = Shopware()->Db()->fetchRow('SELECT ordernumber, articleID FROM s_articles_details LIMIT 1'); - $data['key'] = $article['articleID']; + $product = $this->connection->fetchAssociative('SELECT ordernumber, articleID FROM s_articles_details LIMIT 1'); + static::assertIsArray($product); + $data['key'] = $product['articleID']; $this->resource->create($data); $this->resource->delete($data['key'], $data); - $this->resource->deleteByNumber($article['ordernumber'], $data); + $this->resource->deleteByNumber($product['ordernumber'], $data); } public function testInvalidTypeByNumber(): void { $this->expectException(CustomValidationException::class); - $data = $this->getDummyData('article'); + $data = $this->getDummyData(self::PRODUCT_TYPE); $data['type'] = 'Invalid'; $this->resource->createByNumber($data); } - public function testInvalidArticleNumber(): void + public function testInvalidProductNumber(): void { $this->expectException(NotFoundException::class); - $data = $this->getDummyData('article'); + $data = $this->getDummyData(self::PRODUCT_TYPE); $data['key'] = 'Invalid-Order-Number'; $this->resource->createByNumber($data); } @@ -837,15 +821,15 @@ public function testInvalidConfiguratorOptionWithOptionName(): void public function testMissingTypeException(): void { $this->expectException(ParameterMissingException::class); - $data = $this->getDummyData('article'); + $data = $this->getDummyData(self::PRODUCT_TYPE); unset($data['type']); $this->resource->create($data); } - public function testMissingshopIdException(): void + public function testMissingShopIdException(): void { $this->expectException(ParameterMissingException::class); - $data = $this->getDummyData('article'); + $data = $this->getDummyData(self::PRODUCT_TYPE); unset($data['shopId']); $this->resource->create($data); } @@ -853,7 +837,7 @@ public function testMissingshopIdException(): void public function testMissingDataException(): void { $this->expectException(ParameterMissingException::class); - $data = $this->getDummyData('article'); + $data = $this->getDummyData(self::PRODUCT_TYPE); unset($data['data']); $this->resource->create($data); } @@ -861,35 +845,97 @@ public function testMissingDataException(): void public function testMissingDataIsArrayException(): void { $this->expectException(CustomValidationException::class); - $data = $this->getDummyData('article'); + $data = $this->getDummyData(self::PRODUCT_TYPE); $data['data'] = 1; $this->resource->create($data); } /** + * Override test method of parent class because the translation resource has no "getOne" method + * * @group disable */ public function testGetOneWithMissingPrivilegeShouldThrowPrivilegeException(): void { + // Do not remove static::assertTrue(true); } /** + * Override test method of parent class because the translation resource has no "getOne" method + * * @group disable */ public function testGetOneWithInvalidIdShouldThrowNotFoundException(): void { + // Do not remove static::assertTrue(true); } /** + * Override test method of parent class because the translation resource has no "getOne" method + * * @group disable */ public function testGetOneWithMissingIdShouldThrowParameterMissingException(): void { + // Do not remove static::assertTrue(true); } + private function createProduct(): int + { + $data = $this->getDummyData(self::PRODUCT_TYPE); + + $translation = $this->resource->create($data); + + static::assertInstanceOf(Translation::class, $translation); + static::assertSame( + $data['key'], + $translation->getKey(), + 'Translation key do not match' + ); + static::assertSame( + $data['type'], + $translation->getType(), + 'Translation type do not match' + ); + static::assertSame( + $data['data'], + $this->resource->getTranslationComponent()->unFilterData( + self::PRODUCT_TYPE, + $translation->getData() + ), + 'Translation data do not match' + ); + + return $translation->getKey(); + } + + private function createProductByNumber(): int + { + $data = $this->getDummyData(self::PRODUCT_TYPE); + $product = $this->connection->fetchAssociative('SELECT ordernumber, articleID FROM s_articles_details LIMIT 1'); + static::assertIsArray($product); + $data['key'] = $product['ordernumber']; + + $translation = $this->resource->createByNumber($data); + + static::assertInstanceOf(Translation::class, $translation); + static::assertSame((int) $product['articleID'], $translation->getKey(), 'Translation key do not match'); + static::assertSame($data['type'], $translation->getType(), 'Translation type do not match'); + static::assertSame( + $data['data'], + $this->resource->getTranslationComponent()->unFilterData( + self::PRODUCT_TYPE, + $translation->getData() + ), + 'Translation data do not match' + ); + + return (int) $product['articleID']; + } + private function numberCreate(string $type, int $id, string $number): void { $data = $this->getDummyData($type); @@ -899,7 +945,7 @@ private function numberCreate(string $type, int $id, string $number): void static::assertInstanceOf(Translation::class, $translation); - static::assertEquals($id, $translation->getKey()); + static::assertSame($id, $translation->getKey()); $translated = $this->resource->getTranslationComponent()->unFilterData( $type, @@ -907,7 +953,7 @@ private function numberCreate(string $type, int $id, string $number): void ); foreach ($data['data'] as $key => $value) { - static::assertEquals($value, $translated[$key]); + static::assertSame($value, $translated[$key]); } } @@ -917,12 +963,13 @@ private function numberUpdate(string $type, int $id, string $number): void foreach ($data['data'] as &$item) { $item .= '-UPDATED'; } + unset($item); $translation = $this->resource->updateByNumber($number, $data); static::assertInstanceOf(Translation::class, $translation); - static::assertEquals($id, $translation->getKey()); + static::assertSame($id, $translation->getKey()); $translated = $this->resource->getTranslationComponent()->unFilterData( $type, @@ -930,7 +977,7 @@ private function numberUpdate(string $type, int $id, string $number): void ); foreach ($data['data'] as $key => $value) { - static::assertEquals($value, $translated[$key]); + static::assertSame($value, $translated[$key]); } } @@ -942,7 +989,7 @@ private function numberDelete(string $type, string $number): void } /** - * @return array{type: string, key: int, data: array, shopId: int} + * @return array{type: string, key: int, data: array, shopId: int} */ private function getDummyData(string $type, int $shopId = 2): array { @@ -960,7 +1007,7 @@ private function getDummyData(string $type, int $shopId = 2): array private function getTypeFields(string $type): array { switch (strtolower($type)) { - case 'article': + case self::PRODUCT_TYPE: return [ 'name' => 'Dummy Translation', 'description' => 'Dummy Translation', @@ -1010,7 +1057,7 @@ private function getTypeFields(string $type): array */ private function getFilterGroupName(): array { - return Shopware()->Db()->fetchRow( + $filterOptions = $this->connection->fetchAssociative( "SELECT fo.id, CONCAT(f.name, '|', fo.name) as name FROM s_filter_options as fo INNER JOIN s_filter_relations as fr @@ -1019,6 +1066,9 @@ private function getFilterGroupName(): array ON f.id = fr.groupID LIMIT 1" ); + static::assertIsArray($filterOptions); + + return $filterOptions; } /** @@ -1026,7 +1076,7 @@ private function getFilterGroupName(): array */ private function getFilterOptionName(): array { - return Shopware()->Db()->fetchRow( + $filterValues = $this->connection->fetchAssociative( "SELECT fv.id, CONCAT(f.name, '|', fo.name, '|', fv.value) as name FROM s_filter_values as fv INNER JOIN s_filter_options as fo @@ -1037,6 +1087,9 @@ private function getFilterOptionName(): array ON f.id = fr.groupID LIMIT 1" ); + static::assertIsArray($filterValues); + + return $filterValues; } /** @@ -1044,12 +1097,15 @@ private function getFilterOptionName(): array */ private function getConfiguratorOptionName(): array { - return Shopware()->Db()->fetchRow( + $configuratorGroups = $this->connection->fetchAssociative( "SELECT co.id, CONCAT(cg.name, '|', co.name) as name FROM s_article_configurator_groups as cg INNER JOIN s_article_configurator_options as co ON co.group_id = cg.id LIMIT 1" ); + static::assertIsArray($configuratorGroups); + + return $configuratorGroups; } } From 99e3f4743b694f842da0cc3b287f2c4a291064af Mon Sep 17 00:00:00 2001 From: Michael Telgmann Date: Fri, 10 Jun 2022 15:23:49 +0200 Subject: [PATCH 043/730] SW-26756 - Fix issue with MySQL version 8.0.29 --- .gitlab-ci.yml | 6 +- .phpstan-baseline.neon | 80 -------------- .../Controllers/Backend/Systeminfo.php | 101 +++++++++++------- ...{SysteminfoTest.php => SystemInfoTest.php} | 36 +++++-- 4 files changed, 90 insertions(+), 133 deletions(-) rename tests/Functional/Controllers/Backend/{SysteminfoTest.php => SystemInfoTest.php} (74%) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1051fbf7c99..ebe5f7ba803 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -183,7 +183,7 @@ PHP 8.1: MySQL 8.0: extends: .phpunit_base services: - - name: mysql:8.0.19 + - name: mysql:8.0 alias: mysql command: [ "mysqld", "--character-set-server=utf8mb4", "--collation-server=utf8mb4_unicode_ci", "--default-authentication-plugin=mysql_native_password", "--sql-require-primary-key=ON" ] @@ -203,7 +203,7 @@ Elasticsearch 7: extends: .phpunit_es_base image: gitlab.shopware.com:5005/shopware/5/product/image/continuous:7.4 services: - - name: mysql:8.0.19 + - name: mysql:8.0 alias: mysql command: [ "mysqld", "--character-set-server=utf8mb4", "--collation-server=utf8mb4_unicode_ci", "--default-authentication-plugin=mysql_native_password" ] - name: docker.elastic.co/elasticsearch/elasticsearch:7.9.1 @@ -235,7 +235,7 @@ Elasticsearch 7: alias: selenium - name: mailhog/mailhog alias: smtp - - name: mysql:8.0.19 + - name: mysql:8.0 alias: mysql command: [ "mysqld", "--character-set-server=utf8mb4", "--collation-server=utf8mb4_unicode_ci", "--default-authentication-plugin=mysql_native_password" ] diff --git a/.phpstan-baseline.neon b/.phpstan-baseline.neon index d9426cf3d0c..e381eb5f78f 100644 --- a/.phpstan-baseline.neon +++ b/.phpstan-baseline.neon @@ -26580,56 +26580,6 @@ parameters: count: 1 path: engine/Shopware/Controllers/Backend/Supplier.php - - - message: "#^Cannot call method getOffset\\(\\) on DateTimeZone\\|false\\.$#" - count: 2 - path: engine/Shopware/Controllers/Backend/Systeminfo.php - - - - message: "#^Method Shopware_Controllers_Backend_Systeminfo\\:\\:getConfigListAction\\(\\) has no return type specified\\.$#" - count: 1 - path: engine/Shopware/Controllers/Backend/Systeminfo.php - - - - message: "#^Method Shopware_Controllers_Backend_Systeminfo\\:\\:getFileListAction\\(\\) has no return type specified\\.$#" - count: 1 - path: engine/Shopware/Controllers/Backend/Systeminfo.php - - - - message: "#^Method Shopware_Controllers_Backend_Systeminfo\\:\\:getOptimizersAction\\(\\) has no return type specified\\.$#" - count: 1 - path: engine/Shopware/Controllers/Backend/Systeminfo.php - - - - message: "#^Method Shopware_Controllers_Backend_Systeminfo\\:\\:getPathListAction\\(\\) has no return type specified\\.$#" - count: 1 - path: engine/Shopware/Controllers/Backend/Systeminfo.php - - - - message: "#^Method Shopware_Controllers_Backend_Systeminfo\\:\\:getTimezoneAction\\(\\) has no return type specified\\.$#" - count: 1 - path: engine/Shopware/Controllers/Backend/Systeminfo.php - - - - message: "#^Method Shopware_Controllers_Backend_Systeminfo\\:\\:getVersionListAction\\(\\) has no return type specified\\.$#" - count: 1 - path: engine/Shopware/Controllers/Backend/Systeminfo.php - - - - message: "#^Method Shopware_Controllers_Backend_Systeminfo\\:\\:infoAction\\(\\) has no return type specified\\.$#" - count: 1 - path: engine/Shopware/Controllers/Backend/Systeminfo.php - - - - message: "#^Parameter \\#1 \\$timezone of function timezone_open expects string, string\\|false given\\.$#" - count: 1 - path: engine/Shopware/Controllers/Backend/Systeminfo.php - - - - message: "#^Parameter \\#2 \\$timezone of class DateTime constructor expects DateTimeZone\\|null, DateTimeZone\\|false given\\.$#" - count: 1 - path: engine/Shopware/Controllers/Backend/Systeminfo.php - - message: "#^Cannot access offset 'id' on array\\\\|Shopware\\\\Models\\\\Shop\\\\Template\\.$#" count: 1 @@ -43925,36 +43875,6 @@ parameters: count: 1 path: tests/Functional/Controllers/Backend/SupplierTest.php - - - message: "#^Access to an undefined property Enlight_View_Default\\:\\:\\$success\\.$#" - count: 4 - path: tests/Functional/Controllers/Backend/SysteminfoTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Controllers\\\\Backend\\\\SysteminfoTest\\:\\:testGetConfigList\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Controllers/Backend/SysteminfoTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Controllers\\\\Backend\\\\SysteminfoTest\\:\\:testGetFileList\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Controllers/Backend/SysteminfoTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Controllers\\\\Backend\\\\SysteminfoTest\\:\\:testGetPathList\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Controllers/Backend/SysteminfoTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Controllers\\\\Backend\\\\SysteminfoTest\\:\\:testGetVersionList\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Controllers/Backend/SysteminfoTest.php - - - - message: "#^Parameter \\#1 \\$json of function json_decode expects string, array\\|string\\|null given\\.$#" - count: 4 - path: tests/Functional/Controllers/Backend/SysteminfoTest.php - - message: "#^Access to an undefined property Enlight_View_Default\\:\\:\\$data\\.$#" count: 3 diff --git a/engine/Shopware/Controllers/Backend/Systeminfo.php b/engine/Shopware/Controllers/Backend/Systeminfo.php index 004618bd53b..2dba7efc64b 100644 --- a/engine/Shopware/Controllers/Backend/Systeminfo.php +++ b/engine/Shopware/Controllers/Backend/Systeminfo.php @@ -1,4 +1,6 @@ Request()->getActionName(), ['index', 'load', 'info'])) { - $this->Front()->Plugins()->Json()->setRenderer(true); + $this->Front()->Plugins()->Json()->setRenderer(); } } @@ -55,14 +59,16 @@ public function preDispatch() * The array also contains a status, whether the minimum requirements are met * The encoder-configs are excluded, because they are needed in another store * getEncoderAction loads those two encoder-configs + * + * @return void */ public function getConfigListAction() { $result = $this->get('shopware.requirements')->toArray(); - foreach ($result['checks'] as $key => &$config) { + foreach ($result['checks'] as $key => $config) { // Those configs mustn't be displayed in the grid - if ($config['name'] == 'mod_rewrite') { + if ($config['name'] === 'mod_rewrite') { unset($result['checks'][$key]); } } @@ -71,6 +77,8 @@ public function getConfigListAction() /** * Function to get all necessary paths and a status, whether the paths are available + * + * @return void */ public function getPathListAction() { @@ -80,6 +88,8 @@ public function getPathListAction() /** * Function to get all necessary files and the status, whether those files match with the original Shopware-Files + * + * @return void */ public function getFileListAction() { @@ -94,71 +104,80 @@ public function getFileListAction() $skipList = [ ]; - $list = new Shopware_Components_Check_File($fileName, Shopware()->DocPath(), $skipList); + $list = new Shopware_Components_Check_File( + $fileName, + $this->container->getParameter('shopware.app.rootDir'), + $skipList + ); $this->View()->assign(['success' => true, 'data' => $list->toArray()]); } /** * Function to get all plugins and its version. + * + * @return void */ public function getVersionListAction() { - $select = Shopware()->Db()->select()->from( - 's_core_plugins', - ['version', 'name', 'namespace', 'source'] - ); - - $rows = Shopware()->Db()->fetchAll($select); + $rows = $this->get(Connection::class)->createQueryBuilder() + ->select(['version', 'name', 'namespace', 'source']) + ->from('s_core_plugins') + ->execute() + ->fetchAllAssociative(); foreach ($rows as $key => $row) { $rows[$key]['name'] = $row['namespace'] . '/' . $row['source'] . '/' . $row['name']; } - array_unshift($rows, ['name' => 'Shopware', 'version' => Shopware()->Config()->get('Version')]); + array_unshift($rows, ['name' => 'Shopware', 'version' => $this->get('config')->get('Version')]); $this->View()->assign(['success' => true, 'data' => $rows]); } /** * Function to get timezone diff + * + * @return void */ public function getTimezoneAction() { + $connection = $this->get(Connection::class); $offset = 0; + $timeZone = ''; try { - $sql = <<<'SQL' - SELECT timeZones.timeZone - FROM ( - SELECT @@SESSION.time_zone AS timeZone - UNION - SELECT @@system_time_zone AS timeZone - ) AS timeZones - WHERE timeZone != 'SYSTEM' - LIMIT 1 -SQL; - - $timezone = $this->container->get(\Doctrine\DBAL\Connection::class) - ->query($sql) - ->fetchColumn(0); - - if (\in_array($timezone[0], ['-', '+'], true)) { - $databaseZone = new DateTimeZone($timezone); + $timeZone = $connection->executeQuery('SELECT @@SESSION.time_zone')->fetchOne(); + + if ($timeZone === 'SYSTEM') { + $timeZone = $connection->executeQuery('SELECT @@system_time_zone')->fetchOne(); + } + } catch (PDOException $e) { + } + + if (!empty($timeZone)) { + $databaseZone = null; + if (\in_array($timeZone[0], ['-', '+'], true)) { + $databaseZone = new DateTimeZone($timeZone); } else { - $databaseZone = timezone_open(timezone_name_from_abbr($timezone)); + $timeZoneFromAbbr = timezone_name_from_abbr($timeZone); + if (\is_string($timeZoneFromAbbr)) { + $databaseZone = timezone_open($timeZoneFromAbbr); + if (!$databaseZone instanceof DateTimeZone) { + $databaseZone = null; + } + } } $phpZone = timezone_open(date_default_timezone_get()); - $databaseTime = new DateTime('now', $databaseZone); - - if (!empty($timezone)) { + if ($databaseZone instanceof DateTimeZone && $phpZone instanceof DateTimeZone) { + $databaseTime = new DateTime('now', $databaseZone); $offset = abs($databaseZone->getOffset(new DateTime()) - $phpZone->getOffset($databaseTime)); } - } catch (\PDOException $e) { } + if (empty($offset)) { $sql = 'SELECT UNIX_TIMESTAMP()-' . time(); - $offset = $this->container->get(\Doctrine\DBAL\Connection::class)->query($sql)->fetchColumn(0); + $offset = (int) $connection->executeQuery($sql)->fetchOne(); } $this->View()->assign(['success' => true, 'offset' => $offset < 60 ? 0 : round($offset / 60)]); @@ -166,10 +185,12 @@ public function getTimezoneAction() /** * Function to display the phpinfo + * + * @return void */ public function infoAction() { - Shopware()->Front()->Plugins()->ViewRenderer()->setNoRender(); + $this->get('front')->Plugins()->ViewRenderer()->setNoRender(); $_COOKIE = []; $_REQUEST = []; $_SERVER['HTTP_COOKIE'] = null; @@ -179,9 +200,12 @@ public function infoAction() phpinfo(); } + /** + * @return void + */ public function getOptimizersAction() { - $optimizers = $this->get(\Shopware\Bundle\MediaBundle\OptimizerService::class)->getOptimizers(); + $optimizers = $this->get(OptimizerService::class)->getOptimizers(); $optimizerResult = []; foreach ($optimizers as $optimizer) { @@ -197,11 +221,6 @@ public function getOptimizersAction() $this->View()->assign('total', \count($optimizerResult)); } - /** - * Returns a list with actions which should not be validated for CSRF protection - * - * @return string[] - */ public function getWhitelistedCSRFActions() { return [ diff --git a/tests/Functional/Controllers/Backend/SysteminfoTest.php b/tests/Functional/Controllers/Backend/SystemInfoTest.php similarity index 74% rename from tests/Functional/Controllers/Backend/SysteminfoTest.php rename to tests/Functional/Controllers/Backend/SystemInfoTest.php index e153abfc638..59172b53d88 100644 --- a/tests/Functional/Controllers/Backend/SysteminfoTest.php +++ b/tests/Functional/Controllers/Backend/SystemInfoTest.php @@ -1,4 +1,6 @@ Plugins()->Backend()->Auth()->setNoAcl(); } - public function testGetConfigList() + public function testGetConfigList(): void { $response = $this->dispatch('backend/systeminfo/getConfigList'); - static::assertTrue($this->View()->success); + static::assertTrue($this->View()->getAssign('success')); $body = $response->getBody(); + static::assertIsString($body); $jsonBody = json_decode($body, true); static::assertArrayHasKey('data', $jsonBody); @@ -58,13 +61,14 @@ public function testGetConfigList() static::assertArrayHasKey('status', $jsonBody['data'][0]); } - public function testGetPathList() + public function testGetPathList(): void { $response = $this->dispatch('backend/systeminfo/getPathList'); - static::assertTrue($this->View()->success); + static::assertTrue($this->View()->getAssign('success')); $body = $response->getBody(); + static::assertIsString($body); $jsonBody = json_decode($body, true); static::assertArrayHasKey('data', $jsonBody); @@ -74,26 +78,28 @@ public function testGetPathList() static::assertArrayHasKey('result', $jsonBody['data'][0]); } - public function testGetFileList() + public function testGetFileList(): void { $response = $this->dispatch('backend/systeminfo/getFileList'); - static::assertTrue($this->View()->success); + static::assertTrue($this->View()->getAssign('success')); $body = $response->getBody(); + static::assertIsString($body); $jsonBody = json_decode($body, true); static::assertArrayHasKey('data', $jsonBody); static::assertArrayHasKey('success', $jsonBody); } - public function testGetVersionList() + public function testGetVersionList(): void { $response = $this->dispatch('backend/systeminfo/getVersionList'); - static::assertTrue($this->View()->success); + static::assertTrue($this->View()->getAssign('success')); $body = $response->getBody(); + static::assertIsString($body); $jsonBody = json_decode($body, true); static::assertArrayHasKey('data', $jsonBody); @@ -101,4 +107,16 @@ public function testGetVersionList() static::assertArrayHasKey('name', $jsonBody['data'][0]); static::assertArrayHasKey('version', $jsonBody['data'][0]); } + + public function testGetTimezone(): void + { + $response = $this->dispatch('backend/systeminfo/getTimezone'); + + static::assertTrue($this->View()->getAssign('success')); + + $body = $response->getBody(); + static::assertIsString($body); + $jsonBody = json_decode($body, true); + static::assertIsInt($jsonBody['offset']); + } } From 63db33c29682fbc5e42fe399f28b98eb190832c3 Mon Sep 17 00:00:00 2001 From: Michael Telgmann Date: Mon, 13 Jun 2022 11:23:43 +0200 Subject: [PATCH 044/730] SW-26539 - Fix generating of sitemap if custom URLs are defined --- .phpstan-baseline.neon | 25 --------- .../Provider/CustomUrlProvider.php | 3 +- .../Bundle/SitemapBundle/Struct/Url.php | 36 +++---------- .../Provider/CustomUrlProviderTest.php | 53 ++++++++++++------- 4 files changed, 42 insertions(+), 75 deletions(-) diff --git a/.phpstan-baseline.neon b/.phpstan-baseline.neon index e381eb5f78f..d6bb24318d7 100644 --- a/.phpstan-baseline.neon +++ b/.phpstan-baseline.neon @@ -41090,31 +41090,6 @@ parameters: count: 1 path: tests/Functional/Bundle/SearchBundleDBAL/SearchIndexerTest.php - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Bundle\\\\SitemapBundle\\\\Provider\\\\CustomUrlProviderTest\\:\\:getCustomUrlProvider\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Bundle/SitemapBundle/Provider/CustomUrlProviderTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Bundle\\\\SitemapBundle\\\\Provider\\\\CustomUrlProviderTest\\:\\:testGetUrlsReturnsAllUrlsForShop\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Bundle/SitemapBundle/Provider/CustomUrlProviderTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Bundle\\\\SitemapBundle\\\\Provider\\\\CustomUrlProviderTest\\:\\:testGetUrlsReturnsAllUrlsForShopIdZero\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Bundle/SitemapBundle/Provider/CustomUrlProviderTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Bundle\\\\SitemapBundle\\\\Provider\\\\CustomUrlProviderTest\\:\\:testGetUrlsReturnsNoUrls\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Bundle/SitemapBundle/Provider/CustomUrlProviderTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Bundle\\\\SitemapBundle\\\\Provider\\\\CustomUrlProviderTest\\:\\:testGetUrlsReturnsNoUrlsWrongShopId\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Bundle/SitemapBundle/Provider/CustomUrlProviderTest.php - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Bundle\\\\SitemapBundle\\\\SitemapLockTest\\:\\:testLocks\\(\\) has no return type specified\\.$#" count: 1 diff --git a/engine/Shopware/Bundle/SitemapBundle/Provider/CustomUrlProvider.php b/engine/Shopware/Bundle/SitemapBundle/Provider/CustomUrlProvider.php index 7c56f72a425..e6403ee43d7 100644 --- a/engine/Shopware/Bundle/SitemapBundle/Provider/CustomUrlProvider.php +++ b/engine/Shopware/Bundle/SitemapBundle/Provider/CustomUrlProvider.php @@ -24,6 +24,7 @@ namespace Shopware\Bundle\SitemapBundle\Provider; +use DateTimeImmutable; use Shopware\Bundle\SitemapBundle\Service\ConfigHandler; use Shopware\Bundle\SitemapBundle\Struct\Url; use Shopware\Bundle\SitemapBundle\UrlProviderInterface; @@ -60,7 +61,7 @@ public function getUrls(Context $routingContext, ShopContextInterface $shopConte $urls[] = new Url( $sitemapCustomUrl['url'], - $sitemapCustomUrl['lastMod'], + new DateTimeImmutable($sitemapCustomUrl['lastMod']), $sitemapCustomUrl['changeFreq'], 'custom', null, diff --git a/engine/Shopware/Bundle/SitemapBundle/Struct/Url.php b/engine/Shopware/Bundle/SitemapBundle/Struct/Url.php index d22ddd655c0..56ecd476d1a 100644 --- a/engine/Shopware/Bundle/SitemapBundle/Struct/Url.php +++ b/engine/Shopware/Bundle/SitemapBundle/Struct/Url.php @@ -30,51 +30,29 @@ class Url { /** * The Url - * - * @var string */ - private $loc; + private string $loc; /** * Date and time of last modification - * - * @var DateTimeInterface */ - private $lastmod; + private DateTimeInterface $lastmod; /** * Frequency of changing - * - * @var string */ - private $changefreq; + private string $changefreq; /** * Relative priority for this URL - * - * @var float */ - private $priority; + private float $priority; - /** - * @var string - */ - private $resource; + private string $resource; - /** - * @var int - */ - private $identifier; + private int $identifier; - /** - * @param string $loc - * @param DateTimeInterface $lastmod - * @param string $changefreq - * @param string $resource - * @param int|null $identifier - * @param float $priority - */ - public function __construct($loc, $lastmod, $changefreq, $resource, $identifier, $priority = 0.5) + public function __construct(string $loc, DateTimeInterface $lastmod, string $changefreq, string $resource, ?int $identifier, float $priority = 0.5) { $this->loc = $loc; $this->lastmod = $lastmod; diff --git a/tests/Functional/Bundle/SitemapBundle/Provider/CustomUrlProviderTest.php b/tests/Functional/Bundle/SitemapBundle/Provider/CustomUrlProviderTest.php index 2fb653f1f9c..20ebcb663b2 100644 --- a/tests/Functional/Bundle/SitemapBundle/Provider/CustomUrlProviderTest.php +++ b/tests/Functional/Bundle/SitemapBundle/Provider/CustomUrlProviderTest.php @@ -1,4 +1,6 @@ createMock(ConfigHandler::class); $configHandlerStub->method('get') @@ -45,7 +52,7 @@ public function testGetUrlsReturnsNoUrls() static::assertSame([], $customUrlProvider->getUrls(new Context(), $shopContext)); } - public function testGetUrlsReturnsAllUrlsForShop() + public function testGetUrlsReturnsAllUrlsForShop(): void { $shopId = 1; @@ -55,13 +62,14 @@ public function testGetUrlsReturnsAllUrlsForShop() ->willReturn([ [ 'url' => 'foo', - 'lastMod' => 1546853378, + 'lastMod' => '2022-06-13 11:07:47', 'changeFreq' => 'weekly', 'priority' => 0.5, 'shopId' => 2, - ], [ + ], + [ 'url' => 'bar', - 'lastMod' => 1546853378, + 'lastMod' => '2022-06-13 11:07:47', 'changeFreq' => 'weekly', 'priority' => 0.5, 'shopId' => $shopId, @@ -72,10 +80,16 @@ public function testGetUrlsReturnsAllUrlsForShop() $shopContext = $this->getContextService()->createShopContext($shopId); - static::assertCount(1, $customUrlProvider->getUrls(new Context(), $shopContext)); + $urls = $customUrlProvider->getUrls(new Context(), $shopContext); + static::assertCount(1, $urls); + + static::assertSame( + 'bar2022-06-13weekly0.5', + (string) $urls[0] + ); } - public function testGetUrlsReturnsAllUrlsForShopIdZero() + public function testGetUrlsReturnsAllUrlsForShopIdZero(): void { $shopId = 1; @@ -85,19 +99,21 @@ public function testGetUrlsReturnsAllUrlsForShopIdZero() ->willReturn([ [ 'url' => 'foo', - 'lastMod' => 1546853378, + 'lastMod' => '2022-06-13 11:07:47', 'changeFreq' => 'weekly', 'priority' => 0.5, 'shopId' => 2, - ], [ + ], + [ 'url' => 'bar', - 'lastMod' => 1546853378, + 'lastMod' => '2022-06-13 11:07:47', 'changeFreq' => 'weekly', 'priority' => 0.5, 'shopId' => 0, - ], [ + ], + [ 'url' => 'fooBar', - 'lastMod' => 1546853378, + 'lastMod' => '2022-06-13 11:07:47', 'changeFreq' => 'weekly', 'priority' => 0.5, 'shopId' => 0, @@ -114,7 +130,7 @@ public function testGetUrlsReturnsAllUrlsForShopIdZero() static::assertSame('fooBar', $urls[1]->getLoc()); } - public function testGetUrlsReturnsNoUrlsWrongShopId() + public function testGetUrlsReturnsNoUrlsWrongShopId(): void { $shopId = 1; @@ -124,7 +140,7 @@ public function testGetUrlsReturnsNoUrlsWrongShopId() ->willReturn([ [ 'url' => 'foo', - 'lastMod' => 1546853378, + 'lastMod' => '2022-06-13 11:07:47', 'changeFreq' => 'weekly', 'priority' => 0.5, 'shopId' => 2, @@ -138,16 +154,13 @@ public function testGetUrlsReturnsNoUrlsWrongShopId() static::assertEmpty($customUrlProvider->getUrls(new Context(), $shopContext)); } - private function getCustomUrlProvider(ConfigHandler $configHandlerStub) + private function getCustomUrlProvider(ConfigHandler $configHandlerStub): CustomUrlProvider { return new CustomUrlProvider($configHandlerStub); } - /** - * @return \Shopware\Bundle\StoreFrontBundle\Service\Core\ContextService - */ - private function getContextService() + private function getContextService(): ContextService { - return Shopware()->Container()->get(\Shopware\Bundle\StoreFrontBundle\Service\ContextServiceInterface::class); + return $this->getContainer()->get(ContextServiceInterface::class); } } From a2bc7466715672571e9b2b5895c866e213ed7205 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20Schr=C3=B6der?= Date: Tue, 7 Jun 2022 19:09:17 +0200 Subject: [PATCH 045/730] SW-26753 - Add check for active dispatches in product export fixes https://github.com/shopware/shopware/pull/2499 --- engine/Shopware/Core/sExport.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/Shopware/Core/sExport.php b/engine/Shopware/Core/sExport.php index 9b19c5765c8..7a1d42ea475 100644 --- a/engine/Shopware/Core/sExport.php +++ b/engine/Shopware/Core/sExport.php @@ -1709,7 +1709,7 @@ public function sGetPremiumDispatchSurcharge($basket) return false; } - $sql = 'SELECT id, bind_sql FROM s_premium_dispatch WHERE type=2 AND bind_sql IS NOT NULL'; + $sql = 'SELECT id, bind_sql FROM s_premium_dispatch WHERE type=2 AND active=1 AND bind_sql IS NOT NULL'; $statements = $this->db->fetchPairs($sql); $sql_where = ''; From 381342d61307f66171aba0b274586c2063f37dd8 Mon Sep 17 00:00:00 2001 From: Michael Telgmann Date: Mon, 13 Jun 2022 13:48:47 +0200 Subject: [PATCH 046/730] SW-26753 - Add test and improve code quality --- .phpstan-baseline.neon | 5 -- .phpstan.neon | 4 ++ engine/Shopware/Core/sAdmin.php | 21 +++++---- engine/Shopware/Core/sExport.php | 48 +++++++++++--------- engine/Shopware/Models/Dispatch/Dispatch.php | 41 +++++++++++------ tests/Functional/Core/ExportTest.php | 46 +++++++++++++++++++ 6 files changed, 115 insertions(+), 50 deletions(-) diff --git a/.phpstan-baseline.neon b/.phpstan-baseline.neon index d6bb24318d7..d0acce098e9 100644 --- a/.phpstan-baseline.neon +++ b/.phpstan-baseline.neon @@ -30220,11 +30220,6 @@ parameters: count: 1 path: engine/Shopware/Core/sExport.php - - - message: "#^Method sExport\\:\\:sGetPremiumDispatchSurcharge\\(\\) has parameter \\$basket with no value type specified in iterable type array\\.$#" - count: 1 - path: engine/Shopware/Core/sExport.php - - message: "#^Parameter \\#1 \\$search of function str_replace expects array\\|string, string\\|false\\|null given\\.$#" count: 1 diff --git a/.phpstan.neon b/.phpstan.neon index 99987db73a7..b30613902b9 100644 --- a/.phpstan.neon +++ b/.phpstan.neon @@ -187,3 +187,7 @@ parameters: # This is a bleeding edge feature and not working well since now. See https://github.com/phpstan/phpstan-doctrine/issues/332 - '#Parameter .* of method Doctrine\\ORM\\.*::.*\(\) expects .*literal-string.* given#' + + - # Doctrine type is integer. PHPStan allows only specific values + message: '#Property Shopware\\Models\\Dispatch\\Dispatch::\$.* type mapping mismatch: database can contain int but property expects 0\|1\|2\|3#' + path: engine/Shopware/Models/Dispatch/Dispatch.php diff --git a/engine/Shopware/Core/sAdmin.php b/engine/Shopware/Core/sAdmin.php index e2aa363e08e..600af3b2797 100644 --- a/engine/Shopware/Core/sAdmin.php +++ b/engine/Shopware/Core/sAdmin.php @@ -49,6 +49,7 @@ use Shopware\Components\Validator\EmailValidatorInterface; use Shopware\Models\Customer\Address; use Shopware\Models\Customer\Customer; +use Shopware\Models\Dispatch\Dispatch; use Shopware\Models\Mail\Mail; use ShopwarePlugin\PaymentMethods\Components\BasePaymentMethod; @@ -3045,7 +3046,7 @@ public function sGetPremiumShippingcosts($country = null) ]); $basket = $this->sGetDispatchBasket(empty($country['id']) ? null : $country['id']); - if (empty($basket) || $basket['count_article'] == 0) { + if (empty($basket) || (int) $basket['count_article'] === 0) { return false; } $country = $this->sGetCountry($basket['countryID']); @@ -3129,11 +3130,11 @@ public function sGetPremiumShippingcosts($country = null) if (empty($dispatch['calculation'])) { $from = round($basket['weight'], 3); - } elseif ($dispatch['calculation'] == 1) { + } elseif ((int) $dispatch['calculation'] === Dispatch::CALCULATION_PRICE) { $from = round($basket['amount'], 2); - } elseif ($dispatch['calculation'] == 2) { + } elseif ((int) $dispatch['calculation'] === Dispatch::CALCULATION_NUMBER_OF_PRODUCTS) { $from = round($basket['count_article']); - } elseif ($dispatch['calculation'] == 3) { + } elseif ((int) $dispatch['calculation'] === Dispatch::CALCULATION_CUSTOM) { $from = round((float) $basket['calculation_value_' . $dispatch['id']], 2); } else { return false; @@ -3171,7 +3172,7 @@ public function sGetPremiumShippingcosts($country = null) $result['brutto'] = round($result['brutto'], 2); if ( !empty($payment['surcharge']) - && $dispatch['surcharge_calculation'] != 2 + && (int) $dispatch['surcharge_calculation'] !== Dispatch::SURCHARGE_CALCULATION_NEVER && (empty($basket['shippingfree']) || empty($dispatch['surcharge_calculation'])) ) { $result['surcharge'] = $payment['surcharge']; @@ -4008,7 +4009,7 @@ private function calculateDispatchSurcharge($basket, $dispatches) foreach ($dispatches as $dispatch) { if (empty($dispatch['calculation'])) { $from = round((float) $basket['weight'], 3); - } elseif ($dispatch['calculation'] == 1) { + } elseif ((int) $dispatch['calculation'] === Dispatch::CALCULATION_PRICE) { if ( ($this->config->get('sARTICLESOUTPUTNETTO') && !$this->sSYSTEM->sUSERGROUPDATA['tax']) || (!$this->sSYSTEM->sUSERGROUPDATA['tax'] && $this->sSYSTEM->sUSERGROUPDATA['id']) @@ -4017,9 +4018,9 @@ private function calculateDispatchSurcharge($basket, $dispatches) } else { $from = round((float) $basket['amount'], 2); } - } elseif ($dispatch['calculation'] == 2) { + } elseif ((int) $dispatch['calculation'] === Dispatch::CALCULATION_NUMBER_OF_PRODUCTS) { $from = (int) $basket['count_article']; - } elseif ($dispatch['calculation'] == 3) { + } elseif ((int) $dispatch['calculation'] === Dispatch::CALCULATION_CUSTOM) { $from = (int) $basket['calculation_value_' . $dispatch['id']]; } else { continue; @@ -4147,7 +4148,7 @@ private function handlePaymentMeanSurcharge($country, $payment, $currencyFactor, $payment['surcharge'] = round($payment['surcharge'] * $currencyFactor, 2); // Fixed surcharge - if (!empty($payment['surcharge']) && (empty($dispatch) || $dispatch['surcharge_calculation'] == 3)) { + if (!empty($payment['surcharge']) && (empty($dispatch) || (int) $dispatch['surcharge_calculation'] === Dispatch::SURCHARGE_CALCULATION_AS_CART_ITEM)) { $surcharge = round($payment['surcharge'], 2); $payment['surcharge'] = 0; @@ -4171,7 +4172,7 @@ private function handlePaymentMeanSurcharge($country, $payment, $currencyFactor, } // Percentage surcharge - if (!empty($payment['debit_percent']) && (empty($dispatch) || $dispatch['surcharge_calculation'] != 2)) { + if (!empty($payment['debit_percent']) && (empty($dispatch) || (int) $dispatch['surcharge_calculation'] !== Dispatch::SURCHARGE_CALCULATION_NEVER)) { $amount = (float) $this->db->fetchOne( 'SELECT SUM(quantity*price) AS amount FROM s_order_basket diff --git a/engine/Shopware/Core/sExport.php b/engine/Shopware/Core/sExport.php index 7a1d42ea475..91c121fb0b8 100644 --- a/engine/Shopware/Core/sExport.php +++ b/engine/Shopware/Core/sExport.php @@ -22,6 +22,7 @@ * our trademarks remain entirely with us. */ +use Doctrine\DBAL\Connection; use Doctrine\ORM\AbstractQuery; use Shopware\Bundle\AttributeBundle\Service\CrudService; use Shopware\Bundle\AttributeBundle\Service\CrudServiceInterface; @@ -34,6 +35,7 @@ use Shopware\Components\Model\Exception\ModelNotFoundException; use Shopware\Components\ShopRegistrationServiceInterface; use Shopware\Components\Thumbnail\Manager; +use Shopware\Models\Dispatch\Dispatch; use Shopware\Models\Media\Album; use Shopware\Models\Media\Media; use Shopware\Models\Media\Repository; @@ -137,6 +139,8 @@ class sExport implements Enlight_Hook private Enlight_Components_Db_Adapter_Pdo_Mysql $db; + private Connection $connection; + private Shopware_Components_Config $config; private ConfiguratorServiceInterface $configuratorService; @@ -150,13 +154,15 @@ public function __construct( ContextServiceInterface $contextService = null, Enlight_Components_Db_Adapter_Pdo_Mysql $db = null, Shopware_Components_Config $config = null, - ConfiguratorServiceInterface $configuratorService = null + ConfiguratorServiceInterface $configuratorService = null, + Connection $connection = null ) { $container = Shopware()->Container(); $this->contextService = $contextService ?: $container->get(ContextServiceInterface::class); $this->additionalTextService = $container->get(AdditionalTextServiceInterface::class); $this->db = $db ?: $container->get('db'); + $this->connection = $connection ?: $container->get(Connection::class); $this->config = $config ?: $container->get(Shopware_Components_Config::class); $this->configuratorService = $configuratorService ?: $container->get(ConfiguratorServiceInterface::class); $this->cdnConfig = (array) $container->getParameter('shopware.cdn'); @@ -1699,7 +1705,7 @@ public function sGetPremiumDispatch($basket, $dispatch = null) } /** - * @param array $basket + * @param array $basket * * @return float|false */ @@ -1709,8 +1715,8 @@ public function sGetPremiumDispatchSurcharge($basket) return false; } - $sql = 'SELECT id, bind_sql FROM s_premium_dispatch WHERE type=2 AND active=1 AND bind_sql IS NOT NULL'; - $statements = $this->db->fetchPairs($sql); + $sql = 'SELECT id, bind_sql FROM s_premium_dispatch WHERE type=:type AND active=1 AND bind_sql IS NOT NULL'; + $statements = $this->connection->executeQuery($sql, ['type' => Dispatch::TYPE_SURCHARGE])->fetchAllKeyValue(); $sql_where = ''; foreach ($statements as $dispatchID => $statement) { @@ -1720,7 +1726,7 @@ public function sGetPremiumDispatchSurcharge($basket) } $sql_basket = []; foreach ($basket as $key => $value) { - $sql_basket[] = $this->db->quote($value) . " as `$key`"; + $sql_basket[] = $this->connection->quote($value) . " as `$key`"; } $sql_basket = implode(', ', $sql_basket); @@ -1787,30 +1793,28 @@ public function sGetPremiumDispatchSurcharge($basket) $sql_where GROUP BY d.id "; - $dispatches = $this->db->fetchAll($sql); + $dispatches = $this->connection->fetchAllAssociative($sql); $surcharge = 0; if (!empty($dispatches)) { foreach ($dispatches as $dispatch) { if (empty($dispatch['calculation'])) { $from = round($basket['weight'], 3); - } elseif ($dispatch['calculation'] == 1) { + } elseif ((int) $dispatch['calculation'] === Dispatch::CALCULATION_PRICE) { $from = round($basket['amount'], 2); - } elseif ($dispatch['calculation'] == 2) { + } elseif ((int) $dispatch['calculation'] === Dispatch::CALCULATION_NUMBER_OF_PRODUCTS) { $from = round($basket['count_article']); - } elseif ($dispatch['calculation'] == 3) { + } elseif ((int) $dispatch['calculation'] === Dispatch::CALCULATION_CUSTOM) { $from = round($basket['calculation_value_' . $dispatch['id']], 2); } else { continue; } - $sql = " - SELECT `value` , `factor` - FROM `s_premium_shippingcosts` - WHERE `from` <= $from - AND `dispatchID` = {$dispatch['id']} - ORDER BY `from` DESC - LIMIT 1 - "; - $result = $this->db->fetchRow($sql); + $sql = 'SELECT `value` , `factor` + FROM `s_premium_shippingcosts` + WHERE `from` <= $from + AND `dispatchID` = :dispatchId + ORDER BY `from` DESC + LIMIT 1'; + $result = $this->connection->fetchAssociative($sql, ['dispatchId' => $dispatch['id']]); if (!$result) { continue; } @@ -1856,11 +1860,11 @@ public function sGetArticlePremiumShippingcosts($article, $payment, $country, $d if (empty($dispatchData['calculation'])) { $from = round($basket['weight'], 3); - } elseif ($dispatchData['calculation'] == 1) { + } elseif ((int) $dispatchData['calculation'] === Dispatch::CALCULATION_PRICE) { $from = round($basket['amount'], 2); - } elseif ($dispatchData['calculation'] == 2) { + } elseif ((int) $dispatchData['calculation'] === Dispatch::CALCULATION_NUMBER_OF_PRODUCTS) { $from = round($basket['count_article']); - } elseif ($dispatchData['calculation'] == 3) { + } elseif ((int) $dispatchData['calculation'] === Dispatch::CALCULATION_CUSTOM) { $from = round($basket['calculation_value_' . $dispatchData['id']], 2); } else { return false; @@ -1893,7 +1897,7 @@ public function sGetArticlePremiumShippingcosts($article, $payment, $country, $d } $result['shippingcosts'] *= $this->sCurrency['factor']; $result['shippingcosts'] = round($result['shippingcosts'], 2); - if (!empty($payment['surcharge']) && $dispatchData['surcharge_calculation'] != 2 && (empty($article['shippingfree']) || empty($dispatchData['surcharge_calculation']))) { + if (!empty($payment['surcharge']) && (int) $dispatchData['surcharge_calculation'] !== Dispatch::SURCHARGE_CALCULATION_NEVER && (empty($article['shippingfree']) || empty($dispatchData['surcharge_calculation']))) { $result['shippingcosts'] += $payment['surcharge']; } diff --git a/engine/Shopware/Models/Dispatch/Dispatch.php b/engine/Shopware/Models/Dispatch/Dispatch.php index bb9b5575e99..f7a17a64875 100644 --- a/engine/Shopware/Models/Dispatch/Dispatch.php +++ b/engine/Shopware/Models/Dispatch/Dispatch.php @@ -56,6 +56,21 @@ */ class Dispatch extends ModelEntity { + public const TYPE_STANDARD = 0; + public const TYPE_ALTERNATIVE = 1; + public const TYPE_SURCHARGE = 2; + public const TYPE_DISCOUNT = 3; + + public const CALCULATION_WEIGHT = 0; + public const CALCULATION_PRICE = 1; + public const CALCULATION_NUMBER_OF_PRODUCTS = 2; + public const CALCULATION_CUSTOM = 3; + + public const SURCHARGE_CALCULATION_ALWAYS = 0; + public const SURCHARGE_CALCULATION_EXCLUDE_SHIPPING_FREE_PRODUCTS = 1; + public const SURCHARGE_CALCULATION_NEVER = 2; + public const SURCHARGE_CALCULATION_AS_CART_ITEM = 3; + /** * INVERSE SIDE * @@ -100,9 +115,9 @@ class Dispatch extends ModelEntity * - Standard Shipping == 0 * - Alternate Shipping == 1 * - Surcharge Shipping == 2 - * - Reduction Shipping == 3 + * - Discount Shipping == 3 * - * @var int + * @var self::TYPE_* * * @ORM\Column(name="type", type="integer", nullable=false) */ @@ -149,10 +164,10 @@ class Dispatch extends ModelEntity * Known types: * - 0 == Weight * - 1 == Price - * - 2 == Number of articles - * - 3 == Own Calculation + * - 2 == Number of products + * - 3 == Custom calculation * - * @var int + * @var self::CALCULATION_* * * @ORM\Column(name="calculation", type="integer", nullable=false) */ @@ -162,11 +177,11 @@ class Dispatch extends ModelEntity * Type of the calculation * Known Types: * - 0 == Always - * - 1 == Exclude dispatch fee free products + * - 1 == Exclude shipping free products * - 2 == Never * - 3 == Display as basket item * - * @var int + * @var self::SURCHARGE_CALCULATION_* * * @ORM\Column(name="surcharge_calculation", type="integer", nullable=false) */ @@ -445,7 +460,7 @@ public function getName() } /** - * @param int $type + * @param self::TYPE_* $type * * @return Dispatch */ @@ -457,7 +472,7 @@ public function setType($type) } /** - * @return int + * @return self::TYPE_* */ public function getType() { @@ -545,7 +560,7 @@ public function getPosition() } /** - * @param int $calculation + * @param self::CALCULATION_* $calculation * * @return Dispatch */ @@ -557,7 +572,7 @@ public function setCalculation($calculation) } /** - * @return int + * @return self::CALCULATION_* */ public function getCalculation() { @@ -565,7 +580,7 @@ public function getCalculation() } /** - * @param int $surchargeCalculation + * @param self::SURCHARGE_CALCULATION_* $surchargeCalculation * * @return Dispatch */ @@ -577,7 +592,7 @@ public function setSurchargeCalculation($surchargeCalculation) } /** - * @return int + * @return self::SURCHARGE_CALCULATION_* */ public function getSurchargeCalculation() { diff --git a/tests/Functional/Core/ExportTest.php b/tests/Functional/Core/ExportTest.php index 2006d04ca65..a43c33ff99b 100644 --- a/tests/Functional/Core/ExportTest.php +++ b/tests/Functional/Core/ExportTest.php @@ -31,7 +31,9 @@ use PHPUnit\Framework\TestCase; use RuntimeException; use sExport; +use Shopware\Components\Model\ModelManager; use Shopware\Components\Model\ModelRepository; +use Shopware\Models\Dispatch\Dispatch; use Shopware\Models\ProductFeed\ProductFeed; use Shopware\Tests\Functional\Traits\ContainerTrait; use Shopware\Tests\Functional\Traits\DatabaseTransactionBehaviour; @@ -153,6 +155,50 @@ public function testMainNumbersAreIncludedInTheExport(): void static::assertArrayHasKey('mainnumber', $result); } + public function testsGetPremiumDispatchSurcharge(): void + { + $testSurcharge = new Dispatch(); + $testSurcharge->setName('Test surcharge'); + $testSurcharge->setDescription(''); + $testSurcharge->setComment(''); + $testSurcharge->setPosition(0); + $testSurcharge->setCalculation(Dispatch::CALCULATION_WEIGHT); + $testSurcharge->setSurchargeCalculation(Dispatch::SURCHARGE_CALCULATION_ALWAYS); + $testSurcharge->setTaxCalculation(0); + $testSurcharge->setBindLastStock(0); + + $testSurcharge->setType(Dispatch::TYPE_SURCHARGE); + $testSurcharge->setActive(false); + $testSurcharge->setBindSql('foo=bar'); + + $this->getContainer()->get(ModelManager::class)->persist($testSurcharge); + $this->getContainer()->get(ModelManager::class)->flush($testSurcharge); + + $cart = [ + 'instock' => '1', + 'stockmin' => '1', + 'laststock' => '0', + 'weight' => '0.000', + 'count_article' => '1', + 'shippingfree' => '0', + 'amount' => '19.99', + 'max_tax' => '19.00', + 'userID' => null, + 'has_topseller' => '0', + 'has_comment' => '', + 'has_esd' => '0', + 'articleID' => '2', + 'countryID' => '2', + 'paymentID' => '5', + 'customergroupID' => '1', + 'multishopID' => '1', + 'sessionID' => null, + ]; + $surcharge = $this->export->sGetPremiumDispatchSurcharge($cart); + + static::assertSame(0.0, $surcharge); + } + private function generateFeed(int $feedId): string { $productFeed = $this->repository->find($feedId); From 1b3896b025651e3340c58fc810a10425def592f3 Mon Sep 17 00:00:00 2001 From: Dominik Rathmer Date: Mon, 25 Apr 2022 11:30:13 +0200 Subject: [PATCH 047/730] SW-25580 - Added captcha for product email notification --- .phpstan-baseline.neon | 5 - ...-option-for-email-notification-captcha.php | 71 +++++++ .../Shopware/Controllers/Frontend/Account.php | 5 +- .../Frontend/Notification/Bootstrap.php | 33 ++- .../frontend/plugins/notification/index.ini | 4 +- .../Plugins/Frontend/NotificationTest.php | 195 ++++++++++++++++++ .../frontend/plugins/notification/index.tpl | 12 ++ .../Bare/widgets/captcha/custom_captcha.tpl | 2 +- .../frontend/_public/src/js/jquery.captcha.js | 2 + .../_public/src/less/_modules/detail.less | 5 + 10 files changed, 316 insertions(+), 18 deletions(-) create mode 100644 _sql/migrations/1714-add-option-for-email-notification-captcha.php create mode 100644 tests/Functional/Plugins/Frontend/NotificationTest.php diff --git a/.phpstan-baseline.neon b/.phpstan-baseline.neon index e381eb5f78f..466fd610afe 100644 --- a/.phpstan-baseline.neon +++ b/.phpstan-baseline.neon @@ -39905,11 +39905,6 @@ parameters: count: 1 path: engine/Shopware/Plugins/Default/Frontend/Notification/Bootstrap.php - - - message: "#^PHPDoc tag @return has invalid value \\(\\)\\: Unexpected token \"\\\\n \", expected type at offset 167$#" - count: 1 - path: engine/Shopware/Plugins/Default/Frontend/Notification/Bootstrap.php - - message: "#^Method Shopware_Plugins_Frontend_RouterRewrite_Bootstrap\\:\\:onPreDispatch\\(\\) has no return type specified\\.$#" count: 1 diff --git a/_sql/migrations/1714-add-option-for-email-notification-captcha.php b/_sql/migrations/1714-add-option-for-email-notification-captcha.php new file mode 100644 index 00000000000..95c567cfc7f --- /dev/null +++ b/_sql/migrations/1714-add-option-for-email-notification-captcha.php @@ -0,0 +1,71 @@ +addSql($sql); + + // Create Captcha Option in Password Reset + $sql = <<<'EOD' + INSERT IGNORE s_core_config_elements + (`form_id`, `name`, `value`, `label`, `description`, `type`, `required`, `position`, `scope`, `options`) + VALUE + (LAST_INSERT_ID(), 'notificationCaptchaConfig', '%s', 'Captcha für E-Mail Benachrichtigungen von Produkten', 'Wenn diese Option aktiv ist, wird das Formular zur E-Mail Benachrichtigung für die Verfügbarkeit eines Produktes mit einem Captcha geschützt.', 'combo', 1, 0, 1, 'a:5:{s:8:"editable";b:0;s:10:"valueField";s:2:"id";s:12:"displayField";s:11:"displayname";s:13:"triggerAction";s:3:"all";s:5:"store";s:12:"base.Captcha";}'); +EOD; + $this->addSql(sprintf($sql, serialize('nocaptcha'))); + + // Translation + $sql = <<<'EOD' + SET @elementId = (SELECT id FROM `s_core_config_elements` WHERE `name` LIKE 'notificationCaptchaConfig' LIMIT 1); +EOD; + $this->addSql($sql); + + $sql = <<<'EOD' + INSERT IGNORE INTO `s_core_config_element_translations` + (`element_id`, `locale_id`, `label`, `description`) + VALUES + (@elementId, '2', 'Use captcha for the e-mail notification for products', 'If this option is active, a captcha is used to protect e-mail notification form to notify about new products in stock.'); +EOD; + $this->addSql($sql); + + // Config Element Translation + $sql = <<<'EOD' + SET @form_id = (SELECT id FROM `s_core_config_forms` WHERE `name` LIKE 'notificationCaptchaConfig' LIMIT 1); +EOD; + $this->addSql($sql); + + $sql = <<<'EOD' + INSERT INTO s_core_config_form_translations(form_id, locale_id, label) + VALUES (@form_id, 2, 'Product Notification'); +EOD; + $this->addSql($sql); + } +} + diff --git a/engine/Shopware/Controllers/Frontend/Account.php b/engine/Shopware/Controllers/Frontend/Account.php index 0b373765d4c..d3cecc2ba87 100644 --- a/engine/Shopware/Controllers/Frontend/Account.php +++ b/engine/Shopware/Controllers/Frontend/Account.php @@ -37,6 +37,7 @@ use Shopware\Bundle\StoreFrontBundle\Gateway\CountryGatewayInterface; use Shopware\Bundle\StoreFrontBundle\Service\ContextServiceInterface; use Shopware\Components\Captcha\CaptchaValidator; +use Shopware\Components\Captcha\NoCaptcha; use Shopware\Components\Compatibility\LegacyStructConverter; use Shopware\Components\Model\ModelManager; use Shopware\Components\Random; @@ -49,8 +50,6 @@ class Shopware_Controllers_Frontend_Account extends Enlight_Controller_Action { - private const DEFAULT_CAPTCHA_SETTING = 'nocaptcha'; - private const CONFIG_PASSWORD_RESET_CAPTCHA = 'passwordResetCaptcha'; /** @@ -488,7 +487,7 @@ public function passwordAction() public function sendResetPasswordConfirmationMail($email) { $snippets = Shopware()->Snippets()->getNamespace('frontend/account/password'); - if ($this->config->get(self::CONFIG_PASSWORD_RESET_CAPTCHA) !== self::DEFAULT_CAPTCHA_SETTING) { + if ($this->config->get(self::CONFIG_PASSWORD_RESET_CAPTCHA) !== NoCaptcha::CAPTCHA_METHOD) { if (!empty($this->config->get('CaptchaColor'))) { if (!$this->captchaValidator->validateByName($this->config->get(self::CONFIG_PASSWORD_RESET_CAPTCHA), $this->Request())) { return [ diff --git a/engine/Shopware/Plugins/Default/Frontend/Notification/Bootstrap.php b/engine/Shopware/Plugins/Default/Frontend/Notification/Bootstrap.php index c1be2b8c66b..84304852872 100644 --- a/engine/Shopware/Plugins/Default/Frontend/Notification/Bootstrap.php +++ b/engine/Shopware/Plugins/Default/Frontend/Notification/Bootstrap.php @@ -22,6 +22,9 @@ * our trademarks remain entirely with us. */ +use Doctrine\DBAL\Connection; +use Shopware\Components\Captcha\CaptchaValidator; +use Shopware\Components\Captcha\NoCaptcha; use Shopware\Components\Random; use Shopware\Components\Routing\Context; use Shopware\Components\Validator\EmailValidator; @@ -35,6 +38,8 @@ */ class Shopware_Plugins_Frontend_Notification_Bootstrap extends Shopware_Components_Plugin_Bootstrap { + private const CONFIG_NOTIFY_CAPTCHA = 'notificationCaptchaConfig'; + /** * Installation of plugin * Create-Events to include custom code on product detail page @@ -95,7 +100,7 @@ public function onPostDispatch(Enlight_Event_EventArgs $args) if (!empty($notificationProducts)) { $sql = 'SELECT `ordernumber` FROM `s_articles_details` WHERE `articleID`=?'; - $ordernumbers = $this->get('dbal_connection')->fetchColumn($sql, [$id]); + $ordernumbers = $this->get(Connection::class)->fetchColumn($sql, [$id]); if (!empty($ordernumbers)) { foreach ($ordernumbers as $ordernumber) { @@ -123,7 +128,7 @@ public function onPostDispatch(Enlight_Event_EventArgs $args) * * @static * - * @return + * @throws Exception */ public function onNotifyAction(Enlight_Event_EventArgs $args) { @@ -138,8 +143,7 @@ public function onNotifyAction(Enlight_Event_EventArgs $args) $sError = false; $action->View()->assign('NotifyEmailError', false); $notifyOrderNumber = $action->Request()->getParam('notifyOrdernumber'); - /** @var \Doctrine\DBAL\Connection $connection */ - $connection = $this->get('dbal_connection'); + $connection = $this->get(Connection::class); /** @var \Symfony\Component\HttpFoundation\Session\SessionInterface $session */ $session = $this->get('session'); @@ -147,6 +151,19 @@ public function onNotifyAction(Enlight_Event_EventArgs $args) $sNotificatedArticles = $session->get('sNotificatedArticles', []); if (!empty($notifyOrderNumber)) { + $captchaValidator = $this->get(CaptchaValidator::class); + $config = $this->get(Shopware_Components_Config::class); + + if ($config->get(self::CONFIG_NOTIFY_CAPTCHA) !== NoCaptcha::CAPTCHA_METHOD) { + if (!empty($config->get('CaptchaColor'))) { + if (!$captchaValidator->validateByName($config->get(self::CONFIG_NOTIFY_CAPTCHA), $action->Request())) { + $sError = true; + $action->View()->assign('NotifyCaptchaError', true); + $action->View()->assign('ShowNotification', true); + } + } + } + $validator = $this->get(EmailValidator::class); if (empty($email) || !$validator->isValid($email)) { $sError = true; @@ -219,7 +236,7 @@ public function onNotifyAction(Enlight_Event_EventArgs $args) } } - return $action->forward('index'); + $action->forward('index'); } /** @@ -237,8 +254,8 @@ public function onNotifyConfirmAction(Enlight_Event_EventArgs $args) /** @var Enlight_Controller_Action $action */ $action = $args->getSubject(); - /** @var \Doctrine\DBAL\Connection $db */ - $db = $this->get('dbal_connection'); + /** @var Connection $db */ + $db = $this->get(Connection::class); /** @var \Symfony\Component\HttpFoundation\Session\SessionInterface $session */ $session = $this->get('session'); @@ -329,7 +346,7 @@ public function onRunCronJob(Shopware_Components_Cron_CronJob $job) { $modelManager = $this->get(\Shopware\Components\Model\ModelManager::class); - $conn = $this->get(\Doctrine\DBAL\Connection::class); + $conn = $this->get(Connection::class); $notifications = $conn->createQueryBuilder() ->select( diff --git a/snippets/frontend/plugins/notification/index.ini b/snippets/frontend/plugins/notification/index.ini index 58ff644e70e..548b3fd9466 100644 --- a/snippets/frontend/plugins/notification/index.ini +++ b/snippets/frontend/plugins/notification/index.ini @@ -6,6 +6,7 @@ DetailNotifyInfoInvalid = "An error has occurred while validating your email add DetailNotifyInfoSuccess = "Please confirm your request by clicking the link provided with the email we just sent you. Assuming successful confirmation, you will be notified as soon as the item is available again." DetailNotifyInfoValid = "Thank you! We have successfully saved your request. You will be notified as soon as the item is available again." DetailNotifyLabelMail = "Your email address" +DetailNotifyCaptchaInvalid = "Please fill in the captcha-field correctly." [de_DE] DetailNotifyAlreadyRegistered = "Sie haben sich bereits für eine Benachrichtigung für diesen Artikel eingetragen!" @@ -14,4 +15,5 @@ DetailNotifyInfoErrorMail = "Bitte geben Sie eine gültige E-Mail-Adresse ein" DetailNotifyInfoInvalid = "Bei der Validierung Ihrer E-Mail-Benachrichtigung ist ein Fehler aufgetreten. Eventuell wurde Ihre E-Mail-Adresse bereits validiert." DetailNotifyInfoSuccess = "Bestätigen Sie den Link der E-Mail, die wir Ihnen soeben geschickt haben. Wir benachrichtigen Sie dann, sobald der Artikel wieder verfügbar ist." DetailNotifyInfoValid = "Vielen Dank! Wir haben Ihre Anfrage gespeichert. Sie werden benachrichtigt sobald der Artikel wieder verfügbar ist." -DetailNotifyLabelMail = "Ihre E-Mail-Adresse" \ No newline at end of file +DetailNotifyLabelMail = "Ihre E-Mail-Adresse" +DetailNotifyCaptchaInvalid = "Bitte füllen Sie das Captcha-Feld korrekt aus." \ No newline at end of file diff --git a/tests/Functional/Plugins/Frontend/NotificationTest.php b/tests/Functional/Plugins/Frontend/NotificationTest.php new file mode 100644 index 00000000000..1aad6fbd7cc --- /dev/null +++ b/tests/Functional/Plugins/Frontend/NotificationTest.php @@ -0,0 +1,195 @@ + 'SW10239', + 'sNotificationemail' => 'test@example.de', + ]; + + public const NOTIFICATION_ACTION_URL = 'genusswelten/koestlichkeiten/272/spachtelmasse?action=notify&number=SW10239'; + + /** + * @throws \Doctrine\DBAL\Exception + */ + public function setUp(): void + { + $this->getContainer()->reset(InstallerService::class); + $this->getContainer()->reset(LegacyPluginInstaller::class); + $pluginManager = $this->getContainer()->get(InstallerService::class); + + $pluginManager->refreshPluginList(); + + $plugin = $pluginManager->getPluginByName('Notification'); + + $pluginManager->installPlugin($plugin); + $pluginManager->activatePlugin($plugin); + + $this->getContainer()->reset('plugins')->load('plugins'); + + $sql = 'UPDATE s_articles SET notification = 1 WHERE id = ' . self::PRODUCT_ID; + $this->getContainer()->get('dbal_connection')->executeQuery($sql); + parent::setUp(); + } + + public function tearDown(): void + { + $this->saveNotifyCaptcha('nocaptcha'); + parent::tearDown(); + } + + /** + * @throws Exception + */ + public function testValidateCaptchaWithInvalidName(): void + { + $this->saveNotifyCaptcha('notExistingCaptchaOption'); + $random = md5(uniqid()); + $sessionVars = ['sCaptcha' => $random]; + $this->getContainer()->get('session')->offsetSet(DefaultCaptcha::SESSION_KEY, $sessionVars); + + $postParameter = self::NOTIFY_POST_PARAMETERS; + $postParameter['sCaptcha'] = $random; + + $this->Request()->setMethod('POST'); + $this->Request()->setPost($postParameter); + $this->expectException(CaptchaNotFoundException::class); + $this->dispatch(self::NOTIFICATION_ACTION_URL); + } + + public function testNoCaptcha(): void + { + $this->saveNotifyCaptcha('nocaptcha'); + $postParameter = self::NOTIFY_POST_PARAMETERS; + + $this->Request()->setMethod('POST'); + $this->Request()->setPost($postParameter); + + $this->dispatch(self::NOTIFICATION_ACTION_URL); + + $viewVariables = $this->View()->getAssign(); + static::assertArrayNotHasKey('NotifyCaptchaError', $viewVariables); + } + + public function testHoneypot(): void + { + $this->saveNotifyCaptcha('honeypot'); + $postParameter = self::NOTIFY_POST_PARAMETERS; + + $this->Request()->setMethod('POST'); + $this->Request()->setPost($postParameter); + + $this->dispatch(self::NOTIFICATION_ACTION_URL); + + $viewVariables = $this->View()->getAssign(); + + static::assertArrayNotHasKey('NotifyCaptchaError', $viewVariables); + } + + public function testDefault(): void + { + $this->saveNotifyCaptcha('default'); + $random = md5(uniqid()); + $sessionVars = ['sCaptcha' => $random, $random => true]; + + $this->getContainer()->get('session')->offsetSet(DefaultCaptcha::SESSION_KEY, $sessionVars); + + $postParameter = self::NOTIFY_POST_PARAMETERS; + $postParameter['sCaptcha'] = $random; + $this->Request()->setMethod('POST'); + $this->Request()->setPost($postParameter); + + $this->dispatch(self::NOTIFICATION_ACTION_URL); + $viewVariables = $this->View()->getAssign(); + static::assertArrayNotHasKey('NotifyCaptchaError', $viewVariables); + } + + public function testInvalidDefault(): void + { + $this->saveNotifyCaptcha('default'); + $random = md5(uniqid()); + $sessionVars = ['sCaptcha' => $random]; + + $this->getContainer()->get('session')->offsetSet(DefaultCaptcha::SESSION_KEY, $sessionVars); + + $postParameter = self::NOTIFY_POST_PARAMETERS; + $postParameter['sCaptcha'] = $random; + + $this->Request()->setMethod('POST'); + $this->Request()->setPost($postParameter); + + $this->dispatch(self::NOTIFICATION_ACTION_URL); + + $viewVariables = $this->View()->getAssign(); + static::assertArrayHasKey('NotifyCaptchaError', $viewVariables); + } + + public function testInvalidHoneypot(): void + { + $this->saveNotifyCaptcha('honeypot'); + $postParameter = self::NOTIFY_POST_PARAMETERS; + $postParameter['first_name_confirmation'] = uniqid(); + + $this->Request()->setMethod('POST'); + $this->Request()->setPost($postParameter); + + $this->dispatch(self::NOTIFICATION_ACTION_URL); + + $viewVariables = $this->View()->getAssign(); + + static::assertArrayHasKey('NotifyCaptchaError', $viewVariables); + } + + private function saveNotifyCaptcha(string $value): void + { + $formattedValue = sprintf('s:%d:"%s";', \strlen($value), $value); + $this->getContainer()->get(Connection::class)->executeQuery( + 'UPDATE s_core_config_elements SET value = ? WHERE name = ?', + [$formattedValue, 'notificationCaptchaConfig'] + ); + + $this->getContainer()->get('cache')->clean(); + } +} diff --git a/themes/Frontend/Bare/frontend/plugins/notification/index.tpl b/themes/Frontend/Bare/frontend/plugins/notification/index.tpl index c58dc223b8f..9c95a9ecc4a 100644 --- a/themes/Frontend/Bare/frontend/plugins/notification/index.tpl +++ b/themes/Frontend/Bare/frontend/plugins/notification/index.tpl @@ -4,6 +4,9 @@ {if $NotifyValid == true} {$messageType="success"} {s name="DetailNotifyInfoValid" assign="messageContent"}{/s} + {elseif $NotifyCaptchaError == true} + {$messageType="error"} + {s name='DetailNotifyCaptchaInvalid' assign="messageContent"}{/s} {elseif $NotifyInvalid == true && $NotifyAlreadyRegistered != true} {$messageType="warning"} {s name="DetailNotifyInfoInvalid" assign="messageContent"}{/s} @@ -40,6 +43,15 @@ {/block} + {* Captcha *} + {block name='frontend_account_index_form_captcha'} +
+ {$captchaName = {config name="notificationCaptchaConfig"}} + {$captchaHasError = $NotifyCaptchaError} + {include file="widgets/captcha/custom_captcha.tpl" captchaName=$captchaName captchaHasError=$captchaHasError} +
+ {/block} + {* Data protection information *} {block name="frontend_detail_index_notification_privacy"} {if {config name="ACTDPRTEXT"} || {config name="ACTDPRCHECK"}} diff --git a/themes/Frontend/Bare/widgets/captcha/custom_captcha.tpl b/themes/Frontend/Bare/widgets/captcha/custom_captcha.tpl index dd9bfe3adca..43d495c18d6 100644 --- a/themes/Frontend/Bare/widgets/captcha/custom_captcha.tpl +++ b/themes/Frontend/Bare/widgets/captcha/custom_captcha.tpl @@ -7,7 +7,7 @@ {/block} {if !$isNoCaptcha} -
+
{block name="frontend_widgets_captcha_custom_captcha_placeholder"}
Date: Fri, 3 Jun 2022 13:09:47 +0200 Subject: [PATCH 048/730] SW-26748 - improve input filter --- composer.json | 5 +- composer.lock | 341 +++++++++++++----- .../Frontend/InputFilter/Bootstrap.php | 118 +++--- .../Frontend/InputFilter/FilterTest.php | 46 +++ 4 files changed, 381 insertions(+), 129 deletions(-) diff --git a/composer.json b/composer.json index 111400e8561..1a93dbbd3e5 100644 --- a/composer.json +++ b/composer.json @@ -84,13 +84,16 @@ "symfony/serializer": "~5.4.0", "symfony/validator": "~4.4.34", "symfony/web-link": "~4.4.27", + "voku/anti-xss": "~4.1.39", "wikimedia/less.php": "3.1.0" }, "replace": { "paragonie/random_compat": "*", "symfony/polyfill-ctype": "*", "symfony/polyfill-php72": "*", - "symfony/polyfill-php73": "*" + "symfony/polyfill-php73": "*", + "symfony/polyfill-iconv": "*", + "symfony/polyfill-mbstring": "*" }, "suggest": { "ext-apcu": "*", diff --git a/composer.lock b/composer.lock index c91936db8ab..387b1a14e23 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "04af69417e3a2d261d9f0c8ea6c5854c", + "content-hash": "aa9e7479e5376871d41275c10dffa31c", "packages": [ { "name": "aws/aws-crt-php", @@ -5883,89 +5883,6 @@ ], "time": "2022-05-24T11:49:31+00:00" }, - { - "name": "symfony/polyfill-mbstring", - "version": "v1.26.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e", - "reference": "9344f9cb97f3b19424af1a21a3b0e75b0a7d8d7e", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "provide": { - "ext-mbstring": "*" - }, - "suggest": { - "ext-mbstring": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.26-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill for the Mbstring extension", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "mbstring", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.26.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2022-05-24T11:49:31+00:00" - }, { "name": "symfony/polyfill-php80", "version": "v1.26.0", @@ -7069,6 +6986,262 @@ ], "time": "2022-01-02T09:41:36+00:00" }, + { + "name": "voku/anti-xss", + "version": "4.1.39", + "source": { + "type": "git", + "url": "https://github.com/voku/anti-xss.git", + "reference": "64a59ba4744e6722866ff3440d93561da9e85cd0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/voku/anti-xss/zipball/64a59ba4744e6722866ff3440d93561da9e85cd0", + "reference": "64a59ba4744e6722866ff3440d93561da9e85cd0", + "shasum": "" + }, + "require": { + "php": ">=7.0.0", + "voku/portable-utf8": "~6.0.2" + }, + "require-dev": { + "phpunit/phpunit": "~6.0 || ~7.0 || ~9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.1.x-dev" + } + }, + "autoload": { + "psr-4": { + "voku\\helper\\": "src/voku/helper/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "EllisLab Dev Team", + "homepage": "http://ellislab.com/" + }, + { + "name": "Lars Moelleken", + "email": "lars@moelleken.org", + "homepage": "https://www.moelleken.org/" + } + ], + "description": "anti xss-library", + "homepage": "https://github.com/voku/anti-xss", + "keywords": [ + "anti-xss", + "clean", + "security", + "xss" + ], + "support": { + "issues": "https://github.com/voku/anti-xss/issues", + "source": "https://github.com/voku/anti-xss/tree/4.1.39" + }, + "funding": [ + { + "url": "https://www.paypal.me/moelleken", + "type": "custom" + }, + { + "url": "https://github.com/voku", + "type": "github" + }, + { + "url": "https://opencollective.com/anti-xss", + "type": "open_collective" + }, + { + "url": "https://www.patreon.com/voku", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/voku/anti-xss", + "type": "tidelift" + } + ], + "time": "2022-03-08T17:03:58+00:00" + }, + { + "name": "voku/portable-ascii", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/voku/portable-ascii.git", + "reference": "b56450eed252f6801410d810c8e1727224ae0743" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/voku/portable-ascii/zipball/b56450eed252f6801410d810c8e1727224ae0743", + "reference": "b56450eed252f6801410d810c8e1727224ae0743", + "shasum": "" + }, + "require": { + "php": ">=7.0.0" + }, + "require-dev": { + "phpunit/phpunit": "~6.0 || ~7.0 || ~9.0" + }, + "suggest": { + "ext-intl": "Use Intl for transliterator_transliterate() support" + }, + "type": "library", + "autoload": { + "psr-4": { + "voku\\": "src/voku/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Lars Moelleken", + "homepage": "http://www.moelleken.org/" + } + ], + "description": "Portable ASCII library - performance optimized (ascii) string functions for php.", + "homepage": "https://github.com/voku/portable-ascii", + "keywords": [ + "ascii", + "clean", + "php" + ], + "support": { + "issues": "https://github.com/voku/portable-ascii/issues", + "source": "https://github.com/voku/portable-ascii/tree/2.0.1" + }, + "funding": [ + { + "url": "https://www.paypal.me/moelleken", + "type": "custom" + }, + { + "url": "https://github.com/voku", + "type": "github" + }, + { + "url": "https://opencollective.com/portable-ascii", + "type": "open_collective" + }, + { + "url": "https://www.patreon.com/voku", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/voku/portable-ascii", + "type": "tidelift" + } + ], + "time": "2022-03-08T17:03:00+00:00" + }, + { + "name": "voku/portable-utf8", + "version": "6.0.4", + "source": { + "type": "git", + "url": "https://github.com/voku/portable-utf8.git", + "reference": "f6c78e492520115bb2d947c3a0d90a2c6b7a60a8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/voku/portable-utf8/zipball/f6c78e492520115bb2d947c3a0d90a2c6b7a60a8", + "reference": "f6c78e492520115bb2d947c3a0d90a2c6b7a60a8", + "shasum": "" + }, + "require": { + "php": ">=7.0.0", + "symfony/polyfill-iconv": "~1.0", + "symfony/polyfill-intl-grapheme": "~1.0", + "symfony/polyfill-intl-normalizer": "~1.0", + "symfony/polyfill-mbstring": "~1.0", + "symfony/polyfill-php72": "~1.0", + "voku/portable-ascii": "~2.0.0" + }, + "require-dev": { + "phpunit/phpunit": "~6.0 || ~7.0 || ~9.0" + }, + "suggest": { + "ext-ctype": "Use Ctype for e.g. hexadecimal digit detection", + "ext-fileinfo": "Use Fileinfo for better binary file detection", + "ext-iconv": "Use iconv for best performance", + "ext-intl": "Use Intl for best performance", + "ext-json": "Use JSON for string detection", + "ext-mbstring": "Use Mbstring for best performance" + }, + "type": "library", + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "voku\\": "src/voku/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "(Apache-2.0 or GPL-2.0)" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Hamid Sarfraz", + "homepage": "http://pageconfig.com/" + }, + { + "name": "Lars Moelleken", + "homepage": "http://www.moelleken.org/" + } + ], + "description": "Portable UTF-8 library - performance optimized (unicode) string functions for php.", + "homepage": "https://github.com/voku/portable-utf8", + "keywords": [ + "UTF", + "clean", + "php", + "unicode", + "utf-8", + "utf8" + ], + "support": { + "issues": "https://github.com/voku/portable-utf8/issues", + "source": "https://github.com/voku/portable-utf8/tree/6.0.4" + }, + "funding": [ + { + "url": "https://www.paypal.me/moelleken", + "type": "custom" + }, + { + "url": "https://github.com/voku", + "type": "github" + }, + { + "url": "https://opencollective.com/portable-utf8", + "type": "open_collective" + }, + { + "url": "https://www.patreon.com/voku", + "type": "patreon" + }, + { + "url": "https://tidelift.com/funding/github/packagist/voku/portable-utf8", + "type": "tidelift" + } + ], + "time": "2022-03-08T17:04:59+00:00" + }, { "name": "wikimedia/less.php", "version": "v3.1.0", diff --git a/engine/Shopware/Plugins/Default/Frontend/InputFilter/Bootstrap.php b/engine/Shopware/Plugins/Default/Frontend/InputFilter/Bootstrap.php index 272e34aceeb..3fdebfd84fe 100644 --- a/engine/Shopware/Plugins/Default/Frontend/InputFilter/Bootstrap.php +++ b/engine/Shopware/Plugins/Default/Frontend/InputFilter/Bootstrap.php @@ -22,11 +22,16 @@ * our trademarks remain entirely with us. */ +use voku\helper\AntiXSS; + /** * Shopware InputFilter Plugin */ class Shopware_Plugins_Frontend_InputFilter_Bootstrap extends Shopware_Components_Plugin_Bootstrap { + public const ALLOWED_ATTRIBUTES_KEY = 'allowedAttributes'; + public const ALLOWED_HTML_TAGS_KEY = 'allowedHtmlTags'; + /** * @var string */ @@ -37,6 +42,50 @@ class Shopware_Plugins_Frontend_InputFilter_Bootstrap extends Shopware_Component */ public $xssRegex = 'javascript:|src\s*=|\bon[a-z]+\s*=|style\s*=|\bdata-\w+(?!\.)\b\s?=?'; + /** + * @var array> + */ + public array $stripTagsWhiteList = [ + 'frontend/account/login' => [ + 'password', + ], + 'frontend/account/savepassword' => [ + 'password', + 'passwordConfirmation', + 'currentPassword', + ], + 'frontend/register/ajax_validate_email' => [ + 'password', + ], + 'frontend/register/ajax_validate_password' => [ + 'password', + ], + 'frontend/register/saveregister' => [ + 'password', + ], + 'frontend/account/resetpassword' => [ + 'password', + 'passwordConfirmation', + ], + 'frontend/account/saveemail' => [ + 'currentPassword', + ], + ]; + + /** + * @var array>>> + * + * usage: + * + * 'frontend/account/login' => [ + * 'password' => [ + * self::ALLOWED_ATTRIBUTES_KEY => [], + * self::ALLOWED_HTML_TAGS_KEY => [] + * ] + * ] + */ + public array $allowanceList = []; + /** * @var string */ @@ -102,10 +151,6 @@ public function onRouteShutdown(Enlight_Controller_EventArgs $args) $regex[] = $config->own_filter; } - if (empty($regex)) { - return; - } - $regex = '#' . implode('|', $regex) . '#msi'; $userParams = $request->getUserParams(); @@ -113,33 +158,6 @@ public function onRouteShutdown(Enlight_Controller_EventArgs $args) &$_GET, &$_POST, &$_COOKIE, &$_REQUEST, &$_SERVER, &$userParams, ]; - $whiteList = [ - 'frontend/account/login' => [ - 'password', - ], - 'frontend/account/savepassword' => [ - 'password', - 'passwordConfirmation', - 'currentPassword', - ], - 'frontend/register/ajax_validate_email' => [ - 'password', - ], - 'frontend/register/ajax_validate_password' => [ - 'password', - ], - 'frontend/register/saveregister' => [ - 'password', - ], - 'frontend/account/resetpassword' => [ - 'password', - 'passwordConfirmation', - ], - 'frontend/account/saveemail' => [ - 'currentPassword', - ], - ]; - $route = strtolower( implode( '/', @@ -147,14 +165,17 @@ public function onRouteShutdown(Enlight_Controller_EventArgs $args) ) ); - $whiteList = \array_key_exists($route, $whiteList) ? $whiteList[$route] : []; + $stripTagsWhiteList = \array_key_exists($route, $this->stripTagsWhiteList) ? $this->stripTagsWhiteList[$route] : []; + $allowanceList = \array_key_exists($route, $this->allowanceList) ? $this->allowanceList[$route] : []; foreach ($process as $key => $val) { foreach ($val as $k => $v) { unset($process[$key][$k]); - $stripTags = \in_array($k, $whiteList) ? false : $stripTagsConf; + $stripTags = \in_array($k, $stripTagsWhiteList) ? false : $stripTagsConf; + $allowedHtmlTags = \array_key_exists($k, $allowanceList) ? $allowanceList[$k][self::ALLOWED_HTML_TAGS_KEY] : []; + $allowedAttributes = \array_key_exists($k, $allowanceList) ? $allowanceList[$k][self::ALLOWED_ATTRIBUTES_KEY] : []; if (\is_string($k)) { - $filteredKey = self::filterValue($k, $regex, $stripTags); + $filteredKey = self::filterValue($k, $regex, $stripTags, $allowedHtmlTags, $allowedAttributes); } else { $filteredKey = $k; } @@ -164,12 +185,12 @@ public function onRouteShutdown(Enlight_Controller_EventArgs $args) } if (\is_array($v)) { - $process[$key][$filteredKey] = self::filterArrayValue($v, $regex, $stripTags); + $process[$key][$filteredKey] = self::filterArrayValue($v, $regex, $stripTags, $allowedHtmlTags, $allowedAttributes); continue; } if (\is_string($v)) { - $process[$key][$filteredKey] = self::filterValue($v, $regex, $stripTags); + $process[$key][$filteredKey] = self::filterValue($v, $regex, $stripTags, $allowedHtmlTags, $allowedAttributes); continue; } @@ -188,13 +209,15 @@ public function onRouteShutdown(Enlight_Controller_EventArgs $args) /** * Filter value by regex * - * @param string $value - * @param string $regex - * @param bool $stripTags + * @param string $value + * @param string $regex + * @param bool $stripTags + * @param array $allowedHtmlTags + * @param array $allowedAttributes * * @return string|null */ - public static function filterValue($value, $regex, $stripTags = true) + public static function filterValue($value, $regex, $stripTags = true, array $allowedHtmlTags = [], array $allowedAttributes = []) { if (empty($value)) { return $value; @@ -208,22 +231,29 @@ public static function filterValue($value, $regex, $stripTags = true) return null; } - return $value; + $antiXss = new AntiXSS(); + $antiXss->removeEvilAttributes($allowedHtmlTags); + $antiXss->removeEvilHtmlTags($allowedAttributes); + $value = $antiXss->xss_clean($value); + + return \str_replace(['<', '>'], ['<', '>'], $value); } /** * @param array $value + * @param array $allowedHtmlTags + * @param array $allowedAttributes * * @return array|null */ - public static function filterArrayValue(array $value, string $regex, bool $stripTags = true): ?array + public static function filterArrayValue(array $value, string $regex, bool $stripTags = true, array $allowedHtmlTags = [], array $allowedAttributes = []): ?array { $newReturn = []; foreach ($value as $valueKey => $valueValue) { if (\is_int($valueKey)) { $filteredKey = $valueKey; } else { - $filteredKey = self::filterValue($valueKey, $regex, $stripTags); + $filteredKey = self::filterValue($valueKey, $regex, $stripTags, $allowedHtmlTags, $allowedAttributes); } if ($filteredKey === '' || $filteredKey === null) { @@ -237,7 +267,7 @@ public static function filterArrayValue(array $value, string $regex, bool $strip } if (\is_string($valueValue)) { - $filteredValue = self::filterValue($valueValue, $regex, $stripTags); + $filteredValue = self::filterValue($valueValue, $regex, $stripTags, $allowedHtmlTags, $allowedAttributes); } $newReturn[$filteredKey] = $filteredValue; diff --git a/tests/Unit/Plugin/Frontend/InputFilter/FilterTest.php b/tests/Unit/Plugin/Frontend/InputFilter/FilterTest.php index 3e833b021d3..705c17c1def 100644 --- a/tests/Unit/Plugin/Frontend/InputFilter/FilterTest.php +++ b/tests/Unit/Plugin/Frontend/InputFilter/FilterTest.php @@ -147,6 +147,21 @@ public function testXssFilter(string $input, ?string $expected): void ); } + /** + * @dataProvider stripAntiXssDataProvider + * + * @param array $additions + */ + public function testAntiXssFilter(string $input, ?string $expected, array $additions = []): void + { + $result = Shopware_Plugins_Frontend_InputFilter_Bootstrap::filterValue($input, '/(?!x)x/', ...$additions); + + static::assertEquals( + $expected, + $result + ); + } + /** * @dataProvider stripxssArrayDataProvider * @@ -233,6 +248,37 @@ public function stripxssDataProvider(): array 'input' => '', 'expected' => '', ], + [ + 'input' => '"%26%2362%26%2360img/src%26%2361x%20onerror%26%2361alert()%26%2362', + 'expected' => '">', + ], + ]; + } + + /** + * @return array> + */ + public function stripAntiXssDataProvider(): array + { + return [ + [ + 'input' => '
  • ', + 'expected' => '
  • ', + 'additions' => [ + false, + [], + ['style'], + ], + ], + [ + 'input' => '', + 'expected' => '', + 'additions' => [ + false, + ['iframe'], + [], + ], + ], ]; } From 9aa75d91f67db8906646c75997f571e80761fdd3 Mon Sep 17 00:00:00 2001 From: Michael Telgmann Date: Mon, 20 Jun 2022 14:47:53 +0200 Subject: [PATCH 049/730] SW-26686 - Add composer-runtime-api requirement --- UPGRADE-5.7.md | 5 +---- composer.json | 1 + composer.lock | 5 +++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/UPGRADE-5.7.md b/UPGRADE-5.7.md index 3f184806709..48d0b62127b 100644 --- a/UPGRADE-5.7.md +++ b/UPGRADE-5.7.md @@ -6,12 +6,11 @@ This changelog references changes done in Shopware 5.7 patch versions. [View all changes from v5.7.11...v5.7.12](https://github.com/shopware/shopware/compare/v5.7.11...v5.7.12) -### Deprecations - ### Additions * Added missing dependency `doctrine/annotations`, which was an indirect dependency before * Added new optional parameter `dateTime` to `\Shopware\Components\Logger::addRecord` method to be compatible with parent `\Monolog\Logger::addRecord` method +* Added requirement `composer-runtime-api ^2.0` which was already added indirectly in version [5.7.8](#5.7.8) ### Changes @@ -52,8 +51,6 @@ This changelog references changes done in Shopware 5.7 patch versions. * Updated `symfony/web-link` to version 4.4.37 * Updated several indirect dependencies -### Removals - ## 5.7.11 [View all changes from v5.7.10...v5.7.11](https://github.com/shopware/shopware/compare/v5.7.10...v5.7.11) diff --git a/composer.json b/composer.json index 1a93dbbd3e5..cba59262183 100644 --- a/composer.json +++ b/composer.json @@ -36,6 +36,7 @@ "ext-zip": "*", "ext-zlib": "*", "lib-libxml": "*", + "composer-runtime-api": "^2.0", "bcremer/line-reader": "1.2.0", "beberlei/assert": "3.3.2", "beberlei/doctrineextensions": "1.3.0", diff --git a/composer.lock b/composer.lock index 387b1a14e23..ebc286b9b74 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "aa9e7479e5376871d41275c10dffa31c", + "content-hash": "e59d3f398f3ff18ebe1196f21ec0d4c5", "packages": [ { "name": "aws/aws-crt-php", @@ -10587,7 +10587,8 @@ "ext-xml": "*", "ext-zip": "*", "ext-zlib": "*", - "lib-libxml": "*" + "lib-libxml": "*", + "composer-runtime-api": "^2.0" }, "platform-dev": [], "plugin-api-version": "2.3.0" From 0b379f49e8796226095ee1e5f6c5c1f2a25d4369 Mon Sep 17 00:00:00 2001 From: Michael Telgmann Date: Mon, 20 Jun 2022 15:19:24 +0200 Subject: [PATCH 050/730] SW-26686 - Update doctrine dependency --- UPGRADE-5.7.md | 2 +- composer.json | 2 +- composer.lock | 18 +++++++++--------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/UPGRADE-5.7.md b/UPGRADE-5.7.md index 48d0b62127b..769f4c29398 100644 --- a/UPGRADE-5.7.md +++ b/UPGRADE-5.7.md @@ -20,7 +20,7 @@ This changelog references changes done in Shopware 5.7 patch versions. * Updated `doctrine/cache` to version 1.13.0 * Updated `doctrine/common` to version 3.3.0 * Updated `doctrine/dbal` to version 2.13.8 -* Updated `doctrine/orm` to version 2.12.2 +* Updated `doctrine/orm` to version 2.12.3 * Updated `doctrine/persistence` to version 2.5.3 * Updated `elasticsearch/elasticsearch` to version 7.17.0 * Updated `friendsofphp/proxy-manager-lts` to version 1.0.12 diff --git a/composer.json b/composer.json index cba59262183..8336f78862c 100644 --- a/composer.json +++ b/composer.json @@ -47,7 +47,7 @@ "doctrine/common": "3.3.0", "doctrine/dbal": "2.13.8", "doctrine/event-manager": "1.1.1", - "doctrine/orm": "2.12.2", + "doctrine/orm": "2.12.3", "doctrine/persistence": "2.5.3", "elasticsearch/elasticsearch": "^7", "fig/link-util": "1.1.2", diff --git a/composer.lock b/composer.lock index ebc286b9b74..2071690e14d 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "e59d3f398f3ff18ebe1196f21ec0d4c5", + "content-hash": "e570e2140d73b90be176ab8f7b3cdc35", "packages": [ { "name": "aws/aws-crt-php", @@ -1264,16 +1264,16 @@ }, { "name": "doctrine/orm", - "version": "2.12.2", + "version": "2.12.3", "source": { "type": "git", "url": "https://github.com/doctrine/orm.git", - "reference": "8291a7f09b12d14783ed6537b4586583d155869e" + "reference": "c05e1709e9ffb9abe8d37260a78975cc816ee385" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/orm/zipball/8291a7f09b12d14783ed6537b4586583d155869e", - "reference": "8291a7f09b12d14783ed6537b4586583d155869e", + "url": "https://api.github.com/repos/doctrine/orm/zipball/c05e1709e9ffb9abe8d37260a78975cc816ee385", + "reference": "c05e1709e9ffb9abe8d37260a78975cc816ee385", "shasum": "" }, "require": { @@ -1302,10 +1302,10 @@ "doctrine/annotations": "^1.13", "doctrine/coding-standard": "^9.0", "phpbench/phpbench": "^0.16.10 || ^1.0", - "phpstan/phpstan": "~1.4.10 || 1.6.3", + "phpstan/phpstan": "~1.4.10 || 1.7.13", "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", "psr/log": "^1 || ^2 || ^3", - "squizlabs/php_codesniffer": "3.6.2", + "squizlabs/php_codesniffer": "3.7.0", "symfony/cache": "^4.4 || ^5.4 || ^6.0", "symfony/yaml": "^3.4 || ^4.0 || ^5.0 || ^6.0", "vimeo/psalm": "4.23.0" @@ -1357,9 +1357,9 @@ ], "support": { "issues": "https://github.com/doctrine/orm/issues", - "source": "https://github.com/doctrine/orm/tree/2.12.2" + "source": "https://github.com/doctrine/orm/tree/2.12.3" }, - "time": "2022-05-02T19:10:07+00:00" + "time": "2022-06-16T13:42:23+00:00" }, { "name": "doctrine/persistence", From 5cebdc552e268d672150c1edb884a7af3a12dc61 Mon Sep 17 00:00:00 2001 From: Michael Telgmann Date: Mon, 20 Jun 2022 16:36:36 +0200 Subject: [PATCH 051/730] SW-26768 - Fix return type error while saving shopping worlds --- .phpstan-baseline.neon | 20 ------------------- .../EmotionBundle/Struct/ElementConfig.php | 3 ++- .../Emotion/Preset/PresetLoader.php | 3 ++- .../Shopware/Controllers/Backend/Emotion.php | 16 +++++++++------ .../Shopware/Models/Emotion/Library/Field.php | 3 +++ .../Unit/Controllers/Backend/EmotionTest.php | 19 +++++++++++++++++- 6 files changed, 35 insertions(+), 29 deletions(-) diff --git a/.phpstan-baseline.neon b/.phpstan-baseline.neon index 9f48d38444f..795b9735f9f 100644 --- a/.phpstan-baseline.neon +++ b/.phpstan-baseline.neon @@ -24835,16 +24835,6 @@ parameters: count: 1 path: engine/Shopware/Controllers/Backend/Emotion.php - - - message: "#^Method Shopware_Controllers_Backend_Emotion\\:\\:processDataFieldValue\\(\\) has parameter \\$value with no value type specified in iterable type array\\.$#" - count: 1 - path: engine/Shopware/Controllers/Backend/Emotion.php - - - - message: "#^Method Shopware_Controllers_Backend_Emotion\\:\\:processDataFieldValue\\(\\) should return string but returns array\\|string\\.$#" - count: 1 - path: engine/Shopware/Controllers/Backend/Emotion.php - - message: "#^Method Shopware_Controllers_Backend_Emotion\\:\\:saveEmotion\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#" count: 1 @@ -24860,16 +24850,6 @@ parameters: count: 1 path: engine/Shopware/Controllers/Backend/Emotion.php - - - message: "#^Parameter \\#1 \\$path of method Shopware\\\\Bundle\\\\MediaBundle\\\\MediaServiceInterface\\:\\:isEncoded\\(\\) expects string, array\\|string given\\.$#" - count: 1 - path: engine/Shopware/Controllers/Backend/Emotion.php - - - - message: "#^Parameter \\#1 \\$path of method Shopware\\\\Bundle\\\\MediaBundle\\\\MediaServiceInterface\\:\\:normalize\\(\\) expects string, array\\|string given\\.$#" - count: 1 - path: engine/Shopware/Controllers/Backend/Emotion.php - - message: "#^Method Shopware_Controllers_Backend_EmotionPreset\\:\\:enrichPlugins\\(\\) has parameter \\$presets with no value type specified in iterable type array\\.$#" count: 1 diff --git a/engine/Shopware/Bundle/EmotionBundle/Struct/ElementConfig.php b/engine/Shopware/Bundle/EmotionBundle/Struct/ElementConfig.php index f8be48e4456..449e27b797e 100644 --- a/engine/Shopware/Bundle/EmotionBundle/Struct/ElementConfig.php +++ b/engine/Shopware/Bundle/EmotionBundle/Struct/ElementConfig.php @@ -26,6 +26,7 @@ use JsonSerializable; use ReturnTypeWillChange; +use Shopware\Models\Emotion\Library\Field; class ElementConfig implements JsonSerializable { @@ -40,7 +41,7 @@ public function __construct(array $data = []) { $storage = []; foreach ($data as $configElement) { - if ($configElement['__emotionLibraryComponentField_value_type'] === 'json') { + if ($configElement['__emotionLibraryComponentField_value_type'] === Field::VALUE_TYPE_JSON) { $configElement['__emotionElementValue_value'] = json_decode($configElement['__emotionElementValue_value'], true); } diff --git a/engine/Shopware/Components/Emotion/Preset/PresetLoader.php b/engine/Shopware/Components/Emotion/Preset/PresetLoader.php index 60e50a53963..60539d54c66 100644 --- a/engine/Shopware/Components/Emotion/Preset/PresetLoader.php +++ b/engine/Shopware/Components/Emotion/Preset/PresetLoader.php @@ -29,6 +29,7 @@ use Shopware\Bundle\MediaBundle\MediaServiceInterface; use Shopware\Components\Model\ModelManager; use Shopware\Models\Emotion\Library\Component; +use Shopware\Models\Emotion\Library\Field; use Shopware\Models\Emotion\Preset; class PresetLoader implements PresetLoaderInterface @@ -134,7 +135,7 @@ private function preparePresetData(array $presetData) $data['value'] = $this->mediaService->getUrl($data['value']); } - if (!empty($data['value']) && strtolower($field['valueType']) === 'json') { + if (!empty($data['value']) && strtolower($field['valueType']) === Field::VALUE_TYPE_JSON) { $data['value'] = json_decode($data['value'], true); if (\is_array($data['value'])) { foreach ($data['value'] as $key => &$value) { diff --git a/engine/Shopware/Controllers/Backend/Emotion.php b/engine/Shopware/Controllers/Backend/Emotion.php index a5abcce13be..c4a47860653 100644 --- a/engine/Shopware/Controllers/Backend/Emotion.php +++ b/engine/Shopware/Controllers/Backend/Emotion.php @@ -213,14 +213,14 @@ public function detailAction() $entry = $filterResult; switch (strtolower($entry['valueType'])) { - case 'json': + case Field::VALUE_TYPE_JSON: if ($entry['value'] !== '') { $value = Zend_Json::decode($entry['value']); } else { $value = null; } break; - case 'string': + case Field::VALUE_TYPE_STRING: default: $value = $entry['value']; break; @@ -1356,16 +1356,16 @@ private function createElementData(Emotion $emotion, array $element, array $elem /** * Method for processing the different value types of the data fields. * - * @param array|string $value + * @param array>|string|null $value */ - private function processDataFieldValue(Field $field, $value): string + private function processDataFieldValue(Field $field, $value): ?string { $valueType = strtolower($field->getValueType()); $xType = $field->getXType(); $mediaFields = $this->getMediaXTypes(); - if ($valueType === 'json') { + if ($valueType === Field::VALUE_TYPE_JSON) { if (\is_array($value)) { foreach ($value as &$val) { if (!isset($val['path'])) { @@ -1379,10 +1379,14 @@ private function processDataFieldValue(Field $field, $value): string $value = Zend_Json::encode($value); } - if (\in_array($xType, $mediaFields, true) && $this->mediaService->isEncoded($value)) { + if (\is_string($value) && \in_array($xType, $mediaFields, true) && $this->mediaService->isEncoded($value)) { $value = $this->mediaService->normalize($value); } + if (\is_array($value)) { + throw new \UnexpectedValueException(sprintf('Use field value type "%s" if arrays should be saved. Got value type "%s" instead', Field::VALUE_TYPE_JSON, $valueType)); + } + return $value; } diff --git a/engine/Shopware/Models/Emotion/Library/Field.php b/engine/Shopware/Models/Emotion/Library/Field.php index eb7dfe8164f..9a8c980159e 100644 --- a/engine/Shopware/Models/Emotion/Library/Field.php +++ b/engine/Shopware/Models/Emotion/Library/Field.php @@ -33,6 +33,9 @@ */ class Field extends ModelEntity { + public const VALUE_TYPE_JSON = 'json'; + public const VALUE_TYPE_STRING = 'string'; + /** * Unique identifier field of the element model. * diff --git a/tests/Unit/Controllers/Backend/EmotionTest.php b/tests/Unit/Controllers/Backend/EmotionTest.php index e27192f80ab..939bcc8ea3f 100644 --- a/tests/Unit/Controllers/Backend/EmotionTest.php +++ b/tests/Unit/Controllers/Backend/EmotionTest.php @@ -48,7 +48,7 @@ public function testProcessDataFieldValue(): void $controller = new Shopware_Controllers_Backend_Emotion($mediaServiceMock, $eventManagerMock); $field = new Field(); - $field->setValueType('json'); + $field->setValueType(Field::VALUE_TYPE_JSON); $initialValue = [ [ 'position' => 1, @@ -73,4 +73,21 @@ public function testProcessDataFieldValue(): void static::assertSame('[{"position":1,"path":"path\/to\/media.jpg","mediaId":1,"link":""},{"position":2,"mediaId":2,"link":""},{"position":3,"path":"path\/to\/media.jpg","mediaId":3,"link":""}]', $processedValue); } + + public function testProcessDataFieldValueWithNullValue(): void + { + $processDataFieldValueMethod = TestReflectionHelper::getMethod(Shopware_Controllers_Backend_Emotion::class, 'processDataFieldValue'); + + $mediaServiceMock = $this->createMock(MediaServiceInterface::class); + $eventManagerMock = $this->createMock(ContainerAwareEventManager::class); + $eventManagerMock->expects(static::once())->method('collect')->willReturn(new ArrayCollection()); + $controller = new Shopware_Controllers_Backend_Emotion($mediaServiceMock, $eventManagerMock); + + $field = new Field(); + $initialValue = null; + + $processedValue = $processDataFieldValueMethod->invoke($controller, $field, $initialValue); + + static::assertNull($processedValue); + } } From 6f24d5a619ee7697ea786d13ddd656bd8d3a387b Mon Sep 17 00:00:00 2001 From: Philip Gatzka Date: Mon, 20 Jun 2022 16:54:01 +0200 Subject: [PATCH 052/730] SW-26770 - Extend version compatibility of updater command --- recovery/update/src/Command/UpdateCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recovery/update/src/Command/UpdateCommand.php b/recovery/update/src/Command/UpdateCommand.php index 60ac3786286..08ca86225e0 100644 --- a/recovery/update/src/Command/UpdateCommand.php +++ b/recovery/update/src/Command/UpdateCommand.php @@ -80,7 +80,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $this->getHelper('question') ); - if (!is_dir(UPDATE_FILES_PATH) && !is_dir(UPDATE_ASSET_PATH)) { + if (!is_dir(UPDATE_FILES_PATH ?? '') && !is_dir(UPDATE_ASSET_PATH ?? '')) { $ioService->writeln('No update files found.'); return 1; From 57adb83f4d65fc34bf938562bbc3806befa4b57b Mon Sep 17 00:00:00 2001 From: Philip Gatzka Date: Tue, 21 Jun 2022 10:01:18 +0200 Subject: [PATCH 053/730] SW-26770 - Revert "SW-26770 - Extend version compatibility of updater command" This reverts commit 6f24d5a619ee7697ea786d13ddd656bd8d3a387b. --- recovery/update/src/Command/UpdateCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/recovery/update/src/Command/UpdateCommand.php b/recovery/update/src/Command/UpdateCommand.php index 08ca86225e0..60ac3786286 100644 --- a/recovery/update/src/Command/UpdateCommand.php +++ b/recovery/update/src/Command/UpdateCommand.php @@ -80,7 +80,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $this->getHelper('question') ); - if (!is_dir(UPDATE_FILES_PATH ?? '') && !is_dir(UPDATE_ASSET_PATH ?? '')) { + if (!is_dir(UPDATE_FILES_PATH) && !is_dir(UPDATE_ASSET_PATH)) { $ioService->writeln('No update files found.'); return 1; From d7fa75a269c6a20a9d88d89213a00c2338154619 Mon Sep 17 00:00:00 2001 From: Philip Gatzka Date: Tue, 21 Jun 2022 11:23:00 +0200 Subject: [PATCH 054/730] SW-26770 - Suppress deprecation warnings in installer/updater --- recovery/install/check.php | 2 +- recovery/install/index.php | 2 +- recovery/update/index.php | 3 ++- recovery/update/src/Console/Application.php | 4 ++-- recovery/update/src/app.php | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/recovery/install/check.php b/recovery/install/check.php index 2bbef0b5e0f..0db11b30a0f 100644 --- a/recovery/install/check.php +++ b/recovery/install/check.php @@ -22,7 +22,7 @@ * our trademarks remain entirely with us. */ -error_reporting(-1); +error_reporting(E_ALL ^ E_DEPRECATED); ini_set('display_errors', true); $tokenFile = __DIR__ . '/tmp/token'; diff --git a/recovery/install/index.php b/recovery/install/index.php index d725cffd68f..5e9d30cbdbe 100644 --- a/recovery/install/index.php +++ b/recovery/install/index.php @@ -42,7 +42,7 @@ require_once __DIR__ . '/../common/autoload.php'; -error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE); +error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE ^ E_DEPRECATED); ini_set('display_errors', 1); date_default_timezone_set('UTC'); set_time_limit(0); diff --git a/recovery/update/index.php b/recovery/update/index.php index 959bf821015..65c7d8c5845 100644 --- a/recovery/update/index.php +++ b/recovery/update/index.php @@ -41,8 +41,9 @@ use Shopware\Recovery\Update\Console\Application; use Symfony\Component\Console\Input\ArgvInput; +error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE ^ E_DEPRECATED); + if (PHP_SAPI === 'cli') { - error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE); ini_set('display_errors', 1); $input = new ArgvInput(); diff --git a/recovery/update/src/Console/Application.php b/recovery/update/src/Console/Application.php index c36280ddc57..c5f5d2f175a 100644 --- a/recovery/update/src/Console/Application.php +++ b/recovery/update/src/Console/Application.php @@ -108,11 +108,11 @@ private function registerErrorHandler() { set_error_handler(function ($errno, $errstr, $errfile, $errline) { // error was suppressed with the @-operator - if (error_reporting() === 0 || $errno === E_USER_DEPRECATED) { + if (error_reporting() === 0) { return false; } throw new ErrorException($errstr, 0, $errno, $errfile, $errline); - }); + }, E_ALL ^ E_DEPRECATED ^ E_USER_DEPRECATED); } } diff --git a/recovery/update/src/app.php b/recovery/update/src/app.php index 9e4fe1e4d2a..44424a5f451 100644 --- a/recovery/update/src/app.php +++ b/recovery/update/src/app.php @@ -33,7 +33,7 @@ date_default_timezone_set('Europe/Berlin'); ini_set('display_errors', 1); -error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE); +error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE ^ E_DEPRECATED); $config = require __DIR__ . '/../config/config.php'; $container = new Container(new PimpleContainer(), $config); From f6962a8241280c1c4d985e39050bfae5064f2776 Mon Sep 17 00:00:00 2001 From: Michael Telgmann Date: Wed, 22 Jun 2022 08:42:52 +0200 Subject: [PATCH 055/730] SW-26736 - Upgrade guzzlehttp/guzzle to v7.4.5 --- UPGRADE-5.7.md | 4 ++-- composer.json | 4 ++-- composer.lock | 30 +++++++++++++++--------------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/UPGRADE-5.7.md b/UPGRADE-5.7.md index 769f4c29398..15211a7de0c 100644 --- a/UPGRADE-5.7.md +++ b/UPGRADE-5.7.md @@ -25,8 +25,8 @@ This changelog references changes done in Shopware 5.7 patch versions. * Updated `elasticsearch/elasticsearch` to version 7.17.0 * Updated `friendsofphp/proxy-manager-lts` to version 1.0.12 * Updated `google/cloud-storage` to version 1.27.1 -* Updated `guzzlehttp/guzzle` to version 7.4.4 -* Updated `guzzlehttp/psr7` to version 2.3.0 +* Updated `guzzlehttp/guzzle` to version 7.4.5 +* Updated `guzzlehttp/psr7` to version 2.4.0 * Updated `laminas/laminas-escaper` to version 2.10.0 * Updated `monolog/monolog` to version 2.7.0 * Updated `mpdf/mpdf` to version 8.1.1 diff --git a/composer.json b/composer.json index 8336f78862c..bd3256865fd 100644 --- a/composer.json +++ b/composer.json @@ -53,8 +53,8 @@ "fig/link-util": "1.1.2", "friendsofphp/proxy-manager-lts": "1.0.12", "google/cloud-storage": "1.27.1", - "guzzlehttp/guzzle": "~7.4.4", - "guzzlehttp/psr7": "2.3.0", + "guzzlehttp/guzzle": "~7.4.5", + "guzzlehttp/psr7": "2.4.0", "laminas/laminas-code": "4.5.1", "laminas/laminas-escaper": "2.10.0", "league/flysystem": "~1.1.4", diff --git a/composer.lock b/composer.lock index 2071690e14d..3a6ec3c3255 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "e570e2140d73b90be176ab8f7b3cdc35", + "content-hash": "5c91af0db0e1f45a7cc813c2f6755cba", "packages": [ { "name": "aws/aws-crt-php", @@ -2071,22 +2071,22 @@ }, { "name": "guzzlehttp/guzzle", - "version": "7.4.4", + "version": "7.4.5", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "e3ff079b22820c2029d4c2a87796b6a0b8716ad8" + "reference": "1dd98b0564cb3f6bd16ce683cb755f94c10fbd82" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/e3ff079b22820c2029d4c2a87796b6a0b8716ad8", - "reference": "e3ff079b22820c2029d4c2a87796b6a0b8716ad8", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/1dd98b0564cb3f6bd16ce683cb755f94c10fbd82", + "reference": "1dd98b0564cb3f6bd16ce683cb755f94c10fbd82", "shasum": "" }, "require": { "ext-json": "*", "guzzlehttp/promises": "^1.5", - "guzzlehttp/psr7": "^1.8.3 || ^2.1", + "guzzlehttp/psr7": "^1.9 || ^2.4", "php": "^7.2.5 || ^8.0", "psr/http-client": "^1.0", "symfony/deprecation-contracts": "^2.2 || ^3.0" @@ -2175,7 +2175,7 @@ ], "support": { "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/7.4.4" + "source": "https://github.com/guzzle/guzzle/tree/7.4.5" }, "funding": [ { @@ -2191,7 +2191,7 @@ "type": "tidelift" } ], - "time": "2022-06-09T21:39:15+00:00" + "time": "2022-06-20T22:16:13+00:00" }, { "name": "guzzlehttp/promises", @@ -2279,16 +2279,16 @@ }, { "name": "guzzlehttp/psr7", - "version": "2.3.0", + "version": "2.4.0", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "83260bb50b8fc753c72d14dc1621a2dac31877ee" + "reference": "13388f00956b1503577598873fffb5ae994b5737" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/83260bb50b8fc753c72d14dc1621a2dac31877ee", - "reference": "83260bb50b8fc753c72d14dc1621a2dac31877ee", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/13388f00956b1503577598873fffb5ae994b5737", + "reference": "13388f00956b1503577598873fffb5ae994b5737", "shasum": "" }, "require": { @@ -2312,7 +2312,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.3-dev" + "dev-master": "2.4-dev" } }, "autoload": { @@ -2374,7 +2374,7 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/2.3.0" + "source": "https://github.com/guzzle/psr7/tree/2.4.0" }, "funding": [ { @@ -2390,7 +2390,7 @@ "type": "tidelift" } ], - "time": "2022-06-09T08:26:02+00:00" + "time": "2022-06-20T21:43:11+00:00" }, { "name": "laminas/laminas-code", From ce0e187843852110ed84878b8eb372b437273e2e Mon Sep 17 00:00:00 2001 From: Michael Telgmann Date: Wed, 22 Jun 2022 08:44:11 +0200 Subject: [PATCH 056/730] SW-26736 - Update PHPUnit dependency --- UPGRADE-5.7.md | 2 +- composer.lock | 55 +++++++++++++++++++++++++------------------------- 2 files changed, 28 insertions(+), 29 deletions(-) diff --git a/UPGRADE-5.7.md b/UPGRADE-5.7.md index 15211a7de0c..ad7834c7a4c 100644 --- a/UPGRADE-5.7.md +++ b/UPGRADE-5.7.md @@ -30,7 +30,7 @@ This changelog references changes done in Shopware 5.7 patch versions. * Updated `laminas/laminas-escaper` to version 2.10.0 * Updated `monolog/monolog` to version 2.7.0 * Updated `mpdf/mpdf` to version 8.1.1 -* Updated `phpunit/phpunit` to version 9.5.20 +* Updated `phpunit/phpunit` to version 9.5.21 * Updated `symfony/browser-kit` to version 4.4.37 * Updated `symfony/config` to version 4.4.42 * Updated `symfony/console` to version 4.4.42 diff --git a/composer.lock b/composer.lock index 3a6ec3c3255..c6f68bd94e7 100644 --- a/composer.lock +++ b/composer.lock @@ -58,16 +58,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.225.1", + "version": "3.228.0", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "b795c9c14997dac771f66d1f6cbadb62c742373a" + "reference": "4ff51d01da43aa3bd36eef921a9cd4e0ff843fab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/b795c9c14997dac771f66d1f6cbadb62c742373a", - "reference": "b795c9c14997dac771f66d1f6cbadb62c742373a", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/4ff51d01da43aa3bd36eef921a9cd4e0ff843fab", + "reference": "4ff51d01da43aa3bd36eef921a9cd4e0ff843fab", "shasum": "" }, "require": { @@ -75,9 +75,9 @@ "ext-json": "*", "ext-pcre": "*", "ext-simplexml": "*", - "guzzlehttp/guzzle": "^5.3.3 || ^6.2.1 || ^7.0", + "guzzlehttp/guzzle": "^6.5.7 || ^7.4.4", "guzzlehttp/promises": "^1.4.0", - "guzzlehttp/psr7": "^1.7.0 || ^2.1.1", + "guzzlehttp/psr7": "^1.8.5 || ^2.3", "mtdowling/jmespath.php": "^2.6", "php": ">=5.5" }, @@ -143,9 +143,9 @@ "support": { "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "issues": "https://github.com/aws/aws-sdk-php/issues", - "source": "https://github.com/aws/aws-sdk-php/tree/3.225.1" + "source": "https://github.com/aws/aws-sdk-php/tree/3.228.0" }, - "time": "2022-06-09T18:19:43+00:00" + "time": "2022-06-21T18:13:25+00:00" }, { "name": "bcremer/line-reader", @@ -1847,16 +1847,16 @@ }, { "name": "google/auth", - "version": "v1.21.0", + "version": "v1.21.1", "source": { "type": "git", "url": "https://github.com/googleapis/google-auth-library-php.git", - "reference": "73392bad2eb6852eea9084b6bbdec752515cb849" + "reference": "aa3b9ca29258ac6347ce3c8937a2418c5d78f840" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-auth-library-php/zipball/73392bad2eb6852eea9084b6bbdec752515cb849", - "reference": "73392bad2eb6852eea9084b6bbdec752515cb849", + "url": "https://api.github.com/repos/googleapis/google-auth-library-php/zipball/aa3b9ca29258ac6347ce3c8937a2418c5d78f840", + "reference": "aa3b9ca29258ac6347ce3c8937a2418c5d78f840", "shasum": "" }, "require": { @@ -1899,27 +1899,27 @@ "support": { "docs": "https://googleapis.github.io/google-auth-library-php/main/", "issues": "https://github.com/googleapis/google-auth-library-php/issues", - "source": "https://github.com/googleapis/google-auth-library-php/tree/v1.21.0" + "source": "https://github.com/googleapis/google-auth-library-php/tree/v1.21.1" }, - "time": "2022-04-13T20:35:52+00:00" + "time": "2022-05-16T19:34:15+00:00" }, { "name": "google/cloud-core", - "version": "v1.46.0", + "version": "v1.46.1", "source": { "type": "git", "url": "https://github.com/googleapis/google-cloud-php-core.git", - "reference": "784a1d361c7dbc5de133feac590f549798c80f5e" + "reference": "ee8ad36aa59773669ca0cd5e1ffeccac7a78d083" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-cloud-php-core/zipball/784a1d361c7dbc5de133feac590f549798c80f5e", - "reference": "784a1d361c7dbc5de133feac590f549798c80f5e", + "url": "https://api.github.com/repos/googleapis/google-cloud-php-core/zipball/ee8ad36aa59773669ca0cd5e1ffeccac7a78d083", + "reference": "ee8ad36aa59773669ca0cd5e1ffeccac7a78d083", "shasum": "" }, "require": { "google/auth": "^1.18", - "guzzlehttp/guzzle": "^5.3|^6.5.6|^7.4.3", + "guzzlehttp/guzzle": "^5.3|^6.5.7|^7.4.4", "guzzlehttp/promises": "^1.3", "guzzlehttp/psr7": "^1.7|^2.0", "monolog/monolog": "^1.1|^2.0", @@ -1964,9 +1964,9 @@ ], "description": "Google Cloud PHP shared dependency, providing functionality useful to all components.", "support": { - "source": "https://github.com/googleapis/google-cloud-php-core/tree/v1.46.0" + "source": "https://github.com/googleapis/google-cloud-php-core/tree/v1.46.1" }, - "time": "2022-06-02T21:53:43+00:00" + "time": "2022-06-15T21:38:50+00:00" }, { "name": "google/cloud-storage", @@ -8936,16 +8936,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.5.20", + "version": "9.5.21", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "12bc8879fb65aef2138b26fc633cb1e3620cffba" + "reference": "0e32b76be457de00e83213528f6bb37e2a38fcb1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/12bc8879fb65aef2138b26fc633cb1e3620cffba", - "reference": "12bc8879fb65aef2138b26fc633cb1e3620cffba", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/0e32b76be457de00e83213528f6bb37e2a38fcb1", + "reference": "0e32b76be457de00e83213528f6bb37e2a38fcb1", "shasum": "" }, "require": { @@ -8979,7 +8979,6 @@ "sebastian/version": "^3.0.2" }, "require-dev": { - "ext-pdo": "*", "phpspec/prophecy-phpunit": "^2.0.1" }, "suggest": { @@ -9023,7 +9022,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.20" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.21" }, "funding": [ { @@ -9035,7 +9034,7 @@ "type": "github" } ], - "time": "2022-04-01T12:37:26+00:00" + "time": "2022-06-19T12:14:25+00:00" }, { "name": "sebastian/cli-parser", From 470da1c6f64f2c990023630e549de3c0b95ed9b6 Mon Sep 17 00:00:00 2001 From: Philip Gatzka Date: Wed, 22 Jun 2022 10:59:31 +0200 Subject: [PATCH 057/730] SW-26772 - Revert "SW-26770 - Suppress deprecation warnings in installer/updater" This reverts commit d7fa75a269c6a20a9d88d89213a00c2338154619. --- recovery/install/check.php | 2 +- recovery/install/index.php | 2 +- recovery/update/index.php | 3 +-- recovery/update/src/Console/Application.php | 4 ++-- recovery/update/src/app.php | 2 +- 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/recovery/install/check.php b/recovery/install/check.php index 0db11b30a0f..2bbef0b5e0f 100644 --- a/recovery/install/check.php +++ b/recovery/install/check.php @@ -22,7 +22,7 @@ * our trademarks remain entirely with us. */ -error_reporting(E_ALL ^ E_DEPRECATED); +error_reporting(-1); ini_set('display_errors', true); $tokenFile = __DIR__ . '/tmp/token'; diff --git a/recovery/install/index.php b/recovery/install/index.php index 5e9d30cbdbe..d725cffd68f 100644 --- a/recovery/install/index.php +++ b/recovery/install/index.php @@ -42,7 +42,7 @@ require_once __DIR__ . '/../common/autoload.php'; -error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE ^ E_DEPRECATED); +error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE); ini_set('display_errors', 1); date_default_timezone_set('UTC'); set_time_limit(0); diff --git a/recovery/update/index.php b/recovery/update/index.php index 65c7d8c5845..959bf821015 100644 --- a/recovery/update/index.php +++ b/recovery/update/index.php @@ -41,9 +41,8 @@ use Shopware\Recovery\Update\Console\Application; use Symfony\Component\Console\Input\ArgvInput; -error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE ^ E_DEPRECATED); - if (PHP_SAPI === 'cli') { + error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE); ini_set('display_errors', 1); $input = new ArgvInput(); diff --git a/recovery/update/src/Console/Application.php b/recovery/update/src/Console/Application.php index c5f5d2f175a..c36280ddc57 100644 --- a/recovery/update/src/Console/Application.php +++ b/recovery/update/src/Console/Application.php @@ -108,11 +108,11 @@ private function registerErrorHandler() { set_error_handler(function ($errno, $errstr, $errfile, $errline) { // error was suppressed with the @-operator - if (error_reporting() === 0) { + if (error_reporting() === 0 || $errno === E_USER_DEPRECATED) { return false; } throw new ErrorException($errstr, 0, $errno, $errfile, $errline); - }, E_ALL ^ E_DEPRECATED ^ E_USER_DEPRECATED); + }); } } diff --git a/recovery/update/src/app.php b/recovery/update/src/app.php index 44424a5f451..9e4fe1e4d2a 100644 --- a/recovery/update/src/app.php +++ b/recovery/update/src/app.php @@ -33,7 +33,7 @@ date_default_timezone_set('Europe/Berlin'); ini_set('display_errors', 1); -error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE ^ E_DEPRECATED); +error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE); $config = require __DIR__ . '/../config/config.php'; $container = new Container(new PimpleContainer(), $config); From c7c6e202033e874c0240a07205aac5d6179eff0c Mon Sep 17 00:00:00 2001 From: Philip Gatzka Date: Wed, 22 Jun 2022 11:23:33 +0200 Subject: [PATCH 058/730] SW-26772 - Resolve deprecations for PHPv8.1 compatibility --- recovery/common/src/DumpIterator.php | 4 ++++ recovery/update/index.php | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/recovery/common/src/DumpIterator.php b/recovery/common/src/DumpIterator.php index 30a7d773549..fd5f798cf97 100644 --- a/recovery/common/src/DumpIterator.php +++ b/recovery/common/src/DumpIterator.php @@ -102,6 +102,7 @@ public function seek($position) /** * @return int */ + #[\ReturnTypeWillChange] public function count() { return $this->count; @@ -115,6 +116,7 @@ public function rewind() $this->position = 0; } + #[\ReturnTypeWillChange] public function current() { return $this->current; @@ -123,6 +125,7 @@ public function current() /** * @return int */ + #[\ReturnTypeWillChange] public function key() { return $this->position; @@ -139,6 +142,7 @@ public function next() /** * @return bool */ + #[\ReturnTypeWillChange] public function valid() { return !feof($this->stream); diff --git a/recovery/update/index.php b/recovery/update/index.php index 959bf821015..83780084aa5 100644 --- a/recovery/update/index.php +++ b/recovery/update/index.php @@ -28,9 +28,9 @@ $isManual = is_dir(SW_PATH . '/update-assets'); if ($isManual) { \define('UPDATE_IS_MANUAL', true); - \define('UPDATE_FILES_PATH', null); + \define('UPDATE_FILES_PATH', ''); \define('UPDATE_ASSET_PATH', SW_PATH . '/update-assets'); - \define('UPDATE_META_FILE', null); + \define('UPDATE_META_FILE', ''); } else { \define('UPDATE_IS_MANUAL', false); \define('UPDATE_FILES_PATH', SW_PATH . '/files/update/files'); From 9f71a02dbcc1ea58b648e6e45e206edf54d9c314 Mon Sep 17 00:00:00 2001 From: Philip Gatzka Date: Wed, 22 Jun 2022 14:20:03 +0200 Subject: [PATCH 059/730] SW-26772 - Resolve deprecations for PHPv8.1 compatibility --- recovery/common/src/DumpIterator.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/recovery/common/src/DumpIterator.php b/recovery/common/src/DumpIterator.php index fd5f798cf97..fd63ea1f54b 100644 --- a/recovery/common/src/DumpIterator.php +++ b/recovery/common/src/DumpIterator.php @@ -86,6 +86,7 @@ public function __destruct() * * @throws OutOfBoundsException */ + #[\ReturnTypeWillChange] public function seek($position) { $this->rewind(); @@ -108,6 +109,7 @@ public function count() return $this->count; } + #[\ReturnTypeWillChange] public function rewind() { rewind($this->stream); @@ -131,6 +133,7 @@ public function key() return $this->position; } + #[\ReturnTypeWillChange] public function next() { ++$this->position; From 0576cd8151f0d77376e491ddb3b9c2ce5595146c Mon Sep 17 00:00:00 2001 From: Michael Telgmann Date: Mon, 27 Jun 2022 12:55:28 +0200 Subject: [PATCH 060/730] SW-26848 - Fix shipping cost export --- engine/Shopware/Core/sExport.php | 8 +++---- tests/Functional/Core/ExportTest.php | 32 +++++++++++++++++++++++++++- 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/engine/Shopware/Core/sExport.php b/engine/Shopware/Core/sExport.php index 91c121fb0b8..d10c236d1ce 100644 --- a/engine/Shopware/Core/sExport.php +++ b/engine/Shopware/Core/sExport.php @@ -1716,10 +1716,10 @@ public function sGetPremiumDispatchSurcharge($basket) } $sql = 'SELECT id, bind_sql FROM s_premium_dispatch WHERE type=:type AND active=1 AND bind_sql IS NOT NULL'; - $statements = $this->connection->executeQuery($sql, ['type' => Dispatch::TYPE_SURCHARGE])->fetchAllKeyValue(); + $activeSurcharges = $this->connection->executeQuery($sql, ['type' => Dispatch::TYPE_SURCHARGE])->fetchAllKeyValue(); $sql_where = ''; - foreach ($statements as $dispatchID => $statement) { + foreach ($activeSurcharges as $dispatchID => $statement) { $sql_where .= " AND ( d.id!=$dispatchID OR ($statement)) "; @@ -1810,11 +1810,11 @@ public function sGetPremiumDispatchSurcharge($basket) } $sql = 'SELECT `value` , `factor` FROM `s_premium_shippingcosts` - WHERE `from` <= $from + WHERE `from` <= :from AND `dispatchID` = :dispatchId ORDER BY `from` DESC LIMIT 1'; - $result = $this->connection->fetchAssociative($sql, ['dispatchId' => $dispatch['id']]); + $result = $this->connection->fetchAssociative($sql, ['from' => $from, 'dispatchId' => $dispatch['id']]); if (!$result) { continue; } diff --git a/tests/Functional/Core/ExportTest.php b/tests/Functional/Core/ExportTest.php index a43c33ff99b..27c09257e78 100644 --- a/tests/Functional/Core/ExportTest.php +++ b/tests/Functional/Core/ExportTest.php @@ -155,7 +155,7 @@ public function testMainNumbersAreIncludedInTheExport(): void static::assertArrayHasKey('mainnumber', $result); } - public function testsGetPremiumDispatchSurcharge(): void + public function testsGetPremiumDispatchSurchargeInactiveSurcharge(): void { $testSurcharge = new Dispatch(); $testSurcharge->setName('Test surcharge'); @@ -199,6 +199,36 @@ public function testsGetPremiumDispatchSurcharge(): void static::assertSame(0.0, $surcharge); } + public function testsGetPremiumDispatchSurchargeActiveSurcharge(): void + { + $this->connection->executeStatement( + "INSERT INTO `s_premium_dispatch` (`name`, `type`, `description`, `comment`, `active`, `position`, `calculation`, `surcharge_calculation`, `tax_calculation`, `bind_shippingfree`, `bind_laststock`) + VALUES ('Test', :type, '', '', 1, 0, 1, 0, 0, 0, 0);", + ['type' => Dispatch::TYPE_SURCHARGE] + ); + + $cart = [ + 'instock' => '1', + 'stockmin' => '1', + 'laststock' => '0', + 'weight' => '0.000', + 'count_article' => '1', + 'shippingfree' => '0', + 'amount' => '19.99', + 'max_tax' => '19.00', + 'userID' => null, + 'has_topseller' => '0', + 'has_comment' => '', + 'has_esd' => '0', + 'articleID' => '2', + 'customergroupID' => '1', + 'multishopID' => '1', + ]; + $surcharge = $this->export->sGetPremiumDispatchSurcharge($cart); + + static::assertSame(0.0, $surcharge); + } + private function generateFeed(int $feedId): string { $productFeed = $this->repository->find($feedId); From 9f184a49da39e20a1411d987e0d223f116f37313 Mon Sep 17 00:00:00 2001 From: Philip Gatzka Date: Thu, 23 Jun 2022 12:14:23 +0000 Subject: [PATCH 061/730] SW-26847 - Resolve coverage report deprecation --- .gitlab-ci.yml | 5 +++-- Makefile | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ebe5f7ba803..db0714884fb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -158,8 +158,9 @@ Code Coverage: - ${ARTIFACTS_ROOT}/* expire_in: 1 week reports: - junit: ${ARTIFACTS_ROOT}/phpunit.junit.xml - cobertura: ${ARTIFACTS_ROOT}/*.cobertura.xml + coverage_report: + coverage_format: cobertura + path: ${ARTIFACTS_ROOT}/*.cobertura.xml parallel: matrix: - TESTSUITE: ['unit', 'functional'] diff --git a/Makefile b/Makefile index 56973e9bb56..a4bf16e5fce 100644 --- a/Makefile +++ b/Makefile @@ -69,10 +69,10 @@ test-phpunit: init ./vendor/bin/phpunit --config recovery/common/phpunit.xml.dist --log-junit build/artifacts/test-log.xml test-phpunit-coverage-cobertura: init - php -d pcov.enabled=1 -d pcov.directory="$(CURDIR)" vendor/bin/phpunit --configuration="tests/phpunit.xml.dist" --log-junit="build/artifacts/phpunit.junit.xml" --colors="never" --exclude-group="elasticSearch,pcovAdapterBrokenTest" --testsuite="$(TESTSUITE)" --coverage-cobertura="build/artifacts/phpunit-coverage-$(TESTSUITE).cobertura.xml" + php -d pcov.enabled=1 -d pcov.directory="$(CURDIR)" vendor/bin/phpunit --configuration="tests/phpunit.xml.dist" --colors="never" --exclude-group="elasticSearch,pcovAdapterBrokenTest" --testsuite="$(TESTSUITE)" --coverage-cobertura="build/artifacts/phpunit-coverage-$(TESTSUITE).cobertura.xml" test-phpunit-coverage-statistic: init tests/phpunit-full-coverage.xml - php -d pcov.enabled=1 -d pcov.directory="$(CURDIR)" vendor/bin/phpunit --configuration="tests/phpunit-full-coverage.xml" --log-junit="build/artifacts/phpunit.junit.xml" --colors="never" --exclude-group="elasticSearch,pcovAdapterBrokenTest" --testsuite="$(TESTSUITE)" --coverage-text + php -d pcov.enabled=1 -d pcov.directory="$(CURDIR)" vendor/bin/phpunit --configuration="tests/phpunit-full-coverage.xml" --colors="never" --exclude-group="elasticSearch,pcovAdapterBrokenTest" --testsuite="$(TESTSUITE)" --coverage-text test-phpunit-elasticsearch: elasticsearch-populate ./vendor/bin/phpunit --config tests/phpunit.xml.dist --log-junit build/artifacts/test-log.xml --exclude-group=skipElasticSearch --group=elasticSearch From 76413c76310bd9b866f29c4859491d83ffbf44c5 Mon Sep 17 00:00:00 2001 From: Philip Gatzka Date: Thu, 23 Jun 2022 08:31:49 +0200 Subject: [PATCH 062/730] SW-26843 - Adjust pipeline trigger rules --- .gitlab-ci.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index db0714884fb..a7bc9517f9e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -18,12 +18,12 @@ variables: SW_BASE_PATH: "" ELASTICSEARCH_HOST: elasticsearch -workflow: - rules: - - if: '$CI_PIPELINE_SOURCE == "merge_request_event"' - - if: '$CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS' - when: never - - if: '$CI_COMMIT_BRANCH' +# Include the default gitlab rules template for "MergeRequest-Pipelines". +# This makes pipelines run for the default branch, tags, and all types of merge +# request pipelines. +# @see https://docs.gitlab.com/ee/ci/yaml/workflow.html#workflowrules-templates +include: + - template: 'Workflows/MergeRequest-Pipelines.gitlab-ci.yml' .composer-cache: &composer-cache key: From 4d87b3baaf8ffd618f7aafb2c58259ac69fe04f1 Mon Sep 17 00:00:00 2001 From: Michael Telgmann Date: Tue, 21 Jun 2022 13:48:57 +0200 Subject: [PATCH 063/730] SW-26746 - Implement pipeline for PHP 8.2 --- .gitlab-ci.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a7bc9517f9e..24caf95fa76 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -55,7 +55,6 @@ stages: - Static analysis - PHPUnit - End-to-end testing - - Security - Build Image default: @@ -181,6 +180,11 @@ PHP 8.1: extends: .phpunit_base image: gitlab.shopware.com:5005/shopware/5/product/image/continuous:8.1 +PHP 8.2: + allow_failure: true + extends: .phpunit_base + image: gitlab.shopware.com:5005/shopware/5/product/image/continuous:8.2.0alpha1 + MySQL 8.0: extends: .phpunit_base services: From 13fc0bf36d9e98942a3abdd295f73c747b25cc2c Mon Sep 17 00:00:00 2001 From: Michael Telgmann Date: Wed, 22 Jun 2022 17:08:57 +0200 Subject: [PATCH 064/730] SW-26840 - Fix cart handling for products with purchase steps --- .phpstan-baseline.neon | 5 -- engine/Shopware/Core/sBasket.php | 6 +- tests/Functional/Core/BasketTest.php | 121 ++++++++++++--------------- 3 files changed, 56 insertions(+), 76 deletions(-) diff --git a/.phpstan-baseline.neon b/.phpstan-baseline.neon index 795b9735f9f..7b7c224d569 100644 --- a/.phpstan-baseline.neon +++ b/.phpstan-baseline.neon @@ -29805,11 +29805,6 @@ parameters: count: 1 path: engine/Shopware/Core/sBasket.php - - - message: "#^Method sBasket\\:\\:getAdditionalInfoForUpdateProduct\\(\\) has no return type specified\\.$#" - count: 1 - path: engine/Shopware/Core/sBasket.php - - message: "#^Method sBasket\\:\\:getBasketImage\\(\\) has parameter \\$image with no value type specified in iterable type array\\.$#" count: 1 diff --git a/engine/Shopware/Core/sBasket.php b/engine/Shopware/Core/sBasket.php index d9055603a58..34f81885ea7 100644 --- a/engine/Shopware/Core/sBasket.php +++ b/engine/Shopware/Core/sBasket.php @@ -2886,9 +2886,9 @@ private function loadBasketProducts(): array /** * Gets additional product info for sUpdateArticle * - * @param CartItemStruct[] $cartItems + * @param array $cartItems */ - private function getAdditionalInfoForUpdateProduct(array $cartItems) + private function getAdditionalInfoForUpdateProduct(array $cartItems): void { $ids = []; foreach ($cartItems as $cartItem) { @@ -2967,7 +2967,7 @@ private function getAdditionalInfoForUpdateProduct(array $cartItems) } if (($quantity / $additionalInfo['purchasesteps']) != (int) ($quantity / $additionalInfo['purchasesteps'])) { - $quantity = (int) ($quantity / $additionalInfo['purchasesteps']) * $additionalInfo['purchasesteps']; + $quantity = (int) (($quantity / $additionalInfo['purchasesteps']) * $additionalInfo['purchasesteps']); } $maxPurchase = $this->config->get('sMAXPURCHASE'); diff --git a/tests/Functional/Core/BasketTest.php b/tests/Functional/Core/BasketTest.php index f86f8d1b89c..ae4128ada42 100644 --- a/tests/Functional/Core/BasketTest.php +++ b/tests/Functional/Core/BasketTest.php @@ -85,8 +85,7 @@ public function testsGetAmount(): void { // Test with empty session, expect empty array static::assertEquals([], $this->module->sGetAmount()); - $this->module->sSYSTEM->sSESSION_ID = uniqid((string) mt_rand(), true); - $this->session->offsetSet('sessionId', $this->module->sSYSTEM->sSESSION_ID); + $this->generateBasketSession(); $this->connection->insert( 's_order_basket', @@ -404,8 +403,7 @@ public function testsInsertPremium(): void static::assertTrue($this->module->sInsertPremium()); // Create session id - $this->module->sSYSTEM->sSESSION_ID = uniqid((string) mt_rand(), true); - $this->session->offsetSet('sessionId', $this->module->sSYSTEM->sSESSION_ID); + $this->generateBasketSession(); // Test with session, expect true static::assertTrue($this->module->sInsertPremium()); @@ -465,7 +463,7 @@ public function testsInsertPremium(): void 1, $this->connection->fetchOne( 'SELECT count(*) FROM s_order_basket WHERE sessionID = ?', - [$this->module->sSYSTEM->sSESSION_ID] + [$this->session->get('sessionId')] ) ); @@ -498,7 +496,7 @@ public function testsInsertPremium(): void 1, $this->connection->fetchOne( 'SELECT count(*) FROM s_order_basket WHERE sessionID = ?', - [$this->module->sSYSTEM->sSESSION_ID] + [$this->session->get('sessionId')] ) ); @@ -531,7 +529,7 @@ public function testsInsertPremium(): void 2, $this->connection->fetchOne( 'SELECT count(*) FROM s_order_basket WHERE sessionID = ?', - [$this->module->sSYSTEM->sSESSION_ID] + [$this->session->get('sessionId')] ) ); @@ -542,7 +540,7 @@ public function testsInsertPremium(): void 3, $this->connection->fetchOne( 'SELECT count(*) FROM s_order_basket WHERE sessionID = ?', - [$this->module->sSYSTEM->sSESSION_ID] + [$this->session->get('sessionId')] ) ); @@ -558,8 +556,7 @@ public function testPremiumOrderNumberExport(): void $this->connection->beginTransaction(); // Create session id - $this->module->sSYSTEM->sSESSION_ID = uniqid((string) mt_rand(), true); - $this->session->offsetSet('sessionId', $this->module->sSYSTEM->sSESSION_ID); + $this->generateBasketSession(); // Test with session, expect true static::assertTrue($this->module->sInsertPremium()); @@ -582,7 +579,7 @@ public function testPremiumOrderNumberExport(): void $ordernumberExport, $this->connection->fetchOne( 'SELECT ordernumber FROM s_order_basket WHERE sessionID = ? AND modus = 1', - [$this->module->sSYSTEM->sSESSION_ID] + [$this->session->get('sessionId')] ) ); @@ -596,8 +593,7 @@ public function testGetMaxTax(): void static::assertFalse($this->module->getMaxTax()); // Create session id - $this->module->sSYSTEM->sSESSION_ID = uniqid((string) mt_rand(), true); - $this->session->offsetSet('sessionId', $this->module->sSYSTEM->sSESSION_ID); + $this->generateBasketSession(); // Test with session and empty basket, expect false static::assertFalse($this->module->getMaxTax()); @@ -668,8 +664,7 @@ public function testsAddVoucherWithAbsoluteVoucher(): void ); // Create session id and try again, same results - $this->module->sSYSTEM->sSESSION_ID = uniqid((string) mt_rand(), true); - $this->session->offsetSet('sessionId', $this->module->sSYSTEM->sSESSION_ID); + $this->generateBasketSession(); $result = $this->module->sAddVoucher(''); static::assertIsArray($result); static::assertArrayHasKey('sErrorFlag', $result); @@ -692,8 +687,7 @@ public function testsAddVoucherWithAbsoluteVoucher(): void 'modus' => 0, ]; $this->connection->insert('s_emarketing_vouchers', $voucherData); - $this->module->sSYSTEM->sSESSION_ID = uniqid((string) mt_rand(), true); - $this->session->offsetSet('sessionId', $this->module->sSYSTEM->sSESSION_ID); + $this->generateBasketSession(); $result = $this->module->sAddVoucher('testOne'); static::assertIsArray($result); @@ -706,8 +700,7 @@ public function testsAddVoucherWithAbsoluteVoucher(): void $currencyDe = $this->getContainer()->get(Zend_Currency::class); $this->getContainer()->set('currency', new Zend_Currency('GBP', new Zend_Locale('en_GB'))); - $this->module->sSYSTEM->sSESSION_ID = uniqid((string) mt_rand(), true); - $this->session->offsetSet('sessionId', $this->module->sSYSTEM->sSESSION_ID); + $this->generateBasketSession(); $result = $this->module->sAddVoucher('testOne'); static::assertIsArray($result); static::assertArrayHasKey('sErrorFlag', $result); @@ -766,7 +759,7 @@ public function testsAddVoucherWithAbsoluteVoucher(): void // Test the voucher values with tax from user group $discount = $this->connection->fetchAssociative( 'SELECT * FROM s_order_basket WHERE modus = 2 and sessionID = ?', - [$this->module->sSYSTEM->sSESSION_ID] + [$this->session->get('sessionId')] ); static::assertIsArray($discount); static::assertEquals($voucherData['value'] * -1, $discount['price']); @@ -829,8 +822,7 @@ public function testsAddVoucherWithLimitedVoucher(): void $customer = $this->createDummyCustomer(); $this->session['sUserId'] = $customer->getId(); - $this->module->sSYSTEM->sSESSION_ID = uniqid((string) mt_rand(), true); - $this->session->offsetSet('sessionId', $this->module->sSYSTEM->sSESSION_ID); + $this->generateBasketSession(); // Test with one-time code, fail due to minimum amount (cart is empty) $result = $this->module->sAddVoucher($voucherCodeData['code']); @@ -861,7 +853,7 @@ public function testsAddVoucherWithLimitedVoucher(): void // Test the voucher values. This voucher has no taxes $discount = $this->connection->fetchAssociative( 'SELECT * FROM s_order_basket WHERE modus = 2 and sessionID = ?', - [$this->module->sSYSTEM->sSESSION_ID] + [$this->session->get('sessionId')] ); static::assertIsArray($discount); static::assertEquals($voucherData['value'] * -1, $discount['price']); @@ -925,8 +917,7 @@ public function testsAddVoucherWithSubShopVoucher(): void $customer = $this->createDummyCustomer(); $this->session['sUserId'] = $customer->getId(); - $this->module->sSYSTEM->sSESSION_ID = uniqid((string) random_int(PHP_INT_MIN, PHP_INT_MAX), true); - $this->session->offsetSet('sessionId', $this->module->sSYSTEM->sSESSION_ID); + $this->generateBasketSession(); // Add one product to the basket with enough value to use discount $randomProduct = $this->getRandomProduct(); @@ -952,7 +943,7 @@ public function testsAddVoucherWithSubShopVoucher(): void // Test the voucher values with custom tax from voucher $discount = $this->connection->fetchAssociative( 'SELECT * FROM s_order_basket WHERE modus = 2 and sessionID = ?', - [$this->module->sSYSTEM->sSESSION_ID] + [$this->session->get('sessionId')] ); static::assertIsArray($discount); static::assertEquals($voucherData['value'] * -1, $discount['price']); @@ -1023,8 +1014,7 @@ public function testsAddVoucherWithMultipleVouchers(): void $customer = $this->createDummyCustomer(); $this->session['sUserId'] = $customer->getId(); - $this->module->sSYSTEM->sSESSION_ID = uniqid((string) mt_rand(), true); - $this->session->offsetSet('sessionId', $this->module->sSYSTEM->sSESSION_ID); + $this->generateBasketSession(); // Add one product to the basket with enough value to use discount $randomProduct = $this->getRandomProduct(); @@ -1110,8 +1100,7 @@ public function testsAddVoucherWithCustomerGroup(): void ); $this->module->sSYSTEM->sUSERGROUPDATA['id'] = $randomCustomerGroup[1]['id']; $this->session['sUserId'] = $customer->getId(); - $this->module->sSYSTEM->sSESSION_ID = uniqid((string) mt_rand(), true); - $this->session->offsetSet('sessionId', $this->module->sSYSTEM->sSESSION_ID); + $this->generateBasketSession(); // Add one product to the basket with enough value to use discount $randomProduct = $this->getRandomProduct(); @@ -1193,8 +1182,7 @@ public function testsAddVoucherWithArticle(): void $customer = $this->createDummyCustomer(); $this->session['sUserId'] = $customer->getId(); - $this->module->sSYSTEM->sSESSION_ID = uniqid((string) mt_rand(), true); - $this->session->offsetSet('sessionId', $this->module->sSYSTEM->sSESSION_ID); + $this->generateBasketSession(); // Add one product to the basket with enough value to use discount $this->connection->insert( @@ -1273,8 +1261,7 @@ public function testsAddVoucherWithCurrencyFactor(): void $randomProduct = $this->getRandomProduct(); // Generate session id - $this->module->sSYSTEM->sSESSION_ID = uniqid((string) mt_rand(), true); - $this->session->offsetSet('sessionId', $this->module->sSYSTEM->sSESSION_ID); + $this->generateBasketSession(); // Define different currency factors to test foreach ([0, .5, 1, 1.5, 2] as $currencyFactor) { @@ -1410,8 +1397,7 @@ public function testsGetBasketIds(): void $this->getRandomProduct($randomProductOne['id']), ]; - $this->module->sSYSTEM->sSESSION_ID = uniqid((string) mt_rand(), true); - $this->session->offsetSet('sessionId', $this->module->sSYSTEM->sSESSION_ID); + $this->generateBasketSession(); // Test with empty basket, empty static::assertNull($this->module->sGetBasketIds()); @@ -1493,8 +1479,7 @@ public function testsCheckMinimumCharge(): void // Test with empty cart, expect 10 static::assertEquals(10, $this->module->sCheckMinimumCharge()); - $this->module->sSYSTEM->sSESSION_ID = uniqid((string) mt_rand(), true); - $this->session->offsetSet('sessionId', $this->module->sSYSTEM->sSESSION_ID); + $this->generateBasketSession(); // Add one product to the basket with enough value to use discount $randomArticle = $this->getRandomProduct(); @@ -1548,8 +1533,7 @@ public function testsInsertSurcharge(): void ) ); - $this->module->sSYSTEM->sSESSION_ID = uniqid((string) mt_rand(), true); - $this->session->offsetSet('sessionId', $this->module->sSYSTEM->sSESSION_ID); + $this->generateBasketSession(); // Add one product to the basket with value lower that minimumordersurcharge $randomProduct = $this->getRandomProduct(); @@ -1571,7 +1555,7 @@ public function testsInsertSurcharge(): void static::assertEmpty( $this->connection->fetchAssociative( 'SELECT * FROM s_order_basket WHERE sessionID = ? AND modus=4', - [$this->module->sSYSTEM->sSESSION_ID] + [$this->session->get('sessionId')] ) ); @@ -1586,7 +1570,7 @@ public function testsInsertSurcharge(): void // Fetch the surcharge row, should have price 5 $surchargeRow = $this->connection->fetchAssociative( 'SELECT * FROM s_order_basket WHERE sessionID = ? AND modus=4', - [$this->module->sSYSTEM->sSESSION_ID] + [$this->session->get('sessionId')] ); static::assertIsArray($surchargeRow); static::assertEquals(5, $surchargeRow['price']); @@ -1626,8 +1610,7 @@ public function testsInsertSurchargePercent(): void ['id' => $customer->getId()] ); $this->session['sUserId'] = $customer->getId(); - $this->module->sSYSTEM->sSESSION_ID = uniqid((string) mt_rand(), true); - $this->session->offsetSet('sessionId', $this->module->sSYSTEM->sSESSION_ID); + $this->generateBasketSession(); // Empty basket, expect false static::assertFalse( @@ -1654,7 +1637,7 @@ public function testsInsertSurchargePercent(): void static::assertEmpty( $this->connection->fetchAssociative( 'SELECT * FROM s_order_basket WHERE sessionID = ? AND modus=4', - [$this->module->sSYSTEM->sSESSION_ID] + [$this->session->get('sessionId')] ) ); @@ -1669,7 +1652,7 @@ public function testsInsertSurchargePercent(): void // Fetch the surcharge row, should have price 5 $surchargeRow = $this->connection->fetchAssociative( 'SELECT * FROM s_order_basket WHERE sessionID = ? AND modus = 4', - [$this->module->sSYSTEM->sSESSION_ID] + [$this->session->get('sessionId')] ); static::assertIsArray($surchargeRow); static::assertEquals(2 / 100 * 5, $surchargeRow['price']); @@ -1691,8 +1674,7 @@ public function testsGetBasket(): void // Test with empty basket static::assertEquals([], $this->module->sGetBasket()); - $this->module->sSYSTEM->sSESSION_ID = uniqid((string) mt_rand(), true); - $this->session->offsetSet('sessionId', $this->module->sSYSTEM->sSESSION_ID); + $this->generateBasketSession(); // Add one product to the basket with low amount $randomProduct = $this->getRandomProduct(); @@ -1814,8 +1796,7 @@ public function testsGetBasketDataHasNumericCartItemAmounts(): void ]); $customerGroup = $resourceHelper->createCustomerGroup(); $this->session['sUserId'] = $this->createDummyCustomer()->getId(); - $this->module->sSYSTEM->sSESSION_ID = uniqid((string) mt_rand(), true); - $this->session->offsetSet('sessionId', $this->module->sSYSTEM->sSESSION_ID); + $this->generateBasketSession(); $this->module->sSYSTEM->sUSERGROUPDATA['id'] = $customerGroup->getId(); // Add the product to the basket @@ -1912,8 +1893,7 @@ public function testsGetBasketDataNegativeCloseToZeroTotal(): void ['id' => $customer->getId()] ); $this->session['sUserId'] = $customer->getId(); - $this->module->sSYSTEM->sSESSION_ID = uniqid((string) mt_rand(), true); - $this->session->offsetSet('sessionId', $this->module->sSYSTEM->sSESSION_ID); + $this->generateBasketSession(); $this->module->sSYSTEM->sUSERGROUPDATA['id'] = $customerGroup->getId(); // Actually add the product to the basket @@ -1945,8 +1925,7 @@ public function testsGetBasketWithInvalidProduct(): void { static::assertEquals([], $this->module->sGetBasket()); - $this->module->sSYSTEM->sSESSION_ID = uniqid((string) mt_rand(), true); - $this->session->offsetSet('sessionId', $this->module->sSYSTEM->sSESSION_ID); + $this->generateBasketSession(); // Setup product for the first basket position - a product that costs EUR 29.97 $product = (new Helper($this->getContainer()))->createProduct([ @@ -2000,7 +1979,6 @@ public function testsGetBasketWithInvalidProduct(): void public function testsAddNote(): void { - $front = $this->getContainer()->get('front'); $_COOKIE['sUniqueID'] = Random::getAlphanumericString(32); // Add one product to the basket with low amount @@ -2180,8 +2158,7 @@ public function testsCheckForESD(): void // No session, expect false static::assertFalse($this->module->sCheckForESD()); - $this->module->sSYSTEM->sSESSION_ID = uniqid((string) mt_rand(), true); - $this->session->offsetSet('sessionId', $this->module->sSYSTEM->sSESSION_ID); + $this->generateBasketSession(); // Get random non-esd product and add it to the basket $randomNoESDProduct = $this->connection->fetchAssociative( @@ -2248,8 +2225,7 @@ public function testsDeleteBasket(): void // No session, expect false static::assertFalse($this->module->sDeleteBasket()); - $this->module->sSYSTEM->sSESSION_ID = uniqid((string) mt_rand(), true); - $this->session->offsetSet('sessionId', $this->module->sSYSTEM->sSESSION_ID); + $this->generateBasketSession(); static::assertNull($this->module->sDeleteBasket()); @@ -2289,8 +2265,7 @@ public function testsDeleteArticle(): void // Random id, expect null static::assertNull($this->module->sDeleteArticle(9999999)); - $this->module->sSYSTEM->sSESSION_ID = uniqid((string) mt_rand(), true); - $this->session->offsetSet('sessionId', $this->module->sSYSTEM->sSESSION_ID); + $this->generateBasketSession(); // Get random product and add it to the basket $randomProduct = $this->connection->fetchAssociative( @@ -2323,8 +2298,7 @@ public function testsAddArticle(): void // No id, expect false static::assertFalse($this->module->sAddArticle('')); - $this->module->sSYSTEM->sSESSION_ID = uniqid((string) mt_rand(), true); - $this->session->offsetSet('sessionId', $this->module->sSYSTEM->sSESSION_ID); + $this->generateBasketSession(); // Get random product with stock control and add it to the basket $randomProductOne = $this->connection->fetchAssociative( @@ -2459,8 +2433,7 @@ public function testsPriceCalculationTaxfreeWithPriceGroupDiscount(): void $this->session->set('sUserGroupData', $customerGroupData); // Setup session - $this->module->sSYSTEM->sSESSION_ID = uniqid((string) mt_rand(), true); - $this->session->offsetSet('sessionId', $this->module->sSYSTEM->sSESSION_ID); + $this->generateBasketSession(); static::assertInstanceOf(Detail::class, $product->getMainDetail()); static::assertIsString($product->getMainDetail()->getNumber()); @@ -2489,8 +2462,7 @@ public function testsPriceCalculationTaxfreeWithPriceGroupDiscount(): void public function testMinPurchaseMultipleTimesAdded(): void { - $this->module->sSYSTEM->sSESSION_ID = uniqid((string) mt_rand(), true); - $this->session->offsetSet('sessionId', $this->module->sSYSTEM->sSESSION_ID); + $this->generateBasketSession(); $this->connection->executeStatement('UPDATE s_articles_details SET minpurchase = 2 WHERE ordernumber = "SW10239"'); @@ -2504,11 +2476,24 @@ public function testMinPurchaseMultipleTimesAdded(): void static::assertSame(4, (int) $cart[CartKey::POSITIONS][0]['quantity']); } + public function testUpdateCartItemsWithPurchaseSteps(): void + { + $this->generateBasketSession(); + + $this->connection->executeStatement('UPDATE s_articles_details SET purchasesteps = 4 WHERE ordernumber = "SW10239"'); + + $this->module->sAddArticle('SW10239'); + + $cart = $this->module->sGetBasketData(); + + static::assertArrayHasKey(CartKey::POSITIONS, $cart); + static::assertSame(1, (int) $cart[CartKey::POSITIONS][0]['quantity']); + } + private function generateBasketSession(): string { // Create session id $sessionId = Random::getAlphanumericString(32); - $this->module->sSYSTEM->sSESSION_ID = $sessionId; $this->session->offsetSet('sessionId', $sessionId); return $sessionId; From 6f65dc4b8a0fbb2b962b633ea9d4c01947779972 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20Schr=C3=B6der?= Date: Wed, 22 Jun 2022 10:25:22 +0200 Subject: [PATCH 065/730] SW-26842 - Change mPdf default fontDir to array fixes https://github.com/shopware/shopware/pull/2501 --- engine/Shopware/Configs/Default.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/Shopware/Configs/Default.php b/engine/Shopware/Configs/Default.php index ffe0fecc967..de85cb72800 100644 --- a/engine/Shopware/Configs/Default.php +++ b/engine/Shopware/Configs/Default.php @@ -375,7 +375,7 @@ // Passed to \Mpdf\Mpdf::__construct: 'defaultConfig' => [ 'tempDir' => $this->getCacheDir() . '/mpdf/', - 'fontDir' => $this->DocPath('engine_Library_Mpdf_ttfonts_'), + 'fontDir' => [$this->DocPath('engine_Library_Mpdf_ttfonts_')], 'fonttrans' => [ 'helvetica' => 'arial', 'verdana' => 'arial', From 9b9d2203bf898029d405254fb3d1f56f3bedac8a Mon Sep 17 00:00:00 2001 From: Michael Telgmann Date: Thu, 23 Jun 2022 13:50:00 +0200 Subject: [PATCH 066/730] SW-22895 - Ensure property filter options are sorted correctly while using sort by position mode --- .phpstan-baseline.neon | 40 ------ .../FacetHandler/PropertyFacetHandler.php | 10 +- .../Bundle/SearchBundleES/StructHydrator.php | 2 +- .../DBAL/Hydrator/PropertyHydrator.php | 71 ++++------ .../Struct/Property/Option.php | 4 +- .../FacetHandler/PropertyFacetHandlerTest.php | 132 ++++++++++++++++++ 6 files changed, 171 insertions(+), 88 deletions(-) create mode 100644 tests/Functional/Bundle/SearchBundleDBAL/FacetHandler/PropertyFacetHandlerTest.php diff --git a/.phpstan-baseline.neon b/.phpstan-baseline.neon index 7b7c224d569..3f47a3a659d 100644 --- a/.phpstan-baseline.neon +++ b/.phpstan-baseline.neon @@ -10780,46 +10780,6 @@ parameters: count: 1 path: engine/Shopware/Bundle/StoreFrontBundle/Gateway/DBAL/Hydrator/ProductStreamHydrator.php - - - message: "#^Method Shopware\\\\Bundle\\\\StoreFrontBundle\\\\Gateway\\\\DBAL\\\\Hydrator\\\\PropertyHydrator\\:\\:hydrateGroup\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#" - count: 1 - path: engine/Shopware/Bundle/StoreFrontBundle/Gateway/DBAL/Hydrator/PropertyHydrator.php - - - - message: "#^Method Shopware\\\\Bundle\\\\StoreFrontBundle\\\\Gateway\\\\DBAL\\\\Hydrator\\\\PropertyHydrator\\:\\:hydrateOption\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#" - count: 1 - path: engine/Shopware/Bundle/StoreFrontBundle/Gateway/DBAL/Hydrator/PropertyHydrator.php - - - - message: "#^Method Shopware\\\\Bundle\\\\StoreFrontBundle\\\\Gateway\\\\DBAL\\\\Hydrator\\\\PropertyHydrator\\:\\:hydrateSet\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#" - count: 1 - path: engine/Shopware/Bundle/StoreFrontBundle/Gateway/DBAL/Hydrator/PropertyHydrator.php - - - - message: "#^Method Shopware\\\\Bundle\\\\StoreFrontBundle\\\\Gateway\\\\DBAL\\\\Hydrator\\\\PropertyHydrator\\:\\:hydrateValues\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#" - count: 1 - path: engine/Shopware/Bundle/StoreFrontBundle/Gateway/DBAL/Hydrator/PropertyHydrator.php - - - - message: "#^Method Shopware\\\\Bundle\\\\StoreFrontBundle\\\\Gateway\\\\DBAL\\\\Hydrator\\\\PropertyHydrator\\:\\:sortGroups\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#" - count: 1 - path: engine/Shopware/Bundle/StoreFrontBundle/Gateway/DBAL/Hydrator/PropertyHydrator.php - - - - message: "#^Method Shopware\\\\Bundle\\\\StoreFrontBundle\\\\Gateway\\\\DBAL\\\\Hydrator\\\\PropertyHydrator\\:\\:sortOptions\\(\\) has no return type specified\\.$#" - count: 1 - path: engine/Shopware/Bundle/StoreFrontBundle/Gateway/DBAL/Hydrator/PropertyHydrator.php - - - - message: "#^Method Shopware\\\\Bundle\\\\StoreFrontBundle\\\\Gateway\\\\DBAL\\\\Hydrator\\\\PropertyHydrator\\:\\:sortOptionsByPosition\\(\\) has no return type specified\\.$#" - count: 1 - path: engine/Shopware/Bundle/StoreFrontBundle/Gateway/DBAL/Hydrator/PropertyHydrator.php - - - - message: "#^Method Shopware\\\\Bundle\\\\StoreFrontBundle\\\\Gateway\\\\DBAL\\\\Hydrator\\\\PropertyHydrator\\:\\:sortOptionsNumercialValue\\(\\) has no return type specified\\.$#" - count: 1 - path: engine/Shopware/Bundle/StoreFrontBundle/Gateway/DBAL/Hydrator/PropertyHydrator.php - - message: "#^Method Shopware\\\\Bundle\\\\StoreFrontBundle\\\\Gateway\\\\DBAL\\\\Hydrator\\\\ShopHydrator\\:\\:hydrate\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#" count: 1 diff --git a/engine/Shopware/Bundle/SearchBundleDBAL/FacetHandler/PropertyFacetHandler.php b/engine/Shopware/Bundle/SearchBundleDBAL/FacetHandler/PropertyFacetHandler.php index 495f825c6b7..99077a39e0a 100644 --- a/engine/Shopware/Bundle/SearchBundleDBAL/FacetHandler/PropertyFacetHandler.php +++ b/engine/Shopware/Bundle/SearchBundleDBAL/FacetHandler/PropertyFacetHandler.php @@ -1,4 +1,6 @@ |null */ protected function getProperties(ShopContextInterface $context, Criteria $queryCriteria) { $query = $this->queryBuilderFactory->createQuery($queryCriteria, $context); $this->rebuildQuery($query); - $propertyData = $query->execute()->fetchAll(); + $propertyData = $query->execute()->fetchAllAssociative(); $valueIds = array_column($propertyData, 'id'); $filterGroupIds = array_keys(array_flip(array_column($propertyData, 'filterGroupId'))); @@ -138,8 +140,8 @@ private function getFilteredValues(Criteria $criteria): array } /** - * @param Set[] $sets - * @param int[] $actives + * @param array $sets + * @param array $actives */ private function createCollectionResult( PropertyFacet $facet, diff --git a/engine/Shopware/Bundle/SearchBundleES/StructHydrator.php b/engine/Shopware/Bundle/SearchBundleES/StructHydrator.php index 3245c5a4524..f50f9420e68 100644 --- a/engine/Shopware/Bundle/SearchBundleES/StructHydrator.php +++ b/engine/Shopware/Bundle/SearchBundleES/StructHydrator.php @@ -65,7 +65,7 @@ public function createPropertyOption($data) $option = new PropertyOption(); $option->setId($data['id']); $option->setName($data['name']); - $option->setPosition($data['position']); + $option->setPosition((int) $data['position']); if ($data['media']) { $option->setMedia($this->createMedia($data['media'])); diff --git a/engine/Shopware/Bundle/StoreFrontBundle/Gateway/DBAL/Hydrator/PropertyHydrator.php b/engine/Shopware/Bundle/StoreFrontBundle/Gateway/DBAL/Hydrator/PropertyHydrator.php index 15c2890de5c..b2bb2239c13 100644 --- a/engine/Shopware/Bundle/StoreFrontBundle/Gateway/DBAL/Hydrator/PropertyHydrator.php +++ b/engine/Shopware/Bundle/StoreFrontBundle/Gateway/DBAL/Hydrator/PropertyHydrator.php @@ -34,15 +34,15 @@ class PropertyHydrator extends Hydrator private MediaHydrator $mediaHydrator; - public function __construct( - AttributeHydrator $attributeHydrator, - MediaHydrator $mediaHydrator - ) { + public function __construct(AttributeHydrator $attributeHydrator, MediaHydrator $mediaHydrator) + { $this->attributeHydrator = $attributeHydrator; $this->mediaHydrator = $mediaHydrator; } /** + * @param array> $data + * * @return Set[] */ public function hydrateValues(array $data) @@ -56,18 +56,10 @@ public function hydrateValues(array $data) $groupId = $row['__propertyGroup_id']; $optionId = $row['__propertyOption_id']; - if (isset($sets[$setId])) { - $set = $sets[$setId]; - } else { - $set = $this->hydrateSet($row); - } + $set = $sets[$setId] ?? $this->hydrateSet($row); $groups = $set->getGroups(); - if (isset($groups[$groupId])) { - $group = $groups[$groupId]; - } else { - $group = $this->hydrateGroup($row); - } + $group = $groups[$groupId] ?? $this->hydrateGroup($row); $options = $group->getOptions(); $options[$optionId] = $this->hydrateOption($row); @@ -90,6 +82,8 @@ public function hydrateValues(array $data) } /** + * @param array $data + * * @return Group */ public function hydrateGroup(array $data) @@ -110,6 +104,8 @@ public function hydrateGroup(array $data) } /** + * @param array $data + * * @return Option */ public function hydrateOption(array $data) @@ -135,6 +131,9 @@ public function hydrateOption(array $data) return $option; } + /** + * @param array $data + */ private function hydrateSet(array $data): Set { $set = new Set(); @@ -155,22 +154,20 @@ private function hydrateSet(array $data): Set /** * Sort groups by position in set + * + * @param array> $data */ private function sortGroups(array &$data): void { - usort($data, function ($a, $b) { - if ($a['__relations_position'] == $b['__relations_position']) { - return 0; - } - - return ($a['__relations_position'] < $b['__relations_position']) ? -1 : 1; + usort($data, function (array $a, array $b): int { + return $a['__relations_position'] <=> $b['__relations_position']; }); } /** - * @param Option[] $options + * @param array
  • @@ -112,7 +112,7 @@ type="text" placeholder="{s name='RegisterPlaceholderTitle' namespace="frontend/register/personal_fieldset"}{/s}" id="title" - value="{$formData.title|escape}" + value="{$formData.title|escapeHtml}" class="address--field{if $error_flags.title} has--error{/if}" />
    {/if} @@ -128,7 +128,7 @@ aria-required="true" placeholder="{s name='RegisterShippingPlaceholderFirstname' namespace="frontend/register/shipping_fieldset"}{/s}{s name="RequiredField" namespace="frontend/register/index"}{/s}" id="firstname2" - value="{$formData.firstname|escape}" + value="{$formData.firstname|escapeHtml}" class="address--field is--required{if $error_flags.firstname} has--error{/if}"/>
    {/block} @@ -143,7 +143,7 @@ aria-required="true" placeholder="{s name='RegisterShippingPlaceholderLastname' namespace="frontend/register/shipping_fieldset"}{/s}{s name="RequiredField" namespace="frontend/register/index"}{/s}" id="lastname2" - value="{$formData.lastname|escape}" + value="{$formData.lastname|escapeHtml}" class="address--field is--required{if $error_flags.lastname} has--error{/if}"/> {/block} @@ -158,7 +158,7 @@ aria-required="true" placeholder="{s name='RegisterBillingPlaceholderStreet' namespace="frontend/register/billing_fieldset"}{/s}{s name="RequiredField" namespace="frontend/register/index"}{/s}" id="street" - value="{$formData.street|escape}" + value="{$formData.street|escapeHtml}" class="address--field address--field-street is--required{if $error_flags.street} has--error{/if}"/> {/block} @@ -173,7 +173,7 @@ {if {config name="requireAdditionAddressLine1"}} required="required" aria-required="true"{/if} placeholder="{s name='RegisterLabelAdditionalAddressLine1' namespace="frontend/register/shipping_fieldset"}{/s}{if {config name="requireAdditionAddressLine1"}}{s name="RequiredField" namespace="frontend/register/index"}{/s}{/if}" id="additionalAddressLine1" - value="{$formData.additionalAddressLine1|escape}" + value="{$formData.additionalAddressLine1|escapeHtml}" class="address--field{if {config name="requireAdditionAddressLine1"}} is--required{/if}{if $error_flags.additionalAddressLine1 && {config name="requireAdditionAddressLine1"}} has--error{/if}"/> {/if} @@ -189,7 +189,7 @@ {if {config name="requireAdditionAddressLine2"}} required="required" aria-required="true"{/if} placeholder="{s name='RegisterLabelAdditionalAddressLine2' namespace="frontend/register/shipping_fieldset"}{/s}{if {config name="requireAdditionAddressLine2"}}{s name="RequiredField" namespace="frontend/register/index"}{/s}{/if}" id="additionalAddressLine2" - value="{$formData.additionalAddressLine2|escape}" + value="{$formData.additionalAddressLine2|escapeHtml}" class="address--field{if {config name="requireAdditionAddressLine2"}} is--required{/if}{if $error_flags.additionalAddressLine2 && {config name="requireAdditionAddressLine2"}} has--error{/if}"/> {/if} @@ -206,7 +206,7 @@ aria-required="true" placeholder="{s name='RegisterBillingPlaceholderZipcode' namespace="frontend/register/billing_fieldset"}{/s}{s name="RequiredField" namespace="frontend/register/index"}{/s}" id="zipcode" - value="{$formData.zipcode|escape}" + value="{$formData.zipcode|escapeHtml}" class="address--field address--spacer address--field-zipcode is--required{if $error_flags.zipcode} has--error{/if}"/> {else} @@ -226,7 +226,7 @@ aria-required="true" placeholder="{s name='RegisterBillingPlaceholderCity' namespace="frontend/register/billing_fieldset"}{/s}{s name="RequiredField" namespace="frontend/register/index"}{/s}" id="city" - value="{$formData.city|escape}" + value="{$formData.city|escapeHtml}" size="25" class="address--field address--spacer address--field-city is--required{if $error_flags.city} has--error{/if}"/> {/if} @@ -305,7 +305,7 @@ {if {config name="requirePhoneField"}} required="required" aria-required="true"{/if} placeholder="{s name='RegisterPlaceholderPhone' namespace="frontend/register/personal_fieldset"}{/s}{if {config name="requirePhoneField"}}{s name="RequiredField" namespace="frontend/register/index"}{/s}{/if}" id="phone" - value="{$formData.phone|escape}" + value="{$formData.phone|escapeHtml}" class="address--field{if {config name="requirePhoneField"}} is--required{/if}{if $error_flags.phone && {config name="requirePhoneField"}} has--error{/if}"/> {/if} diff --git a/themes/Frontend/Bare/frontend/checkout/confirm.tpl b/themes/Frontend/Bare/frontend/checkout/confirm.tpl index 62900a8ce25..8e3e8b6b8f7 100644 --- a/themes/Frontend/Bare/frontend/checkout/confirm.tpl +++ b/themes/Frontend/Bare/frontend/checkout/confirm.tpl @@ -92,7 +92,7 @@ {/block} {* Hidden field for the user comment *} - +
      diff --git a/themes/Frontend/Bare/frontend/detail/comment/form.tpl b/themes/Frontend/Bare/frontend/detail/comment/form.tpl index f6621516a92..ba1970f05b8 100644 --- a/themes/Frontend/Bare/frontend/detail/comment/form.tpl +++ b/themes/Frontend/Bare/frontend/detail/comment/form.tpl @@ -21,19 +21,19 @@ {* Review author name *} {block name='frontend_detail_comment_input_name'} - + {/block} {* Reviewer email address *} {block name='frontend_detail_comment_input_mail'} {if {config name="OptinVote"} == true} - + {/if} {/block} {* Review summary *} {block name='frontend_detail_comment_input_summary'} - + {/block} {* Review Rating *} @@ -56,7 +56,7 @@ {* Review text *} {block name='frontend_detail_comment_input_text'} - + {/block} {* Captcha *} diff --git a/themes/Frontend/Bare/frontend/detail/product_quick_view.tpl b/themes/Frontend/Bare/frontend/detail/product_quick_view.tpl index a726ebd9e0b..ef065779001 100644 --- a/themes/Frontend/Bare/frontend/detail/product_quick_view.tpl +++ b/themes/Frontend/Bare/frontend/detail/product_quick_view.tpl @@ -3,13 +3,13 @@ {block name='frontend_detail_product_quick_view_inner'} {block name='frontend_detail_product_quick_view_image_link'} - + {block name='frontend_detail_product_quick_view_image'} - {$alt = $sArticle.articlename|escape} + {$alt = $sArticle.articlename|escapeHtml} {if $sArticle.image.description} - {$alt = $sArticle.image.description|escape} + {$alt = $sArticle.image.description|escapeHtml} {/if} @@ -31,9 +31,9 @@
      {block name='frontend_detail_product_quick_view_header_inner'} {block name='frontend_detail_product_quick_view_title'} - + {block name='frontend_detail_product_quick_view_title_inner'} - {$sArticle.articleName|escape} + {$sArticle.articleName|escapeHtml} {/block} {/block} @@ -41,7 +41,7 @@ {block name='frontend_detail_product_quick_view_supplier'}
      {block name='frontend_detail_product_quick_view_supplier_inner'} - {$sArticle.supplierName|escape} + {$sArticle.supplierName|escapeHtml} {/block}
      {/block} diff --git a/themes/Frontend/Bare/frontend/listing/actions/action-filter-panel.tpl b/themes/Frontend/Bare/frontend/listing/actions/action-filter-panel.tpl index 281e71ca5d3..b0ad832201b 100644 --- a/themes/Frontend/Bare/frontend/listing/actions/action-filter-panel.tpl +++ b/themes/Frontend/Bare/frontend/listing/actions/action-filter-panel.tpl @@ -35,25 +35,25 @@ {block name="frontend_listing_actions_filter_form_search"} {if $term !== null} - + {/if} {/block} {block name="frontend_listing_actions_filter_form_sort"} {if $sSort} - + {/if} {/block} {block name="frontend_listing_actions_filter_form_perpage"} {if $criteria && $criteria->getLimit()} - + {/if} {/block} {block name="frontend_listing_actions_filter_form_category"} {if !$sCategoryContent && $sCategoryCurrent != $sCategoryStart && {controllerName} != 'search'} - + {/if} {/block} diff --git a/themes/Frontend/Bare/frontend/listing/actions/action-pagination.tpl b/themes/Frontend/Bare/frontend/listing/actions/action-pagination.tpl index b100191b888..40968db16fc 100644 --- a/themes/Frontend/Bare/frontend/listing/actions/action-pagination.tpl +++ b/themes/Frontend/Bare/frontend/listing/actions/action-pagination.tpl @@ -11,7 +11,7 @@ {block name="frontend_listing_actions_paging_first"} {if $sPage > 1} {s name="ListingLinkFirst" assign="snippetListingLinkFirst"}{/s} - + @@ -22,7 +22,7 @@ {block name='frontend_listing_actions_paging_previous'} {if $sPage > 1} {s name="ListingLinkPrevious" assign="snippetListingLinkPrevious"}{/s} - + {/if} @@ -31,7 +31,7 @@ {* Pagination - current page *} {block name='frontend_listing_actions_paging_numbers'} {if $pages > 1} - {$sPage} + {$sPage} {/if} {/block} @@ -39,7 +39,7 @@ {block name='frontend_listing_actions_paging_next'} {if $sPage < $pages} {s name="ListingLinkNext" assign="snippetListingLinkNext"}{/s} - + {/if} @@ -49,7 +49,7 @@ {block name="frontend_listing_actions_paging_last"} {if $sPage < $pages} {s name="ListingLinkLast" assign="snippetListingLinkLast"}{/s} - + diff --git a/themes/Frontend/Bare/frontend/listing/atom.tpl b/themes/Frontend/Bare/frontend/listing/atom.tpl index a029b85d143..612a7375195 100644 --- a/themes/Frontend/Bare/frontend/listing/atom.tpl +++ b/themes/Frontend/Bare/frontend/listing/atom.tpl @@ -1,31 +1,31 @@ - + {$sShopname|escapeHtml} -{block name='frontend_listing_atom_title'}{$sCategoryContent.description|escape:'hexentity'}{/block} -{$sCategoryContent.rssFeed|escape:'hexentity'} +{block name='frontend_listing_atom_title'}{$sCategoryContent.description|escapeHtml:'hexentity'}{/block} +{$sCategoryContent.rssFeed|escapeHtml:'hexentity'} {time()|date:atom} {foreach $sArticles as $sArticle} {block name='frontend_listing_atom_entry'} - {block name='frontend_listing_atom_article_title'}{$sArticle.articleName|strip_tags|strip|truncate:80:"...":true|escape}{/block} - {block name='frontend_listing_atom_article_name'}{$sArticle.linkDetails|escape}{/block} - + {block name='frontend_listing_atom_article_title'}{$sArticle.articleName|strip_tags|strip|truncate:80:"...":true|escapeHtml}{/block} + {block name='frontend_listing_atom_article_name'}{$sArticle.linkDetails|escapeHtml}{/block} + {if $sArticle.changetime}{$sArticle.changetime|date:atom}{else}{$sArticle.datum|date:atom}{/if} diff --git a/themes/Frontend/Bare/frontend/listing/banner.tpl b/themes/Frontend/Bare/frontend/listing/banner.tpl index bbc3d23f54b..80db9c40689 100644 --- a/themes/Frontend/Bare/frontend/listing/banner.tpl +++ b/themes/Frontend/Bare/frontend/listing/banner.tpl @@ -10,18 +10,18 @@ - + {/block} {else} {* Normal banner *} {block name='frontend_listing_normal_banner'} - {/block} diff --git a/themes/Frontend/Bare/frontend/listing/customer_stream/layout.tpl b/themes/Frontend/Bare/frontend/listing/customer_stream/layout.tpl index 7d07c0b7207..62b603a9e0c 100644 --- a/themes/Frontend/Bare/frontend/listing/customer_stream/layout.tpl +++ b/themes/Frontend/Bare/frontend/listing/customer_stream/layout.tpl @@ -56,7 +56,7 @@ {if $showListingButton} diff --git a/themes/Frontend/Bare/frontend/listing/filter/_includes/filter-multi-media-selection.tpl b/themes/Frontend/Bare/frontend/listing/filter/_includes/filter-multi-media-selection.tpl index d0f2bd712d0..61f8f33d039 100644 --- a/themes/Frontend/Bare/frontend/listing/filter/_includes/filter-multi-media-selection.tpl +++ b/themes/Frontend/Bare/frontend/listing/filter/_includes/filter-multi-media-selection.tpl @@ -1,15 +1,15 @@ {extends file="parent:frontend/listing/filter/_includes/filter-multi-selection.tpl"} {block name="frontend_listing_filter_facet_multi_selection_input"} - {$name = "__{$facet->getFieldName()|escape:'htmlall'}__{$option->getId()|escape:'htmlall'}"} + {$name = "__{$facet->getFieldName()|escapeHtmlAttr}__{$option->getId()|escapeHtmlAttr}"} {if $singleSelection} - {$name = {$facet->getFieldName()|escape:'htmlall'} } + {$name = {$facet->getFieldName()|escapeHtmlAttr} } {/if} isActive()}checked="checked" {/if}/> -{/block} \ No newline at end of file +{/block} diff --git a/themes/Frontend/Bare/frontend/listing/filter/_includes/filter-multi-selection.tpl b/themes/Frontend/Bare/frontend/listing/filter/_includes/filter-multi-selection.tpl index d0cf3102de7..ccf4a8a4d61 100644 --- a/themes/Frontend/Bare/frontend/listing/filter/_includes/filter-multi-selection.tpl +++ b/themes/Frontend/Bare/frontend/listing/filter/_includes/filter-multi-selection.tpl @@ -1,17 +1,17 @@ {namespace name="frontend/listing/listing_actions"} {block name="frontend_listing_filter_facet_multi_selection"} -
      + data-facet-name="{$facet->getFacetName()|escapeHtmlAttr}" + data-field-name="{$facet->getFieldName()|escapeHtmlAttr}"> {block name="frontend_listing_filter_facet_multi_selection_flyout"}
      {block name="frontend_listing_filter_facet_multi_selection_title"} -
      diff --git a/themes/Frontend/Bare/frontend/register/index.tpl b/themes/Frontend/Bare/frontend/register/index.tpl index 3b3a1a3b93f..96762535c93 100644 --- a/themes/Frontend/Bare/frontend/register/index.tpl +++ b/themes/Frontend/Bare/frontend/register/index.tpl @@ -18,7 +18,7 @@ {s name="FinishButtonBackToShop" namespace="frontend/checkout/finish" assign="snippetFinishButtonBackToShop"}{/s} + title="{$snippetFinishButtonBackToShop|escapeHtml}"> {s name="FinishButtonBackToShop" namespace="frontend/checkout/finish"}{/s} diff --git a/themes/Frontend/Bare/frontend/register/login.tpl b/themes/Frontend/Bare/frontend/register/login.tpl index d8e0174055b..83003fcdcf3 100644 --- a/themes/Frontend/Bare/frontend/register/login.tpl +++ b/themes/Frontend/Bare/frontend/register/login.tpl @@ -40,7 +40,7 @@ {block name='frontend_register_login_form_additional_inputs'} - {if $sTarget}{/if} + {if $sTarget}{/if} {if $showNoAccount}{/if} {/block} @@ -55,7 +55,7 @@ type="email" autocomplete="email" tabindex="1" - value="{$sFormData.email|escape}" + value="{$sFormData.email|escapeHtml}" id="email" class="register--login-field{if $sErrorFlag.email} has--error{/if}" /> @@ -78,7 +78,7 @@ {/block} @@ -123,7 +123,7 @@ required="required" aria-required="true" placeholder="{s name='RegisterPlaceholderLastname'}{/s}{s name="RequiredField" namespace="frontend/register/index"}{/s}" - id="lastname" value="{$form_data.lastname|escape}" + id="lastname" value="{$form_data.lastname|escapeHtml}" class="register--field is--required{if isset($error_flags.lastname)} has--error{/if}" />
      {/block} @@ -162,7 +162,7 @@ aria-required="true" placeholder="{s name='RegisterPlaceholderMail'}{/s}{s name="RequiredField" namespace="frontend/register/index"}{/s}" id="register_personal_email" - value="{$form_data.email|escape}" + value="{$form_data.email|escapeHtml}" class="register--field email is--required{if isset($error_flags.email)} has--error{/if}" />
      @@ -175,7 +175,7 @@ aria-required="true" placeholder="{s name='RegisterPlaceholderMailConfirmation'}{/s}{s name="RequiredField" namespace="frontend/register/index"}{/s}" id="register_personal_emailConfirmation" - value="{$form_data.emailConfirmation|escape}" + value="{$form_data.emailConfirmation|escapeHtml}" class="register--field emailConfirmation is--required{if isset($error_flags.emailConfirmation)} has--error{/if}" /> {/if} @@ -231,7 +231,7 @@ type="tel"{if {config name="requirePhoneField"}} required="required" aria-required="true"{/if} placeholder="{s name='RegisterPlaceholderPhone'}{/s}{if {config name="requirePhoneField"}}{s name="RequiredField" namespace="frontend/register/index"}{/s}{/if}" id="phone" - value="{$form_data.phone|escape}" + value="{$form_data.phone|escapeHtml}" class="register--field{if {config name="requirePhoneField"}} is--required{/if}{if isset($error_flags.phone) && {config name="requirePhoneField"}} has--error{/if}" /> {/if} diff --git a/themes/Frontend/Bare/frontend/register/shipping_fieldset.tpl b/themes/Frontend/Bare/frontend/register/shipping_fieldset.tpl index 38e82709e2c..0abba6a2348 100644 --- a/themes/Frontend/Bare/frontend/register/shipping_fieldset.tpl +++ b/themes/Frontend/Bare/frontend/register/shipping_fieldset.tpl @@ -32,7 +32,7 @@ name="register[shipping][company]" type="text" placeholder="{s name='RegisterShippingPlaceholderCompany'}{/s}" - id="company2" value="{$form_data.company|escape}" + id="company2" value="{$form_data.company|escapeHtml}" class="register--field{if isset($error_flags.company)} has--error{/if}" /> {/block} @@ -44,7 +44,7 @@ name="register[shipping][department]" type="text" placeholder="{s name='RegisterShippingPlaceholderDepartment'}{/s}" - id="department2" value="{$form_data.department|escape}" + id="department2" value="{$form_data.department|escapeHtml}" class="register--field {if isset($error_flags.department)} has--error{/if}" /> {/block} @@ -59,7 +59,7 @@ aria-required="true" placeholder="{s name='RegisterShippingPlaceholderFirstname'}{/s}{s name="RequiredField" namespace="frontend/register/index"}{/s}" id="firstname2" - value="{$form_data.firstname|escape}" + value="{$form_data.firstname|escapeHtml}" class="register--field is--required{if isset($error_flags.firstname)} has--error{/if}" /> {/block} @@ -74,7 +74,7 @@ aria-required="true" placeholder="{s name='RegisterShippingPlaceholderLastname'}{/s}{s name="RequiredField" namespace="frontend/register/index"}{/s}" id="lastname2" - value="{$form_data.lastname|escape}" + value="{$form_data.lastname|escapeHtml}" class="register--field is--required{if isset($error_flags.lastname)} has--error{/if}" /> {/block} @@ -89,7 +89,7 @@ aria-required="true" placeholder="{s name='RegisterShippingPlaceholderStreet'}{/s}{s name="RequiredField" namespace="frontend/register/index"}{/s}" id="street2" - value="{$form_data.street|escape}" + value="{$form_data.street|escapeHtml}" class="register--field register--field-street is--required{if isset($error_flags.street)} has--error{/if}" /> {/block} @@ -103,7 +103,7 @@ type="text"{if {config name="requireAdditionAddressLine1"}} required="required" aria-required="true"{/if} placeholder="{s name='RegisterLabelAdditionalAddressLine1'}{/s}{if {config name="requireAdditionAddressLine1"}}{s name="RequiredField" namespace="frontend/register/index"}{/s}{/if}" id="additionalAddressLine21" - value="{$form_data.additionalAddressLine1|escape}" + value="{$form_data.additionalAddressLine1|escapeHtml}" class="register--field{if {config name="requireAdditionAddressLine1"}} is--required{/if}{if isset($error_flags.additionalAddressLine1) && {config name="requireAdditionAddressLine1"}} has--error{/if}" /> {/if} @@ -118,7 +118,7 @@ type="text"{if {config name="requireAdditionAddressLine2"}} required="required" aria-required="true"{/if} placeholder="{s name='RegisterLabelAdditionalAddressLine2'}{/s}{if {config name="requireAdditionAddressLine2"}}{s name="RequiredField" namespace="frontend/register/index"}{/s}{/if}" id="additionalAddressLine22" - value="{$form_data.additionalAddressLine2|escape}" + value="{$form_data.additionalAddressLine2|escapeHtml}" class="register--field{if {config name="requireAdditionAddressLine2"}} is--required{/if}{if isset($error_flags.additionalAddressLine2) && {config name="requireAdditionAddressLine2"}} has--error{/if}" /> {/if} @@ -135,7 +135,7 @@ aria-required="true" placeholder="{s name='RegisterShippingPlaceholderZipcode'}{/s}{s name="RequiredField" namespace="frontend/register/index"}{/s}" id="zipcode2" - value="{$form_data.zipcode|escape}" + value="{$form_data.zipcode|escapeHtml}" class="register--field register--spacer register--field-zipcode is--required{if isset($error_flags.zipcode)} has--error{/if}" /> {else} @@ -156,7 +156,7 @@ aria-required="true" placeholder="{s name='RegisterShippingPlaceholderCity'}{/s}{s name="RequiredField" namespace="frontend/register/index"}{/s}" id="city2" - value="{$form_data.city|escape}" + value="{$form_data.city|escapeHtml}" size="25" class="register--field register--spacer register--field-city is--required{if isset($error_flags.city)} has--error{/if}" /> @@ -167,7 +167,7 @@ aria-required="true" placeholder="{s name='RegisterShippingPlaceholderZipcode'}{/s}{s name="RequiredField" namespace="frontend/register/index"}{/s}" id="zipcode2" - value="{$form_data.zipcode|escape}" + value="{$form_data.zipcode|escapeHtml}" class="register--field register--field-zipcode is--required{if isset($error_flags.zipcode)} has--error{/if}" /> {/if} From 6e51cd4389fd78292f89a1345067b8519e3192ad Mon Sep 17 00:00:00 2001 From: Michael Telgmann Date: Mon, 26 Jun 2023 16:50:19 +0200 Subject: [PATCH 418/730] fix(SW-27005): Fix notices and warnings in tests --- .phpstan-baseline.neon | 519 +----------------- engine/Library/Enlight/Class.php | 13 +- .../Template/Plugins/modifier.currency.php | 9 +- .../AccountBundle/Controller/AccountTest.php | 8 +- .../AccountBundle/Controller/RegisterTest.php | 5 + .../AttributeBundle/SchemaOperatorTest.php | 109 ++-- .../CustomerSearchBundleDBAL/TestCase.php | 6 +- .../ImmediateDeliveryConditionTest.php | 28 +- .../Condition/PriceConditionTest.php | 2 +- .../VariantConditionWithPriceGroupTest.php | 2 +- .../StoreFrontBundle/ManufacturerTest.php | 6 +- .../Bundle/StoreFrontBundle/VoteTest.php | 2 +- tests/Functional/Components/Api/CacheTest.php | 6 +- .../Components/Api/EmotionPresetTest.php | 16 +- .../Captcha/CaptchaValidatorTest.php | 3 + .../Cart/CalculationOnLogoutTest.php | 12 +- .../Components/Cart/CartDatabaseViewTest.php | 6 +- .../Components/Cart/CartMigrationTest.php | 56 +- .../Components/Cart/CartRaceConditionTest.php | 8 +- .../Cart/FloatTaxCalculationTest.php | 4 +- .../Cart/PaymentTokenServiceTest.php | 1 - ...tionalCartCalculationCustomerGroupTest.php | 4 +- ...roportionalCartCalculationDispatchTest.php | 4 +- ...oportionalCartCalculationSurchargeTest.php | 4 +- ...ProportionalCartCalculationVoucherTest.php | 4 +- .../Cart/fixture/cart_migration_1.sql | 6 +- ...{CheckoutTest.php => CheckoutTestCase.php} | 13 +- .../DependencyInjection/Bridge/CacheTest.php | 141 +++-- .../Compiler/LegacyApiResourcesPassTest.php | 2 +- .../EmotionToPresetDataTransformerTest.php | 15 +- .../Preset/PresetDataSynchronizerTest.php | 32 +- .../Components/NumberRangeIncrementerTest.php | 2 + .../Privacy/CookieRemoveSubscriberTest.php | 22 +- .../ProductStream/RepositoryTest.php | 2 +- .../Components/Router/RouterTest.php | 3 +- .../Template/TemplateManagerTest.php | 8 +- .../Components/TemplateMailTest.php | 30 +- .../Controllers/Backend/AnalyticsTest.php | 2 +- .../Controllers/Backend/ArticleTest.php | 1 - .../Controllers/Backend/CustomerTest.php | 134 +++-- .../Controllers/Backend/LogTest.php | 36 +- .../Controllers/Backend/MailTest.php | 5 +- .../Controllers/Backend/MediaManagerTest.php | 4 +- .../Backend/OrderProductSearchTest.php | 2 +- .../Controllers/Backend/OrderTest.php | 2 +- .../Controllers/Backend/PaymentTest.php | 55 +- .../Backend/RiskManagementTest.php | 3 +- .../Controllers/Backend/UserManagerTest.php | 34 +- .../Controllers/Backend/VoteTest.php | 30 +- .../Controllers/Backend/VoucherTest.php | 142 ++--- .../Controllers/Frontend/BlogTest.php | 27 +- .../Frontend/RegisterWithCaptchaTest.php | 2 + .../Controllers/Frontend/SearchTest.php | 29 +- .../Controllers/Frontend/SitemapTest.php | 28 +- .../Controllers/Frontend/SitemapXmlTest.php | 37 -- .../Controllers/Widgets/IndexTest.php | 2 +- tests/Functional/Core/AdminTest.php | 3 +- tests/Functional/Core/BasketTest.php | 51 +- tests/Functional/Core/ExportTest.php | 6 +- tests/Functional/Core/OrderTest.php | 74 ++- .../Template/Plugins/CurrencyModifierTest.php | 55 ++ .../Library/{ => Zend}/ZendDBTest.php | 2 +- .../Library/{ => Zend}/ZendLocaleTest.php | 19 +- .../Functional/Models/Article/DetailTest.php | 6 +- .../BlogCategoryTreeListQueryTest.php | 22 +- .../CustomerStreamRepositoryTest.php | 4 +- .../Order/OrderDocumentDocumentTest.php | 3 + .../Modules/Articles/CompareTest.php | 14 +- .../Modules/Articles/sGetArticleByIdTest.php | 2 +- .../HttpCache/DynamicCacheTimeServiceTest.php | 153 +++--- 70 files changed, 776 insertions(+), 1326 deletions(-) rename tests/Functional/Components/{CheckoutTest.php => CheckoutTestCase.php} (95%) rename tests/Functional/{Shopware => }/Components/ProductStream/RepositoryTest.php (96%) delete mode 100644 tests/Functional/Controllers/Frontend/SitemapXmlTest.php create mode 100644 tests/Functional/Library/Enlight/Template/Plugins/CurrencyModifierTest.php rename tests/Functional/Library/{ => Zend}/ZendDBTest.php (96%) rename tests/Functional/Library/{ => Zend}/ZendLocaleTest.php (77%) diff --git a/.phpstan-baseline.neon b/.phpstan-baseline.neon index 950b3d5008f..7bfec3b74a3 100644 --- a/.phpstan-baseline.neon +++ b/.phpstan-baseline.neon @@ -1281,13 +1281,8 @@ parameters: path: engine/Library/Enlight/Application.php - - message: "#^Method Enlight_Class\\:\\:Instance\\(\\) has parameter \\$args with no value type specified in iterable type array\\.$#" - count: 1 - path: engine/Library/Enlight/Class.php - - - - message: "#^Method Enlight_Class\\:\\:Instance\\(\\) should return Enlight_Class but returns object\\.$#" - count: 1 + message: "#^Method Enlight_Class\\:\\:Instance\\(\\) should return TClass of object but returns object\\.$#" + count: 2 path: engine/Library/Enlight/Class.php - @@ -1335,11 +1330,6 @@ parameters: count: 1 path: engine/Library/Enlight/Class.php - - - message: "#^Property Enlight_Class\\:\\:\\$instances type has no value type specified in iterable type array\\.$#" - count: 1 - path: engine/Library/Enlight/Class.php - - message: "#^Method Enlight_Collection_ArrayCollection\\:\\:__call\\(\\) has no return type specified\\.$#" count: 1 @@ -3795,16 +3785,6 @@ parameters: count: 1 path: engine/Library/Enlight/Template/Plugins/modifier.count.php - - - message: "#^Function smarty_modifier_currency\\(\\) has parameter \\$config with no value type specified in iterable type array\\.$#" - count: 1 - path: engine/Library/Enlight/Template/Plugins/modifier.currency.php - - - - message: "#^Parameter \\#3 \\$subject of function str_replace expects array\\|string, float given\\.$#" - count: 1 - path: engine/Library/Enlight/Template/Plugins/modifier.currency.php - - message: "#^Parameter \\#1 \\$date of class Zend_Date constructor expects array\\|int\\|string\\|Zend_Date\\|null, DateTime\\|int\\|false given\\.$#" count: 1 @@ -15430,6 +15410,11 @@ parameters: count: 1 path: engine/Shopware/Components/DependencyInjection/Bridge/MailTransport.php + - + message: "#^Unable to resolve the template type TClass in call to method static method Enlight_Class\\:\\:Instance\\(\\)$#" + count: 2 + path: engine/Shopware/Components/DependencyInjection/Bridge/MailTransport.php + - message: "#^Method Shopware\\\\Components\\\\DependencyInjection\\\\Bridge\\\\Models\\:\\:generateAttributeModels\\(\\) has no return type specified\\.$#" count: 1 @@ -34960,21 +34945,6 @@ parameters: count: 1 path: engine/Shopware/Plugins/Default/Core/MarketingAggregate/Bootstrap.php - - - message: "#^Method Shopware_Plugins_Core_MarketingAggregate_Bootstrap\\:\\:initAlsoBoughtResource\\(\\) should return Shopware_Components_AlsoBought but returns Enlight_Class\\.$#" - count: 1 - path: engine/Shopware/Plugins/Default/Core/MarketingAggregate/Bootstrap.php - - - - message: "#^Method Shopware_Plugins_Core_MarketingAggregate_Bootstrap\\:\\:initSimilarShownResource\\(\\) should return Shopware_Components_SimilarShown but returns Enlight_Class\\.$#" - count: 1 - path: engine/Shopware/Plugins/Default/Core/MarketingAggregate/Bootstrap.php - - - - message: "#^Method Shopware_Plugins_Core_MarketingAggregate_Bootstrap\\:\\:initTopSellerResource\\(\\) should return Shopware_Components_TopSeller but returns Enlight_Class\\.$#" - count: 1 - path: engine/Shopware/Plugins/Default/Core/MarketingAggregate/Bootstrap.php - - message: "#^Method Shopware_Plugins_Core_MarketingAggregate_Bootstrap\\:\\:isSimilarShownActivated\\(\\) has no return type specified\\.$#" count: 1 @@ -35390,11 +35360,6 @@ parameters: count: 1 path: engine/Shopware/Plugins/Default/Core/RebuildIndex/Bootstrap.php - - - message: "#^Method Shopware_Plugins_Core_RebuildIndex_Bootstrap\\:\\:initSeoIndexResource\\(\\) should return Shopware_Components_SeoIndex but returns Enlight_Class\\.$#" - count: 1 - path: engine/Shopware/Plugins/Default/Core/RebuildIndex/Bootstrap.php - - message: "#^Method Shopware_Plugins_Core_RebuildIndex_Bootstrap\\:\\:onAfterSendResponse\\(\\) has no return type specified\\.$#" count: 1 @@ -35920,11 +35885,6 @@ parameters: count: 1 path: tests/Functional/Bundle/AttributeBundle/DataLoaderTest.php - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Bundle\\\\AttributeBundle\\\\SchemaOperatorTest\\:\\:iterateTypeArray\\(\\) has parameter \\$types with no value type specified in iterable type array\\.$#" - count: 1 - path: tests/Functional/Bundle/AttributeBundle/SchemaOperatorTest.php - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Bundle\\\\ContentTypeBundle\\\\Services\\\\ExtjsBuilderTest\\:\\:dataProviderColumnFields\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 @@ -37360,16 +37320,6 @@ parameters: count: 1 path: tests/Functional/Components/Cart/ProportionalCartCalculationCustomerGroupTest.php - - - message: "#^Query error\\: Column \"s_emarketing_vouchers\\.percental\" expects value type int, got type bool$#" - count: 1 - path: tests/Functional/Components/CheckoutTest.php - - - - message: "#^Query error\\: Column \"s_emarketing_vouchers\\.taxconfig\" expects value type string, got type int$#" - count: 1 - path: tests/Functional/Components/CheckoutTest.php - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Components\\\\DependencyInjection\\\\Compiler\\\\ConfigureContainerAwareCommandsTest\\:\\:getShopwareCommands\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 @@ -38060,86 +38010,6 @@ parameters: count: 1 path: tests/Functional/Controllers/Backend/AnalyticsTest.php - - - message: "#^Access to an undefined property Enlight_View_Default\\:\\:\\$data\\.$#" - count: 2 - path: tests/Functional/Controllers/Backend/CustomerTest.php - - - - message: "#^Access to an undefined property Enlight_View_Default\\:\\:\\$success\\.$#" - count: 5 - path: tests/Functional/Controllers/Backend/CustomerTest.php - - - - message: "#^Cannot call method getAdditionalAddressLine1\\(\\) on Shopware\\\\Models\\\\Customer\\\\Address\\|null\\.$#" - count: 2 - path: tests/Functional/Controllers/Backend/CustomerTest.php - - - - message: "#^Cannot call method getAdditionalAddressLine2\\(\\) on Shopware\\\\Models\\\\Customer\\\\Address\\|null\\.$#" - count: 2 - path: tests/Functional/Controllers/Backend/CustomerTest.php - - - - message: "#^Cannot call method getCity\\(\\) on Shopware\\\\Models\\\\Customer\\\\Address\\|null\\.$#" - count: 2 - path: tests/Functional/Controllers/Backend/CustomerTest.php - - - - message: "#^Cannot call method getDepartment\\(\\) on Shopware\\\\Models\\\\Customer\\\\Address\\|null\\.$#" - count: 2 - path: tests/Functional/Controllers/Backend/CustomerTest.php - - - - message: "#^Cannot call method getFirstname\\(\\) on Shopware\\\\Models\\\\Customer\\\\Address\\|null\\.$#" - count: 2 - path: tests/Functional/Controllers/Backend/CustomerTest.php - - - - message: "#^Cannot call method getId\\(\\) on Shopware\\\\Models\\\\Customer\\\\Group\\|null\\.$#" - count: 1 - path: tests/Functional/Controllers/Backend/CustomerTest.php - - - - message: "#^Cannot call method getId\\(\\) on Shopware\\\\Models\\\\Payment\\\\Payment\\|null\\.$#" - count: 12 - path: tests/Functional/Controllers/Backend/CustomerTest.php - - - - message: "#^Cannot call method getLastname\\(\\) on Shopware\\\\Models\\\\Customer\\\\Address\\|null\\.$#" - count: 2 - path: tests/Functional/Controllers/Backend/CustomerTest.php - - - - message: "#^Cannot call method getStreet\\(\\) on Shopware\\\\Models\\\\Customer\\\\Address\\|null\\.$#" - count: 2 - path: tests/Functional/Controllers/Backend/CustomerTest.php - - - - message: "#^Cannot call method getTitle\\(\\) on Shopware\\\\Models\\\\Customer\\\\Address\\|null\\.$#" - count: 2 - path: tests/Functional/Controllers/Backend/CustomerTest.php - - - - message: "#^Cannot call method getVatId\\(\\) on Shopware\\\\Models\\\\Customer\\\\Address\\|null\\.$#" - count: 2 - path: tests/Functional/Controllers/Backend/CustomerTest.php - - - - message: "#^Cannot call method getZipcode\\(\\) on Shopware\\\\Models\\\\Customer\\\\Address\\|null\\.$#" - count: 2 - path: tests/Functional/Controllers/Backend/CustomerTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Controllers\\\\Backend\\\\CustomerTest\\:\\:testUpdateCustomerPaymentDataWithSepa\\(\\) has parameter \\$dummyDataId with no type specified\\.$#" - count: 1 - path: tests/Functional/Controllers/Backend/CustomerTest.php - - - - message: "#^Parameter \\#1 \\$group of method Shopware\\\\Models\\\\Customer\\\\Customer\\:\\:setGroup\\(\\) expects array\\|Shopware\\\\Models\\\\Customer\\\\Group, Shopware\\\\Models\\\\Customer\\\\Group\\|null given\\.$#" - count: 1 - path: tests/Functional/Controllers/Backend/CustomerTest.php - - message: "#^Access to an undefined property Enlight_View_Default\\:\\:\\$data\\.$#" count: 5 @@ -38180,36 +38050,6 @@ parameters: count: 1 path: tests/Functional/Controllers/Backend/FormTest.php - - - message: "#^Access to an undefined property Enlight_View_Default\\:\\:\\$success\\.$#" - count: 3 - path: tests/Functional/Controllers/Backend/LogTest.php - - - - message: "#^Method Enlight_Controller_Request_RequestTestCase\\:\\:setClientIp\\(\\) invoked with 2 parameters, 1 required\\.$#" - count: 2 - path: tests/Functional/Controllers/Backend/LogTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Controllers\\\\Backend\\\\LogTest\\:\\:testCreateDeprecatedLog\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Controllers/Backend/LogTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Controllers\\\\Backend\\\\LogTest\\:\\:testCreateLog\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Controllers/Backend/LogTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Controllers\\\\Backend\\\\LogTest\\:\\:testDeleteLogs\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Controllers/Backend/LogTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Controllers\\\\Backend\\\\LogTest\\:\\:testGetLogs\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Controllers/Backend/LogTest.php - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Controllers\\\\Backend\\\\MailTest\\:\\:testCreateMail\\(\\) has no return type specified\\.$#" count: 1 @@ -38285,51 +38125,6 @@ parameters: count: 1 path: tests/Functional/Controllers/Backend/NotificationTest.php - - - message: "#^Access to an undefined property Enlight_View_Default\\:\\:\\$success\\.$#" - count: 5 - path: tests/Functional/Controllers/Backend/PaymentTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Controllers\\\\Backend\\\\PaymentTest\\:\\:testCreatePayments\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Controllers/Backend/PaymentTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Controllers\\\\Backend\\\\PaymentTest\\:\\:testDeletePayment\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Controllers/Backend/PaymentTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Controllers\\\\Backend\\\\PaymentTest\\:\\:testDeletePayment\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#" - count: 1 - path: tests/Functional/Controllers/Backend/PaymentTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Controllers\\\\Backend\\\\PaymentTest\\:\\:testGetCountries\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Controllers/Backend/PaymentTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Controllers\\\\Backend\\\\PaymentTest\\:\\:testGetPayments\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Controllers/Backend/PaymentTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Controllers\\\\Backend\\\\PaymentTest\\:\\:testUpdatePayments\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Controllers/Backend/PaymentTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Controllers\\\\Backend\\\\PaymentTest\\:\\:testUpdatePayments\\(\\) has parameter \\$data with no value type specified in iterable type array\\.$#" - count: 1 - path: tests/Functional/Controllers/Backend/PaymentTest.php - - - - message: "#^Property Shopware\\\\Tests\\\\Functional\\\\Controllers\\\\Backend\\\\PaymentTest\\:\\:\\$testDataCreate has no type specified\\.$#" - count: 1 - path: tests/Functional/Controllers/Backend/PaymentTest.php - - message: "#^Access to an undefined property Enlight_View_Default\\:\\:\\$success\\.$#" count: 2 @@ -38420,71 +38215,6 @@ parameters: count: 1 path: tests/Functional/Controllers/Backend/SupplierTest.php - - - message: "#^Access to an undefined property Enlight_View_Default\\:\\:\\$data\\.$#" - count: 7 - path: tests/Functional/Controllers/Backend/VoucherTest.php - - - - message: "#^Access to an undefined property Enlight_View_Default\\:\\:\\$success\\.$#" - count: 8 - path: tests/Functional/Controllers/Backend/VoucherTest.php - - - - message: "#^Access to an undefined property Enlight_View_Default\\:\\:\\$totalCount\\.$#" - count: 1 - path: tests/Functional/Controllers/Backend/VoucherTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Controllers\\\\Backend\\\\VoucherTest\\:\\:testDeleteVoucher\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Controllers/Backend/VoucherTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Controllers\\\\Backend\\\\VoucherTest\\:\\:testExportVoucherCode\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Controllers/Backend/VoucherTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Controllers\\\\Backend\\\\VoucherTest\\:\\:testGenerateVoucherCodes\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Controllers/Backend/VoucherTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Controllers\\\\Backend\\\\VoucherTest\\:\\:testGetTaxConfiguration\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Controllers/Backend/VoucherTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Controllers\\\\Backend\\\\VoucherTest\\:\\:testGetVoucher\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Controllers/Backend/VoucherTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Controllers\\\\Backend\\\\VoucherTest\\:\\:testGetVoucherCodes\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Controllers/Backend/VoucherTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Controllers\\\\Backend\\\\VoucherTest\\:\\:testUpdateVoucher\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Controllers/Backend/VoucherTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Controllers\\\\Backend\\\\VoucherTest\\:\\:testValidateOrderCode\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Controllers/Backend/VoucherTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Controllers\\\\Backend\\\\VoucherTest\\:\\:testValidateVoucherCode\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Controllers/Backend/VoucherTest.php - - - - message: "#^Property Shopware\\\\Tests\\\\Functional\\\\Controllers\\\\Backend\\\\VoucherTest\\:\\:\\$voucherData type has no value type specified in iterable type array\\.$#" - count: 1 - path: tests/Functional/Controllers/Backend/VoucherTest.php - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Controllers\\\\Backend\\\\WidgetsTest\\:\\:backendAuthProvider\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 @@ -38525,106 +38255,21 @@ parameters: count: 1 path: tests/Functional/Controllers/Backend/WidgetsTest.php - - - message: "#^Access to an undefined property Shopware\\\\Tests\\\\Functional\\\\Controllers\\\\Frontend\\\\BlogTest\\:\\:\\$connection\\.$#" - count: 3 - path: tests/Functional/Controllers/Frontend/BlogTest.php - - - - message: "#^Cannot call method getCode\\(\\) on Exception\\|null\\.$#" - count: 2 - path: tests/Functional/Controllers/Frontend/BlogTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Controllers\\\\Frontend\\\\BlogTest\\:\\:invalidCategoryUrlDataProvider\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Controllers/Frontend/BlogTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Controllers\\\\Frontend\\\\BlogTest\\:\\:testDispatchInactiveCategory\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Controllers/Frontend/BlogTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Controllers\\\\Frontend\\\\BlogTest\\:\\:testDispatchNoActiveBlogItem\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Controllers/Frontend/BlogTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Controllers\\\\Frontend\\\\BlogTest\\:\\:testDispatchNonBlogCategory\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Controllers/Frontend/BlogTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Controllers\\\\Frontend\\\\BlogTest\\:\\:testDispatchNotExistingBlogCategory\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Controllers/Frontend/BlogTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Controllers\\\\Frontend\\\\BlogTest\\:\\:testDispatchNotExistingBlogItem\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Controllers/Frontend/BlogTest.php - - message: "#^Query error\\: Column \"s_core_rulesets\\.value1\" expects value type string, got type 100$#" count: 1 path: tests/Functional/Controllers/Frontend/CheckoutTest.php - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Controllers\\\\Frontend\\\\SearchTest\\:\\:searchTermProvider\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Controllers/Frontend/SearchTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Controllers\\\\Frontend\\\\SearchTest\\:\\:testAjaxSearch\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Controllers/Frontend/SearchTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Controllers\\\\Frontend\\\\SearchTest\\:\\:testSearchEscapes\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Controllers/Frontend/SearchTest.php - - - - message: "#^Parameter \\#1 \\$needle of static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertStringContainsString\\(\\) expects string, string\\|null given\\.$#" - count: 1 - path: tests/Functional/Controllers/Frontend/SearchTest.php - - - - message: "#^Parameter \\#2 \\$haystack of static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertStringContainsString\\(\\) expects string, string\\|null given\\.$#" - count: 1 - path: tests/Functional/Controllers/Frontend/SearchTest.php - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Controllers\\\\Frontend\\\\SitemapTest\\:\\:sitemapDataprovider\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 path: tests/Functional/Controllers/Frontend/SitemapTest.php - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Controllers\\\\Frontend\\\\SitemapTest\\:\\:testIndex\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Controllers/Frontend/SitemapTest.php - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Controllers\\\\Frontend\\\\SitemapTest\\:\\:testIndex\\(\\) has parameter \\$sitemapData with no value type specified in iterable type array\\.$#" count: 1 path: tests/Functional/Controllers/Frontend/SitemapTest.php - - - message: "#^Parameter \\#1 \\$shop of method Shopware\\\\Components\\\\ShopRegistrationService\\:\\:registerShop\\(\\) expects Shopware\\\\Models\\\\Shop\\\\Shop, Shopware\\\\Models\\\\Shop\\\\Shop\\|null given\\.$#" - count: 1 - path: tests/Functional/Controllers/Frontend/SitemapTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Controllers\\\\Frontend\\\\SitemapXmlTest\\:\\:testIndex\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Controllers/Frontend/SitemapXmlTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Controllers\\\\Widgets\\\\IndexTest\\:\\:testShopMenu\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Controllers/Widgets/IndexTest.php - - message: "#^Query error\\: Argument \\#1 is not a constant array, got array\\$#" count: 7 @@ -39110,16 +38755,6 @@ parameters: count: 1 path: tests/Functional/Core/sCoreTest.php - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Library\\\\ZendLocaleTest\\:\\:getLocales\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: tests/Functional/Library/ZendLocaleTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Library\\\\ZendLocaleTest\\:\\:testLocalCreation\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Library/ZendLocaleTest.php - - message: "#^Property Shopware\\\\Tests\\\\Functional\\\\Models\\\\Category\\\\BlogCategoryTreeListQueryTest\\:\\:\\$expected type has no value type specified in iterable type array\\.$#" count: 1 @@ -39180,11 +38815,6 @@ parameters: count: 2 path: tests/Functional/Models/Order/OrderDocumentDocumentTest.php - - - message: "#^Variable \\$document might not be defined\\.$#" - count: 1 - path: tests/Functional/Models/Order/OrderDocumentDocumentTest.php - - message: "#^Parameter \\#1 \\$dispatch of method Shopware\\\\Models\\\\Order\\\\Order\\:\\:setDispatch\\(\\) expects Shopware\\\\Models\\\\Dispatch\\\\Dispatch, Shopware\\\\Models\\\\Dispatch\\\\Dispatch\\|null given\\.$#" count: 1 @@ -39385,141 +39015,6 @@ parameters: count: 1 path: tests/Functional/Plugins/Core/HttpCache/BootstrapTest.php - - - message: "#^Cannot call method getId\\(\\) on Shopware\\\\Models\\\\Category\\\\Category\\|null\\.$#" - count: 1 - path: tests/Functional/Plugins/Core/HttpCache/DynamicCacheTimeServiceTest.php - - - - message: "#^Cannot call method getNumber\\(\\) on Shopware\\\\Models\\\\Article\\\\Detail\\|null\\.$#" - count: 1 - path: tests/Functional/Plugins/Core/HttpCache/DynamicCacheTimeServiceTest.php - - - - message: "#^Cannot call method setCategories\\(\\) on Shopware\\\\Models\\\\Emotion\\\\Emotion\\|null\\.$#" - count: 1 - path: tests/Functional/Plugins/Core/HttpCache/DynamicCacheTimeServiceTest.php - - - - message: "#^Cannot call method setCategoryId\\(\\) on Shopware\\\\Models\\\\Blog\\\\Blog\\|null\\.$#" - count: 1 - path: tests/Functional/Plugins/Core/HttpCache/DynamicCacheTimeServiceTest.php - - - - message: "#^Cannot call method setReleaseDate\\(\\) on Shopware\\\\Models\\\\Article\\\\Detail\\|null\\.$#" - count: 1 - path: tests/Functional/Plugins/Core/HttpCache/DynamicCacheTimeServiceTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Plugins\\\\Core\\\\HttpCache\\\\DynamicCacheTimeServiceTest\\:\\:createTestBlog\\(\\) never returns null so it can be removed from the return type\\.$#" - count: 1 - path: tests/Functional/Plugins/Core/HttpCache/DynamicCacheTimeServiceTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Plugins\\\\Core\\\\HttpCache\\\\DynamicCacheTimeServiceTest\\:\\:createTestCategory\\(\\) never returns null so it can be removed from the return type\\.$#" - count: 1 - path: tests/Functional/Plugins/Core/HttpCache/DynamicCacheTimeServiceTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Plugins\\\\Core\\\\HttpCache\\\\DynamicCacheTimeServiceTest\\:\\:createTestEmotion\\(\\) never returns null so it can be removed from the return type\\.$#" - count: 1 - path: tests/Functional/Plugins/Core/HttpCache/DynamicCacheTimeServiceTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Plugins\\\\Core\\\\HttpCache\\\\DynamicCacheTimeServiceTest\\:\\:createTestProduct\\(\\) never returns null so it can be removed from the return type\\.$#" - count: 1 - path: tests/Functional/Plugins/Core/HttpCache/DynamicCacheTimeServiceTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Plugins\\\\Core\\\\HttpCache\\\\DynamicCacheTimeServiceTest\\:\\:getBlogTestData\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: tests/Functional/Plugins/Core/HttpCache/DynamicCacheTimeServiceTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Plugins\\\\Core\\\\HttpCache\\\\DynamicCacheTimeServiceTest\\:\\:getEmotionTestData\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: tests/Functional/Plugins/Core/HttpCache/DynamicCacheTimeServiceTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Plugins\\\\Core\\\\HttpCache\\\\DynamicCacheTimeServiceTest\\:\\:getProductTestData\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: tests/Functional/Plugins/Core/HttpCache/DynamicCacheTimeServiceTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Plugins\\\\Core\\\\HttpCache\\\\DynamicCacheTimeServiceTest\\:\\:testBlogListingTimeCalculation\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Plugins/Core/HttpCache/DynamicCacheTimeServiceTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Plugins\\\\Core\\\\HttpCache\\\\DynamicCacheTimeServiceTest\\:\\:testBlogTimeCalculation\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Plugins/Core/HttpCache/DynamicCacheTimeServiceTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Plugins\\\\Core\\\\HttpCache\\\\DynamicCacheTimeServiceTest\\:\\:testCategoryTimeCalculation\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Plugins/Core/HttpCache/DynamicCacheTimeServiceTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Plugins\\\\Core\\\\HttpCache\\\\DynamicCacheTimeServiceTest\\:\\:testProductDetailTimeCalculation\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Plugins/Core/HttpCache/DynamicCacheTimeServiceTest.php - - - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Plugins\\\\Core\\\\HttpCache\\\\DynamicCacheTimeServiceTest\\:\\:testServiceIsAvailable\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/Functional/Plugins/Core/HttpCache/DynamicCacheTimeServiceTest.php - - - - message: "#^Parameter \\#1 \\$active of method Shopware\\\\Models\\\\Category\\\\Category\\:\\:setActive\\(\\) expects bool, int given\\.$#" - count: 1 - path: tests/Functional/Plugins/Core/HttpCache/DynamicCacheTimeServiceTest.php - - - - message: "#^Parameter \\#1 \\$blog of method Shopware\\\\Tests\\\\Functional\\\\Plugins\\\\Core\\\\HttpCache\\\\DynamicCacheTimeServiceTest\\:\\:getBlogListingRequest\\(\\) expects Shopware\\\\Models\\\\Blog\\\\Blog, Shopware\\\\Models\\\\Blog\\\\Blog\\|null given\\.$#" - count: 1 - path: tests/Functional/Plugins/Core/HttpCache/DynamicCacheTimeServiceTest.php - - - - message: "#^Parameter \\#1 \\$blog of method Shopware\\\\Tests\\\\Functional\\\\Plugins\\\\Core\\\\HttpCache\\\\DynamicCacheTimeServiceTest\\:\\:getBlogRequest\\(\\) expects Shopware\\\\Models\\\\Blog\\\\Blog, Shopware\\\\Models\\\\Blog\\\\Blog\\|null given\\.$#" - count: 1 - path: tests/Functional/Plugins/Core/HttpCache/DynamicCacheTimeServiceTest.php - - - - message: "#^Parameter \\#1 \\$category of method Shopware\\\\Tests\\\\Functional\\\\Plugins\\\\Core\\\\HttpCache\\\\DynamicCacheTimeServiceTest\\:\\:getcategoryRequest\\(\\) expects Shopware\\\\Models\\\\Category\\\\Category, Shopware\\\\Models\\\\Category\\\\Category\\|null given\\.$#" - count: 1 - path: tests/Functional/Plugins/Core/HttpCache/DynamicCacheTimeServiceTest.php - - - - message: "#^Parameter \\#1 \\$emotions of method Shopware\\\\Models\\\\Category\\\\Category\\:\\:setEmotions\\(\\) expects Doctrine\\\\Common\\\\Collections\\\\ArrayCollection&iterable\\, Doctrine\\\\Common\\\\Collections\\\\ArrayCollection\\ given\\.$#" - count: 1 - path: tests/Functional/Plugins/Core/HttpCache/DynamicCacheTimeServiceTest.php - - - - message: "#^Parameter \\#1 \\$entity of method Doctrine\\\\ORM\\\\EntityManager\\:\\:persist\\(\\) expects object, Shopware\\\\Models\\\\Blog\\\\Blog\\|null given\\.$#" - count: 1 - path: tests/Functional/Plugins/Core/HttpCache/DynamicCacheTimeServiceTest.php - - - - message: "#^Parameter \\#1 \\$entity of method Doctrine\\\\ORM\\\\EntityManager\\:\\:remove\\(\\) expects object, Shopware\\\\Models\\\\Article\\\\Article\\|null given\\.$#" - count: 1 - path: tests/Functional/Plugins/Core/HttpCache/DynamicCacheTimeServiceTest.php - - - - message: "#^Parameter \\#1 \\$entity of method Doctrine\\\\ORM\\\\EntityManager\\:\\:remove\\(\\) expects object, Shopware\\\\Models\\\\Blog\\\\Blog\\|null given\\.$#" - count: 2 - path: tests/Functional/Plugins/Core/HttpCache/DynamicCacheTimeServiceTest.php - - - - message: "#^Parameter \\#1 \\$entity of method Doctrine\\\\ORM\\\\EntityManager\\:\\:remove\\(\\) expects object, Shopware\\\\Models\\\\Category\\\\Category\\|null given\\.$#" - count: 1 - path: tests/Functional/Plugins/Core/HttpCache/DynamicCacheTimeServiceTest.php - - - - message: "#^Parameter \\#1 \\$product of method Shopware\\\\Tests\\\\Functional\\\\Plugins\\\\Core\\\\HttpCache\\\\DynamicCacheTimeServiceTest\\:\\:getProductRequest\\(\\) expects Shopware\\\\Models\\\\Article\\\\Article, Shopware\\\\Models\\\\Article\\\\Article\\|null given\\.$#" - count: 1 - path: tests/Functional/Plugins/Core/HttpCache/DynamicCacheTimeServiceTest.php - - message: "#^Method Shopware\\\\Tests\\\\Functional\\\\Plugins\\\\Core\\\\MarketingAggregate\\\\AbstractMarketing\\:\\:assertArrayEquals\\(\\) has no return type specified\\.$#" count: 1 diff --git a/engine/Library/Enlight/Class.php b/engine/Library/Enlight/Class.php index b96f1f7e565..12f3a445664 100644 --- a/engine/Library/Enlight/Class.php +++ b/engine/Library/Enlight/Class.php @@ -33,7 +33,7 @@ abstract class Enlight_Class /** * Contains all initialized Enlight instances. * - * @var array + * @var array, Enlight_Class|object> */ protected static $instances = []; @@ -59,7 +59,8 @@ public function __construct() } if ($this instanceof Enlight_Hook && !$this instanceof Enlight_Hook_Proxy - && Shopware()->Hooks()->hasProxy($class)) { + && Shopware()->Hooks()->hasProxy($class) + ) { throw new Enlight_Exception( 'Class "' . \get_class($this) . '" has hooks, please use the instance method' ); @@ -161,12 +162,14 @@ public static function getClassName($class = null) * Returns a class instance. If the class is already initialed the existing instance will returned. * Otherwise the class will be initialed with the given arguments. * - * @param class-string $class - * @param array $args + * @template TClass of (Enlight_Class|object) + * + * @param class-string|null $class + * @param array|null $args * * @throws \ReflectionException * - * @return Enlight_Class + * @return TClass */ public static function Instance($class = null, $args = null) { diff --git a/engine/Library/Enlight/Template/Plugins/modifier.currency.php b/engine/Library/Enlight/Template/Plugins/modifier.currency.php index 77f3fa9f92b..b3baea6dea0 100644 --- a/engine/Library/Enlight/Template/Plugins/modifier.currency.php +++ b/engine/Library/Enlight/Template/Plugins/modifier.currency.php @@ -22,9 +22,9 @@ * * @see http://framework.zend.com/manual/de/zend.currency.options.html * - * @param float $value Value can have a coma as a decimal separator - * @param array|string $config - * @param string $position where the currency symbol should be displayed + * @param float|string $value Value can have a coma as a decimal separator + * @param array|string $config + * @param string|null $position where the currency symbol should be displayed * * @return string */ @@ -49,9 +49,8 @@ function smarty_modifier_currency($value, $config = null, $position = null) } $currency = Shopware()->Container()->get('currency'); - $formattedValue = (float) str_replace(',', '.', $value); + $formattedValue = (float) str_replace(',', '.', (string) $value); $formattedValue = $currency->toCurrency($formattedValue, $config); - $formattedValue = mb_convert_encoding($formattedValue, 'HTML-ENTITIES', 'UTF-8'); return htmlentities($formattedValue, ENT_COMPAT, 'UTF-8', false); } diff --git a/tests/Functional/Bundle/AccountBundle/Controller/AccountTest.php b/tests/Functional/Bundle/AccountBundle/Controller/AccountTest.php index fc427091f27..4d413bf8df2 100644 --- a/tests/Functional/Bundle/AccountBundle/Controller/AccountTest.php +++ b/tests/Functional/Bundle/AccountBundle/Controller/AccountTest.php @@ -26,7 +26,6 @@ namespace Shopware\Tests\Functional\Bundle\AccountBundle\Controller; -use Enlight_Components_Db_Adapter_Pdo_Mysql; use Enlight_Components_Session_Namespace; use Enlight_Components_Test_Controller_TestCase as ControllerTestCase; use Shopware_Components_Config; @@ -127,12 +126,12 @@ public function testNormalLogin(): void public function testHashPostLogin(): void { // test with md5 password and without the ignoreAccountMode parameter - static::assertEmpty($this->session->offsetGet('sUserId')); + static::assertEmpty($this->session->get('sUserId')); $this->setUserDataToPost(); $this->dispatch('/account/login'); - static::assertEmpty($this->session->offsetGet('sUserId')); + static::assertEmpty($this->session->get('sUserId')); $this->logoutUser(); } @@ -222,9 +221,10 @@ private function setUserDataToPost(): void { $sql = 'SELECT email, password FROM s_user WHERE id = 1'; $database = $this->container->get('db'); - static::assertInstanceOf(Enlight_Components_Db_Adapter_Pdo_Mysql::class, $database); $userData = $database->fetchRow($sql); + static::assertNotEmpty($userData['email']); + static::assertNotEmpty($userData['password']); $this->Request()->setMethod('POST') ->setPost('email', $userData['email']) ->setPost('passwordMD5', $userData['password']); diff --git a/tests/Functional/Bundle/AccountBundle/Controller/RegisterTest.php b/tests/Functional/Bundle/AccountBundle/Controller/RegisterTest.php index 78ba7845b77..76121322551 100644 --- a/tests/Functional/Bundle/AccountBundle/Controller/RegisterTest.php +++ b/tests/Functional/Bundle/AccountBundle/Controller/RegisterTest.php @@ -72,6 +72,7 @@ public function testSimpleRegistration(): void 'register' => [ 'personal' => $this->getPersonalData(), 'billing' => $this->getBillingData(), + 'shipping' => $this->getShippingData(), ], ]); @@ -104,6 +105,7 @@ public function testDoubleOptInRegistration(): void 'register' => [ 'personal' => $this->getPersonalData(), 'billing' => $this->getBillingData(), + 'shipping' => $this->getShippingData(), ], ]); @@ -173,6 +175,7 @@ public function testCompanyRegistration(): void 'company' => 'company', 'department' => 'department', ]), + 'shipping' => $this->getShippingData(), ], ]); @@ -199,6 +202,7 @@ public function testFastRegistration(): void 'accountmode' => Customer::ACCOUNT_MODE_FAST_LOGIN, ]), 'billing' => $this->getBillingData(), + 'shipping' => $this->getShippingData(), ], ]); @@ -228,6 +232,7 @@ public function testDefaultPayment(): void 'register' => [ 'personal' => $this->getPersonalData(), 'billing' => $this->getBillingData(), + 'shipping' => $this->getShippingData(), ], ]); diff --git a/tests/Functional/Bundle/AttributeBundle/SchemaOperatorTest.php b/tests/Functional/Bundle/AttributeBundle/SchemaOperatorTest.php index feb321cf422..61586f71d27 100644 --- a/tests/Functional/Bundle/AttributeBundle/SchemaOperatorTest.php +++ b/tests/Functional/Bundle/AttributeBundle/SchemaOperatorTest.php @@ -24,26 +24,30 @@ namespace Shopware\Tests\Functional\Bundle\AttributeBundle; +use Doctrine\DBAL\DBALException; use Exception; use PHPUnit\Framework\TestCase; use Shopware\Bundle\AttributeBundle\Service\ConfigurationStruct; +use Shopware\Bundle\AttributeBundle\Service\CrudService; +use Shopware\Bundle\AttributeBundle\Service\TableMapping; +use Shopware\Bundle\AttributeBundle\Service\TypeMappingInterface; class SchemaOperatorTest extends TestCase { public function testDefaultValues(): void { $types = [ - 'string' => 'test123', - 'integer' => 123, - 'float' => 123, - 'boolean' => 1, - 'date' => '2010-01-01', - 'datetime' => '2010-01-01 10:00:00', - 'text' => 'test123', - 'html' => 'test123', - 'combobox' => '1', - 'multi_selection' => '1', - 'single_selection' => 'SW10003', + TypeMappingInterface::TYPE_STRING => 'test123', + TypeMappingInterface::TYPE_INTEGER => 123, + TypeMappingInterface::TYPE_FLOAT => 123, + TypeMappingInterface::TYPE_BOOLEAN => 1, + TypeMappingInterface::TYPE_DATE => '2010-01-01', + TypeMappingInterface::TYPE_DATETIME => '2010-01-01 10:00:00', + TypeMappingInterface::TYPE_TEXT => 'test123', + TypeMappingInterface::TYPE_HTML => 'test123', + TypeMappingInterface::TYPE_COMBOBOX => '1', + TypeMappingInterface::TYPE_MULTI_SELECTION => '1', + TypeMappingInterface::TYPE_SINGLE_SELECTION => 'SW10003', ]; $this->iterateTypeArray($types); @@ -52,17 +56,17 @@ public function testDefaultValues(): void public function testNullDefaultValues(): void { $types = [ - 'string' => null, - 'integer' => null, - 'float' => null, - 'boolean' => null, - 'date' => null, - 'datetime' => null, - 'text' => null, - 'html' => null, - 'combobox' => null, - 'multi_selection' => null, - 'single_selection' => null, + TypeMappingInterface::TYPE_STRING => null, + TypeMappingInterface::TYPE_INTEGER => null, + TypeMappingInterface::TYPE_FLOAT => null, + TypeMappingInterface::TYPE_BOOLEAN => null, + TypeMappingInterface::TYPE_DATE => null, + TypeMappingInterface::TYPE_DATETIME => null, + TypeMappingInterface::TYPE_TEXT => null, + TypeMappingInterface::TYPE_HTML => null, + TypeMappingInterface::TYPE_COMBOBOX => null, + TypeMappingInterface::TYPE_MULTI_SELECTION => null, + TypeMappingInterface::TYPE_SINGLE_SELECTION => null, ]; $this->iterateTypeArray($types); @@ -71,17 +75,17 @@ public function testNullDefaultValues(): void public function testNullStringDefaultValues(): void { $types = [ - 'string' => 'NULL', - 'integer' => 'NULL', - 'float' => 'NULL', - 'boolean' => 'NULL', - 'date' => 'NULL', - 'datetime' => 'NULL', - 'text' => 'NULL', - 'html' => 'NULL', - 'combobox' => 'NULL', - 'multi_selection' => 'NULL', - 'single_selection' => 'NULL', + TypeMappingInterface::TYPE_STRING => 'NULL', + TypeMappingInterface::TYPE_INTEGER => 'NULL', + TypeMappingInterface::TYPE_FLOAT => 'NULL', + TypeMappingInterface::TYPE_BOOLEAN => 'NULL', + TypeMappingInterface::TYPE_DATE => 'NULL', + TypeMappingInterface::TYPE_DATETIME => 'NULL', + TypeMappingInterface::TYPE_TEXT => 'NULL', + TypeMappingInterface::TYPE_HTML => 'NULL', + TypeMappingInterface::TYPE_COMBOBOX => 'NULL', + TypeMappingInterface::TYPE_MULTI_SELECTION => 'NULL', + TypeMappingInterface::TYPE_SINGLE_SELECTION => 'NULL', ]; $this->iterateTypeArray($types); @@ -92,16 +96,16 @@ public function testNullStringDefaultValues(): void */ public function testDefaultValuesBoolean(): void { - $this->iterateTypeArray(['boolean' => 1]); - $this->iterateTypeArray(['boolean' => 0]); - $this->iterateTypeArray(['boolean' => true]); - $this->iterateTypeArray(['boolean' => false]); - $this->iterateTypeArray(['boolean' => null]); - $this->iterateTypeArray(['boolean' => '1']); - $this->iterateTypeArray(['boolean' => '0']); - $this->iterateTypeArray(['boolean' => 'true']); - $this->iterateTypeArray(['boolean' => 'false']); - $this->iterateTypeArray(['boolean' => 'null']); + $this->iterateTypeArray([TypeMappingInterface::TYPE_BOOLEAN => 1]); + $this->iterateTypeArray([TypeMappingInterface::TYPE_BOOLEAN => 0]); + $this->iterateTypeArray([TypeMappingInterface::TYPE_BOOLEAN => true]); + $this->iterateTypeArray([TypeMappingInterface::TYPE_BOOLEAN => false]); + $this->iterateTypeArray([TypeMappingInterface::TYPE_BOOLEAN => null]); + $this->iterateTypeArray([TypeMappingInterface::TYPE_BOOLEAN => '1']); + $this->iterateTypeArray([TypeMappingInterface::TYPE_BOOLEAN => '0']); + $this->iterateTypeArray([TypeMappingInterface::TYPE_BOOLEAN => 'true']); + $this->iterateTypeArray([TypeMappingInterface::TYPE_BOOLEAN => 'false']); + $this->iterateTypeArray([TypeMappingInterface::TYPE_BOOLEAN => 'null']); } public function testUpdateConfiguration(): void @@ -109,22 +113,21 @@ public function testUpdateConfiguration(): void $service = Shopware()->Container()->get('shopware_attribute.crud_service'); $tableMapping = Shopware()->Container()->get('shopware_attribute.table_mapping'); $table = 's_articles_attributes'; - $columnName = 'attr_' . uniqid((string) mt_rand(), false); + $columnName = 'attr_' . uniqid((string) mt_rand()); - $service->update($table, $columnName, 'bool'); + $service->update($table, $columnName, TypeMappingInterface::TYPE_BOOLEAN); static::assertTrue($tableMapping->isTableColumn($table, $columnName)); - $service->update($table, $columnName, 'date'); + $service->update($table, $columnName, TypeMappingInterface::TYPE_DATE); static::assertTrue($tableMapping->isTableColumn($table, $columnName)); - /** @var ConfigurationStruct|null $column */ $column = $service->get($table, $columnName); static::assertInstanceOf(ConfigurationStruct::class, $column); - static::assertEquals('date', $column->getColumnType()); + static::assertEquals(TypeMappingInterface::TYPE_DATE, $column->getColumnType()); } public function testReinsertColumnConfigurationShouldFail(): void { - $this->expectException(\Doctrine\DBAL\DBALException::class); + $this->expectException(DBALException::class); $connection = Shopware()->Container()->get('dbal_connection'); $attributeData = [ 'table_name' => 's_articles_attributes', @@ -136,14 +139,14 @@ public function testReinsertColumnConfigurationShouldFail(): void } /** - * @param array $types + * @param array $types * * @throws Exception */ - private function iterateTypeArray($types): void + private function iterateTypeArray(array $types): void { - $service = Shopware()->Container()->get(\Shopware\Bundle\AttributeBundle\Service\CrudService::class); - $tableMapping = Shopware()->Container()->get(\Shopware\Bundle\AttributeBundle\Service\TableMapping::class); + $service = Shopware()->Container()->get(CrudService::class); + $tableMapping = Shopware()->Container()->get(TableMapping::class); $table = 's_articles_attributes'; foreach ($types as $type => $default) { diff --git a/tests/Functional/Bundle/CustomerSearchBundleDBAL/TestCase.php b/tests/Functional/Bundle/CustomerSearchBundleDBAL/TestCase.php index 415af0de3a6..c983d19f04e 100644 --- a/tests/Functional/Bundle/CustomerSearchBundleDBAL/TestCase.php +++ b/tests/Functional/Bundle/CustomerSearchBundleDBAL/TestCase.php @@ -114,7 +114,7 @@ protected function createCustomer(array $customer) $customer['addresses'] = [['country_id' => 2]]; } - $customerId = $this->insert('s_user', array_merge([ + $customerData = array_merge([ 'firstname' => 'example', 'lastname' => 'example', 'customergroup' => 'EK', @@ -123,7 +123,9 @@ protected function createCustomer(array $customer) 'paymentpreset' => 1, 'subshopID' => $customer['subshopID'] ?? 1000, 'failedlogins' => 0, - ], $customer)); + ], $customer); + unset($customerData['addresses'], $customerData['orders'], $customerData['newsletter']); + $customerId = $this->insert('s_user', $customerData); if (\array_key_exists('addresses', $customer)) { foreach ($customer['addresses'] as $address) { diff --git a/tests/Functional/Bundle/SearchBundle/Condition/ImmediateDeliveryConditionTest.php b/tests/Functional/Bundle/SearchBundle/Condition/ImmediateDeliveryConditionTest.php index 6027058152f..5a9ac4712cf 100644 --- a/tests/Functional/Bundle/SearchBundle/Condition/ImmediateDeliveryConditionTest.php +++ b/tests/Functional/Bundle/SearchBundle/Condition/ImmediateDeliveryConditionTest.php @@ -43,10 +43,10 @@ public function testNoStock(): void $this->search( [ - 'first' => ['inStock' => 0, 'minPurchase' => 1], - 'second' => ['inStock' => 0, 'minPurchase' => 1], - 'third' => ['inStock' => 2, 'minPurchase' => 1], - 'fourth' => ['inStock' => 1, 'minPurchase' => 1], + 'first' => ['inStock' => 0, 'minPurchase' => 1, 'createVariants' => false], + 'second' => ['inStock' => 0, 'minPurchase' => 1, 'createVariants' => false], + 'third' => ['inStock' => 2, 'minPurchase' => 1, 'createVariants' => false], + 'fourth' => ['inStock' => 1, 'minPurchase' => 1, 'createVariants' => false], ], ['third', 'fourth'], null, @@ -60,10 +60,10 @@ public function testMinPurchaseEquals(): void $this->search( [ - 'first' => ['inStock' => 0, 'minPurchase' => 1], - 'second' => ['inStock' => 0, 'minPurchase' => 1], - 'third' => ['inStock' => 3, 'minPurchase' => 3], - 'fourth' => ['inStock' => 20, 'minPurchase' => 20], + 'first' => ['inStock' => 0, 'minPurchase' => 1, 'createVariants' => false], + 'second' => ['inStock' => 0, 'minPurchase' => 1, 'createVariants' => false], + 'third' => ['inStock' => 3, 'minPurchase' => 3, 'createVariants' => false], + 'fourth' => ['inStock' => 20, 'minPurchase' => 20, 'createVariants' => false], ], ['third', 'fourth'], null, @@ -77,11 +77,11 @@ public function testSubVariantWithStock(): void $this->search( [ - 'first' => ['inStock' => 0, 'minPurchase' => 1], - 'second' => ['inStock' => 0, 'minPurchase' => 1], - 'third' => ['inStock' => 1, 'minPurchase' => 1], + 'first' => ['inStock' => 0, 'minPurchase' => 1, 'createVariants' => false], + 'second' => ['inStock' => 0, 'minPurchase' => 1, 'createVariants' => false], + 'third' => ['inStock' => 1, 'minPurchase' => 1, 'createVariants' => false], 'fourth' => ['inStock' => 1, 'minPurchase' => 1, 'createVariants' => true], - 'fifth' => ['inStock' => 2, 'minPurchase' => 1], + 'fifth' => ['inStock' => 2, 'minPurchase' => 1, 'createVariants' => false], ], ['third', 'fifth'], null, @@ -118,10 +118,10 @@ protected function createProduct( $additionally ): Article { if ($additionally['createVariants'] === true) { - $fourth = $this->getProduct('fourth', $context, $category); + $fourth = $this->getProduct($number, $context, $category); $configurator = $this->helper->getConfigurator( $context->getCurrentCustomerGroup(), - 'fourth' + $number ); $fourth = array_merge($fourth, $configurator); diff --git a/tests/Functional/Bundle/SearchBundle/Condition/PriceConditionTest.php b/tests/Functional/Bundle/SearchBundle/Condition/PriceConditionTest.php index 89b261070b2..e6fda6ffdb4 100644 --- a/tests/Functional/Bundle/SearchBundle/Condition/PriceConditionTest.php +++ b/tests/Functional/Bundle/SearchBundle/Condition/PriceConditionTest.php @@ -225,7 +225,7 @@ protected function getProduct( ]; } - if ($prices['priceGroup']) { + if (isset($prices['priceGroup'])) { $product['priceGroupActive'] = true; $product['priceGroupId'] = $prices['priceGroup']->getId(); } diff --git a/tests/Functional/Bundle/SearchBundle/Condition/VariantConditionWithPriceGroupTest.php b/tests/Functional/Bundle/SearchBundle/Condition/VariantConditionWithPriceGroupTest.php index 6bd426da5c2..94ca2afa23e 100644 --- a/tests/Functional/Bundle/SearchBundle/Condition/VariantConditionWithPriceGroupTest.php +++ b/tests/Functional/Bundle/SearchBundle/Condition/VariantConditionWithPriceGroupTest.php @@ -266,7 +266,7 @@ protected function getProduct( ++$i; } - if ($data['priceGroup']) { + if (isset($data['priceGroup'])) { $product['priceGroupActive'] = true; $product['priceGroupId'] = $data['priceGroup']->getId(); } diff --git a/tests/Functional/Bundle/StoreFrontBundle/ManufacturerTest.php b/tests/Functional/Bundle/StoreFrontBundle/ManufacturerTest.php index ac1e0a2d9f2..5a12f9c6739 100644 --- a/tests/Functional/Bundle/StoreFrontBundle/ManufacturerTest.php +++ b/tests/Functional/Bundle/StoreFrontBundle/ManufacturerTest.php @@ -37,7 +37,7 @@ public function testManufacturerList(): void $manufacturer = $this->helper->createManufacturer([ 'name' => 'testManufacturerList-1', - 'image' => 'Manufacturer-Cover-1', + 'image' => 'media/image/Manufacturer-Cover-1', 'link' => 'www.google.de?manufacturer=1', 'metaTitle' => 'Meta title', 'description' => 'Lorem ipsum manufacturer', @@ -47,7 +47,7 @@ public function testManufacturerList(): void $manufacturer = $this->helper->createManufacturer([ 'name' => 'testManufacturerList-2', - 'image' => 'Manufacturer-Cover-2.jpg', + 'image' => 'media/image/Manufacturer-Cover-2.jpg', 'link' => 'www.google.de?manufacturer=2', 'metaTitle' => 'Meta title', 'description' => 'Lorem ipsum manufacturer', @@ -57,7 +57,7 @@ public function testManufacturerList(): void $manufacturer = $this->helper->createManufacturer([ 'name' => 'testManufacturerList-2', - 'image' => 'Manufacturer-Cover-2.jpg', + 'image' => 'media/image/Manufacturer-Cover-2.jpg', 'link' => 'www.google.de?manufacturer=2', 'metaTitle' => 'Meta title', 'description' => 'Lorem ipsum manufacturer', diff --git a/tests/Functional/Bundle/StoreFrontBundle/VoteTest.php b/tests/Functional/Bundle/StoreFrontBundle/VoteTest.php index 92b20c16eac..9354bf5585a 100644 --- a/tests/Functional/Bundle/StoreFrontBundle/VoteTest.php +++ b/tests/Functional/Bundle/StoreFrontBundle/VoteTest.php @@ -192,7 +192,7 @@ private function assertShopVotes(string $number, array $points = [], array $expe $config = Shopware()->Container()->get(Shopware_Components_Config::class); $originals = []; foreach ($configs as $key => $value) { - $originals = $config->get($key); + $originals[$key] = $config->get($key); $config->offsetSet($key, $value); } diff --git a/tests/Functional/Components/Api/CacheTest.php b/tests/Functional/Components/Api/CacheTest.php index 0f64a735184..e3d311cb866 100644 --- a/tests/Functional/Components/Api/CacheTest.php +++ b/tests/Functional/Components/Api/CacheTest.php @@ -89,7 +89,7 @@ public function testClearTemplateCacheShouldBeSuccessFull(): void $this->getResource()->delete('template'); $info = $this->getResource()->getOne('template'); - static::assertEquals(0, $info['files']); + static::assertFalse(isset($info['files'])); } /** @@ -99,10 +99,10 @@ public function testClearHttpCacheShouldBeSuccessFull(): void { $this->getResource()->delete('http'); $info = $this->getResource()->getOne('http'); - static::assertEquals(0, $info['files']); + static::assertFalse(isset($info['files'])); $this->getResource()->delete('template'); $info = $this->getResource()->getOne('template'); - static::assertEquals(0, $info['files']); + static::assertFalse(isset($info['files'])); } } diff --git a/tests/Functional/Components/Api/EmotionPresetTest.php b/tests/Functional/Components/Api/EmotionPresetTest.php index 029d41f0d02..9bef5d4499f 100644 --- a/tests/Functional/Components/Api/EmotionPresetTest.php +++ b/tests/Functional/Components/Api/EmotionPresetTest.php @@ -35,32 +35,30 @@ use Shopware\Components\Api\Exception\ValidationException; use Shopware\Components\Api\Resource\EmotionPreset; use Shopware\Models\Emotion\Preset; +use Shopware\Tests\Functional\Traits\ContainerTrait; +use Shopware\Tests\Functional\Traits\DatabaseTransactionBehaviour; /** * @group EmotionPreset */ class EmotionPresetTest extends TestCase { + use ContainerTrait; + use DatabaseTransactionBehaviour; + private Connection $connection; private EmotionPreset $resource; protected function setUp(): void { - $this->connection = Shopware()->Container()->get(Connection::class); - $this->connection->beginTransaction(); + $this->connection = $this->getContainer()->get(Connection::class); $this->connection->executeQuery('DELETE FROM s_emotion_presets'); $this->connection->executeQuery('DELETE FROM s_core_plugins'); - $this->resource = Shopware()->Container()->get(EmotionPreset::class); + $this->resource = $this->getContainer()->get(EmotionPreset::class); parent::setUp(); } - protected function tearDown(): void - { - $this->connection->rollBack(); - parent::tearDown(); - } - public function testCreate(): void { $this->resource->create(['name' => 'test', 'presetData' => '[]']); diff --git a/tests/Functional/Components/Captcha/CaptchaValidatorTest.php b/tests/Functional/Components/Captcha/CaptchaValidatorTest.php index 5e8cc37325f..b13356eed23 100644 --- a/tests/Functional/Components/Captcha/CaptchaValidatorTest.php +++ b/tests/Functional/Components/Captcha/CaptchaValidatorTest.php @@ -31,10 +31,13 @@ use PHPUnit\Framework\TestCase; use Shopware\Components\Captcha\CaptchaValidator; use Shopware\Components\Captcha\DefaultCaptcha; +use Shopware\Tests\Functional\Traits\DatabaseTransactionBehaviour; use Shopware_Components_Config; class CaptchaValidatorTest extends TestCase { + use DatabaseTransactionBehaviour; + private DefaultCaptcha $captcha; public function setUp(): void diff --git a/tests/Functional/Components/Cart/CalculationOnLogoutTest.php b/tests/Functional/Components/Cart/CalculationOnLogoutTest.php index 385bb9edec6..275d1eedd02 100644 --- a/tests/Functional/Components/Cart/CalculationOnLogoutTest.php +++ b/tests/Functional/Components/Cart/CalculationOnLogoutTest.php @@ -27,21 +27,15 @@ namespace Shopware\Tests\Functional\Components\Cart; use Enlight_Controller_Request_RequestHttp; -use Shopware\Tests\Functional\Components\CheckoutTest; +use Shopware\Tests\Functional\Components\CheckoutTestCase; use Shopware\Tests\Functional\Traits\DatabaseTransactionBehaviour; -class CalculationOnLogoutTest extends CheckoutTest +class CalculationOnLogoutTest extends CheckoutTestCase { use DatabaseTransactionBehaviour; public bool $clearBasketOnReset = false; - public function setUp(): void - { - parent::setUp(); - Shopware()->Session()->offsetSet('sessionId', null); - } - public function testLogout(): void { Shopware()->Front()->setRequest(new Enlight_Controller_Request_RequestHttp()); @@ -54,7 +48,7 @@ public function testLogout(): void $currentAmount = Shopware()->Session()->get('sBasketAmount'); - $this->loginFrontendCustomer('H'); + $this->loginCustomerOfGroup('H'); Shopware()->Modules()->Admin()->logout(); diff --git a/tests/Functional/Components/Cart/CartDatabaseViewTest.php b/tests/Functional/Components/Cart/CartDatabaseViewTest.php index 9f71d8cd12b..0c8766b4b1d 100644 --- a/tests/Functional/Components/Cart/CartDatabaseViewTest.php +++ b/tests/Functional/Components/Cart/CartDatabaseViewTest.php @@ -27,11 +27,11 @@ namespace Shopware\Tests\Functional\Components\Cart; use Doctrine\DBAL\Connection; -use Shopware\Tests\Functional\Components\CheckoutTest; +use Shopware\Tests\Functional\Components\CheckoutTestCase; use Shopware\Tests\Functional\Traits\ContainerTrait; use Shopware\Tests\Functional\Traits\DatabaseTransactionBehaviour; -class CartDatabaseViewTest extends CheckoutTest +class CartDatabaseViewTest extends CheckoutTestCase { use ContainerTrait; use DatabaseTransactionBehaviour; @@ -42,7 +42,7 @@ public function testEnsureCartInViewHasSameIDsAsTheDatabase(): void { $productNumber = $this->createProduct(5, 19.00); - $this->loginFrontendCustomer(); + $this->loginCustomerOfGroup(); $this->addProduct($productNumber); $this->visitConfirm(); diff --git a/tests/Functional/Components/Cart/CartMigrationTest.php b/tests/Functional/Components/Cart/CartMigrationTest.php index f635bc2af3e..96456a37b37 100644 --- a/tests/Functional/Components/Cart/CartMigrationTest.php +++ b/tests/Functional/Components/Cart/CartMigrationTest.php @@ -24,16 +24,19 @@ namespace Shopware\Tests\Functional\Components\Cart; -use Enlight_Controller_Request_RequestHttp; +use Doctrine\DBAL\Connection; use Enlight_Controller_Request_RequestTestCase; use PHPUnit\Framework\TestCase; +use Shopware\Components\Model\ModelManager; use Shopware\Components\ShopRegistrationServiceInterface; use Shopware\Models\Shop\Shop; +use Shopware\Tests\Functional\Traits\ContainerTrait; use Shopware\Tests\Functional\Traits\DatabaseTransactionBehaviour; use Shopware\Tests\Functional\Traits\FixtureBehaviour; class CartMigrationTest extends TestCase { + use ContainerTrait; use DatabaseTransactionBehaviour; use FixtureBehaviour; @@ -41,46 +44,51 @@ public function testMigrateOnLoginWithEmptyCart(): void { self::executeFixture(__DIR__ . '/fixture/cart_migration_1.sql'); - Shopware()->Front()->setRequest(new Enlight_Controller_Request_RequestTestCase()); - Shopware()->Modules()->Basket()->sRefreshBasket(); - static::assertEquals(0, Shopware()->Session()->get('sBasketAmount')); + $this->setFrontRequest(); + $this->getContainer()->get('modules')->Basket()->sRefreshBasket(); + static::assertEquals(0, $this->getContainer()->get('session')->get('sBasketAmount')); - $this->loginFrontendUser(); + $this->loginCustomer(); - static::assertGreaterThan(0, Shopware()->Session()->get('sBasketAmount')); + static::assertGreaterThan(0, $this->getContainer()->get('session')->get('sBasketAmount')); } public function testMigrateOnLoginWithFilledCart(): void { self::executeFixture(__DIR__ . '/fixture/cart_migration_1.sql'); - Shopware()->Modules()->Basket()->sAddArticle('SW10001'); - Shopware()->Modules()->Basket()->sRefreshBasket(); + $this->setFrontRequest(); + $this->getContainer()->get('modules')->Basket()->sAddArticle('SW10001'); + $this->getContainer()->get('modules')->Basket()->sRefreshBasket(); - $currentBasketAmount = Shopware()->Session()->get('sBasketAmount'); + $currentBasketAmount = $this->getContainer()->get('session')->get('sBasketAmount'); - $this->loginFrontendUser(); + $this->loginCustomer(); - static::assertEquals($currentBasketAmount, Shopware()->Session()->get('sBasketAmount')); + static::assertEquals($currentBasketAmount, $this->getContainer()->get('session')->get('sBasketAmount')); } - private function loginFrontendUser(): void + private function setFrontRequest(): void { - $user = Shopware()->Db()->fetchRow( - 'SELECT `id`, `email`, `password`, `subshopID`, `language` FROM s_user WHERE `id` = 1' + $this->getContainer()->get('front')->setRequest(new Enlight_Controller_Request_RequestTestCase()); + } + + private function loginCustomer(): void + { + $customer = $this->getContainer()->get(Connection::class)->fetchAssociative( + 'SELECT `email`, `password`, `language` FROM s_user WHERE `id` = 1' ); + static::assertIsArray($customer); - $shop = Shopware()->Models()->getRepository(Shop::class)->getActiveById($user['language']); - static::assertNotNull($shop); - Shopware()->Container()->get(ShopRegistrationServiceInterface::class)->registerResources($shop); + $shop = $this->getContainer()->get(ModelManager::class)->getRepository(Shop::class)->getActiveById($customer['language']); + static::assertInstanceOf(Shop::class, $shop); + $this->getContainer()->get(ShopRegistrationServiceInterface::class)->registerResources($shop); - $request = new Enlight_Controller_Request_RequestHttp(); - $request->setPost([ - 'email' => $user['email'], - 'passwordMD5' => $user['password'], + $this->getContainer()->get('front')->ensureRequest()->setPost([ + 'email' => $customer['email'], + 'passwordMD5' => $customer['password'], ]); - Shopware()->Front()->setRequest($request); - Shopware()->Session()->set('Admin', true); - Shopware()->Modules()->Admin()->sLogin(true); + $this->getContainer()->get('session')->set('Admin', true); + static::assertIsArray($this->getContainer()->get('modules')->Admin()->sLogin(true)); } } diff --git a/tests/Functional/Components/Cart/CartRaceConditionTest.php b/tests/Functional/Components/Cart/CartRaceConditionTest.php index 25e0b16cbec..799815764a1 100644 --- a/tests/Functional/Components/Cart/CartRaceConditionTest.php +++ b/tests/Functional/Components/Cart/CartRaceConditionTest.php @@ -27,10 +27,10 @@ namespace Shopware\Tests\Functional\Components\Cart; use Doctrine\DBAL\Connection; -use Shopware\Tests\Functional\Components\CheckoutTest; +use Shopware\Tests\Functional\Components\CheckoutTestCase; use Shopware\Tests\Functional\Traits\DatabaseTransactionBehaviour; -class CartRaceConditionTest extends CheckoutTest +class CartRaceConditionTest extends CheckoutTestCase { use DatabaseTransactionBehaviour; @@ -40,7 +40,7 @@ public function testPriceChangesInConfirmWithoutPriceModifications(): void { $productNumber = $this->createProduct(5, 19.00); - $this->loginFrontendCustomer(); + $this->loginCustomerOfGroup(); $this->addProduct($productNumber); $this->visitConfirm(); @@ -56,7 +56,7 @@ public function testPriceChangesInConfirmWithPriceModifications(): void { $productNumber1 = $this->createProduct(5, 19.00); - $this->loginFrontendCustomer(); + $this->loginCustomerOfGroup(); $this->addProduct($productNumber1); $this->visitConfirm(); diff --git a/tests/Functional/Components/Cart/FloatTaxCalculationTest.php b/tests/Functional/Components/Cart/FloatTaxCalculationTest.php index 64af47c3435..a00b2eacb40 100644 --- a/tests/Functional/Components/Cart/FloatTaxCalculationTest.php +++ b/tests/Functional/Components/Cart/FloatTaxCalculationTest.php @@ -27,9 +27,9 @@ namespace Shopware\Tests\Functional\Components\Cart; use Doctrine\DBAL\Connection; -use Shopware\Tests\Functional\Components\CheckoutTest; +use Shopware\Tests\Functional\Components\CheckoutTestCase; -class FloatTaxCalculationTest extends CheckoutTest +class FloatTaxCalculationTest extends CheckoutTestCase { private Connection $connection; diff --git a/tests/Functional/Components/Cart/PaymentTokenServiceTest.php b/tests/Functional/Components/Cart/PaymentTokenServiceTest.php index 582269fd120..83d4592c12d 100644 --- a/tests/Functional/Components/Cart/PaymentTokenServiceTest.php +++ b/tests/Functional/Components/Cart/PaymentTokenServiceTest.php @@ -119,7 +119,6 @@ public function paymentTokenProviders(): array */ public function testPaymentTokenPath(string $virtualUrl, string $path): void { - session_destroy(); Shopware()->Container()->reset('session'); $currentUrl = Shopware()->Shop()->getBaseUrl(); diff --git a/tests/Functional/Components/Cart/ProportionalCartCalculationCustomerGroupTest.php b/tests/Functional/Components/Cart/ProportionalCartCalculationCustomerGroupTest.php index 6a71c386302..7cfa988d977 100644 --- a/tests/Functional/Components/Cart/ProportionalCartCalculationCustomerGroupTest.php +++ b/tests/Functional/Components/Cart/ProportionalCartCalculationCustomerGroupTest.php @@ -27,12 +27,12 @@ namespace Shopware\Tests\Functional\Components\Cart; use Doctrine\DBAL\Connection; -use Shopware\Tests\Functional\Components\CheckoutTest; +use Shopware\Tests\Functional\Components\CheckoutTestCase; /** * @group Basket */ -class ProportionalCartCalculationCustomerGroupTest extends CheckoutTest +class ProportionalCartCalculationCustomerGroupTest extends CheckoutTestCase { public function setUp(): void { diff --git a/tests/Functional/Components/Cart/ProportionalCartCalculationDispatchTest.php b/tests/Functional/Components/Cart/ProportionalCartCalculationDispatchTest.php index 22056d53a32..90d2890c960 100644 --- a/tests/Functional/Components/Cart/ProportionalCartCalculationDispatchTest.php +++ b/tests/Functional/Components/Cart/ProportionalCartCalculationDispatchTest.php @@ -27,12 +27,12 @@ namespace Shopware\Tests\Functional\Components\Cart; use Doctrine\DBAL\Connection; -use Shopware\Tests\Functional\Components\CheckoutTest; +use Shopware\Tests\Functional\Components\CheckoutTestCase; /** * @group Basket */ -class ProportionalCartCalculationDispatchTest extends CheckoutTest +class ProportionalCartCalculationDispatchTest extends CheckoutTestCase { public function setUp(): void { diff --git a/tests/Functional/Components/Cart/ProportionalCartCalculationSurchargeTest.php b/tests/Functional/Components/Cart/ProportionalCartCalculationSurchargeTest.php index d5fa36e91b1..96b8e093314 100644 --- a/tests/Functional/Components/Cart/ProportionalCartCalculationSurchargeTest.php +++ b/tests/Functional/Components/Cart/ProportionalCartCalculationSurchargeTest.php @@ -27,12 +27,12 @@ namespace Shopware\Tests\Functional\Components\Cart; use Doctrine\DBAL\Connection; -use Shopware\Tests\Functional\Components\CheckoutTest; +use Shopware\Tests\Functional\Components\CheckoutTestCase; /** * @group Basket */ -class ProportionalCartCalculationSurchargeTest extends CheckoutTest +class ProportionalCartCalculationSurchargeTest extends CheckoutTestCase { /** * A product with 7% tax diff --git a/tests/Functional/Components/Cart/ProportionalCartCalculationVoucherTest.php b/tests/Functional/Components/Cart/ProportionalCartCalculationVoucherTest.php index fb9626c663f..6797d3314b9 100644 --- a/tests/Functional/Components/Cart/ProportionalCartCalculationVoucherTest.php +++ b/tests/Functional/Components/Cart/ProportionalCartCalculationVoucherTest.php @@ -27,12 +27,12 @@ namespace Shopware\Tests\Functional\Components\Cart; use Doctrine\DBAL\Connection; -use Shopware\Tests\Functional\Components\CheckoutTest; +use Shopware\Tests\Functional\Components\CheckoutTestCase; /** * @group Basket */ -class ProportionalCartCalculationVoucherTest extends CheckoutTest +class ProportionalCartCalculationVoucherTest extends CheckoutTestCase { public function setUp(): void { diff --git a/tests/Functional/Components/Cart/fixture/cart_migration_1.sql b/tests/Functional/Components/Cart/fixture/cart_migration_1.sql index 67c25e2ed04..46814df340c 100644 --- a/tests/Functional/Components/Cart/fixture/cart_migration_1.sql +++ b/tests/Functional/Components/Cart/fixture/cart_migration_1.sql @@ -1,3 +1,3 @@ -INSERT INTO `s_order_basket` (`sessionID`, `userID`, `articlename`, `articleID`, `ordernumber`, `shippingfree`, `quantity`, `price`, `netprice`, `tax_rate`, `datum`, `modus`, `esdarticle`, `partnerID`, `lastviewport`, `useragent`, `config`, `currencyFactor`) VALUES -('52f0cf0e9f3737fd42f8371ec79fbd5a', 1, 'Münsterländer Aperitif 16%', 3, 'SW10003', 0, 1, 14.95, 12.563025210084, 19, '2019-04-05 09:09:54', 0, 0, '', 'account', 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36', '', 1), -('52f0cf0e9f3737fd42f8371ec79fbd5a', 1, 'Warenkorbrabatt', 0, 'SHIPPINGDISCOUNT', 0, 1, -2, -1.68, 19, '2019-04-05 09:10:30', 4, 0, '', '', '', '', 1); +INSERT INTO `s_order_basket` (`userID`, `articlename`, `articleID`, `ordernumber`, `shippingfree`, `quantity`, `price`, `netprice`, `tax_rate`, `datum`, `modus`, `esdarticle`, `partnerID`, `lastviewport`, `useragent`, `config`, `currencyFactor`) VALUES +(1, 'Münsterländer Aperitif 16%', 3, 'SW10003', 0, 1, 14.95, 12.563025210084, 19, '2019-04-05 09:09:54', 0, 0, '', 'account', 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36', '', 1), +(1, 'Warenkorbrabatt', 0, 'SHIPPINGDISCOUNT', 0, 1, -2, -1.68, 19, '2019-04-05 09:10:30', 4, 0, '', '', '', '', 1); diff --git a/tests/Functional/Components/CheckoutTest.php b/tests/Functional/Components/CheckoutTestCase.php similarity index 95% rename from tests/Functional/Components/CheckoutTest.php rename to tests/Functional/Components/CheckoutTestCase.php index 15007fc0a21..ad7581ceb83 100644 --- a/tests/Functional/Components/CheckoutTest.php +++ b/tests/Functional/Components/CheckoutTestCase.php @@ -27,14 +27,14 @@ namespace Shopware\Tests\Functional\Components; use Doctrine\DBAL\Connection; -use Enlight_Components_Test_Controller_TestCase; +use Enlight_Components_Test_Controller_TestCase as ControllerTestCase; use Shopware\Components\Random; use Shopware\Tests\Functional\Bundle\StoreFrontBundle\Helper; use Shopware\Tests\Functional\Traits\ContainerTrait; use Shopware\Tests\Functional\Traits\CustomerLoginTrait; use Shopware\Tests\Functional\Traits\DatabaseTransactionBehaviour; -abstract class CheckoutTest extends Enlight_Components_Test_Controller_TestCase +abstract class CheckoutTestCase extends ControllerTestCase { use ContainerTrait; use CustomerLoginTrait; @@ -115,7 +115,10 @@ protected function updateProductPrice(string $orderNumber, float $price, float $ ]); } - protected function createVoucher(float $value, int $taxId, bool $percental = true): string + /** + * @param 0|1 $percental + */ + protected function createVoucher(float $value, int $taxId, int $percental = 1): string { $code = Random::getAlphanumericString(12); $this->getContainer()->get(Connection::class) @@ -130,7 +133,7 @@ protected function createVoucher(float $value, int $taxId, bool $percental = tru 'modus' => 0, 'numorder' => 1000, 'percental' => $percental, - 'taxconfig' => $taxId, + 'taxconfig' => (string) $taxId, ]); return $code; @@ -199,7 +202,7 @@ protected function setVoucherTax(string $orderCode, string $taxConfig): void ]); } - protected function loginFrontendCustomer(string $group = 'EK'): void + protected function loginCustomerOfGroup(string $group = 'EK'): void { $customer = Shopware()->Db()->fetchRow( 'SELECT id, email, password, subshopID, language FROM s_user WHERE customergroup = ? LIMIT 1', diff --git a/tests/Functional/Components/DependencyInjection/Bridge/CacheTest.php b/tests/Functional/Components/DependencyInjection/Bridge/CacheTest.php index 26d7a87931d..58da6d9b9d5 100644 --- a/tests/Functional/Components/DependencyInjection/Bridge/CacheTest.php +++ b/tests/Functional/Components/DependencyInjection/Bridge/CacheTest.php @@ -37,140 +37,125 @@ class CacheTest extends TestCase private ShopwareReleaseStruct $release; - public function setUp(): void + private string $testDir; + + private string $cacheDirectory; + + private string $cacheFile; + + protected function setUp(): void { $this->release = new ShopwareReleaseStruct('5.5.0', '', '4711'); + $this->testDir = $this->createTestDir(); + $this->cacheDirectory = $this->testDir . '/shopware_test--0'; + $this->cacheFile = $this->cacheDirectory . '/shopware_test---bar'; + } + + protected function tearDown(): void + { + $this->deleteDirectory($this->testDir); } public function testWorldReadWriteExecutable(): void { - $testDir = sys_get_temp_dir() . '/umask-test'; $options = [ 'hashed_directory_perm' => 0777 & ~umask(), 'cache_file_perm' => 0666 & ~umask(), 'hashed_directory_level' => 1, - 'cache_dir' => $testDir, + 'cache_dir' => $this->testDir, 'file_name_prefix' => 'shopware_test', ]; - mkdir($testDir); - - $cache = (new Cache())->factory('file', [ - 'automatic_serialization' => true, - ], $options, $this->release); - $cache->save('foo', 'bar'); - - $cacheDirectory = $testDir . '/shopware_test--0'; - $cacheFile = $cacheDirectory . '/shopware_test---bar'; + $this->createCache($options); - $dirPermissions = fileperms($cacheDirectory) & 0777; - $filePermissions = fileperms($cacheFile) & 0777; - - static::assertFileExists($cacheDirectory); - static::assertFileExists($cacheFile); - - static::assertEquals($options['hashed_directory_perm'], $dirPermissions); - static::assertEquals($options['cache_file_perm'], $filePermissions); - - $this->deleteDirectory($testDir); + $this->assertCacheDirectory($options); } public function testUserReadWriteExecutable(): void { - $testDir = sys_get_temp_dir() . '/umask-test'; $options = [ 'hashed_directory_perm' => 0700 & ~umask(), 'cache_file_perm' => 0600 & ~umask(), 'hashed_directory_level' => 1, - 'cache_dir' => $testDir, + 'cache_dir' => $this->testDir, 'file_name_prefix' => 'shopware_test', ]; - mkdir($testDir); - - $cache = (new Cache())->factory('file', [ - 'automatic_serialization' => true, - ], $options, $this->release); - $cache->save('foo', 'bar'); - - $cacheDirectory = $testDir . '/shopware_test--0'; - $cacheFile = $cacheDirectory . '/shopware_test---bar'; - - $dirPermissions = fileperms($cacheDirectory) & 0777; - $filePermissions = fileperms($cacheFile) & 0777; - - static::assertFileExists($cacheDirectory); - static::assertFileExists($cacheFile); - - static::assertEquals($options['hashed_directory_perm'], $dirPermissions); - static::assertEquals($options['cache_file_perm'], $filePermissions); + $this->createCache($options); - $this->deleteDirectory($testDir); + $this->assertCacheDirectory($options); } public function testMixedReadWriteExecutable(): void { - $testDir = sys_get_temp_dir() . '/umask-test'; $options = [ 'hashed_directory_perm' => 0755 & ~umask(), 'cache_file_perm' => 0600 & ~umask(), 'hashed_directory_level' => 1, - 'cache_dir' => $testDir, + 'cache_dir' => $this->testDir, 'file_name_prefix' => 'shopware_test', ]; - mkdir($testDir); - - $cache = (new Cache())->factory('file', [ - 'automatic_serialization' => true, - ], $options, $this->release); - $cache->save('foo', 'bar'); - - $cacheDirectory = $testDir . '/shopware_test--0'; - $cacheFile = $cacheDirectory . '/shopware_test---bar'; + $this->createCache($options); - $dirPermissions = fileperms($cacheDirectory) & 0777; - $filePermissions = fileperms($cacheFile) & 0777; - - static::assertFileExists($cacheDirectory); - static::assertFileExists($cacheFile); - - static::assertEquals($options['hashed_directory_perm'], $dirPermissions); - static::assertEquals($options['cache_file_perm'], $filePermissions); - - $this->deleteDirectory($testDir); + $this->assertCacheDirectory($options); } public function testWorldReadWriteExecutableAsString(): void { - $testDir = sys_get_temp_dir() . '/umask-test'; $options = [ 'hashed_directory_perm' => '0777', 'cache_file_perm' => '0666', 'hashed_directory_level' => 1, - 'cache_dir' => $testDir, + 'cache_dir' => $this->testDir, 'file_name_prefix' => 'shopware_test', ]; - mkdir($testDir); + $this->createCache($options); + + $dirPermissions = fileperms($this->cacheDirectory) & 0777; + $filePermissions = fileperms($this->cacheFile) & 0777; + + static::assertFileExists($this->cacheDirectory); + static::assertFileExists($this->cacheFile); + static::assertSame(octdec($options['hashed_directory_perm']), $dirPermissions); + static::assertSame(octdec($options['cache_file_perm']), $filePermissions); + } + + private function createTestDir(): string + { + $testDir = sys_get_temp_dir() . '/umask-test'; + if (!is_dir($testDir)) { + mkdir($testDir); + } + + return $testDir; + } + + /** + * @param array $options + */ + private function createCache(array $options): void + { $cache = (new Cache())->factory('file', [ 'automatic_serialization' => true, ], $options, $this->release); $cache->save('foo', 'bar'); + } - $cacheDirectory = $testDir . '/shopware_test--0'; - $cacheFile = $cacheDirectory . '/shopware_test---bar'; - - $dirPermissions = fileperms($cacheDirectory) & 0777; - $filePermissions = fileperms($cacheFile) & 0777; - - static::assertFileExists($cacheDirectory); - static::assertFileExists($cacheFile); + /** + * @param array $options + */ + private function assertCacheDirectory(array $options): void + { + $dirPermissions = fileperms($this->cacheDirectory) & 0777; + $filePermissions = fileperms($this->cacheFile) & 0777; - static::assertEquals(octdec($options['hashed_directory_perm']), $dirPermissions); - static::assertEquals(octdec($options['cache_file_perm']), $filePermissions); + static::assertFileExists($this->cacheDirectory); + static::assertFileExists($this->cacheFile); - $this->deleteDirectory($testDir); + static::assertSame($options['hashed_directory_perm'], $dirPermissions); + static::assertSame($options['cache_file_perm'], $filePermissions); } } diff --git a/tests/Functional/Components/DependencyInjection/Compiler/LegacyApiResourcesPassTest.php b/tests/Functional/Components/DependencyInjection/Compiler/LegacyApiResourcesPassTest.php index d2d40601f18..c5fa1febbe4 100644 --- a/tests/Functional/Components/DependencyInjection/Compiler/LegacyApiResourcesPassTest.php +++ b/tests/Functional/Components/DependencyInjection/Compiler/LegacyApiResourcesPassTest.php @@ -45,7 +45,7 @@ public function testLegacyServiceGettingAssigned(): void $container ->register('shopware.api.mynewresource.hasalreadytag') ->setClass(Article::class) - ->setTags(['shopware.api.mynewresource.hasalreadytag']) + ->setTags(['shopware.api.mynewresource.hasalreadytag' => ['attr' => ['foo']]]) ->setPublic(true); $container->compile(); diff --git a/tests/Functional/Components/Emotion/Preset/EmotionToPresetDataTransformerTest.php b/tests/Functional/Components/Emotion/Preset/EmotionToPresetDataTransformerTest.php index b09a3b6fbef..9e40cba4705 100644 --- a/tests/Functional/Components/Emotion/Preset/EmotionToPresetDataTransformerTest.php +++ b/tests/Functional/Components/Emotion/Preset/EmotionToPresetDataTransformerTest.php @@ -32,12 +32,17 @@ use ReflectionMethod; use Shopware\Components\Emotion\Preset\EmotionToPresetDataTransformer; use Shopware\Components\Emotion\Preset\EmotionToPresetDataTransformerInterface; +use Shopware\Tests\Functional\Traits\ContainerTrait; +use Shopware\Tests\Functional\Traits\DatabaseTransactionBehaviour; /** * @group EmotionPreset */ class EmotionToPresetDataTransformerTest extends TestCase { + use ContainerTrait; + use DatabaseTransactionBehaviour; + /** * @var EmotionToPresetDataTransformer */ @@ -50,18 +55,12 @@ class EmotionToPresetDataTransformerTest extends TestCase protected function setUp(): void { - $this->connection = Shopware()->Container()->get(Connection::class); - $this->connection->beginTransaction(); + $this->connection = $this->getContainer()->get(Connection::class); $this->connection->executeQuery('DELETE FROM s_emotion_presets'); $this->connection->executeQuery('DELETE FROM s_core_plugins'); - $this->transformer = Shopware()->Container()->get(EmotionToPresetDataTransformerInterface::class); - } - - protected function tearDown(): void - { - $this->connection->rollBack(); + $this->transformer = $this->getContainer()->get(EmotionToPresetDataTransformerInterface::class); } public function testShouldFailBecauseOfMissingEmotion(): void diff --git a/tests/Functional/Components/Emotion/Preset/PresetDataSynchronizerTest.php b/tests/Functional/Components/Emotion/Preset/PresetDataSynchronizerTest.php index 09764c1389e..de5af198c7a 100644 --- a/tests/Functional/Components/Emotion/Preset/PresetDataSynchronizerTest.php +++ b/tests/Functional/Components/Emotion/Preset/PresetDataSynchronizerTest.php @@ -32,48 +32,38 @@ use Shopware\Components\Emotion\Preset\Exception\PresetAssetImportException; use Shopware\Components\Emotion\Preset\PresetDataSynchronizer; use Shopware\Components\Emotion\Preset\PresetDataSynchronizerInterface; +use Shopware\Tests\Functional\Traits\ContainerTrait; +use Shopware\Tests\Functional\Traits\DatabaseTransactionBehaviour; /** * @group EmotionPreset */ class PresetDataSynchronizerTest extends TestCase { - /** - * @var PresetDataSynchronizer - */ - private $synchronizerService; + use ContainerTrait; + use DatabaseTransactionBehaviour; - /** - * @var EmotionPreset - */ - private $presetResource; + private PresetDataSynchronizer $synchronizerService; - /** - * @var Connection - */ - private $connection; + private EmotionPreset $presetResource; + + private Connection $connection; private string $imageData; protected function setUp(): void { - $this->connection = Shopware()->Container()->get(Connection::class); - $this->connection->beginTransaction(); + $this->connection = $this->getContainer()->get(Connection::class); $this->connection->executeQuery('DELETE FROM s_emotion_presets'); $this->connection->executeQuery('DELETE FROM s_core_plugins'); - $this->synchronizerService = Shopware()->Container()->get(PresetDataSynchronizerInterface::class); - $this->presetResource = Shopware()->Container()->get(EmotionPreset::class); + $this->synchronizerService = $this->getContainer()->get(PresetDataSynchronizerInterface::class); + $this->presetResource = $this->getContainer()->get(EmotionPreset::class); $this->imageData = 'data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs='; } - protected function tearDown(): void - { - $this->connection->rollBack(); - } - public function testAssetImportWithPresetAlreadyImported(): void { $preset = $this->presetResource->create(['name' => 'test', 'presetData' => '[]', 'assetsImported' => true]); diff --git a/tests/Functional/Components/NumberRangeIncrementerTest.php b/tests/Functional/Components/NumberRangeIncrementerTest.php index 00081e28956..3306c20b97d 100644 --- a/tests/Functional/Components/NumberRangeIncrementerTest.php +++ b/tests/Functional/Components/NumberRangeIncrementerTest.php @@ -31,10 +31,12 @@ use RuntimeException; use Shopware\Components\NumberRangeIncrementer; use Shopware\Tests\Functional\Traits\ContainerTrait; +use Shopware\Tests\Functional\Traits\DatabaseTransactionBehaviour; class NumberRangeIncrementerTest extends TestCase { use ContainerTrait; + use DatabaseTransactionBehaviour; private Connection $connection; diff --git a/tests/Functional/Components/Privacy/CookieRemoveSubscriberTest.php b/tests/Functional/Components/Privacy/CookieRemoveSubscriberTest.php index 7f93720de9a..33468aa6c9f 100644 --- a/tests/Functional/Components/Privacy/CookieRemoveSubscriberTest.php +++ b/tests/Functional/Components/Privacy/CookieRemoveSubscriberTest.php @@ -34,11 +34,8 @@ use Enlight_Template_Manager; use Enlight_View_Default; use PHPUnit\Framework\TestCase; -use Shopware\Bundle\CookieBundle\CookieCollection; use Shopware\Bundle\CookieBundle\Services\CookieHandler; use Shopware\Bundle\CookieBundle\Services\CookieRemoveHandler; -use Shopware\Bundle\CookieBundle\Structs\CookieGroupStruct; -use Shopware\Bundle\CookieBundle\Structs\CookieStruct; use Shopware\Components\Privacy\CookieRemoveSubscriber; use Shopware_Controllers_Frontend_Index; @@ -73,9 +70,8 @@ public function testPostDispatchDoesNothingAllowAllModeCookieSet(): void Shopware()->Config()->offsetSet('cookie_note_mode', CookieRemoveSubscriber::COOKIE_MODE_ALL); Shopware()->Config()->offsetSet('show_cookie_note', 1); - $_COOKIE['allowCookie'] = 1; - $controller = $this->getController(); + $controller->Request()->cookies->set('allowCookie', 1); // May not be removed, since further code may not be executed $controller->Response()->setCookie('notRemoved', 'foo'); @@ -179,19 +175,3 @@ private function getCookieRemoveSubscriber(bool $httpCacheEnabled = true): Cooki ); } } - -class PreserveCookieFromRemovingSubscriber -{ - public function addCookie(): CookieCollection - { - $cookieCollection = new CookieCollection(); - $cookieCollection->add(new CookieStruct( - 'keepMe', - '/^keepMe$/', - 'keepMe', - CookieGroupStruct::PERSONALIZATION - )); - - return $cookieCollection; - } -} diff --git a/tests/Functional/Shopware/Components/ProductStream/RepositoryTest.php b/tests/Functional/Components/ProductStream/RepositoryTest.php similarity index 96% rename from tests/Functional/Shopware/Components/ProductStream/RepositoryTest.php rename to tests/Functional/Components/ProductStream/RepositoryTest.php index 9c4c68084a8..37d9472c0e4 100644 --- a/tests/Functional/Shopware/Components/ProductStream/RepositoryTest.php +++ b/tests/Functional/Components/ProductStream/RepositoryTest.php @@ -24,7 +24,7 @@ * our trademarks remain entirely with us. */ -namespace Shopware\Tests\Functional\Shopware\Components\ProductStream; +namespace Shopware\Tests\Functional\Components\ProductStream; use Doctrine\DBAL\Connection; use PHPUnit\Framework\TestCase; diff --git a/tests/Functional/Components/Router/RouterTest.php b/tests/Functional/Components/Router/RouterTest.php index 20da66048e3..a259199a5d1 100644 --- a/tests/Functional/Components/Router/RouterTest.php +++ b/tests/Functional/Components/Router/RouterTest.php @@ -110,7 +110,8 @@ public function testArrayParams(array $params): void static::assertIsString($url); $match = $router->match($url); static::assertIsArray($match); - static::assertEquals(array_intersect($match, $params), $params); + unset($match['module'], $match['controller'], $match['action'], $match['index']); + static::assertEquals($params, $match); } public function getTestParamsProvider(): array diff --git a/tests/Functional/Components/Template/TemplateManagerTest.php b/tests/Functional/Components/Template/TemplateManagerTest.php index d168a03f48b..69b658b715f 100644 --- a/tests/Functional/Components/Template/TemplateManagerTest.php +++ b/tests/Functional/Components/Template/TemplateManagerTest.php @@ -89,14 +89,14 @@ public function testFetchInvalidExtends(): void public function testValidPermissionsAreSet(): void { $testDir = sys_get_temp_dir() . '/tpl-test'; + if (!is_dir($testDir)) { + mkdir($testDir); + } $backendOptions = [ 'hashed_directory_perm' => 0777 & ~umask(), 'cache_file_perm' => 0666 & ~umask(), ]; - /** @var Enlight_Template_Manager $template */ - $template = Enlight_Class::Instance('Enlight_Template_Manager', [null, $backendOptions]); - - mkdir($testDir); + $template = Enlight_Class::Instance(Enlight_Template_Manager::class, [null, $backendOptions]); $cacheDirectory = $testDir . '/compile-test'; $cacheFile = $cacheDirectory . '/8843d7f92416211de9ebb963ff4ce28125932878.string.php'; diff --git a/tests/Functional/Components/TemplateMailTest.php b/tests/Functional/Components/TemplateMailTest.php index 73379510e5d..e1898c4db9b 100644 --- a/tests/Functional/Components/TemplateMailTest.php +++ b/tests/Functional/Components/TemplateMailTest.php @@ -284,26 +284,14 @@ private function getSimpleMailMockObject(): Mail private function getSmartyMailMockObject(): Mail { - $templateMock = $this->createMock(Mail::class); - - $templateMock->method('getFromMail') - ->willReturn('{$sConfig.sMAIL}'); - - $templateMock->method('getFromName') - ->willReturn('{$sConfig.sSHOPNAME}'); - - $templateMock->method('getSubject') - ->willReturn('Ihr Bestellung bei {$sConfig.sSHOPNAME}'); - - $templateMock->method('getContent') - ->willReturn('Testbestellung bei {$sConfig.sSHOPNAME}'); - - $templateMock->method('getContentHtml') - ->willReturn('Testbestellung HTML bei {$sConfig.sSHOPNAME}'); - - $templateMock->method('isHtml') - ->willReturn(true); - - return $templateMock; + $mail = new Mail(); + $mail->setFromMail('{$sConfig.sMAIL}'); + $mail->setFromName('{$sConfig.sSHOPNAME}'); + $mail->setSubject('Ihr Bestellung bei {$sConfig.sSHOPNAME}'); + $mail->setContent('Testbestellung bei {$sConfig.sSHOPNAME}'); + $mail->setContentHtml('Testbestellung HTML bei {$sConfig.sSHOPNAME}'); + $mail->setIsHtml(); + + return $mail; } } diff --git a/tests/Functional/Controllers/Backend/AnalyticsTest.php b/tests/Functional/Controllers/Backend/AnalyticsTest.php index 29e49ae8bf4..649ac991c2a 100644 --- a/tests/Functional/Controllers/Backend/AnalyticsTest.php +++ b/tests/Functional/Controllers/Backend/AnalyticsTest.php @@ -1154,7 +1154,7 @@ private function getSearchTermFromReferrerUrl(string $url): string { preg_match_all( '#[?&]([qp]|query|highlight|encquery|url|field-keywords|as_q|sucheall|satitle|KW)=([^&\$]+)#', - utf8_encode($url) . '&', + mb_convert_encoding($url, 'UTF-8', 'ISO-8859-1') . '&', $matches ); if (empty($matches[0])) { diff --git a/tests/Functional/Controllers/Backend/ArticleTest.php b/tests/Functional/Controllers/Backend/ArticleTest.php index dea51c114f9..ef71724e56d 100644 --- a/tests/Functional/Controllers/Backend/ArticleTest.php +++ b/tests/Functional/Controllers/Backend/ArticleTest.php @@ -166,7 +166,6 @@ public function testSaveNetRegulationPrice(): void 'autoNumber' => '10002', 'mainPrices' => [ [ - 'id' => 0, 'from' => 1, 'to' => 'Beliebig', 'price' => 10, diff --git a/tests/Functional/Controllers/Backend/CustomerTest.php b/tests/Functional/Controllers/Backend/CustomerTest.php index fe16fc439f3..6fb9db0f864 100644 --- a/tests/Functional/Controllers/Backend/CustomerTest.php +++ b/tests/Functional/Controllers/Backend/CustomerTest.php @@ -1,4 +1,6 @@ manager ->getRepository(Payment::class) ->findOneBy(['name' => 'debit']); + static::assertInstanceOf(Payment::class, $debit); static::assertNotNull($customer->getChanged()); $params = [ @@ -102,7 +105,7 @@ public function testChangeCustomerPaymentMean(): void $this->dispatch('/backend/Customer/save'); $jsonBody = $this->View()->getAssign(); - static::assertTrue($this->View()->success); + static::assertTrue($this->View()->getAssign('success')); static::assertEquals($debit->getId(), $jsonBody['data']['paymentId']); $this->manager->refresh($customer); @@ -120,6 +123,7 @@ public function testAddCustomerPaymentDataWithDebit(): int $debit = $this->manager ->getRepository(Payment::class) ->findOneBy(['name' => 'debit']); + static::assertInstanceOf(Payment::class, $debit); $params = [ 'paymentId' => $debit->getId(), @@ -139,16 +143,16 @@ public function testAddCustomerPaymentDataWithDebit(): int $this->dispatch('/backend/Customer/save'); $jsonBody = $this->View()->getAssign(); - static::assertTrue($this->View()->success); + static::assertTrue($this->View()->getAssign('success')); static::assertEquals($debit->getId(), $jsonBody['data']['paymentId']); - $dummyData = $this->repository->find($this->View()->data['id']); - static::assertNotNull($dummyData); + $customer = $this->repository->find($this->View()->getAssign('data')['id']); + static::assertInstanceOf(Customer::class, $customer); - static::assertEquals($debit->getId(), $dummyData->getPaymentId()); - static::assertCount(1, $dummyData->getPaymentData()->toArray()); + static::assertEquals($debit->getId(), $customer->getPaymentId()); + static::assertCount(1, $customer->getPaymentData()->toArray()); - $paymentDataArray = $dummyData->getPaymentData()->toArray(); + $paymentDataArray = $customer->getPaymentData()->toArray(); $paymentData = array_shift($paymentDataArray); static::assertInstanceOf(PaymentData::class, $paymentData); static::assertEquals('Account Holder Name', $paymentData->getAccountHolder()); @@ -159,7 +163,7 @@ public function testAddCustomerPaymentDataWithDebit(): int static::assertEmpty($paymentData->getIban()); static::assertFalse($paymentData->getUseBillingData()); - return $dummyData->getId(); + return $customer->getId(); } /** @@ -170,6 +174,7 @@ public function testAddCustomerWithAddress(): void $debit = $this->manager ->getRepository(Payment::class) ->findOneBy(['name' => 'debit']); + static::assertInstanceOf(Payment::class, $debit); $params = [ 'paymentId' => $debit->getId(), @@ -180,7 +185,7 @@ public function testAddCustomerWithAddress(): void $this->dispatch('/backend/Customer/save'); $jsonBody = $this->View()->getAssign(); - static::assertTrue($this->View()->success); + static::assertTrue($this->View()->getAssign('success')); static::assertEquals($debit->getId(), $jsonBody['data']['paymentId']); $params = [ @@ -188,7 +193,7 @@ public function testAddCustomerWithAddress(): void 'defaultAddress' => '', 'setDefaultBillingAddress' => true, 'setDefaultShippingAddress' => true, - 'user_id' => $this->View()->data['id'], + 'user_id' => $this->View()->getAssign('data')['id'], 'company' => 'company', 'department' => 'department', 'vatId' => 'vatId', @@ -219,54 +224,61 @@ public function testAddCustomerWithAddress(): void $this->dispatch('/backend/Address/create'); - /** @var Customer $dummyData */ - $dummyData = $this->repository->find($params['user_id']); - - static::assertEquals('firstname', $dummyData->getDefaultBillingAddress()->getFirstname()); - static::assertEquals('lastname', $dummyData->getDefaultBillingAddress()->getLastname()); - static::assertEquals('department', $dummyData->getDefaultBillingAddress()->getDepartment()); - static::assertEquals('vatId', $dummyData->getDefaultBillingAddress()->getVatId()); - static::assertEquals('title', $dummyData->getDefaultBillingAddress()->getTitle()); - static::assertEquals('zipcode', $dummyData->getDefaultBillingAddress()->getZipcode()); - static::assertEquals('city', $dummyData->getDefaultBillingAddress()->getCity()); - static::assertEquals('street', $dummyData->getDefaultBillingAddress()->getStreet()); - static::assertEquals('additionalAddressLine1', $dummyData->getDefaultBillingAddress()->getAdditionalAddressLine1()); - static::assertEquals('additionalAddressLine2', $dummyData->getDefaultBillingAddress()->getAdditionalAddressLine2()); - - static::assertEquals('firstname', $dummyData->getDefaultShippingAddress()->getFirstname()); - static::assertEquals('lastname', $dummyData->getDefaultShippingAddress()->getLastname()); - static::assertEquals('department', $dummyData->getDefaultShippingAddress()->getDepartment()); - static::assertEquals('vatId', $dummyData->getDefaultShippingAddress()->getVatId()); - static::assertEquals('title', $dummyData->getDefaultShippingAddress()->getTitle()); - static::assertEquals('zipcode', $dummyData->getDefaultShippingAddress()->getZipcode()); - static::assertEquals('city', $dummyData->getDefaultShippingAddress()->getCity()); - static::assertEquals('street', $dummyData->getDefaultShippingAddress()->getStreet()); - static::assertEquals('additionalAddressLine1', $dummyData->getDefaultShippingAddress()->getAdditionalAddressLine1()); - static::assertEquals('additionalAddressLine2', $dummyData->getDefaultShippingAddress()->getAdditionalAddressLine2()); + $customer = $this->repository->find($params['user_id']); + static::assertInstanceOf(Customer::class, $customer); + + $billingAddress = $customer->getDefaultBillingAddress(); + static::assertInstanceOf(Address::class, $billingAddress); + static::assertEquals('firstname', $billingAddress->getFirstname()); + static::assertEquals('lastname', $billingAddress->getLastname()); + static::assertEquals('department', $billingAddress->getDepartment()); + static::assertEquals('vatId', $billingAddress->getVatId()); + static::assertEquals('title', $billingAddress->getTitle()); + static::assertEquals('zipcode', $billingAddress->getZipcode()); + static::assertEquals('city', $billingAddress->getCity()); + static::assertEquals('street', $billingAddress->getStreet()); + static::assertEquals('additionalAddressLine1', $billingAddress->getAdditionalAddressLine1()); + static::assertEquals('additionalAddressLine2', $billingAddress->getAdditionalAddressLine2()); + + $shippingAddress = $customer->getDefaultShippingAddress(); + static::assertInstanceOf(Address::class, $shippingAddress); + static::assertEquals('firstname', $shippingAddress->getFirstname()); + static::assertEquals('lastname', $shippingAddress->getLastname()); + static::assertEquals('department', $shippingAddress->getDepartment()); + static::assertEquals('vatId', $shippingAddress->getVatId()); + static::assertEquals('title', $shippingAddress->getTitle()); + static::assertEquals('zipcode', $shippingAddress->getZipcode()); + static::assertEquals('city', $shippingAddress->getCity()); + static::assertEquals('street', $shippingAddress->getStreet()); + static::assertEquals('additionalAddressLine1', $shippingAddress->getAdditionalAddressLine1()); + static::assertEquals('additionalAddressLine2', $shippingAddress->getAdditionalAddressLine2()); } /** * Test saveAction controller action - Update an existing customer - * - * @depends testAddCustomerPaymentDataWithDebit */ - public function testUpdateCustomerPaymentDataWithSepa($dummyDataId): void + public function testUpdateCustomerPaymentDataWithSepa(): void { - /** @var Customer $dummyData */ - $dummyData = $this->repository->find($dummyDataId); + $customerId = $this->testAddCustomerPaymentDataWithDebit(); + $customer = $this->repository->find($customerId); + static::assertInstanceOf(Customer::class, $customer); + $sepa = $this->manager ->getRepository(Payment::class) ->findOneBy(['name' => 'sepa']); + static::assertInstanceOf(Payment::class, $sepa); + $debit = $this->manager ->getRepository(Payment::class) ->findOneBy(['name' => 'debit']); + static::assertInstanceOf(Payment::class, $debit); - static::assertEquals($debit->getId(), $dummyData->getPaymentId()); - static::assertCount(1, $dummyData->getPaymentData()->toArray()); - static::assertNotNull($dummyData->getChanged()); + static::assertEquals($debit->getId(), $customer->getPaymentId()); + static::assertCount(1, $customer->getPaymentData()->toArray()); + static::assertNotNull($customer->getChanged()); $params = [ - 'id' => $dummyData->getId(), + 'id' => $customer->getId(), 'paymentId' => $sepa->getId(), 'paymentData' => [[ 'accountHolder' => '', @@ -277,23 +289,22 @@ public function testUpdateCustomerPaymentDataWithSepa($dummyDataId): void 'iban' => '456iban654', 'useBillingData' => true, ]], - 'changed' => $dummyData->getChanged()->format('c'), + 'changed' => $customer->getChanged()->format('c'), ]; $this->Request()->setMethod('POST')->setPost($params); $this->dispatch('/backend/Customer/save'); $jsonBody = $this->View()->getAssign(); - static::assertTrue($this->View()->success); + static::assertTrue($this->View()->getAssign('success')); static::assertEquals($sepa->getId(), $jsonBody['data']['paymentId']); - $this->manager->refresh($dummyData); + $this->manager->refresh($customer); - static::assertEquals($sepa->getId(), $dummyData->getPaymentId()); - $paymentDataArray = $dummyData->getPaymentData()->toArray(); + static::assertEquals($sepa->getId(), $customer->getPaymentId()); + $paymentDataArray = $customer->getPaymentData()->toArray(); static::assertCount(2, $paymentDataArray); // Old debit payment data is still there, it's just not used currently - /** @var PaymentData $paymentData */ $paymentData = array_shift($paymentDataArray); static::assertInstanceOf(PaymentData::class, $paymentData); static::assertEquals('Account Holder Name', $paymentData->getAccountHolder()); @@ -305,7 +316,6 @@ public function testUpdateCustomerPaymentDataWithSepa($dummyDataId): void static::assertFalse($paymentData->getUseBillingData()); // New SEPA data - /** @var PaymentData $paymentData */ $paymentData = array_shift($paymentDataArray); static::assertInstanceOf(PaymentData::class, $paymentData); static::assertEmpty($paymentData->getAccountHolder()); @@ -316,7 +326,7 @@ public function testUpdateCustomerPaymentDataWithSepa($dummyDataId): void static::assertEquals('456iban654', $paymentData->getIban()); static::assertTrue($paymentData->getUseBillingData()); - $this->manager->remove($dummyData); + $this->manager->remove($customer); $this->manager->flush(); } @@ -329,8 +339,8 @@ public function testPerformOrderAction(): void $this->Request()->setParams(['id' => $customer->getId()]); - /** @var Enlight_Controller_Response_ResponseTestCase $response */ $response = $this->dispatch('backend/Customer/performOrder'); + static::assertInstanceOf(Enlight_Controller_Response_ResponseTestCase::class, $response); $headerLocation = $response->getHeader('Location'); $this->reset(); @@ -365,7 +375,7 @@ public function testSaveCustomerOverwriteProtection(): void ->setMethod('POST') ->setPost($postData); $this->dispatch('backend/Customer/save'); - static::assertTrue($this->View()->success); + static::assertTrue($this->View()->getAssign('success')); // Now use an outdated timestamp. The controller should detect this and fail. $postData['changed'] = '2008-08-07 18:11:31'; @@ -373,7 +383,7 @@ public function testSaveCustomerOverwriteProtection(): void ->setMethod('POST') ->setPost($postData); $this->dispatch('backend/Customer/save'); - static::assertFalse($this->View()->success); + static::assertFalse($this->View()->getAssign('success')); } /** @@ -386,7 +396,9 @@ public function testCustomerId(): void $customer = Shopware()->Models()->find(Customer::class, $dummy->getId()); static::assertInstanceOf(Customer::class, $customer); - static::assertEquals('1', $customer->getGroup()->getId()); + $customerGroup = $customer->getGroup(); + static::assertInstanceOf(Group::class, $customerGroup); + static::assertSame(1, $customerGroup->getId()); } /** @@ -407,7 +419,9 @@ private function createDummyCustomer(): Customer { $dummyData = new Customer(); $dummyData->setEmail('test@phpunit.org'); - $dummyData->setGroup($this->manager->find(Group::class, 1)); + $customerGroup = $this->manager->find(Group::class, 1); + static::assertInstanceOf(Group::class, $customerGroup); + $dummyData->setGroup($customerGroup); $this->manager->persist($dummyData); $this->manager->flush(); diff --git a/tests/Functional/Controllers/Backend/LogTest.php b/tests/Functional/Controllers/Backend/LogTest.php index 573b3ae71f2..4b35a30a65a 100644 --- a/tests/Functional/Controllers/Backend/LogTest.php +++ b/tests/Functional/Controllers/Backend/LogTest.php @@ -1,4 +1,6 @@ dispatch('backend/log/getLogs'); - static::assertTrue($this->View()->success); + static::assertTrue($this->View()->getAssign('success')); $jsonBody = $this->View()->getAssign(); @@ -61,11 +63,11 @@ public function testGetLogs() * This test tests the creating of a new log. * This function is called before testDeleteLogs */ - public function testCreateLog() + public function testCreateLog(): int { - Shopware()->Container()->get(\Doctrine\DBAL\Connection::class)->beginTransaction(); + Shopware()->Container()->get(Connection::class)->beginTransaction(); - $this->Request()->setClientIp('10.0.0.3', false); + $this->Request()->setClientIp('10.0.0.3'); $this->Request()->setMethod('POST')->setPost( [ 'type' => 'backend', @@ -78,7 +80,7 @@ public function testCreateLog() ); $this->dispatch('backend/logger/createLog'); - static::assertTrue($this->View()->success); + static::assertTrue($this->View()->getAssign('success')); $jsonBody = $this->View()->getAssign(); @@ -93,10 +95,8 @@ public function testCreateLog() * This test-method tests the deleting of a log. * * @depends testCreateLog - * - * @param string $lastId */ - public function testDeleteLogs($lastId) + public function testDeleteLogs(int $lastId): void { $this->Request()->setMethod('POST')->setPost(['id' => $lastId]); @@ -105,20 +105,21 @@ public function testDeleteLogs($lastId) $jsonBody = $this->View()->getAssign(); static::assertArrayHasKey('success', $jsonBody); + static::assertTrue($jsonBody['success']); static::assertArrayHasKey('data', $jsonBody); - Shopware()->Container()->get(\Doctrine\DBAL\Connection::class)->rollBack(); + Shopware()->Container()->get(Connection::class)->rollBack(); } /** * This test tests the creating of a new log. * This function is called before testDeleteLogs */ - public function testCreateDeprecatedLog() + public function testCreateDeprecatedLog(): void { - Shopware()->Container()->get(\Doctrine\DBAL\Connection::class)->beginTransaction(); + Shopware()->Container()->get(Connection::class)->beginTransaction(); - $this->Request()->setClientIp('10.0.0.3', false); + $this->Request()->setClientIp('10.0.0.3'); $this->Request()->setMethod('POST')->setPost( [ 'type' => 'backend', @@ -130,8 +131,8 @@ public function testCreateDeprecatedLog() ] ); - $this->dispatch('backend/log/createLog'); - static::assertTrue($this->View()->success); + $this->dispatch('backend/logger/createLog'); + static::assertTrue($this->View()->getAssign('success')); $jsonBody = $this->View()->getAssign(); @@ -139,7 +140,7 @@ public function testCreateDeprecatedLog() static::assertArrayHasKey('success', $jsonBody); static::assertArrayHasKey('id', $jsonBody['data']); - Shopware()->Container()->get(\Doctrine\DBAL\Connection::class)->rollBack(); + Shopware()->Container()->get(Connection::class)->rollBack(); } public function testSystemLogList(): void @@ -195,7 +196,6 @@ public function testSystemLogListWithFilter(): void $pluginLogger->info('Running test...'); $coreLogger->info('Running test...'); - /** @var string $environment */ $environment = $container->getParameter('kernel.environment'); // test filtering diff --git a/tests/Functional/Controllers/Backend/MailTest.php b/tests/Functional/Controllers/Backend/MailTest.php index bd618244089..9ff3461d459 100644 --- a/tests/Functional/Controllers/Backend/MailTest.php +++ b/tests/Functional/Controllers/Backend/MailTest.php @@ -28,10 +28,7 @@ class MailTest extends Enlight_Components_Test_Controller_TestCase { - /** - * @var array - */ - public $testData = [ + public array $testData = [ 'name' => 'Testmail123', 'fromMail' => 'Shopware Demoshop', 'fromName' => 'info@example.com', diff --git a/tests/Functional/Controllers/Backend/MediaManagerTest.php b/tests/Functional/Controllers/Backend/MediaManagerTest.php index dcb8f2c151b..7ca95ebf073 100644 --- a/tests/Functional/Controllers/Backend/MediaManagerTest.php +++ b/tests/Functional/Controllers/Backend/MediaManagerTest.php @@ -40,7 +40,7 @@ class MediaManagerTest extends TestCase /** * Creates a new album, * checks if the new album has inherited the parents settings - * and deletes it afterwards + * and deletes it afterward */ public function testAlbumInheritance(): void { @@ -54,7 +54,7 @@ public function testAlbumInheritance(): void 'parentId' => '-11', 'position' => '', 'text' => 'PHPUNIT_ALBUM', - 'thumbnailSize' => '', + 'thumbnailSize' => [], ]; $request = new Enlight_Controller_Request_RequestTestCase(); diff --git a/tests/Functional/Controllers/Backend/OrderProductSearchTest.php b/tests/Functional/Controllers/Backend/OrderProductSearchTest.php index f96ebe262bb..3b20b05f6b6 100644 --- a/tests/Functional/Controllers/Backend/OrderProductSearchTest.php +++ b/tests/Functional/Controllers/Backend/OrderProductSearchTest.php @@ -680,7 +680,7 @@ private function getSearchParams(array $searchParams): array ]], ]; - if ($searchParams['orderId']) { + if (isset($searchParams['orderId'])) { $params['orderId'] = $searchParams['orderId']; } diff --git a/tests/Functional/Controllers/Backend/OrderTest.php b/tests/Functional/Controllers/Backend/OrderTest.php index e6dcce8bfc3..7a78ec818bc 100644 --- a/tests/Functional/Controllers/Backend/OrderTest.php +++ b/tests/Functional/Controllers/Backend/OrderTest.php @@ -396,7 +396,7 @@ public function testSavePositionActionWithTaxRule(int $customerGroupId, string $ $controller->savePositionAction(); $results = $controller->View()->getAssign(); - static::assertTrue($results['success'], (string) $results['message']); + static::assertTrue($results['success'], $results['message'] ?? ''); static::assertSame(self::NEW_TAX, $results['data']['taxRate']); } diff --git a/tests/Functional/Controllers/Backend/PaymentTest.php b/tests/Functional/Controllers/Backend/PaymentTest.php index 4620b0972a5..ed21cc1a7c7 100644 --- a/tests/Functional/Controllers/Backend/PaymentTest.php +++ b/tests/Functional/Controllers/Backend/PaymentTest.php @@ -1,4 +1,6 @@ + */ + private array $testDataCreate = [ 'name' => 'New payment', 'description' => 'New payment', 'source' => 1, @@ -55,19 +65,18 @@ public function setUp(): void parent::setUp(); // Disable auth and acl - Shopware()->Plugins()->Backend()->Auth()->setNoAuth(); - Shopware()->Plugins()->Backend()->Auth()->setNoAcl(); + $this->getContainer()->get('plugins')->Backend()->Auth()->setNoAuth(); + $this->getContainer()->get('plugins')->Backend()->Auth()->setNoAcl(); } /** * Tests the getPaymentsAction() * to test if reading the payments is working */ - public function testGetPayments() + public function testGetPayments(): void { - /* @var \Enlight_Controller_Response_ResponseTestCase */ $this->dispatch('backend/payment/getPayments'); - static::assertTrue($this->View()->success); + static::assertTrue($this->View()->getAssign('success')); $jsonBody = $this->View()->getAssign(); @@ -79,11 +88,10 @@ public function testGetPayments() * Tests the getCountriesAction() * to test if reading the countries is working */ - public function testGetCountries() + public function testGetCountries(): void { - /* @var \Enlight_Controller_Response_ResponseTestCase */ $this->dispatch('backend/payment/getCountries'); - static::assertTrue($this->View()->success); + static::assertTrue($this->View()->getAssign('success')); $jsonBody = $this->View()->getAssign(); @@ -93,15 +101,15 @@ public function testGetCountries() /** * Function to test creating a new payment + * + * @return array */ - public function testCreatePayments() + public function testCreatePayments(): array { - Shopware()->Db()->exec('DELETE FROM s_core_paymentmeans WHERE name = "New payment"'); - $this->Request()->setMethod('POST')->setPost($this->testDataCreate); $this->dispatch('backend/payment/createPayments'); - static::assertTrue($this->View()->success); + static::assertTrue($this->View()->getAssign('success')); $jsonBody = $this->View()->getAssign(); static::assertArrayHasKey('data', $jsonBody); @@ -112,18 +120,14 @@ public function testCreatePayments() /** * Function to test updating a payment - * - * @param array $data Contains the data of the created payment - * - * @depends testCreatePayments */ - public function testUpdatePayments($data) + public function testUpdatePayments(): void { + $data = $this->testCreatePayments(); $this->Request()->setMethod('POST')->setPost(['id' => $data['id'], 'name' => 'Neue Zahlungsart']); - /* @var \Enlight_Controller_Response_ResponseTestCase */ $this->dispatch('backend/payment/updatePayments'); - static::assertTrue($this->View()->success); + static::assertTrue($this->View()->getAssign('success')); $jsonBody = $this->View()->getAssign(); @@ -133,18 +137,15 @@ public function testUpdatePayments($data) /** * Function to test deleting a payment - * - * @param array $data Contains the data of the created payment - * - * @depends testCreatePayments */ - public function testDeletePayment($data) + public function testDeletePayment(): void { + $data = $this->testCreatePayments(); + $this->resetRequest(); $this->Request()->setMethod('POST')->setPost(['id' => $data['id']]); - /* @var \Enlight_Controller_Response_ResponseTestCase */ $this->dispatch('backend/payment/deletePayment'); - static::assertTrue($this->View()->success); + static::assertTrue($this->View()->getAssign('success')); $jsonBody = $this->View()->getAssign(); diff --git a/tests/Functional/Controllers/Backend/RiskManagementTest.php b/tests/Functional/Controllers/Backend/RiskManagementTest.php index 139aad2deac..50036f29b79 100644 --- a/tests/Functional/Controllers/Backend/RiskManagementTest.php +++ b/tests/Functional/Controllers/Backend/RiskManagementTest.php @@ -123,8 +123,9 @@ public function testEditRule($lastId) $jsonBody = $this->View()->getAssign(); - static::assertArrayHasKey('data', $jsonBody); static::assertArrayHasKey('success', $jsonBody); + static::assertTrue($jsonBody['success'], $jsonBody['errorMsg'] ?? ''); + static::assertArrayHasKey('data', $jsonBody); } /** diff --git a/tests/Functional/Controllers/Backend/UserManagerTest.php b/tests/Functional/Controllers/Backend/UserManagerTest.php index ebe6c8a7926..488ffe92d3e 100644 --- a/tests/Functional/Controllers/Backend/UserManagerTest.php +++ b/tests/Functional/Controllers/Backend/UserManagerTest.php @@ -29,15 +29,18 @@ use Doctrine\DBAL\Connection; use Doctrine\DBAL\Query\QueryBuilder; use Enlight_Components_Test_Controller_TestCase; +use Shopware\Tests\Functional\Traits\DatabaseTransactionBehaviour; class UserManagerTest extends Enlight_Components_Test_Controller_TestCase { + use DatabaseTransactionBehaviour; + /** * Temporary user data * * @var array{username: string, password: string, localeId: int, roleId: int, name: string, email: string, active: bool} */ - protected array $temporaryUserData = [ + private array $temporaryUserData = [ 'username' => 'UserManagerTemporaryUser', 'password' => 'test', 'localeId' => 1, @@ -52,7 +55,7 @@ class UserManagerTest extends Enlight_Components_Test_Controller_TestCase * * @var array{id: int|null, localeId: int, roleId: int, active: bool, username: string, name: string, email: string, password: string, admin: bool, encoder: string, disabledCache: bool, lockedUntil: string} */ - protected array $temporaryAdminUserData = [ + private array $temporaryAdminUserData = [ 'id' => null, 'localeId' => 1, 'roleId' => 1, @@ -78,7 +81,7 @@ public function setUp(): void } /** - * Verify that we can not login with a user that doesn't exists (yet) + * Verify that we can not log in with a user that doesn't exist (yet) */ public function testWrongAdminLogin(): void { @@ -112,11 +115,10 @@ public function testCreateAdminUser(): void /** * Verify that the previously created admin user can login with a correct password - * - * @depends testCreateAdminUser */ public function testAdminLogin(): void { + $this->testCreateAdminUser(); $this->enableAuth(); $this->resetRequest(); @@ -168,11 +170,10 @@ public function testUserAdd(): string /** * Test edit of users - * - * @depends testUserAdd */ - public function testUserEdit(string $username): string + public function testUserEdit(): string { + $username = $this->testUserAdd(); $this->resetRequest() ->resetResponse(); @@ -199,11 +200,10 @@ public function testUserEdit(string $username): string /** * Test deleting of users - * - * @depends testUserEdit */ - public function testUserDelete(string $username): void + public function testUserDelete(): void { + $username = $this->testUserAdd(); $user = $this->getUserByUsername($username); static::assertGreaterThan(0, $user['id']); @@ -253,7 +253,7 @@ public function testUserDetails(): void static::assertEquals($user['id'], $this->View()->getAssign('data')['id']); // Check that result does not contain passwords - static::assertNull($this->View()->getAssign('data')['password']); + static::assertFalse(isset($this->View()->getAssign('data')['password'])); } /** @@ -289,11 +289,10 @@ public function testCreateRole(): string /** * Test editing of roles - * - * @depends testCreateRole */ - public function testEditRole(string $randomRoleName): int + public function testEditRole(): int { + $randomRoleName = $this->testCreateRole(); $randomRole = Shopware()->Container() ->get(Connection::class) ->createQueryBuilder() @@ -318,11 +317,10 @@ public function testEditRole(string $randomRoleName): int /** * Test deleting of roles - * - * @depends testEditRole */ - public function testDeleteRole(int $randomRoleId): void + public function testDeleteRole(): void { + $randomRoleId = $this->testEditRole(); $this->Request()->setParam('id', $randomRoleId); $this->dispatch('backend/UserManager/deleteRole'); diff --git a/tests/Functional/Controllers/Backend/VoteTest.php b/tests/Functional/Controllers/Backend/VoteTest.php index e6465a1c195..e9badcae998 100644 --- a/tests/Functional/Controllers/Backend/VoteTest.php +++ b/tests/Functional/Controllers/Backend/VoteTest.php @@ -27,9 +27,12 @@ namespace Shopware\Tests\Functional\Controllers\Backend; use Enlight_Components_Test_Controller_TestCase; +use Shopware\Tests\Functional\Traits\DatabaseTransactionBehaviour; class VoteTest extends Enlight_Components_Test_Controller_TestCase { + use DatabaseTransactionBehaviour; + /** * Standard set up for every test - just disable auth */ @@ -78,13 +81,12 @@ public function testGetVotes(): array /** * Test method to test the answerVoteAction-method, which sets an answer to a vote - * - * @depends testGetVotes - * - * @param array $data Contains the product, which is created in testGetVotes */ - public function testAnswerVote(array $data): void + public function testAnswerVote(): void { + $data = $this->testGetVotes(); + $this->resetRequest()->resetResponse(); + $data['answer'] = 'Test'; $this->Request()->setMethod('POST')->setPost($data); @@ -98,13 +100,12 @@ public function testAnswerVote(array $data): void /** * Test method to test the acceptVoteAction-method, which sets the active-property to 1, so the vote is enabled * in the frontend - * - * @depends testGetVotes - * - * @param array $data Contains the product, which is created in testGetVotes */ - public function testAcceptVote(array $data): void + public function testAcceptVote(): void { + $data = $this->testGetVotes(); + $this->resetRequest()->resetResponse(); + $sql = 'UPDATE s_articles_vote SET active=0 WHERE id=?'; Shopware()->Db()->query($sql, [$data['id']]); @@ -120,13 +121,12 @@ public function testAcceptVote(array $data): void /** * Test method to test the deleteVoteAction-method, which deletes the product created in the testGetVotes-method - * - * @depends testGetVotes - * - * @param array $data Contains the product, which is created in testGetVotes */ - public function testDeleteVote(array $data): void + public function testDeleteVote(): void { + $data = $this->testGetVotes(); + $this->resetRequest()->resetResponse(); + $this->Request()->setMethod('POST')->setPost($data); $this->dispatch('backend/vote/delete'); static::assertTrue($this->View()->getAssign('success')); diff --git a/tests/Functional/Controllers/Backend/VoucherTest.php b/tests/Functional/Controllers/Backend/VoucherTest.php index c2b5e183fa1..154e77e5602 100644 --- a/tests/Functional/Controllers/Backend/VoucherTest.php +++ b/tests/Functional/Controllers/Backend/VoucherTest.php @@ -1,4 +1,6 @@ */ private array $voucherData = [ 'description' => 'description', @@ -60,14 +57,10 @@ class VoucherTest extends Enlight_Components_Test_Controller_TestCase 'value' => '10', ]; - /** - * @var ModelManager - */ - private $manager; + private Repository $repository; + + private ModelManager $manager; - /** - * Standard set up for every test - just disable auth - */ public function setUp(): void { parent::setUp(); @@ -80,10 +73,7 @@ public function setUp(): void Shopware()->Plugins()->Backend()->Auth()->setNoAcl(); } - /** - * test the voucher list - */ - public function testGetVoucher() + public function testGetVoucher(): void { // Delete old data $vouchers = $this->repository->findBy(['orderCode' => '65168phpunit']); @@ -95,10 +85,10 @@ public function testGetVoucher() $voucher = $this->createDummy(); $this->dispatch('backend/voucher/getVoucher?page=1&start=0&limit=2000'); - static::assertTrue($this->View()->success); - $returnData = $this->View()->data; + static::assertTrue($this->View()->getAssign('success')); + $returnData = $this->View()->getAssign('data'); static::assertNotEmpty($returnData); - static::assertGreaterThan(0, $this->View()->totalCount); + static::assertGreaterThan(0, $this->View()->getAssign('totalCount')); $lastInsert = $returnData[\count($returnData) - 1]; static::assertEquals($voucher->getId(), $lastInsert['id']); @@ -106,42 +96,31 @@ public function testGetVoucher() $this->manager->flush(); } - /** - * test adding a voucher - * - * @return string The id to for the testUpdateVoucher Method - */ - public function testAddVoucher() + public function testAddVoucher(): int { - $this->manager->getConnection()->executeUpdate('DELETE FROM s_emarketing_vouchers WHERE ordercode = :code', [ + $this->manager->getConnection()->executeStatement('DELETE FROM s_emarketing_vouchers WHERE ordercode = :code', [ ':code' => $this->voucherData['orderCode'], ]); $params = $this->voucherData; $this->Request()->setParams($params); $this->dispatch('backend/voucher/saveVoucher'); - static::assertTrue($this->View()->success); - static::assertEquals($params['description'], $this->View()->data['description']); + static::assertTrue($this->View()->getAssign('success')); + static::assertEquals($params['description'], $this->View()->getAssign('data')['description']); - return $this->View()->data['id']; + return $this->View()->getAssign('data')['id']; } /** - * the the getVoucherDetail Method - * * @depends testAddVoucher - * - * @param string $id - * - * @return string the id to for the testUpdateVoucher Method */ - public function testGetVoucherDetail($id) + public function testGetVoucherDetail(int $id): int { $params['voucherID'] = $id; $this->Request()->setParams($params); $this->dispatch('backend/voucher/getVoucherDetail'); - static::assertTrue($this->View()->success); - $returningData = $this->View()->data; + static::assertTrue($this->View()->getAssign('success')); + $returningData = $this->View()->getAssign('data'); $voucherData = $this->voucherData; static::assertEquals($voucherData['description'], $returningData['description']); static::assertEquals($voucherData['numberOfUnits'], $returningData['numberOfUnits']); @@ -154,11 +133,9 @@ public function testGetVoucherDetail($id) } /** - * test the voucherCode validation methods with the created voucher - * * @depends testAddVoucher */ - public function testValidateVoucherCode() + public function testValidateVoucherCode(): void { $params = []; $voucherModel = $this->createDummy(false); @@ -186,13 +163,9 @@ public function testValidateVoucherCode() } /** - * Test the orderCode validation methods with the created voucher - * * @depends testAddVoucher - * - * @param string $id */ - public function testValidateOrderCode($id) + public function testValidateOrderCode(int $id): void { $params = []; $voucherData = $this->voucherData; @@ -217,13 +190,9 @@ public function testValidateOrderCode($id) } /** - * Test updating a voucher - * * @depends testGetVoucherDetail - * - * @param string $id */ - public function testUpdateVoucher($id) + public function testUpdateVoucher(int $id): int { $params = $this->voucherData; $params['id'] = $id; @@ -231,59 +200,47 @@ public function testUpdateVoucher($id) $this->Request()->setParams($params); $this->dispatch('backend/voucher/saveVoucher'); - static::assertTrue($this->View()->success); - static::assertEquals($params['description'], $this->View()->data['description']); + static::assertTrue($this->View()->getAssign('success')); + static::assertEquals($params['description'], $this->View()->getAssign('data')['description']); return $id; } /** - * Test generating voucher codes - * * @depends testUpdateVoucher - * - * @param string $id */ - public function testGenerateVoucherCodes($id) + public function testGenerateVoucherCodes(int $id): int { $voucherData = $this->voucherData; $params = []; $params['numberOfUnits'] = $voucherData['numberOfUnits']; - $params['voucherId'] = (int) $id; + $params['voucherId'] = $id; $this->Request()->setParams($params); $this->dispatch('backend/voucher/createVoucherCodes'); - static::assertTrue($this->View()->success); + static::assertTrue($this->View()->getAssign('success')); return $id; } /** - * Test the listing of the voucher codes - * * @depends testGenerateVoucherCodes - * - * @param string $id */ - public function testGetVoucherCodes($id) + public function testGetVoucherCodes(int $id): int { $this->dispatch('backend/voucher/getVoucherCodes?voucherID=' . $id); - static::assertTrue($this->View()->success); - static::assertCount(50, $this->View()->data); + static::assertTrue($this->View()->getAssign('success')); + static::assertCount(50, $this->View()->getAssign('data')); return $id; } /** - * Test the exportVoucherCode Method - * * @depends testGetVoucherCodes - * - * @param string $id */ - public function testExportVoucherCode($id) + public function testExportVoucherCode(int $id): int { $params = []; - $params['voucherId'] = (int) $id; + $params['voucherId'] = $id; $this->Request()->setParams($params); $this->dispatch('backend/voucher/exportVoucherCode'); $header = $this->Response()->getHeaders(); @@ -299,40 +256,26 @@ public function testExportVoucherCode($id) } /** - * Test the delete the voucher method - * * @depends testExportVoucherCode - * - * @param string $id */ - public function testDeleteVoucher($id) + public function testDeleteVoucher(int $id): void { $params = []; - $params['id'] = (int) $id; + $params['id'] = $id; $this->Request()->setParams($params); $this->dispatch('backend/voucher/deleteVoucher'); - static::assertTrue($this->View()->success); + static::assertTrue($this->View()->getAssign('success')); static::assertNull($this->repository->find($params['id'])); } - /** - * Test getTaxConfiguration Method - */ - public function testGetTaxConfiguration() + public function testGetTaxConfiguration(): void { $this->dispatch('backend/voucher/getTaxConfiguration'); - static::assertTrue($this->View()->success); - static::assertNotEmpty($this->View()->data); + static::assertTrue($this->View()->getAssign('success')); + static::assertNotEmpty($this->View()->getAssign('data')); } - /** - * Creates the dummy voucher - * - * @param bool $individualMode - * - * @return Voucher - */ - private function getDummyVoucher($individualMode = true) + private function getDummyVoucher(bool $individualMode = true): Voucher { $voucher = new Voucher(); $voucherData = $this->voucherData; @@ -345,14 +288,7 @@ private function getDummyVoucher($individualMode = true) return $voucher; } - /** - * Helper method to create the dummy object - * - * @param bool $individualMode - * - * @return Voucher - */ - private function createDummy($individualMode = true) + private function createDummy(bool $individualMode = true): Voucher { $voucher = $this->getDummyVoucher($individualMode); $this->manager->persist($voucher); diff --git a/tests/Functional/Controllers/Frontend/BlogTest.php b/tests/Functional/Controllers/Frontend/BlogTest.php index 74b02feef88..d0e93112ab1 100644 --- a/tests/Functional/Controllers/Frontend/BlogTest.php +++ b/tests/Functional/Controllers/Frontend/BlogTest.php @@ -1,4 +1,6 @@ connection = Shopware()->Container()->get(\Doctrine\DBAL\Connection::class); + $this->connection = Shopware()->Container()->get(Connection::class); } /** * Tests the behavior if the blog article is not activated */ - public function testDispatchNoActiveBlogItem() + public function testDispatchNoActiveBlogItem(): void { $this->expectException('Enlight_Exception'); $this->expectExceptionCode('404'); @@ -55,7 +60,7 @@ public function testDispatchNoActiveBlogItem() /** * Tests the behavior if the BlogItem does not exist anymore */ - public function testDispatchNotExistingBlogItem() + public function testDispatchNotExistingBlogItem(): void { $this->expectException('Enlight_Exception'); $this->expectExceptionCode('404'); @@ -63,10 +68,10 @@ public function testDispatchNotExistingBlogItem() static::assertTrue($this->Response()->isRedirect()); } - public function testDispatchInactiveCategory() + public function testDispatchInactiveCategory(): void { // Deactivate blog category - $this->connection->exec('UPDATE `s_categories` SET `active` = 0 WHERE `id` = 17'); + $this->connection->executeStatement('UPDATE `s_categories` SET `active` = 0 WHERE `id` = 17'); // Should be redirected because blog category is inactive $ex = null; @@ -75,6 +80,7 @@ public function testDispatchInactiveCategory() } catch (Exception $e) { $ex = $e; } + static::assertInstanceOf(Exception::class, $ex); static::assertEquals(404, $ex->getCode()); // Should be redirected because blog category is inactive @@ -89,7 +95,7 @@ public function testDispatchInactiveCategory() /** * Test that requesting a non-blog category-id creates a redirect */ - public function testDispatchNonBlogCategory() + public function testDispatchNonBlogCategory(): void { $this->expectException('Enlight_Exception'); $this->expectExceptionCode('404'); @@ -100,17 +106,18 @@ public function testDispatchNonBlogCategory() * Test redirect when the blog category does not exist * * @dataProvider invalidCategoryUrlDataProvider - * - * @param string $url */ - public function testDispatchNotExistingBlogCategory($url) + public function testDispatchNotExistingBlogCategory(string $url): void { $this->expectException('Enlight_Exception'); $this->expectExceptionCode('404'); $this->dispatch($url); } - public function invalidCategoryUrlDataProvider() + /** + * @return list> + */ + public function invalidCategoryUrlDataProvider(): array { return [ ['/blog/?sCategory=14'], // Not a blog category diff --git a/tests/Functional/Controllers/Frontend/RegisterWithCaptchaTest.php b/tests/Functional/Controllers/Frontend/RegisterWithCaptchaTest.php index 36c917e7914..a15d8bf0752 100644 --- a/tests/Functional/Controllers/Frontend/RegisterWithCaptchaTest.php +++ b/tests/Functional/Controllers/Frontend/RegisterWithCaptchaTest.php @@ -30,10 +30,12 @@ use Enlight_Components_Test_Plugin_TestCase; use Shopware\Components\Captcha\DefaultCaptcha; use Shopware\Tests\Functional\Traits\ContainerTrait; +use Shopware\Tests\Functional\Traits\DatabaseTransactionBehaviour; class RegisterWithCaptchaTest extends Enlight_Components_Test_Plugin_TestCase { use ContainerTrait; + use DatabaseTransactionBehaviour; private const USER_AGENT = 'Mozilla/5.0 (Android; Tablet; rv:14.0) Gecko/14.0 Firefox/14.0'; diff --git a/tests/Functional/Controllers/Frontend/SearchTest.php b/tests/Functional/Controllers/Frontend/SearchTest.php index e6d9216fc06..752944b9b37 100644 --- a/tests/Functional/Controllers/Frontend/SearchTest.php +++ b/tests/Functional/Controllers/Frontend/SearchTest.php @@ -1,4 +1,6 @@ dispatch('ajax_search?sSearch=ipad'); // Check for valid markup - // Ignore whitespace, since this testcase checks wether the list is structured correctly (li following ul) + // Ignore whitespace, since this testcase checks whether the list is structured correctly (li following ul) self::assertStringContainsStringIgnoringWhitespace( '