From a0e14c94097a7c3104def8236e331901a7465181 Mon Sep 17 00:00:00 2001 From: Sandro Wagner Date: Tue, 26 Sep 2017 15:38:12 +0200 Subject: [PATCH 1/6] 6712 Remove additional margin for footer links widget; prevents layout gap in the footer on luma theme --- .../Magento/luma/Magento_Theme/web/css/source/_module.less | 1 + 1 file changed, 1 insertion(+) diff --git a/app/design/frontend/Magento/luma/Magento_Theme/web/css/source/_module.less b/app/design/frontend/Magento/luma/Magento_Theme/web/css/source/_module.less index a845a8dce2818..fd004ef2c14d9 100644 --- a/app/design/frontend/Magento/luma/Magento_Theme/web/css/source/_module.less +++ b/app/design/frontend/Magento/luma/Magento_Theme/web/css/source/_module.less @@ -333,6 +333,7 @@ .widget.block { .lib-css(margin, @indent__base 0); } + .links .widget.block { margin: 0; } } .no-display:extend(.abs-no-display all) { From 008bb5a577db26006f6506df2dfd3babf7da89c6 Mon Sep 17 00:00:00 2001 From: Fabian Schmengler Date: Tue, 26 Sep 2017 15:58:56 +0200 Subject: [PATCH 2/6] Show different message if DB module version is higher than code module version --- .../Module/Plugin/DbStatusValidator.php | 63 +++++++++++- .../Module/Plugin/DbStatusValidatorTest.php | 96 ++++++++++++++----- 2 files changed, 132 insertions(+), 27 deletions(-) diff --git a/lib/internal/Magento/Framework/Module/Plugin/DbStatusValidator.php b/lib/internal/Magento/Framework/Module/Plugin/DbStatusValidator.php index bdaf59f02c300..54466f9b6e6aa 100644 --- a/lib/internal/Magento/Framework/Module/Plugin/DbStatusValidator.php +++ b/lib/internal/Magento/Framework/Module/Plugin/DbStatusValidator.php @@ -50,14 +50,21 @@ public function __construct(FrontendCacheInterface $cache, DbVersionInfo $dbVers public function beforeDispatch(FrontController $subject, RequestInterface $request) { if (!$this->cache->load('db_is_up_to_date')) { - $errors = $this->dbVersionInfo->getDbVersionErrors(); - - if ($errors) { + list($versionTooLowErrors, $versionTooHighErrors) = array_values($this->getGroupedDbVersionErrors()); + if ($versionTooHighErrors) { + $message = 'Please update your modules: ' . "Run \"composer install\" from the Magento root directory.\n" + . "The following modules are outdated:\n%1"; + throw new LocalizedException( + new Phrase($message, [implode("\n", $this->formatVersionTooHighErrors($versionTooHighErrors))]) + ); + } elseif ($versionTooLowErrors) { $message = 'Please upgrade your database: ' . "Run \"bin/magento setup:upgrade\" from the Magento root directory.\n" . "The following modules are outdated:\n%1"; - throw new LocalizedException(new Phrase($message, [implode("\n", $this->formatErrors($errors))])); + throw new LocalizedException( + new Phrase($message, [implode("\n", $this->formatVersionTooLowErrors($versionTooLowErrors))]) + ); } else { $this->cache->save('true', 'db_is_up_to_date'); } @@ -70,7 +77,7 @@ public function beforeDispatch(FrontController $subject, RequestInterface $reque * @param array $errorsData array of error data from getOutOfDateDbErrors * @return array Messages that can be used to log the error */ - private function formatErrors($errorsData) + private function formatVersionTooLowErrors($errorsData) { $formattedErrors = []; @@ -82,4 +89,50 @@ private function formatErrors($errorsData) return $formattedErrors; } + + /** + * Format each error in the error data from getOutOfDataDbErrors into a single message + * + * @param array $errorsData array of error data from getOutOfDateDbErrors + * @return array Messages that can be used to log the error + */ + private function formatVersionTooHighErrors($errorsData) + { + $formattedErrors = []; + + foreach ($errorsData as $error) { + $formattedErrors[] = $error[DbVersionInfo::KEY_MODULE] . ' ' . $error[DbVersionInfo::KEY_TYPE] + . ': code version - ' . $error[DbVersionInfo::KEY_REQUIRED] + . ', database version - ' . $error[DbVersionInfo::KEY_CURRENT]; + } + + return $formattedErrors; + } + + /** + * Return DB version errors grouped by 'version_too_low' and 'version_too_high' + * + * @return mixed + */ + private function getGroupedDbVersionErrors() + { + $allDbVersionErrors = $this->dbVersionInfo->getDbVersionErrors(); + return array_reduce( + (array)$allDbVersionErrors, + function ($carry, $item) { + if ($item[DbVersionInfo::KEY_CURRENT] === 'none' + || $item[DbVersionInfo::KEY_CURRENT] < $item[DbVersionInfo::KEY_REQUIRED] + ) { + $carry['version_too_low'][] = $item; + } else { + $carry['version_too_high'][] = $item; + } + return $carry; + }, + [ + 'version_too_low' => [], + 'version_too_high' => [], + ] + ); + } } diff --git a/lib/internal/Magento/Framework/Test/Unit/Module/Plugin/DbStatusValidatorTest.php b/lib/internal/Magento/Framework/Test/Unit/Module/Plugin/DbStatusValidatorTest.php index 3e739c3688694..4968e41613dd5 100644 --- a/lib/internal/Magento/Framework/Test/Unit/Module/Plugin/DbStatusValidatorTest.php +++ b/lib/internal/Magento/Framework/Test/Unit/Module/Plugin/DbStatusValidatorTest.php @@ -99,28 +99,11 @@ public function testBeforeDispatchOutOfDateNoErrors() $this->plugin->beforeDispatch($this->frontControllerMock, $this->requestMock); } - public function testBeforeDispatchOutOfDateWithErrors() + /** + * @dataProvider beforeDispatchOutOfDateWithErrorsDataProvider + */ + public function testBeforeDispatchOutOfDateWithErrors(array $errors, string $expectedMessage) { - $errors = [ - [ - DbVersionInfo::KEY_MODULE => 'Magento_Module1', - DbVersionInfo::KEY_TYPE => 'schema', - DbVersionInfo::KEY_CURRENT => '3.3.3', - DbVersionInfo::KEY_REQUIRED => '4.4.4' - ], - [ - DbVersionInfo::KEY_MODULE => 'Magento_Module2', - DbVersionInfo::KEY_TYPE => 'data', - DbVersionInfo::KEY_CURRENT => '2.8.7', - DbVersionInfo::KEY_REQUIRED => '5.1.6' - ] - ]; - $message = 'Please upgrade your database: ' - . "Run \"bin/magento setup:upgrade\" from the Magento root directory.\n" - . "The following modules are outdated:\n" - . "Magento_Module1 schema: current version - 3.3.3, required version - 4.4.4\n" - . "Magento_Module2 data: current version - 2.8.7, required version - 5.1.6"; - $this->cacheMock->expects(static::any()) ->method('load') ->with('db_is_up_to_date') @@ -131,7 +114,76 @@ public function testBeforeDispatchOutOfDateWithErrors() $this->cacheMock->expects(static::never()) ->method('save'); - $this->expectException(LocalizedException::class, $message); + $this->expectException(LocalizedException::class, $expectedMessage); + $this->expectExceptionMessage($expectedMessage); $this->plugin->beforeDispatch($this->frontControllerMock, $this->requestMock); } + + public static function beforeDispatchOutOfDateWithErrorsDataProvider() + { + return [ + 'module versions too low' => [ + 'errors' => [ + [ + DbVersionInfo::KEY_MODULE => 'Magento_Module1', + DbVersionInfo::KEY_TYPE => 'schema', + DbVersionInfo::KEY_CURRENT => 'none', + DbVersionInfo::KEY_REQUIRED => '4.4.4' + ], + [ + DbVersionInfo::KEY_MODULE => 'Magento_Module2', + DbVersionInfo::KEY_TYPE => 'data', + DbVersionInfo::KEY_CURRENT => '2.8.7', + DbVersionInfo::KEY_REQUIRED => '5.1.6' + ], + ], + 'expectedMessage' => 'Please upgrade your database: ' + . "Run \"bin/magento setup:upgrade\" from the Magento root directory.\n" + . "The following modules are outdated:\n" + . "Magento_Module1 schema: current version - none, required version - 4.4.4\n" + . "Magento_Module2 data: current version - 2.8.7, required version - 5.1.6" + ], + 'module versions too high' => [ + 'errors' => [ + [ + DbVersionInfo::KEY_MODULE => 'Magento_Module3', + DbVersionInfo::KEY_TYPE => 'schema', + DbVersionInfo::KEY_CURRENT => '2.0.0', + DbVersionInfo::KEY_REQUIRED => '1.0.0' + ], + [ + DbVersionInfo::KEY_MODULE => 'Magento_Module4', + DbVersionInfo::KEY_TYPE => 'data', + DbVersionInfo::KEY_CURRENT => '1.0.1', + DbVersionInfo::KEY_REQUIRED => '1.0.0' + ], + ], + 'expectedMessage' => "Please update your modules: " + . "Run \"composer install\" from the Magento root directory.\n" + . "The following modules are outdated:\n" + . "Magento_Module3 schema: code version - 1.0.0, database version - 2.0.0\n" + . "Magento_Module4 data: code version - 1.0.0, database version - 1.0.1", + ], + 'some versions too high, some too low' => [ + 'errors' => [ + [ + DbVersionInfo::KEY_MODULE => 'Magento_Module1', + DbVersionInfo::KEY_TYPE => 'schema', + DbVersionInfo::KEY_CURRENT => '2.0.0', + DbVersionInfo::KEY_REQUIRED => '1.0.0' + ], + [ + DbVersionInfo::KEY_MODULE => 'Magento_Module2', + DbVersionInfo::KEY_TYPE => 'schema', + DbVersionInfo::KEY_CURRENT => '1.0.0', + DbVersionInfo::KEY_REQUIRED => '2.0.0' + ], + ], + 'expectedMessage' => "Please update your modules: " + . "Run \"composer install\" from the Magento root directory.\n" + . "The following modules are outdated:\n" + . "Magento_Module1 schema: code version - 1.0.0, database version - 2.0.0" + ] + ]; + } } From 66d88575e80bc0ec4997324f0ce9339aec33b1fc Mon Sep 17 00:00:00 2001 From: Gabriel Somoza Date: Tue, 26 Sep 2017 17:01:36 +0200 Subject: [PATCH 3/6] Backport to 2.2 of #10824 add name for order items grid default renderer block --- .../adminhtml/layout/sales_order_view.xml | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_view.xml b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_view.xml index 12b4cfdf98920..e1a406346fc1a 100644 --- a/app/code/Magento/Sales/view/adminhtml/layout/sales_order_view.xml +++ b/app/code/Magento/Sales/view/adminhtml/layout/sales_order_view.xml @@ -41,21 +41,21 @@ Row Total - - - - col-product - col-status - col-price-original - col-price - col-ordered-qty - col-subtotal - col-tax-amount - col-tax-percent - col-discont - col-total - - + + + + col-product + col-status + col-price-original + col-price + col-ordered-qty + col-subtotal + col-tax-amount + col-tax-percent + col-discont + col-total + + From db7148e51adb01917a105fbdef5e1af4d9b79983 Mon Sep 17 00:00:00 2001 From: Eugene Tulika Date: Wed, 27 Sep 2017 17:15:12 -0500 Subject: [PATCH 4/6] MAGETWO-80225: Show different message if DB module version is higher than code module #11064 - changed wording of the error --- .../Magento/Framework/Module/Plugin/DbStatusValidator.php | 6 +++--- .../Test/Unit/Module/Plugin/DbStatusValidatorTest.php | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/internal/Magento/Framework/Module/Plugin/DbStatusValidator.php b/lib/internal/Magento/Framework/Module/Plugin/DbStatusValidator.php index 54466f9b6e6aa..6459b2d1920de 100644 --- a/lib/internal/Magento/Framework/Module/Plugin/DbStatusValidator.php +++ b/lib/internal/Magento/Framework/Module/Plugin/DbStatusValidator.php @@ -101,9 +101,9 @@ private function formatVersionTooHighErrors($errorsData) $formattedErrors = []; foreach ($errorsData as $error) { - $formattedErrors[] = $error[DbVersionInfo::KEY_MODULE] . ' ' . $error[DbVersionInfo::KEY_TYPE] - . ': code version - ' . $error[DbVersionInfo::KEY_REQUIRED] - . ', database version - ' . $error[DbVersionInfo::KEY_CURRENT]; + $formattedErrors[] = $error[DbVersionInfo::KEY_MODULE] . ' db ' . $error[DbVersionInfo::KEY_TYPE] + . ' version: defined in codebase - ' . $error[DbVersionInfo::KEY_REQUIRED] + . ', currently installed - ' . $error[DbVersionInfo::KEY_CURRENT]; } return $formattedErrors; diff --git a/lib/internal/Magento/Framework/Test/Unit/Module/Plugin/DbStatusValidatorTest.php b/lib/internal/Magento/Framework/Test/Unit/Module/Plugin/DbStatusValidatorTest.php index 4968e41613dd5..201856124d721 100644 --- a/lib/internal/Magento/Framework/Test/Unit/Module/Plugin/DbStatusValidatorTest.php +++ b/lib/internal/Magento/Framework/Test/Unit/Module/Plugin/DbStatusValidatorTest.php @@ -161,8 +161,8 @@ public static function beforeDispatchOutOfDateWithErrorsDataProvider() 'expectedMessage' => "Please update your modules: " . "Run \"composer install\" from the Magento root directory.\n" . "The following modules are outdated:\n" - . "Magento_Module3 schema: code version - 1.0.0, database version - 2.0.0\n" - . "Magento_Module4 data: code version - 1.0.0, database version - 1.0.1", + . "Magento_Module3 db schema version: defined in codebase - 1.0.0, currently installed - 2.0.0\n" + . "Magento_Module4 db data version: defined in codebase - 1.0.0, currently installed - 1.0.1", ], 'some versions too high, some too low' => [ 'errors' => [ @@ -182,7 +182,7 @@ public static function beforeDispatchOutOfDateWithErrorsDataProvider() 'expectedMessage' => "Please update your modules: " . "Run \"composer install\" from the Magento root directory.\n" . "The following modules are outdated:\n" - . "Magento_Module1 schema: code version - 1.0.0, database version - 2.0.0" + . "Magento_Module1 db schema version: defined in codebase - 1.0.0, currently installed - 2.0.0" ] ]; } From 145c72667ff58d1ff7aec23b168844d97ff12a4c Mon Sep 17 00:00:00 2001 From: Sergey Shvets Date: Thu, 28 Sep 2017 14:45:36 +0300 Subject: [PATCH 5/6] MAGETWO-80288: Fix unit tests on jenkins --- dev/tests/unit/framework/bootstrap.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dev/tests/unit/framework/bootstrap.php b/dev/tests/unit/framework/bootstrap.php index 9de9b3ac9ed26..68dba4e2ce00c 100644 --- a/dev/tests/unit/framework/bootstrap.php +++ b/dev/tests/unit/framework/bootstrap.php @@ -20,6 +20,10 @@ error_reporting(E_ALL); ini_set('display_errors', 1); +/* For data consistency between displaying (printing) and serialization a float number */ +ini_set('precision', 14); +ini_set('serialize_precision', 14); + /** * Set custom error handler */ From 5fc2169041862ebec0db8b424aa72f202ee354e4 Mon Sep 17 00:00:00 2001 From: Eugene Tulika Date: Thu, 28 Sep 2017 11:54:41 -0500 Subject: [PATCH 6/6] MAGETWO-80225: Show different message if DB module version is higher than code module #11064 - changed wording of the error --- .../Magento/Framework/Module/Plugin/DbStatusValidator.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/Module/Plugin/DbStatusValidator.php b/lib/internal/Magento/Framework/Module/Plugin/DbStatusValidator.php index 6459b2d1920de..171f6f74515fd 100644 --- a/lib/internal/Magento/Framework/Module/Plugin/DbStatusValidator.php +++ b/lib/internal/Magento/Framework/Module/Plugin/DbStatusValidator.php @@ -52,7 +52,8 @@ public function beforeDispatch(FrontController $subject, RequestInterface $reque if (!$this->cache->load('db_is_up_to_date')) { list($versionTooLowErrors, $versionTooHighErrors) = array_values($this->getGroupedDbVersionErrors()); if ($versionTooHighErrors) { - $message = 'Please update your modules: ' . "Run \"composer install\" from the Magento root directory.\n" + $message = 'Please update your modules: ' + . "Run \"composer install\" from the Magento root directory.\n" . "The following modules are outdated:\n%1"; throw new LocalizedException( new Phrase($message, [implode("\n", $this->formatVersionTooHighErrors($versionTooHighErrors))])