From fffad8d165fccde54b664627345515696dae3ea0 Mon Sep 17 00:00:00 2001 From: Ronald Edelschaap Date: Fri, 11 Nov 2016 18:18:16 +0100 Subject: [PATCH 01/60] Update Curl.php Added support for PUT requests --- lib/internal/Magento/Framework/HTTP/Adapter/Curl.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/internal/Magento/Framework/HTTP/Adapter/Curl.php b/lib/internal/Magento/Framework/HTTP/Adapter/Curl.php index 181783c7b2115..2311da9e0e9ac 100644 --- a/lib/internal/Magento/Framework/HTTP/Adapter/Curl.php +++ b/lib/internal/Magento/Framework/HTTP/Adapter/Curl.php @@ -175,6 +175,9 @@ public function write($method, $url, $http_ver = '1.1', $headers = [], $body = ' if ($method == \Zend_Http_Client::POST) { curl_setopt($this->_getResource(), CURLOPT_POST, true); curl_setopt($this->_getResource(), CURLOPT_POSTFIELDS, $body); + } elseif ($method == \Zend_Http_Client::PUT) { + curl_setopt($this->_getResource(), CURLOPT_CUSTOMREQUEST, 'PUT'); + curl_setopt($this->_getResource(), CURLOPT_POSTFIELDS, $body); } elseif ($method == \Zend_Http_Client::GET) { curl_setopt($this->_getResource(), CURLOPT_HTTPGET, true); } From 2b9a6b35bfe640024bd0ae5152b35914a98f4cb4 Mon Sep 17 00:00:00 2001 From: Ronald Edelschaap Date: Mon, 14 Nov 2016 11:53:58 +0100 Subject: [PATCH 02/60] Update Curl.php We noticed that `CURLOPT_CUSTOMREQUEST` has priority over regular options like `CURLOPT_HTTPGET` and `CURLOPT_POST`. When the `CURLOPT_CUSTOMREQUEST` option has been set to `PUT` for a PUT request, `CURLOPT_HTTPGET` and `CURLOPT_POST` do not overwrite the value of `CURLOPT_CUSTOMREQUEST` and thus `CURLOPT_CUSTOMREQUEST` has to be used again. --- lib/internal/Magento/Framework/HTTP/Adapter/Curl.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/internal/Magento/Framework/HTTP/Adapter/Curl.php b/lib/internal/Magento/Framework/HTTP/Adapter/Curl.php index 2311da9e0e9ac..3d11e62d96f82 100644 --- a/lib/internal/Magento/Framework/HTTP/Adapter/Curl.php +++ b/lib/internal/Magento/Framework/HTTP/Adapter/Curl.php @@ -174,12 +174,14 @@ public function write($method, $url, $http_ver = '1.1', $headers = [], $body = ' curl_setopt($this->_getResource(), CURLOPT_RETURNTRANSFER, true); if ($method == \Zend_Http_Client::POST) { curl_setopt($this->_getResource(), CURLOPT_POST, true); + curl_setopt($this->_getResource(), CURLOPT_CUSTOMREQUEST, 'POST'); curl_setopt($this->_getResource(), CURLOPT_POSTFIELDS, $body); } elseif ($method == \Zend_Http_Client::PUT) { curl_setopt($this->_getResource(), CURLOPT_CUSTOMREQUEST, 'PUT'); curl_setopt($this->_getResource(), CURLOPT_POSTFIELDS, $body); } elseif ($method == \Zend_Http_Client::GET) { curl_setopt($this->_getResource(), CURLOPT_HTTPGET, true); + curl_setopt($this->_getResource(), CURLOPT_CUSTOMREQUEST, 'GET'); } if (is_array($headers)) { From c18602c3c2924175e8d2f0a8f147854781b40529 Mon Sep 17 00:00:00 2001 From: Pablo Ivulic Date: Tue, 13 Dec 2016 14:55:36 +0100 Subject: [PATCH 03/60] Throw exception if errors are found --- .../src/Magento/Setup/Module/Di/Compiler/Log/Writer/Console.php | 1 + 1 file changed, 1 insertion(+) diff --git a/setup/src/Magento/Setup/Module/Di/Compiler/Log/Writer/Console.php b/setup/src/Magento/Setup/Module/Di/Compiler/Log/Writer/Console.php index b6196c45f4e06..e914301f10ab7 100644 --- a/setup/src/Magento/Setup/Module/Di/Compiler/Log/Writer/Console.php +++ b/setup/src/Magento/Setup/Module/Di/Compiler/Log/Writer/Console.php @@ -70,6 +70,7 @@ public function write(array $data) if ($errorsCount) { $this->console->writeln('' . 'Total Errors Count: ' . $errorsCount . ''); + throw new \Magento\Framework\Validator\Exception(__('Error durring compilation')); } } From ed132d007bb9f059b27a7acdefe1bec53b3d6b52 Mon Sep 17 00:00:00 2001 From: Aydin Hassan Date: Mon, 12 Dec 2016 12:47:35 +0100 Subject: [PATCH 04/60] Throw exception when attribute doesn't exitst --- app/code/Magento/Eav/Setup/EavSetup.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Eav/Setup/EavSetup.php b/app/code/Magento/Eav/Setup/EavSetup.php index 9ed8ffcdc9375..2444ab9ca61d5 100644 --- a/app/code/Magento/Eav/Setup/EavSetup.php +++ b/app/code/Magento/Eav/Setup/EavSetup.php @@ -942,6 +942,7 @@ public function updateAttribute($entityTypeId, $id, $field, $value = null, $sort * @param mixed $value * @param int $sortOrder * @return $this + * @throws LocalizedException */ private function _updateAttribute($entityTypeId, $id, $field, $value = null, $sortOrder = null) { @@ -972,11 +973,15 @@ private function _updateAttribute($entityTypeId, $id, $field, $value = null, $so return $this; } } + $attributeId = $this->getAttributeId($entityTypeId, $id); + if (false === $attributeId) { + throw new LocalizedException(__('Attribute with ID: "%1" does not exist', $id)); + } $this->setup->updateTableRow( 'eav_attribute', 'attribute_id', - $this->getAttributeId($entityTypeId, $id), + $attributeId, $field, $value, 'entity_type_id', @@ -994,6 +999,7 @@ private function _updateAttribute($entityTypeId, $id, $field, $value = null, $so * @param string|array $field * @param mixed $value * @return $this + * @throws LocalizedException */ private function _updateAttributeAdditionalData($entityTypeId, $id, $field, $value = null) { @@ -1020,10 +1026,15 @@ private function _updateAttributeAdditionalData($entityTypeId, $id, $field, $val return $this; } } + $attributeId = $this->getAttributeId($entityTypeId, $id); + if (false === $attributeId) { + throw new LocalizedException(__('Attribute with ID: "%1" does not exist', $id)); + } + $this->setup->updateTableRow( $this->setup->getTable($additionalTable), 'attribute_id', - $this->getAttributeId($entityTypeId, $id), + $attributeId, $field, $value ); From ef56615c75a1e5daec8abfaa99b2a02daeb3f696 Mon Sep 17 00:00:00 2001 From: Olga Lytvynenko Date: Tue, 4 Apr 2017 10:48:09 +0300 Subject: [PATCH 05/60] MAGETWO-61189: Stored xss using svg images in Favicon --- .../view/adminhtml/ui_component/design_config_form.xml | 6 +++--- .../Magento/Config/Model/Config/Backend/Image/Favicon.php | 2 +- .../Magento/Config/Model/Config/Backend/Image/Logo.php | 2 +- .../Test/Unit/Model/Config/Backend/Image/LogoTest.php | 2 +- .../view/adminhtml/ui_component/design_config_form.xml | 2 +- .../view/adminhtml/ui_component/design_config_form.xml | 2 +- app/code/Magento/Theme/Model/Design/Backend/Favicon.php | 2 +- app/code/Magento/Theme/Model/Design/Backend/Logo.php | 2 +- .../view/adminhtml/ui_component/design_config_form.xml | 8 ++++---- 9 files changed, 14 insertions(+), 14 deletions(-) diff --git a/app/code/Magento/Catalog/view/adminhtml/ui_component/design_config_form.xml b/app/code/Magento/Catalog/view/adminhtml/ui_component/design_config_form.xml index dbca31a35a30b..942f0e62bc18b 100644 --- a/app/code/Magento/Catalog/view/adminhtml/ui_component/design_config_form.xml +++ b/app/code/Magento/Catalog/view/adminhtml/ui_component/design_config_form.xml @@ -31,7 +31,7 @@ fileUploader Allowed file types: jpeg, gif, png. 2097152 - jpg jpeg gif png svg + jpg jpeg gif png theme/design_config_fileUploader/save @@ -95,7 +95,7 @@ fileUploader Allowed file types: jpeg, gif, png. 2097152 - jpg jpeg gif png svg + jpg jpeg gif png theme/design_config_fileUploader/save @@ -159,7 +159,7 @@ fileUploader Allowed file types: jpeg, gif, png. 2097152 - jpg jpeg gif png svg + jpg jpeg gif png theme/design_config_fileUploader/save diff --git a/app/code/Magento/Config/Model/Config/Backend/Image/Favicon.php b/app/code/Magento/Config/Model/Config/Backend/Image/Favicon.php index 960853778d5f6..1412e0cd77c17 100644 --- a/app/code/Magento/Config/Model/Config/Backend/Image/Favicon.php +++ b/app/code/Magento/Config/Model/Config/Backend/Image/Favicon.php @@ -45,6 +45,6 @@ protected function _addWhetherScopeInfo() */ protected function _getAllowedExtensions() { - return ['ico', 'png', 'gif', 'jpg', 'jpeg', 'apng', 'svg']; + return ['ico', 'png', 'gif', 'jpg', 'jpeg', 'apng']; } } diff --git a/app/code/Magento/Config/Model/Config/Backend/Image/Logo.php b/app/code/Magento/Config/Model/Config/Backend/Image/Logo.php index 908ae53af0991..fc57287fb4945 100644 --- a/app/code/Magento/Config/Model/Config/Backend/Image/Logo.php +++ b/app/code/Magento/Config/Model/Config/Backend/Image/Logo.php @@ -45,6 +45,6 @@ protected function _addWhetherScopeInfo() */ protected function _getAllowedExtensions() { - return ['jpg', 'jpeg', 'gif', 'png', 'svg']; + return ['jpg', 'jpeg', 'gif', 'png']; } } diff --git a/app/code/Magento/Config/Test/Unit/Model/Config/Backend/Image/LogoTest.php b/app/code/Magento/Config/Test/Unit/Model/Config/Backend/Image/LogoTest.php index e68cff5d1280d..28f35c233b874 100644 --- a/app/code/Magento/Config/Test/Unit/Model/Config/Backend/Image/LogoTest.php +++ b/app/code/Magento/Config/Test/Unit/Model/Config/Backend/Image/LogoTest.php @@ -73,7 +73,7 @@ public function testBeforeSave() ->will($this->returnValue('/tmp/val')); $this->uploaderMock->expects($this->once()) ->method('setAllowedExtensions') - ->with($this->equalTo(['jpg', 'jpeg', 'gif', 'png', 'svg'])); + ->with($this->equalTo(['jpg', 'jpeg', 'gif', 'png'])); $this->model->beforeSave(); } } diff --git a/app/code/Magento/Email/view/adminhtml/ui_component/design_config_form.xml b/app/code/Magento/Email/view/adminhtml/ui_component/design_config_form.xml index d4c841d1c3c4f..12f6d3b06d2da 100644 --- a/app/code/Magento/Email/view/adminhtml/ui_component/design_config_form.xml +++ b/app/code/Magento/Email/view/adminhtml/ui_component/design_config_form.xml @@ -23,7 +23,7 @@ fileUploader Allowed file types: jpg, jpeg, gif, png. To optimize logo for high-resolution displays, upload an image that is 3x normal size and then specify 1x dimensions in the width/height fields below. 2097152 - jpg jpeg gif png svg + jpg jpeg gif png theme/design_config_fileUploader/save diff --git a/app/code/Magento/Swatches/view/adminhtml/ui_component/design_config_form.xml b/app/code/Magento/Swatches/view/adminhtml/ui_component/design_config_form.xml index d4673bf7e0073..d4cdbc403eb61 100644 --- a/app/code/Magento/Swatches/view/adminhtml/ui_component/design_config_form.xml +++ b/app/code/Magento/Swatches/view/adminhtml/ui_component/design_config_form.xml @@ -24,7 +24,7 @@ fileUploader Allowed file types: jpeg, gif, png. 2097152 - jpg jpeg gif png svg + jpg jpeg gif png theme/design_config_fileUploader/save diff --git a/app/code/Magento/Theme/Model/Design/Backend/Favicon.php b/app/code/Magento/Theme/Model/Design/Backend/Favicon.php index 160642818cfbd..2d53b11eea6cb 100644 --- a/app/code/Magento/Theme/Model/Design/Backend/Favicon.php +++ b/app/code/Magento/Theme/Model/Design/Backend/Favicon.php @@ -43,6 +43,6 @@ protected function _addWhetherScopeInfo() */ public function getAllowedExtensions() { - return ['ico', 'png', 'gif', 'jpg', 'jpeg', 'apng', 'svg']; + return ['ico', 'png', 'gif', 'jpg', 'jpeg', 'apng']; } } diff --git a/app/code/Magento/Theme/Model/Design/Backend/Logo.php b/app/code/Magento/Theme/Model/Design/Backend/Logo.php index 88a1317d74b78..e5652d7ee4007 100644 --- a/app/code/Magento/Theme/Model/Design/Backend/Logo.php +++ b/app/code/Magento/Theme/Model/Design/Backend/Logo.php @@ -41,6 +41,6 @@ protected function _addWhetherScopeInfo() */ public function getAllowedExtensions() { - return ['jpg', 'jpeg', 'gif', 'png', 'svg']; + return ['jpg', 'jpeg', 'gif', 'png']; } } diff --git a/app/code/Magento/Theme/view/adminhtml/ui_component/design_config_form.xml b/app/code/Magento/Theme/view/adminhtml/ui_component/design_config_form.xml index f6478844ba4e3..411bbe3d061d5 100644 --- a/app/code/Magento/Theme/view/adminhtml/ui_component/design_config_form.xml +++ b/app/code/Magento/Theme/view/adminhtml/ui_component/design_config_form.xml @@ -65,9 +65,9 @@ Favicon Icon fileUploader fileUploader - Allowed file types: ico, png, gif, jpg, jpeg, apng, svg. Not all browsers support all these formats! + Allowed file types: ico, png, gif, jpg, jpeg, apng. Not all browsers support all these formats! 2097152 - jpg jpeg gif png svg ico apng + jpg jpeg gif png ico apng theme/design_config_fileUploader/save @@ -176,9 +176,9 @@ Logo Image fileUploader fileUploader - Allowed file types: png, gif, jpg, jpeg, svg. + Allowed file types: png, gif, jpg, jpeg. 2097152 - jpg jpeg gif png svg + jpg jpeg gif png theme/design_config_fileUploader/save From 27f540c962cd4d370684a544e8711ffc6142f278 Mon Sep 17 00:00:00 2001 From: Tibor Kotosz Date: Thu, 6 Apr 2017 15:30:30 +0200 Subject: [PATCH 06/60] Return array of blocks as items instead of array of arrays Based on `BlockSearchResultsInterface` the `getItems()` should return `\Magento\Cms\Api\Data\BlockInterface[]`. --- app/code/Magento/Cms/Model/BlockRepository.php | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/app/code/Magento/Cms/Model/BlockRepository.php b/app/code/Magento/Cms/Model/BlockRepository.php index a06c5fac1bc4e..5f8ec399e9bd6 100644 --- a/app/code/Magento/Cms/Model/BlockRepository.php +++ b/app/code/Magento/Cms/Model/BlockRepository.php @@ -154,25 +154,10 @@ public function getList(\Magento\Framework\Api\SearchCriteriaInterface $criteria $this->collectionProcessor->process($criteria, $collection); - $blocks = []; - /** @var Block $blockModel */ - foreach ($collection as $blockModel) { - $blockData = $this->dataBlockFactory->create(); - $this->dataObjectHelper->populateWithArray( - $blockData, - $blockModel->getData(), - \Magento\Cms\Api\Data\BlockInterface::class - ); - $blocks[] = $this->dataObjectProcessor->buildOutputDataArray( - $blockData, - \Magento\Cms\Api\Data\BlockInterface::class - ); - } - /** @var Data\BlockSearchResultsInterface $searchResults */ $searchResults = $this->searchResultsFactory->create(); $searchResults->setSearchCriteria($criteria); - $searchResults->setItems($blocks); + $searchResults->setItems($collection->getItems()); $searchResults->setTotalCount($collection->getSize()); return $searchResults; } From 658a30a42046bc21abb7d61e700be566e06d61e1 Mon Sep 17 00:00:00 2001 From: Pablo Ivulic Date: Thu, 13 Apr 2017 13:03:47 +0200 Subject: [PATCH 07/60] Moved exception to be thrown one level up --- setup/src/Magento/Setup/Module/Di/Compiler/Log/Log.php | 4 ++++ .../Magento/Setup/Module/Di/Compiler/Log/Writer/Console.php | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/setup/src/Magento/Setup/Module/Di/Compiler/Log/Log.php b/setup/src/Magento/Setup/Module/Di/Compiler/Log/Log.php index 9dff437500e57..de1c8c9fd99d8 100644 --- a/setup/src/Magento/Setup/Module/Di/Compiler/Log/Log.php +++ b/setup/src/Magento/Setup/Module/Di/Compiler/Log/Log.php @@ -81,11 +81,15 @@ public function add($type, $key, $message = '') * Write entries * * @return void + * @throws \Magento\Framework\Validator\Exception */ public function report() { $this->_successWriter->write($this->_successEntries); $this->_errorWriter->write($this->_errorEntries); + if (count($this->_errorEntries) > 0) { + throw new \Magento\Framework\Validator\Exception(__('Error during compilation')); + } } /** diff --git a/setup/src/Magento/Setup/Module/Di/Compiler/Log/Writer/Console.php b/setup/src/Magento/Setup/Module/Di/Compiler/Log/Writer/Console.php index e914301f10ab7..b6196c45f4e06 100644 --- a/setup/src/Magento/Setup/Module/Di/Compiler/Log/Writer/Console.php +++ b/setup/src/Magento/Setup/Module/Di/Compiler/Log/Writer/Console.php @@ -70,7 +70,6 @@ public function write(array $data) if ($errorsCount) { $this->console->writeln('' . 'Total Errors Count: ' . $errorsCount . ''); - throw new \Magento\Framework\Validator\Exception(__('Error durring compilation')); } } From 9fe3b8a0cdff5c9f4677c1890ca2bf52718acae5 Mon Sep 17 00:00:00 2001 From: Anton Evers Date: Mon, 6 Jun 2016 12:40:11 +0200 Subject: [PATCH 08/60] This does not belong here The table catalog_product_entity_media_gallery does not have a column that represents a product entity_id so it cannot be subscribed to triggers for catalogrule_product or catalog_product_flat The current value_id is not a product entity_id so https://github.com/magento/magento2/commit/88891edb1069cda1c8ac78286be308a4bec7175e should have never been approved. Insead the whole subscription should be removed. For now there is no way to trigger an indexer when the name if an image changes. If the image gets deleted or added the subscription on catalog_product_entity_media_gallery_value will handle it. --- app/code/Magento/Catalog/etc/mview.xml | 1 - app/code/Magento/CatalogRule/etc/mview.xml | 1 - 2 files changed, 2 deletions(-) diff --git a/app/code/Magento/Catalog/etc/mview.xml b/app/code/Magento/Catalog/etc/mview.xml index 4213faf9307b5..7ae38a7f2d0e1 100644 --- a/app/code/Magento/Catalog/etc/mview.xml +++ b/app/code/Magento/Catalog/etc/mview.xml @@ -36,7 +36,6 @@
-
diff --git a/app/code/Magento/CatalogRule/etc/mview.xml b/app/code/Magento/CatalogRule/etc/mview.xml index 0fc3be87057be..2990c03ae0159 100644 --- a/app/code/Magento/CatalogRule/etc/mview.xml +++ b/app/code/Magento/CatalogRule/etc/mview.xml @@ -18,7 +18,6 @@
-
From 1f0b8f267c257b676035208361b22f810497f72c Mon Sep 17 00:00:00 2001 From: Danny Verkade Date: Fri, 14 Apr 2017 22:18:48 +0200 Subject: [PATCH 09/60] Fixed coding standard violations in the Framework\Validator namespace: - Removed @codingStandardsIgnoreFile - Fixed indentation - Fixed number of chars per line --- .../Magento/Framework/Validator/Builder.php | 21 ++++++++----- .../Validator/Constraint/Property.php | 8 ++--- .../Framework/Validator/ConstraintFactory.php | 10 +++---- .../Magento/Framework/Validator/Factory.php | 30 +++++++++++-------- 4 files changed, 40 insertions(+), 29 deletions(-) diff --git a/lib/internal/Magento/Framework/Validator/Builder.php b/lib/internal/Magento/Framework/Validator/Builder.php index b50c729c3973e..7340be51948a5 100644 --- a/lib/internal/Magento/Framework/Validator/Builder.php +++ b/lib/internal/Magento/Framework/Validator/Builder.php @@ -6,8 +6,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Validator; use Magento\Framework\Validator\Constraint\OptionInterface; @@ -257,7 +255,11 @@ protected function _createConstraint(array $data) } if (\Magento\Framework\Validator\Config::CONSTRAINT_TYPE_PROPERTY == $data['type']) { - $result = new \Magento\Framework\Validator\Constraint\Property($validator, $data['property'], $data['alias']); + $result = new \Magento\Framework\Validator\Constraint\Property( + $validator, + $data['property'], + ['alias'] + ); } else { $result = $this->_constraintFactory->create(['validator' => $validator, 'alias' => $data['alias']]); } @@ -286,7 +288,10 @@ protected function _createConstraintValidator(array $data) // Check validator type if (!$validator instanceof \Magento\Framework\Validator\ValidatorInterface) { throw new \InvalidArgumentException( - sprintf('Constraint class "%s" must implement \Magento\Framework\Validator\ValidatorInterface', $data['class']) + sprintf( + 'Constraint class "%s" must implement \Magento\Framework\Validator\ValidatorInterface', + $data['class'] + ) ); } @@ -300,8 +305,10 @@ protected function _createConstraintValidator(array $data) * @param array $options * @return void */ - protected function _configureConstraintValidator(\Magento\Framework\Validator\ValidatorInterface $validator, array $options) - { + protected function _configureConstraintValidator( + \Magento\Framework\Validator\ValidatorInterface $validator, + array $options + ) { // Call all validator methods according to configuration if (isset($options['methods'])) { foreach ($options['methods'] as $methodData) { @@ -344,4 +351,4 @@ protected function _applyArgumentsCallback(array $arguments) } return $arguments; } -} +} \ No newline at end of file diff --git a/lib/internal/Magento/Framework/Validator/Constraint/Property.php b/lib/internal/Magento/Framework/Validator/Constraint/Property.php index a209e00f738e8..04f0c95450b05 100644 --- a/lib/internal/Magento/Framework/Validator/Constraint/Property.php +++ b/lib/internal/Magento/Framework/Validator/Constraint/Property.php @@ -6,8 +6,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - namespace Magento\Framework\Validator\Constraint; class Property extends \Magento\Framework\Validator\Constraint @@ -33,8 +31,8 @@ public function __construct(\Magento\Framework\Validator\ValidatorInterface $val } /** - * Get value that should be validated. Tries to extract value's property if \Magento\Framework\DataObject or \ArrayAccess or array - * is passed + * Get value that should be validated. Tries to extract value's property if \Magento\Framework\DataObject or + * \ArrayAccess or array is passed * * @param mixed $value * @return mixed @@ -62,4 +60,4 @@ protected function _addMessages(array $messages) { $this->_messages[$this->_property] = $messages; } -} +} \ No newline at end of file diff --git a/lib/internal/Magento/Framework/Validator/ConstraintFactory.php b/lib/internal/Magento/Framework/Validator/ConstraintFactory.php index 43d3ef3d9cb35..170d067e76e84 100644 --- a/lib/internal/Magento/Framework/Validator/ConstraintFactory.php +++ b/lib/internal/Magento/Framework/Validator/ConstraintFactory.php @@ -4,8 +4,6 @@ * See COPYING.txt for license details. */ -// @codingStandardsIgnoreFile - /** * Factory class for \Magento\Framework\Validator\Constraint */ @@ -33,8 +31,10 @@ class ConstraintFactory * @param \Magento\Framework\ObjectManagerInterface $objectManager * @param string $instanceName */ - public function __construct(\Magento\Framework\ObjectManagerInterface $objectManager, $instanceName = \Magento\Framework\Validator\Constraint::class) - { + public function __construct( + \Magento\Framework\ObjectManagerInterface $objectManager, + $instanceName = \Magento\Framework\Validator\Constraint::class + ) { $this->_objectManager = $objectManager; $this->_instanceName = $instanceName; } @@ -50,4 +50,4 @@ public function create(array $data = []) { return $this->_objectManager->create($this->_instanceName, $data); } -} +} \ No newline at end of file diff --git a/lib/internal/Magento/Framework/Validator/Factory.php b/lib/internal/Magento/Framework/Validator/Factory.php index a1b1752d5ded1..b2d34ff4cbcae 100644 --- a/lib/internal/Magento/Framework/Validator/Factory.php +++ b/lib/internal/Magento/Framework/Validator/Factory.php @@ -3,18 +3,14 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\Validator; use Magento\Framework\Cache\FrontendInterface; -/** - * @codingStandardsIgnoreFile - */ class Factory { - /** - * Cache key - */ + /** cache key */ const CACHE_KEY = __CLASS__; /** @@ -73,6 +69,8 @@ public function __construct( /** * Init cached list of validation files + * + * @return void */ protected function _initializeConfigList() { @@ -80,7 +78,10 @@ protected function _initializeConfigList() $this->_configFiles = $this->cache->load(self::CACHE_KEY); if (!$this->_configFiles) { $this->_configFiles = $this->moduleReader->getConfigurationFiles('validation.xml'); - $this->cache->save($this->getSerializer()->serialize($this->_configFiles->toArray()), self::CACHE_KEY); + $this->cache->save($this->getSerializer()->serialize( + $this->_configFiles->toArray()), + self::CACHE_KEY + ); } else { $filesArray = $this->getSerializer()->unserialize($this->_configFiles); $this->_configFiles = $this->getFileIteratorFactory()->create(array_keys($filesArray)); @@ -121,7 +122,9 @@ public function getValidatorConfig() $this->_initializeConfigList(); $this->_initializeDefaultTranslator(); return $this->_objectManager->create( - \Magento\Framework\Validator\Config::class, ['configFiles' => $this->_configFiles]); + \Magento\Framework\Validator\Config::class, + ['configFiles' => $this->_configFiles] + ); } /** @@ -161,7 +164,9 @@ public function createValidator($entityName, $groupName, array $builderConfig = private function getSerializer() { if ($this->serializer === null) { - $this->serializer = $this->_objectManager->get(\Magento\Framework\Serialize\SerializerInterface::class); + $this->serializer = $this->_objectManager->get( + \Magento\Framework\Serialize\SerializerInterface::class + ); } return $this->serializer; } @@ -175,9 +180,10 @@ private function getSerializer() private function getFileIteratorFactory() { if ($this->fileIteratorFactory === null) { - $this->fileIteratorFactory = $this->_objectManager - ->get(\Magento\Framework\Config\FileIteratorFactory::class); + $this->fileIteratorFactory = $this->_objectManager->get( + \Magento\Framework\Config\FileIteratorFactory::class + ); } return $this->fileIteratorFactory; } -} +} \ No newline at end of file From bfef638cc2d487914ebc7bf7e5dacee843ed7119 Mon Sep 17 00:00:00 2001 From: Danny Verkade Date: Fri, 14 Apr 2017 22:27:45 +0200 Subject: [PATCH 10/60] Added new lines to the end of the changed files. --- lib/internal/Magento/Framework/Validator/Builder.php | 2 +- .../Magento/Framework/Validator/Constraint/Property.php | 2 +- lib/internal/Magento/Framework/Validator/ConstraintFactory.php | 2 +- lib/internal/Magento/Framework/Validator/Factory.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/internal/Magento/Framework/Validator/Builder.php b/lib/internal/Magento/Framework/Validator/Builder.php index 7340be51948a5..1bca50385bb45 100644 --- a/lib/internal/Magento/Framework/Validator/Builder.php +++ b/lib/internal/Magento/Framework/Validator/Builder.php @@ -351,4 +351,4 @@ protected function _applyArgumentsCallback(array $arguments) } return $arguments; } -} \ No newline at end of file +} diff --git a/lib/internal/Magento/Framework/Validator/Constraint/Property.php b/lib/internal/Magento/Framework/Validator/Constraint/Property.php index 04f0c95450b05..f4842e15ea32e 100644 --- a/lib/internal/Magento/Framework/Validator/Constraint/Property.php +++ b/lib/internal/Magento/Framework/Validator/Constraint/Property.php @@ -60,4 +60,4 @@ protected function _addMessages(array $messages) { $this->_messages[$this->_property] = $messages; } -} \ No newline at end of file +} diff --git a/lib/internal/Magento/Framework/Validator/ConstraintFactory.php b/lib/internal/Magento/Framework/Validator/ConstraintFactory.php index 170d067e76e84..d90c4ee47338a 100644 --- a/lib/internal/Magento/Framework/Validator/ConstraintFactory.php +++ b/lib/internal/Magento/Framework/Validator/ConstraintFactory.php @@ -50,4 +50,4 @@ public function create(array $data = []) { return $this->_objectManager->create($this->_instanceName, $data); } -} \ No newline at end of file +} diff --git a/lib/internal/Magento/Framework/Validator/Factory.php b/lib/internal/Magento/Framework/Validator/Factory.php index b2d34ff4cbcae..cc00a54250338 100644 --- a/lib/internal/Magento/Framework/Validator/Factory.php +++ b/lib/internal/Magento/Framework/Validator/Factory.php @@ -186,4 +186,4 @@ private function getFileIteratorFactory() } return $this->fileIteratorFactory; } -} \ No newline at end of file +} From 62b3a287fc83cd46088721d34860e3efd0b59b45 Mon Sep 17 00:00:00 2001 From: Danny Verkade Date: Mon, 17 Apr 2017 20:41:56 +0200 Subject: [PATCH 11/60] Fixed opening & closoing parenthesis coding violation --- lib/internal/Magento/Framework/Validator/Factory.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/internal/Magento/Framework/Validator/Factory.php b/lib/internal/Magento/Framework/Validator/Factory.php index cc00a54250338..c7df8547fb4b3 100644 --- a/lib/internal/Magento/Framework/Validator/Factory.php +++ b/lib/internal/Magento/Framework/Validator/Factory.php @@ -78,8 +78,8 @@ protected function _initializeConfigList() $this->_configFiles = $this->cache->load(self::CACHE_KEY); if (!$this->_configFiles) { $this->_configFiles = $this->moduleReader->getConfigurationFiles('validation.xml'); - $this->cache->save($this->getSerializer()->serialize( - $this->_configFiles->toArray()), + $this->cache->save( + $this->getSerializer()->serialize($this->_configFiles->toArray()), self::CACHE_KEY ); } else { From 7d4ee3eaa226885717edd05006e9394e0150f262 Mon Sep 17 00:00:00 2001 From: Danny Verkade Date: Mon, 17 Apr 2017 21:21:23 +0200 Subject: [PATCH 12/60] Fixed the broken build. Restored the $data string instead of pushing a fixed array into the constructor of the Property class. --- lib/internal/Magento/Framework/Validator/Builder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/Validator/Builder.php b/lib/internal/Magento/Framework/Validator/Builder.php index 1bca50385bb45..41be9346251ce 100644 --- a/lib/internal/Magento/Framework/Validator/Builder.php +++ b/lib/internal/Magento/Framework/Validator/Builder.php @@ -258,7 +258,7 @@ protected function _createConstraint(array $data) $result = new \Magento\Framework\Validator\Constraint\Property( $validator, $data['property'], - ['alias'] + $data['alias'] ); } else { $result = $this->_constraintFactory->create(['validator' => $validator, 'alias' => $data['alias']]); From 90ebccbb95d488db0b44ef568ace8e3ba5ec5e24 Mon Sep 17 00:00:00 2001 From: Arshad M Date: Wed, 3 May 2017 11:41:15 +0530 Subject: [PATCH 13/60] #7988 Typo in billingAddressFromData changed --- app/code/Magento/Checkout/view/frontend/web/js/checkout-data.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Checkout/view/frontend/web/js/checkout-data.js b/app/code/Magento/Checkout/view/frontend/web/js/checkout-data.js index b5d3c93de6539..2cf37296840a3 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/checkout-data.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/checkout-data.js @@ -39,7 +39,7 @@ define([ 'selectedShippingRate': null, 'selectedPaymentMethod': null, 'selectedBillingAddress': null, - 'billingAddressFormData': null, + 'billingAddressFromData': null, 'newCustomerBillingAddress': null }; saveData(checkoutData); From 5bc1a222fe16121d020ffbb578cf9f8688983f75 Mon Sep 17 00:00:00 2001 From: Arshad M Date: Wed, 3 May 2017 14:03:32 +0530 Subject: [PATCH 14/60] magento/magento2#7988 Added commnets in file checkout-data.js - added missing index in checkoutData --- .../view/frontend/web/js/checkout-data.js | 57 ++++++++++++++++--- 1 file changed, 49 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/Checkout/view/frontend/web/js/checkout-data.js b/app/code/Magento/Checkout/view/frontend/web/js/checkout-data.js index 2cf37296840a3..2c9950e522d22 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/checkout-data.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/checkout-data.js @@ -33,20 +33,24 @@ define([ if ($.isEmptyObject(getData())) { checkoutData = { - 'selectedShippingAddress': null, - 'shippingAddressFromData': null, - 'newCustomerShippingAddress': null, - 'selectedShippingRate': null, - 'selectedPaymentMethod': null, - 'selectedBillingAddress': null, - 'billingAddressFromData': null, - 'newCustomerBillingAddress': null + 'selectedShippingAddress': null, // Selected shipping address pullled from local storage (Persistence) + 'shippingAddressFromData': null, // Shipping address pullled from local storage (Persistence) + 'newCustomerShippingAddress': null, // Shipping address pullled from local storage for new customer (Persistence) + 'selectedShippingRate': null, // Shipping rate pulled from local storage (Persistence) + 'selectedPaymentMethod': null, // Payment method pulled from local storage (Persistence) + 'selectedBillingAddress': null, // Selected billing address pullled from local storage (Persistence) + 'billingAddressFromData': null, // Billing address pullled from local storage (Persistence) + 'newCustomerBillingAddress': null, // Billing address pullled from local storage for new customer (Persistence) + 'validatedEmailValue': null, // Validated email address from local storage (Persistence) + 'inputFieldEmailValue' : null // Email input field value from local storage (Persistence) }; saveData(checkoutData); } return { /** + * Setting the selected shipping address pulled from local storage + * * @param {Object} data */ setSelectedShippingAddress: function (data) { @@ -57,6 +61,8 @@ define([ }, /** + * Pulling the selected shipping address from local storage + * * @return {*} */ getSelectedShippingAddress: function () { @@ -64,6 +70,8 @@ define([ }, /** + * Setting the shipping address pulled from local storage + * * @param {Object} data */ setShippingAddressFromData: function (data) { @@ -74,6 +82,8 @@ define([ }, /** + * Pulling the shipping address from local storage + * * @return {*} */ getShippingAddressFromData: function () { @@ -81,6 +91,8 @@ define([ }, /** + * Setting the shipping address pulled from local storage for new customer + * * @param {Object} data */ setNewCustomerShippingAddress: function (data) { @@ -91,6 +103,8 @@ define([ }, /** + * Pulling the shipping address from local storage for new customer + * * @return {*} */ getNewCustomerShippingAddress: function () { @@ -98,6 +112,8 @@ define([ }, /** + * Setting the selected shipping rate pulled from local storage + * * @param {Object} data */ setSelectedShippingRate: function (data) { @@ -108,6 +124,8 @@ define([ }, /** + * Pulling the selected shipping rate from local storge + * * @return {*} */ getSelectedShippingRate: function () { @@ -115,6 +133,8 @@ define([ }, /** + * Setting the selected payment method pulled from local storage + * * @param {Object} data */ setSelectedPaymentMethod: function (data) { @@ -125,6 +145,8 @@ define([ }, /** + * Pulling the payment method from local storage + * * @return {*} */ getSelectedPaymentMethod: function () { @@ -132,6 +154,8 @@ define([ }, /** + * Setting the selected billing address pulled from local storage + * * @param {Object} data */ setSelectedBillingAddress: function (data) { @@ -142,6 +166,8 @@ define([ }, /** + * Pulling the selected billing address from local storage + * * @return {*} */ getSelectedBillingAddress: function () { @@ -149,6 +175,8 @@ define([ }, /** + * Setting the billing address pulled from local storage + * * @param {Object} data */ setBillingAddressFromData: function (data) { @@ -159,6 +187,7 @@ define([ }, /** + * Pulling the billing address from local storage * @return {*} */ getBillingAddressFromData: function () { @@ -166,6 +195,8 @@ define([ }, /** + * Setting the billing address pulled from local storage for new customer + * * @param {Object} data */ setNewCustomerBillingAddress: function (data) { @@ -176,6 +207,8 @@ define([ }, /** + * Pulling the billing address from local storage for new customer + * * @return {*} */ getNewCustomerBillingAddress: function () { @@ -183,6 +216,8 @@ define([ }, /** + * Pulling the email address from local storage + * * @return {*} */ getValidatedEmailValue: function () { @@ -192,6 +227,8 @@ define([ }, /** + * Setting the email address pulled from local storage + * * @param {String} email */ setValidatedEmailValue: function (email) { @@ -202,6 +239,8 @@ define([ }, /** + * Pulling the email input field value from local storage + * * @return {*} */ getInputFieldEmailValue: function () { @@ -211,6 +250,8 @@ define([ }, /** + * Setting the email input field value pulled from local storage + * * @param {String} email */ setInputFieldEmailValue: function (email) { From e3b22e4a95ef8abfbf689151e182089af43a198f Mon Sep 17 00:00:00 2001 From: Arshad M Date: Wed, 3 May 2017 14:43:10 +0530 Subject: [PATCH 15/60] magento/magento2#7988 Requested changes updated also reverted last updates in checkoutData index --- .../view/frontend/web/js/checkout-data.js | 56 +++++++++---------- 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/app/code/Magento/Checkout/view/frontend/web/js/checkout-data.js b/app/code/Magento/Checkout/view/frontend/web/js/checkout-data.js index 2c9950e522d22..d5ad5fea29dcf 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/checkout-data.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/checkout-data.js @@ -33,23 +33,21 @@ define([ if ($.isEmptyObject(getData())) { checkoutData = { - 'selectedShippingAddress': null, // Selected shipping address pullled from local storage (Persistence) - 'shippingAddressFromData': null, // Shipping address pullled from local storage (Persistence) - 'newCustomerShippingAddress': null, // Shipping address pullled from local storage for new customer (Persistence) - 'selectedShippingRate': null, // Shipping rate pulled from local storage (Persistence) - 'selectedPaymentMethod': null, // Payment method pulled from local storage (Persistence) - 'selectedBillingAddress': null, // Selected billing address pullled from local storage (Persistence) - 'billingAddressFromData': null, // Billing address pullled from local storage (Persistence) - 'newCustomerBillingAddress': null, // Billing address pullled from local storage for new customer (Persistence) - 'validatedEmailValue': null, // Validated email address from local storage (Persistence) - 'inputFieldEmailValue' : null // Email input field value from local storage (Persistence) + 'selectedShippingAddress': null, //Selected shipping address pullled from persistence storage. + 'shippingAddressFromData': null, //Shipping address pullled from persistence storage. + 'newCustomerShippingAddress': null, //Shipping address pullled from persistence storage for new customer. + 'selectedShippingRate': null, //Shipping rate pulled from persistence storage. + 'selectedPaymentMethod': null, //Payment method pulled from persistence storage. + 'selectedBillingAddress': null, //Selected billing address pullled from persistence storage. + 'billingAddressFromData': null, //Billing address pullled from persistence storage. + 'newCustomerBillingAddress': null //Billing address pullled from persistence storage for new customer. }; saveData(checkoutData); } return { /** - * Setting the selected shipping address pulled from local storage + * Setting the selected shipping address pulled from persistence storage. * * @param {Object} data */ @@ -61,7 +59,7 @@ define([ }, /** - * Pulling the selected shipping address from local storage + * Pulling the selected shipping address from persistence storage. * * @return {*} */ @@ -70,7 +68,7 @@ define([ }, /** - * Setting the shipping address pulled from local storage + * Setting the shipping address pulled from persistence storage. * * @param {Object} data */ @@ -82,7 +80,7 @@ define([ }, /** - * Pulling the shipping address from local storage + * Pulling the shipping address from persistence storage. * * @return {*} */ @@ -91,7 +89,7 @@ define([ }, /** - * Setting the shipping address pulled from local storage for new customer + * Setting the shipping address pulled from persistence storage for new customer. * * @param {Object} data */ @@ -103,7 +101,7 @@ define([ }, /** - * Pulling the shipping address from local storage for new customer + * Pulling the shipping address from persistence storage for new customer. * * @return {*} */ @@ -112,7 +110,7 @@ define([ }, /** - * Setting the selected shipping rate pulled from local storage + * Setting the selected shipping rate pulled from persistence storage. * * @param {Object} data */ @@ -133,7 +131,7 @@ define([ }, /** - * Setting the selected payment method pulled from local storage + * Setting the selected payment method pulled from persistence storage. * * @param {Object} data */ @@ -145,7 +143,7 @@ define([ }, /** - * Pulling the payment method from local storage + * Pulling the payment method from persistence storage. * * @return {*} */ @@ -154,7 +152,7 @@ define([ }, /** - * Setting the selected billing address pulled from local storage + * Setting the selected billing address pulled from persistence storage. * * @param {Object} data */ @@ -166,7 +164,7 @@ define([ }, /** - * Pulling the selected billing address from local storage + * Pulling the selected billing address from persistence storage. * * @return {*} */ @@ -175,7 +173,7 @@ define([ }, /** - * Setting the billing address pulled from local storage + * Setting the billing address pulled from persistence storage. * * @param {Object} data */ @@ -187,7 +185,7 @@ define([ }, /** - * Pulling the billing address from local storage + * Pulling the billing address from persistence storage. * @return {*} */ getBillingAddressFromData: function () { @@ -195,7 +193,7 @@ define([ }, /** - * Setting the billing address pulled from local storage for new customer + * Setting the billing address pulled from persistence storage for new customer. * * @param {Object} data */ @@ -207,7 +205,7 @@ define([ }, /** - * Pulling the billing address from local storage for new customer + * Pulling the billing address from persistence storage for new customer. * * @return {*} */ @@ -216,7 +214,7 @@ define([ }, /** - * Pulling the email address from local storage + * Pulling the email address from persistence storage. * * @return {*} */ @@ -227,7 +225,7 @@ define([ }, /** - * Setting the email address pulled from local storage + * Setting the email address pulled from persistence storage. * * @param {String} email */ @@ -239,7 +237,7 @@ define([ }, /** - * Pulling the email input field value from local storage + * Pulling the email input field value from persistence storage. * * @return {*} */ @@ -250,7 +248,7 @@ define([ }, /** - * Setting the email input field value pulled from local storage + * Setting the email input field value pulled from persistence storage. * * @param {String} email */ From 73ac8c4bd994764a2e401b2c6b1c2f22d7a27ed0 Mon Sep 17 00:00:00 2001 From: Arshad M Date: Wed, 3 May 2017 17:37:43 +0530 Subject: [PATCH 16/60] magento/magento2#7988 Changed typo pullled to pulled --- .../Checkout/view/frontend/web/js/checkout-data.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/Checkout/view/frontend/web/js/checkout-data.js b/app/code/Magento/Checkout/view/frontend/web/js/checkout-data.js index d5ad5fea29dcf..49911ddbee9d4 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/checkout-data.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/checkout-data.js @@ -33,14 +33,14 @@ define([ if ($.isEmptyObject(getData())) { checkoutData = { - 'selectedShippingAddress': null, //Selected shipping address pullled from persistence storage. - 'shippingAddressFromData': null, //Shipping address pullled from persistence storage. - 'newCustomerShippingAddress': null, //Shipping address pullled from persistence storage for new customer. + 'selectedShippingAddress': null, //Selected shipping address pulled from persistence storage. + 'shippingAddressFromData': null, //Shipping address pulled from persistence storage. + 'newCustomerShippingAddress': null, //Shipping address pulled from persistence storage for new customer. 'selectedShippingRate': null, //Shipping rate pulled from persistence storage. 'selectedPaymentMethod': null, //Payment method pulled from persistence storage. - 'selectedBillingAddress': null, //Selected billing address pullled from persistence storage. - 'billingAddressFromData': null, //Billing address pullled from persistence storage. - 'newCustomerBillingAddress': null //Billing address pullled from persistence storage for new customer. + 'selectedBillingAddress': null, //Selected billing address pulled from persistence storage. + 'billingAddressFromData': null, //Billing address pulled from persistence storage. + 'newCustomerBillingAddress': null //Billing address pulled from persistence storage for new customer. }; saveData(checkoutData); } From f68dd921c7e0d064220780fd301d0c06aa6012b8 Mon Sep 17 00:00:00 2001 From: vpiyappan Date: Fri, 5 May 2017 15:15:31 +0530 Subject: [PATCH 17/60] Fixed the label to be consistent Changed small "gift options" to "Gift Options" for Multisipping address. --- app/code/Magento/GiftMessage/i18n/en_US.csv | 6 +++--- .../GiftMessage/view/frontend/templates/inline.phtml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/code/Magento/GiftMessage/i18n/en_US.csv b/app/code/Magento/GiftMessage/i18n/en_US.csv index 5c82c8e5aeb81..bac6989bd01ae 100644 --- a/app/code/Magento/GiftMessage/i18n/en_US.csv +++ b/app/code/Magento/GiftMessage/i18n/en_US.csv @@ -22,7 +22,7 @@ OK,OK "Gift Options","Gift Options" "Gift Message","Gift Message" "Do you have any gift items in your order?","Do you have any gift items in your order?" -"Add gift options","Add gift options" +"Add Gift Options","Add Gift Options" "Gift Options for the Entire Order","Gift Options for the Entire Order" "Leave this box blank if you don\'t want to leave a gift message for the entire order.","Leave this box blank if you don\'t want to leave a gift message for the entire order." "Gift Options for Individual Items","Gift Options for Individual Items" @@ -30,14 +30,14 @@ OK,OK "Leave a box blank if you don\'t want to add a gift message for that item.","Leave a box blank if you don\'t want to add a gift message for that item." "Add Gift Options for the Entire Order","Add Gift Options for the Entire Order" "You can leave this box blank if you don\'t want to add a gift message for this address.","You can leave this box blank if you don\'t want to add a gift message for this address." -"Add gift options for Individual Items","Add gift options for Individual Items" +"Add Gift Options for Individual Items","Add Gift Options for Individual Items" "You can leave this box blank if you don\'t want to add a gift message for the item.","You can leave this box blank if you don\'t want to add a gift message for the item." "Gift Message (optional)","Gift Message (optional)" To:,To: From:,From: Message:,Message: Update,Update -"Gift options","Gift options" +"Gift Options","Gift Options" Edit,Edit Delete,Delete "Allow Gift Messages on Order Level","Allow Gift Messages on Order Level" diff --git a/app/code/Magento/GiftMessage/view/frontend/templates/inline.phtml b/app/code/Magento/GiftMessage/view/frontend/templates/inline.phtml index 8fbb6918d7119..6155cfc37c4ad 100644 --- a/app/code/Magento/GiftMessage/view/frontend/templates/inline.phtml +++ b/app/code/Magento/GiftMessage/view/frontend/templates/inline.phtml @@ -14,7 +14,7 @@
getItemsHasMesssages() || $block->getEntityHasMessage()): ?> checked="checked" class="checkbox" /> - +
@@ -148,7 +148,7 @@
getItemsHasMesssages() || $block->getEntityHasMessage()): ?> checked="checked" class="checkbox" /> - +
@@ -197,7 +197,7 @@
getItemsHasMesssages()): ?> checked="checked" class="checkbox" /> - +
From d3b54864af54114f0914785e4e2153d17602cdba Mon Sep 17 00:00:00 2001 From: Oleksii Korshenko Date: Mon, 15 May 2017 11:49:24 -0500 Subject: [PATCH 18/60] MAGETWO-68877: Issue #7988 Typo changed also added comments for each index, getters and setters. #9484 - fixed code style issue --- .../Checkout/view/frontend/web/js/checkout-data.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Checkout/view/frontend/web/js/checkout-data.js b/app/code/Magento/Checkout/view/frontend/web/js/checkout-data.js index 49911ddbee9d4..01d65f8cd856b 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/checkout-data.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/checkout-data.js @@ -48,7 +48,7 @@ define([ return { /** * Setting the selected shipping address pulled from persistence storage. - * + * * @param {Object} data */ setSelectedShippingAddress: function (data) { @@ -60,7 +60,7 @@ define([ /** * Pulling the selected shipping address from persistence storage. - * + * * @return {*} */ getSelectedShippingAddress: function () { @@ -80,7 +80,7 @@ define([ }, /** - * Pulling the shipping address from persistence storage. + * Pulling the shipping address from persistence storage. * * @return {*} */ @@ -122,7 +122,7 @@ define([ }, /** - * Pulling the selected shipping rate from local storge + * Pulling the selected shipping rate from local storage. * * @return {*} */ From 1e878622b63ebf624388938941011f27e721b209 Mon Sep 17 00:00:00 2001 From: Oleksii Korshenko Date: Mon, 15 May 2017 13:17:07 -0500 Subject: [PATCH 19/60] MAGETWO-68877: Issue #7988 Typo changed also added comments for each index, getters and setters. #9484 - fixed code style issue --- .../view/frontend/web/js/checkout-data.js | 57 ++++++++++--------- 1 file changed, 29 insertions(+), 28 deletions(-) diff --git a/app/code/Magento/Checkout/view/frontend/web/js/checkout-data.js b/app/code/Magento/Checkout/view/frontend/web/js/checkout-data.js index 01d65f8cd856b..4ebe145b11d06 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/checkout-data.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/checkout-data.js @@ -33,21 +33,21 @@ define([ if ($.isEmptyObject(getData())) { checkoutData = { - 'selectedShippingAddress': null, //Selected shipping address pulled from persistence storage. - 'shippingAddressFromData': null, //Shipping address pulled from persistence storage. - 'newCustomerShippingAddress': null, //Shipping address pulled from persistence storage for new customer. - 'selectedShippingRate': null, //Shipping rate pulled from persistence storage. - 'selectedPaymentMethod': null, //Payment method pulled from persistence storage. - 'selectedBillingAddress': null, //Selected billing address pulled from persistence storage. - 'billingAddressFromData': null, //Billing address pulled from persistence storage. - 'newCustomerBillingAddress': null //Billing address pulled from persistence storage for new customer. + 'selectedShippingAddress': null, //Selected shipping address pulled from persistence storage + 'shippingAddressFromData': null, //Shipping address pulled from persistence storage + 'newCustomerShippingAddress': null, //Shipping address pulled from persistence storage for new customer + 'selectedShippingRate': null, //Shipping rate pulled from persistence storage + 'selectedPaymentMethod': null, //Payment method pulled from persistence storage + 'selectedBillingAddress': null, //Selected billing address pulled from persistence storage + 'billingAddressFromData': null, //Billing address pulled from persistence storage + 'newCustomerBillingAddress': null //Billing address pulled from persistence storage for new customer }; saveData(checkoutData); } return { /** - * Setting the selected shipping address pulled from persistence storage. + * Setting the selected shipping address pulled from persistence storage * * @param {Object} data */ @@ -59,7 +59,7 @@ define([ }, /** - * Pulling the selected shipping address from persistence storage. + * Pulling the selected shipping address from persistence storage * * @return {*} */ @@ -68,7 +68,7 @@ define([ }, /** - * Setting the shipping address pulled from persistence storage. + * Setting the shipping address pulled from persistence storage * * @param {Object} data */ @@ -80,7 +80,7 @@ define([ }, /** - * Pulling the shipping address from persistence storage. + * Pulling the shipping address from persistence storage * * @return {*} */ @@ -89,7 +89,7 @@ define([ }, /** - * Setting the shipping address pulled from persistence storage for new customer. + * Setting the shipping address pulled from persistence storage for new customer * * @param {Object} data */ @@ -101,7 +101,7 @@ define([ }, /** - * Pulling the shipping address from persistence storage for new customer. + * Pulling the shipping address from persistence storage for new customer * * @return {*} */ @@ -110,7 +110,7 @@ define([ }, /** - * Setting the selected shipping rate pulled from persistence storage. + * Setting the selected shipping rate pulled from persistence storage * * @param {Object} data */ @@ -122,7 +122,7 @@ define([ }, /** - * Pulling the selected shipping rate from local storage. + * Pulling the selected shipping rate from local storage * * @return {*} */ @@ -131,7 +131,7 @@ define([ }, /** - * Setting the selected payment method pulled from persistence storage. + * Setting the selected payment method pulled from persistence storage * * @param {Object} data */ @@ -143,7 +143,7 @@ define([ }, /** - * Pulling the payment method from persistence storage. + * Pulling the payment method from persistence storage * * @return {*} */ @@ -152,7 +152,7 @@ define([ }, /** - * Setting the selected billing address pulled from persistence storage. + * Setting the selected billing address pulled from persistence storage * * @param {Object} data */ @@ -164,7 +164,7 @@ define([ }, /** - * Pulling the selected billing address from persistence storage. + * Pulling the selected billing address from persistence storage * * @return {*} */ @@ -173,7 +173,7 @@ define([ }, /** - * Setting the billing address pulled from persistence storage. + * Setting the billing address pulled from persistence storage * * @param {Object} data */ @@ -185,7 +185,8 @@ define([ }, /** - * Pulling the billing address from persistence storage. + * Pulling the billing address from persistence storage + * * @return {*} */ getBillingAddressFromData: function () { @@ -193,7 +194,7 @@ define([ }, /** - * Setting the billing address pulled from persistence storage for new customer. + * Setting the billing address pulled from persistence storage for new customer * * @param {Object} data */ @@ -205,7 +206,7 @@ define([ }, /** - * Pulling the billing address from persistence storage for new customer. + * Pulling the billing address from persistence storage for new customer * * @return {*} */ @@ -214,7 +215,7 @@ define([ }, /** - * Pulling the email address from persistence storage. + * Pulling the email address from persistence storage * * @return {*} */ @@ -225,7 +226,7 @@ define([ }, /** - * Setting the email address pulled from persistence storage. + * Setting the email address pulled from persistence storage * * @param {String} email */ @@ -237,7 +238,7 @@ define([ }, /** - * Pulling the email input field value from persistence storage. + * Pulling the email input field value from persistence storage * * @return {*} */ @@ -248,7 +249,7 @@ define([ }, /** - * Setting the email input field value pulled from persistence storage. + * Setting the email input field value pulled from persistence storage * * @param {String} email */ From 6d44dd8fc64753d995c368a690af71cce55cccdd Mon Sep 17 00:00:00 2001 From: "Karpenko, Oleksandr" Date: Tue, 16 May 2017 12:47:49 +0300 Subject: [PATCH 20/60] MAGETWO-54702: Failed ClearAllCompareProductsTest test due to Alert window. --- .../Test/TestCase/Product/ClearAllCompareProductsTest.php | 1 + .../Test/TestCase/Product/ClearAllCompareProductsTest.xml | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ClearAllCompareProductsTest.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ClearAllCompareProductsTest.php index e6a7f60bcec0d..ebd455fa1ed93 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ClearAllCompareProductsTest.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ClearAllCompareProductsTest.php @@ -28,6 +28,7 @@ class ClearAllCompareProductsTest extends AbstractCompareProductsTest { /* tags */ const MVP = 'yes'; + const TEST_TYPE = 'extended_acceptance_test'; /* end tags */ /** diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ClearAllCompareProductsTest.xml b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ClearAllCompareProductsTest.xml index 1a702147b40f4..523156fb0de74 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ClearAllCompareProductsTest.xml +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/TestCase/Product/ClearAllCompareProductsTest.xml @@ -8,7 +8,6 @@ - stable:no compare_products catalogProductSimple::simple_for_composite_products,catalogProductVirtual::default,downloadableProduct::default,groupedProduct::grouped_product_with_price,configurableProduct::default,bundleProduct::bundle_dynamic_product,bundleProduct::bundle_fixed_product From 19a6485f7891c0990ba3b493b7d2e28842a96633 Mon Sep 17 00:00:00 2001 From: Volodymyr Zaets Date: Wed, 17 May 2017 10:11:18 +0300 Subject: [PATCH 21/60] MAGETWO-66885: Special Characters like % in widget inside of WYSIWYG gives an error #9452 --- lib/web/mage/adminhtml/wysiwyg/tiny_mce/setup.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/setup.js b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/setup.js index aa0b19f5f11a2..f2b3365555f3c 100755 --- a/lib/web/mage/adminhtml/wysiwyg/tiny_mce/setup.js +++ b/lib/web/mage/adminhtml/wysiwyg/tiny_mce/setup.js @@ -463,8 +463,6 @@ define([ var url = this.makeDirectiveUrl('%directive%').replace(/([$^.?*!+:=()\[\]{}|\\])/g, '\\$1'), reg = new RegExp(url.replace('%directive%', '([a-zA-Z0-9,_-]+)')); - content = decodeURIComponent(content); - return content.gsub(reg, function (match) { //eslint-disable-line no-extra-bind return Base64.mageDecode(match[1]); }); From e13194db9dfc7c56b4361a18131ad06b9f0bd64d Mon Sep 17 00:00:00 2001 From: Maxim Medinskiy Date: Fri, 19 May 2017 12:13:46 +0300 Subject: [PATCH 22/60] MAGETWO-59514: Hard coded "tax_region_id" in the \Magento\Tax\Setup\InstallData --- app/code/Magento/Tax/Setup/RecurringData.php | 92 ++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 app/code/Magento/Tax/Setup/RecurringData.php diff --git a/app/code/Magento/Tax/Setup/RecurringData.php b/app/code/Magento/Tax/Setup/RecurringData.php new file mode 100644 index 0000000000000..bc05db428cde8 --- /dev/null +++ b/app/code/Magento/Tax/Setup/RecurringData.php @@ -0,0 +1,92 @@ +taxRateRepository = $taxRateRepository; + $this->searchCriteriaFactory = $searchCriteriaFactory; + $this->directoryRegionFactory = $directoryRegionFactory; + } + + /** + * {@inheritdoc} + */ + public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) + { + $taxRateList = $this->taxRateRepository->getList($this->searchCriteriaFactory->create()); + /** @var \Magento\Tax\Api\Data\TaxRateInterface $taxRateData */ + foreach ($taxRateList->getItems() as $taxRateData) { + $regionCode = $this->parseRegionFromTaxCode($taxRateData->getCode()); + if ($regionCode) { + /** @var \Magento\Directory\Model\Region $region */ + $region = $this->directoryRegionFactory->create(); + $region->loadByCode($regionCode, $taxRateData->getTaxCountryId()); + $taxRateData->setTaxRegionId($region->getRegionId()); + $this->taxRateRepository->save($taxRateData); + } + } + } + + /** + * Parse region code from tax code + * + * @param string $taxCode + * @return string + */ + private function parseRegionFromTaxCode($taxCode) + { + $result = ''; + $parts = explode('-', $taxCode, 3); + + if (isset($parts[1])) { + $result = $parts[1]; + } + + return $result; + } +} From 948bea6af5f4041816cdf6d74bb3c3c64d7e83c1 Mon Sep 17 00:00:00 2001 From: Ievgen Kolesov Date: Fri, 19 May 2017 16:19:29 +0300 Subject: [PATCH 23/60] MAGETWO-64952: Admin login does not handle autocomplete feature correctly --- .../Backend/view/adminhtml/templates/admin/login.phtml | 2 +- .../Backup/view/adminhtml/templates/backup/dialogs.phtml | 4 ++-- setup/view/magento/setup/marketplace-credentials.phtml | 3 +++ setup/view/magento/setup/popupauth.phtml | 3 +++ setup/view/magento/setup/system-config.phtml | 5 +++-- 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Backend/view/adminhtml/templates/admin/login.phtml b/app/code/Magento/Backend/view/adminhtml/templates/admin/login.phtml index b951fd2c19495..c829a2f01fa9c 100644 --- a/app/code/Magento/Backend/view/adminhtml/templates/admin/login.phtml +++ b/app/code/Magento/Backend/view/adminhtml/templates/admin/login.phtml @@ -43,7 +43,7 @@ data-validate="{required:true}" value="" placeholder="" - autocomplete="off" + autocomplete="new-password" /> diff --git a/app/code/Magento/Backup/view/adminhtml/templates/backup/dialogs.phtml b/app/code/Magento/Backup/view/adminhtml/templates/backup/dialogs.phtml index 03d52ab9e5703..2eebcdbe65749 100644 --- a/app/code/Magento/Backup/view/adminhtml/templates/backup/dialogs.phtml +++ b/app/code/Magento/Backup/view/adminhtml/templates/backup/dialogs.phtml @@ -73,7 +73,7 @@
-
+
@@ -119,7 +119,7 @@
- +
diff --git a/setup/view/magento/setup/marketplace-credentials.phtml b/setup/view/magento/setup/marketplace-credentials.phtml index 22ad4b6558f33..c13517f2200ee 100644 --- a/setup/view/magento/setup/marketplace-credentials.phtml +++ b/setup/view/magento/setup/marketplace-credentials.phtml @@ -23,6 +23,7 @@
@@ -63,6 +64,7 @@ || (auth.username.$error.required && user.submitted) }" autofocus required + autocomplete="off" >
This is a required field. @@ -84,6 +86,7 @@ && !auth.password.$pristine) || (auth.password.$error.required && user.submitted) }" required + autocomplete="new-password" >
This is a required field. diff --git a/setup/view/magento/setup/popupauth.phtml b/setup/view/magento/setup/popupauth.phtml index 87263c7247461..bce55a7c336dc 100644 --- a/setup/view/magento/setup/popupauth.phtml +++ b/setup/view/magento/setup/popupauth.phtml @@ -32,6 +32,7 @@
@@ -62,6 +63,7 @@ || (auth.username.$error.required && user.submitted) }" autofocus required + autocomplete="off" >
This is a required field. @@ -83,6 +85,7 @@ && !auth.password.$pristine) || (auth.password.$error.required && user.submitted) }" required + autocomplete="new-password" >
This is a required field. diff --git a/setup/view/magento/setup/system-config.phtml b/setup/view/magento/setup/system-config.phtml index 65c13ab3cdf18..55087c5a99491 100644 --- a/setup/view/magento/setup/system-config.phtml +++ b/setup/view/magento/setup/system-config.phtml @@ -57,7 +57,7 @@

Magento Marketplace

Sign in to sync your Magento Marketplace purchases.

- +
@@ -74,6 +74,7 @@ || (auth.username.$error.required && user.submitted)}" autofocus required + autocomplete="off" >
This is a required field. @@ -100,7 +101,7 @@ ng-class="{ 'invalid' : (auth.password.$error.required && !auth.password.$pristine) || (auth.password.$error.required && user.submitted) }" required - autocomplete="off" + autocomplete="new-password" >
This is a required field. From c7e5edbf719e9de98bf0d15f7e36a6f0887a1601 Mon Sep 17 00:00:00 2001 From: Dmytro Yushkin Date: Fri, 26 May 2017 17:58:27 +0300 Subject: [PATCH 24/60] MAGETWO-60828: [Github] Exception when switching locale in some configurations --- .../Framework/View/Element/Html/Calendar.php | 21 +++- .../Test/Unit/Element/Html/CalendarTest.php | 95 ++++++++++++++----- 2 files changed, 88 insertions(+), 28 deletions(-) diff --git a/lib/internal/Magento/Framework/View/Element/Html/Calendar.php b/lib/internal/Magento/Framework/View/Element/Html/Calendar.php index 8bfa611466ac4..0c8187569cf28 100644 --- a/lib/internal/Magento/Framework/View/Element/Html/Calendar.php +++ b/lib/internal/Magento/Framework/View/Element/Html/Calendar.php @@ -78,14 +78,31 @@ protected function _toHtml() ] ); - // get months names + /** + * Month names in abbreviated format values was added to ICU Data tables + * starting ICU library version 52.1. For some OS, like CentOS, default + * installation version of ICU library is 50.1.2, which not contain + * 'abbreviated' key, and that may cause a PHP fatal error when passing + * as an argument of function 'iterator_to_array'. This issue affects + * locales like ja_JP, ko_KR etc. + * + * @see http://source.icu-project.org/repos/icu/tags/release-50-1-2/icu4c/source/data/locales/ja.txt + * @see http://source.icu-project.org/repos/icu/tags/release-52-1/icu4c/source/data/locales/ja.txt + * @var \ResourceBundle $monthsData + */ $monthsData = $localeData['calendar']['gregorian']['monthNames']; $this->assign( 'months', [ 'wide' => $this->encoder->encode(array_values(iterator_to_array($monthsData['format']['wide']))), 'abbreviated' => $this->encoder->encode( - array_values(iterator_to_array($monthsData['format']['abbreviated'])) + array_values( + iterator_to_array( + null !== $monthsData->get('format')->get('abbreviated') + ? $monthsData['format']['abbreviated'] + : $monthsData['format']['wide'] + ) + ) ), ] ); diff --git a/lib/internal/Magento/Framework/View/Test/Unit/Element/Html/CalendarTest.php b/lib/internal/Magento/Framework/View/Test/Unit/Element/Html/CalendarTest.php index d5a9adb80a84a..36e16499ca763 100644 --- a/lib/internal/Magento/Framework/View/Test/Unit/Element/Html/CalendarTest.php +++ b/lib/internal/Magento/Framework/View/Test/Unit/Element/Html/CalendarTest.php @@ -5,49 +5,92 @@ */ namespace Magento\Framework\View\Test\Unit\Element\Html; +use Magento\Framework\Locale\ResolverInterface; +use Magento\Framework\Stdlib\DateTime\TimezoneInterface; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\Framework\View\Element\Html\Calendar; +use Magento\Framework\View\Element\Template\Context; +use PHPUnit_Framework_MockObject_MockObject as MockObject; + +/** + * @see Calendar + */ class CalendarTest extends \PHPUnit_Framework_TestCase { /** - * @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager + * @see MAGETWO-60828 + * @see Calendar::_toHtml + * + * @param string $locale + * @dataProvider localesDataProvider */ - protected $objectManagerHelper; - - /** @var \Magento\Framework\View\Element\Html\Calendar */ - protected $block; - - /** @var \Magento\Framework\View\Element\Template\Context */ - protected $context; + public function testToHtmlWithDifferentLocales($locale) + { + $calendarBlock = (new ObjectManager($this))->getObject( + Calendar::class, + [ + 'localeResolver' => $this->getLocalResolver($locale) + ] + ); - /** @var \Magento\Framework\Stdlib\DateTime\TimezoneInterface|\PHPUnit_Framework_MockObject_MockObject */ - protected $localeDate; + $calendarBlock->toHtml(); + } - protected function setUp() + /** + * @return array + */ + public function localesDataProvider() { - $this->objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); - $this->localeDate = $this->getMockBuilder(\Magento\Framework\Stdlib\DateTime\TimezoneInterface::class) - ->getMock(); + return [ + ['en_US'], + ['ja_JP'], + ['ko_KR'], + ]; + } - /** @var \Magento\Framework\View\Element\Template\Context $context */ - $this->context = $this->objectManagerHelper->getObject( - \Magento\Framework\View\Element\Template\Context::class, + /** + * @see Calendar::getYearRange + */ + public function testGetYearRange() + { + $calendarBlock = (new ObjectManager($this))->getObject( + Calendar::class, [ - 'localeDate' => $this->localeDate, + 'context' => $this->getContext() ] ); - /** @var \Magento\Framework\View\Element\Html\Links $block */ - $this->block = $this->objectManagerHelper->getObject( - \Magento\Framework\View\Element\Html\Calendar::class, - ['context' => $this->context] + $testCurrentYear = (new \DateTime())->format('Y'); + $this->assertEquals( + (int) $testCurrentYear - 100 . ':' . ($testCurrentYear + 100), + $calendarBlock->getYearRange() ); } /** - * @test + * @param string $locale + * @return ResolverInterface|MockObject */ - public function testGetYearRange() + private function getLocalResolver($locale) { - $testCurrentYear = (new \DateTime())->format('Y'); - $this->assertEquals((int)$testCurrentYear - 100 . ':' . ($testCurrentYear + 100), $this->block->getYearRange()); + $localResolver = $this->getMockBuilder(ResolverInterface::class) + ->getMockForAbstractClass(); + $localResolver->method('getLocale')->willReturn($locale); + + return $localResolver; + } + + /** + * @return Context|Object + */ + private function getContext() + { + $localeDate = $this->getMockBuilder(TimezoneInterface::class) + ->getMockForAbstractClass(); + + return (new ObjectManager($this))->getObject( + Context::class, + ['localeDate' => $localeDate] + ); } } From 2c3b42daf1135d2e241493e616b7e6da3fec5e1b Mon Sep 17 00:00:00 2001 From: Volodymyr Kublytskyi Date: Wed, 31 May 2017 13:07:56 +0300 Subject: [PATCH 25/60] MAGETWO-69539: PHP "soap" extension is not declared in composer.json but can be used by Magento modules --- composer.json | 1 + composer.lock | 202 +++++++++++++++++++++++++------------------------- 2 files changed, 102 insertions(+), 101 deletions(-) diff --git a/composer.json b/composer.json index 95a1ae33985da..fe877bff8bcf4 100644 --- a/composer.json +++ b/composer.json @@ -68,6 +68,7 @@ "ext-openssl": "*", "ext-zip": "*", "ext-pdo_mysql": "*", + "ext-soap": "*", "sjparkinson/static-review": "~4.1", "ramsey/uuid": "3.6.1" }, diff --git a/composer.lock b/composer.lock index f4b32154e8370..37c12c515256b 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "54e536d6a16773c0efc4d6a7a6e668d4", - "content-hash": "83b07861c465af490d6cf0c75adc78fd", + "content-hash": "1bc90f92ebb53912b7f58e7fef0cc57e", "packages": [ { "name": "braintree/braintree_php", @@ -52,7 +51,7 @@ } ], "description": "Braintree PHP Client Library", - "time": "2017-02-16 19:59:04" + "time": "2017-02-16T19:59:04+00:00" }, { "name": "colinmollenhour/cache-backend-file", @@ -88,7 +87,7 @@ ], "description": "The stock Zend_Cache_Backend_File backend has extremely poor performance for cleaning by tags making it become unusable as the number of cached items increases. This backend makes many changes resulting in a huge performance boost, especially for tag cleaning.", "homepage": "https://github.com/colinmollenhour/Cm_Cache_Backend_File", - "time": "2016-05-02 16:24:47" + "time": "2016-05-02T16:24:47+00:00" }, { "name": "colinmollenhour/cache-backend-redis", @@ -124,7 +123,7 @@ ], "description": "Zend_Cache backend using Redis with full support for tags.", "homepage": "https://github.com/colinmollenhour/Cm_Cache_Backend_Redis", - "time": "2017-03-25 04:54:24" + "time": "2017-03-25T04:54:24+00:00" }, { "name": "colinmollenhour/credis", @@ -163,7 +162,7 @@ ], "description": "Credis is a lightweight interface to the Redis key-value store which wraps the phpredis library when available for better performance.", "homepage": "https://github.com/colinmollenhour/credis", - "time": "2015-11-28 01:20:04" + "time": "2015-11-28T01:20:04+00:00" }, { "name": "colinmollenhour/php-redis-session-abstract", @@ -200,7 +199,7 @@ ], "description": "A Redis-based session handler with optimistic locking", "homepage": "https://github.com/colinmollenhour/php-redis-session-abstract", - "time": "2017-04-19 14:21:43" + "time": "2017-04-19T14:21:43+00:00" }, { "name": "composer/ca-bundle", @@ -259,7 +258,7 @@ "ssl", "tls" ], - "time": "2017-03-06 11:59:08" + "time": "2017-03-06T11:59:08+00:00" }, { "name": "composer/composer", @@ -336,7 +335,7 @@ "dependency", "package" ], - "time": "2017-03-10 08:29:45" + "time": "2017-03-10T08:29:45+00:00" }, { "name": "composer/semver", @@ -398,7 +397,7 @@ "validation", "versioning" ], - "time": "2016-08-30 16:08:34" + "time": "2016-08-30T16:08:34+00:00" }, { "name": "composer/spdx-licenses", @@ -459,7 +458,7 @@ "spdx", "validator" ], - "time": "2017-04-03 19:08:52" + "time": "2017-04-03T19:08:52+00:00" }, { "name": "container-interop/container-interop", @@ -490,7 +489,7 @@ ], "description": "Promoting the interoperability of container objects (DIC, SL, etc.)", "homepage": "https://github.com/container-interop/container-interop", - "time": "2017-02-14 19:40:03" + "time": "2017-02-14T19:40:03+00:00" }, { "name": "justinrainbow/json-schema", @@ -557,7 +556,7 @@ "json", "schema" ], - "time": "2017-03-22 22:43:35" + "time": "2017-03-22T22:43:35+00:00" }, { "name": "league/climate", @@ -606,7 +605,7 @@ "php", "terminal" ], - "time": "2015-01-18 14:31:58" + "time": "2015-01-18T14:31:58+00:00" }, { "name": "magento/composer", @@ -642,7 +641,7 @@ "AFL-3.0" ], "description": "Magento composer library helps to instantiate Composer application and run composer commands.", - "time": "2017-04-24 09:57:02" + "time": "2017-04-24T09:57:02+00:00" }, { "name": "magento/magento-composer-installer", @@ -721,7 +720,7 @@ "composer-installer", "magento" ], - "time": "2016-10-06 16:05:07" + "time": "2016-10-06T16:05:07+00:00" }, { "name": "magento/zendframework1", @@ -768,7 +767,7 @@ "ZF1", "framework" ], - "time": "2017-04-24 09:56:59" + "time": "2017-04-24T09:56:59+00:00" }, { "name": "monolog/monolog", @@ -846,7 +845,7 @@ "logging", "psr-3" ], - "time": "2017-03-13 07:08:03" + "time": "2017-03-13T07:08:03+00:00" }, { "name": "oyejorge/less.php", @@ -908,7 +907,7 @@ "php", "stylesheet" ], - "time": "2017-03-28 22:19:25" + "time": "2017-03-28T22:19:25+00:00" }, { "name": "paragonie/random_compat", @@ -956,7 +955,7 @@ "pseudorandom", "random" ], - "time": "2017-03-13 16:27:32" + "time": "2017-03-13T16:27:32+00:00" }, { "name": "pelago/emogrifier", @@ -1012,7 +1011,7 @@ ], "description": "Converts CSS styles into inline style attributes in your HTML code", "homepage": "http://www.pelagodesign.com/sidecar/emogrifier/", - "time": "2015-05-15 11:37:51" + "time": "2015-05-15T11:37:51+00:00" }, { "name": "phpseclib/phpseclib", @@ -1104,7 +1103,7 @@ "x.509", "x509" ], - "time": "2016-10-04 00:57:04" + "time": "2016-10-04T00:57:04+00:00" }, { "name": "psr/container", @@ -1153,7 +1152,7 @@ "container-interop", "psr" ], - "time": "2017-02-14 16:28:37" + "time": "2017-02-14T16:28:37+00:00" }, { "name": "psr/log", @@ -1200,7 +1199,7 @@ "psr", "psr-3" ], - "time": "2016-10-10 12:19:37" + "time": "2016-10-10T12:19:37+00:00" }, { "name": "ramsey/uuid", @@ -1282,7 +1281,7 @@ "identifier", "uuid" ], - "time": "2017-03-26 20:37:53" + "time": "2017-03-26T20:37:53+00:00" }, { "name": "seld/cli-prompt", @@ -1330,7 +1329,7 @@ "input", "prompt" ], - "time": "2017-03-18 11:32:45" + "time": "2017-03-18T11:32:45+00:00" }, { "name": "seld/jsonlint", @@ -1379,7 +1378,7 @@ "parser", "validator" ], - "time": "2017-03-06 16:42:24" + "time": "2017-03-06T16:42:24+00:00" }, { "name": "seld/phar-utils", @@ -1423,7 +1422,7 @@ "keywords": [ "phra" ], - "time": "2015-10-13 18:44:15" + "time": "2015-10-13T18:44:15+00:00" }, { "name": "sjparkinson/static-review", @@ -1476,7 +1475,7 @@ } ], "description": "An extendable framework for version control hooks.", - "time": "2014-09-22 08:40:36" + "time": "2014-09-22T08:40:36+00:00" }, { "name": "symfony/console", @@ -1537,7 +1536,7 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2017-04-26 01:38:53" + "time": "2017-04-26T01:38:53+00:00" }, { "name": "symfony/debug", @@ -1594,7 +1593,7 @@ ], "description": "Symfony Debug Component", "homepage": "https://symfony.com", - "time": "2016-07-30 07:22:48" + "time": "2016-07-30T07:22:48+00:00" }, { "name": "symfony/event-dispatcher", @@ -1654,7 +1653,7 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2017-04-26 16:56:54" + "time": "2017-04-26T16:56:54+00:00" }, { "name": "symfony/filesystem", @@ -1703,7 +1702,7 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2017-04-12 14:13:17" + "time": "2017-04-12T14:13:17+00:00" }, { "name": "symfony/finder", @@ -1752,7 +1751,7 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2017-04-12 14:13:17" + "time": "2017-04-12T14:13:17+00:00" }, { "name": "symfony/polyfill-mbstring", @@ -1811,7 +1810,7 @@ "portable", "shim" ], - "time": "2016-11-14 01:06:16" + "time": "2016-11-14T01:06:16+00:00" }, { "name": "symfony/process", @@ -1860,7 +1859,7 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2017-04-12 14:07:15" + "time": "2017-04-12T14:07:15+00:00" }, { "name": "tedivm/jshrink", @@ -1906,7 +1905,7 @@ "javascript", "minifier" ], - "time": "2015-07-04 07:35:09" + "time": "2015-07-04T07:35:09+00:00" }, { "name": "tubalmartin/cssmin", @@ -1954,7 +1953,7 @@ "minify", "yui" ], - "time": "2017-04-04 14:33:00" + "time": "2017-04-04T14:33:00+00:00" }, { "name": "zendframework/zend-captcha", @@ -2011,7 +2010,7 @@ "captcha", "zf2" ], - "time": "2017-02-23 08:09:44" + "time": "2017-02-23T08:09:44+00:00" }, { "name": "zendframework/zend-code", @@ -2064,7 +2063,7 @@ "code", "zf2" ], - "time": "2016-10-24 13:23:32" + "time": "2016-10-24T13:23:32+00:00" }, { "name": "zendframework/zend-config", @@ -2120,7 +2119,7 @@ "config", "zf2" ], - "time": "2016-02-04 23:01:10" + "time": "2016-02-04T23:01:10+00:00" }, { "name": "zendframework/zend-console", @@ -2172,7 +2171,7 @@ "console", "zf2" ], - "time": "2016-02-09 17:15:12" + "time": "2016-02-09T17:15:12+00:00" }, { "name": "zendframework/zend-crypt", @@ -2222,7 +2221,7 @@ "crypt", "zf2" ], - "time": "2016-02-03 23:46:30" + "time": "2016-02-03T23:46:30+00:00" }, { "name": "zendframework/zend-db", @@ -2279,7 +2278,7 @@ "db", "zf2" ], - "time": "2016-08-09 19:28:55" + "time": "2016-08-09T19:28:55+00:00" }, { "name": "zendframework/zend-di", @@ -2326,7 +2325,7 @@ "di", "zf2" ], - "time": "2016-04-25 20:58:11" + "time": "2016-04-25T20:58:11+00:00" }, { "name": "zendframework/zend-escaper", @@ -2370,7 +2369,7 @@ "escaper", "zf2" ], - "time": "2016-06-30 19:48:38" + "time": "2016-06-30T19:48:38+00:00" }, { "name": "zendframework/zend-eventmanager", @@ -2417,7 +2416,7 @@ "eventmanager", "zf2" ], - "time": "2016-02-18 20:49:05" + "time": "2016-02-18T20:49:05+00:00" }, { "name": "zendframework/zend-filter", @@ -2477,7 +2476,7 @@ "filter", "zf2" ], - "time": "2016-04-18 18:32:43" + "time": "2016-04-18T18:32:43+00:00" }, { "name": "zendframework/zend-form", @@ -2554,7 +2553,7 @@ "form", "zf2" ], - "time": "2017-04-26 21:27:43" + "time": "2017-04-26T21:27:43+00:00" }, { "name": "zendframework/zend-http", @@ -2604,7 +2603,7 @@ "http", "zf2" ], - "time": "2017-01-31 14:41:02" + "time": "2017-01-31T14:41:02+00:00" }, { "name": "zendframework/zend-hydrator", @@ -2662,7 +2661,7 @@ "hydrator", "zf2" ], - "time": "2016-02-18 22:38:26" + "time": "2016-02-18T22:38:26+00:00" }, { "name": "zendframework/zend-i18n", @@ -2729,7 +2728,7 @@ "i18n", "zf2" ], - "time": "2016-06-07 21:08:30" + "time": "2016-06-07T21:08:30+00:00" }, { "name": "zendframework/zend-inputfilter", @@ -2784,7 +2783,7 @@ "inputfilter", "zf2" ], - "time": "2016-08-18 18:40:34" + "time": "2016-08-18T18:40:34+00:00" }, { "name": "zendframework/zend-json", @@ -2839,7 +2838,7 @@ "json", "zf2" ], - "time": "2016-02-04 21:20:26" + "time": "2016-02-04T21:20:26+00:00" }, { "name": "zendframework/zend-loader", @@ -2883,7 +2882,7 @@ "loader", "zf2" ], - "time": "2015-06-03 14:05:47" + "time": "2015-06-03T14:05:47+00:00" }, { "name": "zendframework/zend-log", @@ -2954,7 +2953,7 @@ "logging", "zf2" ], - "time": "2016-08-11 13:44:10" + "time": "2016-08-11T13:44:10+00:00" }, { "name": "zendframework/zend-math", @@ -3004,7 +3003,7 @@ "math", "zf2" ], - "time": "2016-04-07 16:29:53" + "time": "2016-04-07T16:29:53+00:00" }, { "name": "zendframework/zend-modulemanager", @@ -3063,7 +3062,7 @@ "modulemanager", "zf2" ], - "time": "2016-05-16 21:21:11" + "time": "2016-05-16T21:21:11+00:00" }, { "name": "zendframework/zend-mvc", @@ -3150,7 +3149,7 @@ "mvc", "zf2" ], - "time": "2016-02-23 15:24:59" + "time": "2016-02-23T15:24:59+00:00" }, { "name": "zendframework/zend-serializer", @@ -3207,7 +3206,7 @@ "serializer", "zf2" ], - "time": "2016-06-21 17:01:55" + "time": "2016-06-21T17:01:55+00:00" }, { "name": "zendframework/zend-server", @@ -3253,7 +3252,7 @@ "server", "zf2" ], - "time": "2016-06-20 22:27:55" + "time": "2016-06-20T22:27:55+00:00" }, { "name": "zendframework/zend-servicemanager", @@ -3305,7 +3304,7 @@ "servicemanager", "zf2" ], - "time": "2016-12-19 19:14:29" + "time": "2016-12-19T19:14:29+00:00" }, { "name": "zendframework/zend-session", @@ -3371,7 +3370,7 @@ "session", "zf2" ], - "time": "2016-07-05 18:32:50" + "time": "2016-07-05T18:32:50+00:00" }, { "name": "zendframework/zend-soap", @@ -3423,7 +3422,7 @@ "soap", "zf2" ], - "time": "2016-04-21 16:06:27" + "time": "2016-04-21T16:06:27+00:00" }, { "name": "zendframework/zend-stdlib", @@ -3482,7 +3481,7 @@ "stdlib", "zf2" ], - "time": "2016-04-12 21:17:31" + "time": "2016-04-12T21:17:31+00:00" }, { "name": "zendframework/zend-text", @@ -3529,7 +3528,7 @@ "text", "zf2" ], - "time": "2016-02-08 19:03:52" + "time": "2016-02-08T19:03:52+00:00" }, { "name": "zendframework/zend-uri", @@ -3576,7 +3575,7 @@ "uri", "zf2" ], - "time": "2016-02-17 22:38:51" + "time": "2016-02-17T22:38:51+00:00" }, { "name": "zendframework/zend-validator", @@ -3647,7 +3646,7 @@ "validator", "zf2" ], - "time": "2017-03-17 10:15:50" + "time": "2017-03-17T10:15:50+00:00" }, { "name": "zendframework/zend-view", @@ -3734,7 +3733,7 @@ "view", "zf2" ], - "time": "2017-03-21 15:05:56" + "time": "2017-03-21T15:05:56+00:00" } ], "packages-dev": [ @@ -3790,7 +3789,7 @@ "constructor", "instantiate" ], - "time": "2015-06-14 21:17:01" + "time": "2015-06-14T21:17:01+00:00" }, { "name": "friendsofphp/php-cs-fixer", @@ -3860,7 +3859,7 @@ } ], "description": "A tool to automatically fix PHP code style", - "time": "2017-03-31 12:59:38" + "time": "2017-03-31T12:59:38+00:00" }, { "name": "ircmaxell/password-compat", @@ -3902,7 +3901,7 @@ "hashing", "password" ], - "time": "2014-11-20 16:49:30" + "time": "2014-11-20T16:49:30+00:00" }, { "name": "lusitanian/oauth", @@ -3969,7 +3968,7 @@ "oauth", "security" ], - "time": "2016-07-12 22:15:40" + "time": "2016-07-12T22:15:40+00:00" }, { "name": "pdepend/pdepend", @@ -4009,7 +4008,7 @@ "BSD-3-Clause" ], "description": "Official version of pdepend to be handled with Composer", - "time": "2017-01-19 14:23:36" + "time": "2017-01-19T14:23:36+00:00" }, { "name": "phpmd/phpmd", @@ -4075,7 +4074,7 @@ "phpmd", "pmd" ], - "time": "2017-01-20 14:41:10" + "time": "2017-01-20T14:41:10+00:00" }, { "name": "phpunit/php-code-coverage", @@ -4137,7 +4136,7 @@ "testing", "xunit" ], - "time": "2015-10-06 15:47:00" + "time": "2015-10-06T15:47:00+00:00" }, { "name": "phpunit/php-file-iterator", @@ -4182,7 +4181,7 @@ "filesystem", "iterator" ], - "time": "2013-10-10 15:34:57" + "time": "2013-10-10T15:34:57+00:00" }, { "name": "phpunit/php-text-template", @@ -4223,7 +4222,7 @@ "keywords": [ "template" ], - "time": "2015-06-21 13:50:34" + "time": "2015-06-21T13:50:34+00:00" }, { "name": "phpunit/php-timer", @@ -4272,7 +4271,7 @@ "keywords": [ "timer" ], - "time": "2017-02-26 11:10:40" + "time": "2017-02-26T11:10:40+00:00" }, { "name": "phpunit/php-token-stream", @@ -4321,7 +4320,7 @@ "keywords": [ "tokenizer" ], - "time": "2017-02-27 10:12:30" + "time": "2017-02-27T10:12:30+00:00" }, { "name": "phpunit/phpunit", @@ -4395,7 +4394,7 @@ "testing", "xunit" ], - "time": "2014-05-02 07:13:40" + "time": "2014-05-02T07:13:40+00:00" }, { "name": "phpunit/phpunit-mock-objects", @@ -4451,7 +4450,7 @@ "mock", "xunit" ], - "time": "2015-10-02 06:51:40" + "time": "2015-10-02T06:51:40+00:00" }, { "name": "sebastian/comparator", @@ -4515,7 +4514,7 @@ "compare", "equality" ], - "time": "2017-01-29 09:50:25" + "time": "2017-01-29T09:50:25+00:00" }, { "name": "sebastian/diff", @@ -4567,7 +4566,7 @@ "keywords": [ "diff" ], - "time": "2015-12-08 07:14:41" + "time": "2015-12-08T07:14:41+00:00" }, { "name": "sebastian/environment", @@ -4617,7 +4616,7 @@ "environment", "hhvm" ], - "time": "2016-08-18 05:49:44" + "time": "2016-08-18T05:49:44+00:00" }, { "name": "sebastian/exporter", @@ -4684,7 +4683,7 @@ "export", "exporter" ], - "time": "2016-06-17 09:04:28" + "time": "2016-06-17T09:04:28+00:00" }, { "name": "sebastian/finder-facade", @@ -4723,7 +4722,7 @@ ], "description": "FinderFacade is a convenience wrapper for Symfony's Finder component.", "homepage": "https://github.com/sebastianbergmann/finder-facade", - "time": "2016-02-17 07:02:23" + "time": "2016-02-17T07:02:23+00:00" }, { "name": "sebastian/phpcpd", @@ -4774,7 +4773,7 @@ ], "description": "Copy/Paste Detector (CPD) for PHP code.", "homepage": "https://github.com/sebastianbergmann/phpcpd", - "time": "2016-04-17 19:32:49" + "time": "2016-04-17T19:32:49+00:00" }, { "name": "sebastian/recursion-context", @@ -4827,7 +4826,7 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2016-10-03 07:41:43" + "time": "2016-10-03T07:41:43+00:00" }, { "name": "sebastian/version", @@ -4862,7 +4861,7 @@ ], "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", - "time": "2015-06-21 13:59:46" + "time": "2015-06-21T13:59:46+00:00" }, { "name": "squizlabs/php_codesniffer", @@ -4937,7 +4936,7 @@ "phpcs", "standards" ], - "time": "2014-05-01 03:07:07" + "time": "2014-05-01T03:07:07+00:00" }, { "name": "symfony/config", @@ -4993,7 +4992,7 @@ ], "description": "Symfony Config Component", "homepage": "https://symfony.com", - "time": "2017-04-12 14:13:17" + "time": "2017-04-12T14:13:17+00:00" }, { "name": "symfony/dependency-injection", @@ -5053,7 +5052,7 @@ ], "description": "Symfony DependencyInjection Component", "homepage": "https://symfony.com", - "time": "2017-01-28 00:04:57" + "time": "2017-01-28T00:04:57+00:00" }, { "name": "symfony/polyfill-php54", @@ -5111,7 +5110,7 @@ "portable", "shim" ], - "time": "2016-11-14 01:06:16" + "time": "2016-11-14T01:06:16+00:00" }, { "name": "symfony/polyfill-php55", @@ -5167,7 +5166,7 @@ "portable", "shim" ], - "time": "2016-11-14 01:06:16" + "time": "2016-11-14T01:06:16+00:00" }, { "name": "symfony/polyfill-php70", @@ -5226,7 +5225,7 @@ "portable", "shim" ], - "time": "2016-11-14 01:06:16" + "time": "2016-11-14T01:06:16+00:00" }, { "name": "symfony/polyfill-xml", @@ -5284,7 +5283,7 @@ "portable", "shim" ], - "time": "2016-11-14 01:06:16" + "time": "2016-11-14T01:06:16+00:00" }, { "name": "symfony/stopwatch", @@ -5333,7 +5332,7 @@ ], "description": "Symfony Stopwatch Component", "homepage": "https://symfony.com", - "time": "2017-04-12 14:13:17" + "time": "2017-04-12T14:13:17+00:00" }, { "name": "symfony/yaml", @@ -5382,7 +5381,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2017-05-01 14:31:55" + "time": "2017-05-01T14:31:55+00:00" }, { "name": "theseer/fdomdocument", @@ -5422,7 +5421,7 @@ ], "description": "The classes contained within this repository extend the standard DOM to use exceptions at all occasions of errors instead of PHP warnings or notices. They also add various custom methods and shortcuts for convenience and to simplify the usage of DOM.", "homepage": "https://github.com/theseer/fDOMDocument", - "time": "2017-04-21 14:50:31" + "time": "2017-04-21T14:50:31+00:00" } ], "aliases": [], @@ -5449,7 +5448,8 @@ "ext-mbstring": "*", "ext-openssl": "*", "ext-zip": "*", - "ext-pdo_mysql": "*" + "ext-pdo_mysql": "*", + "ext-soap": "*" }, "platform-dev": [] } From 065ab557bc3deb1600bcecb061a3f4ae09770ead Mon Sep 17 00:00:00 2001 From: alojua Date: Wed, 31 May 2017 16:17:03 +0200 Subject: [PATCH 26/60] Fix bug linked product position not updated if product link already exists --- .../CatalogImportExport/Model/Import/Product.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product.php b/app/code/Magento/CatalogImportExport/Model/Import/Product.php index 8eb1214157265..289ce8798f896 100644 --- a/app/code/Magento/CatalogImportExport/Model/Import/Product.php +++ b/app/code/Magento/CatalogImportExport/Model/Import/Product.php @@ -1230,15 +1230,15 @@ protected function _saveLinks() 'linked_product_id' => $linkedId, 'link_type_id' => $linkId, ]; - if (!empty($linkPositions[$linkedKey])) { - $positionRows[] = [ - 'link_id' => $productLinkKeys[$linkKey], - 'product_link_attribute_id' => $positionAttrId[$linkId], - 'value' => $linkPositions[$linkedKey], - ]; - } - $nextLinkId++; } + if (!empty($linkPositions[$linkedKey])) { + $positionRows[] = [ + 'link_id' => $productLinkKeys[$linkKey], + 'product_link_attribute_id' => $positionAttrId[$linkId], + 'value' => $linkPositions[$linkedKey], + ]; + } + $nextLinkId++; } } } From 23796694dcd79525d12732d369104fc461c899b4 Mon Sep 17 00:00:00 2001 From: Ievgen Sentiabov Date: Thu, 25 May 2017 14:11:12 +0300 Subject: [PATCH 27/60] MAGETWO-69340: [Github] Braintree PayPal locale should have it's own setting #9639 - Added list of allowed Braintree PayPal locales --- .../Magento/Braintree/Block/Paypal/Button.php | 10 +- .../Braintree/Model/LocaleResolver.php | 93 +++++++++++++++++++ .../Model/Ui/PayPal/ConfigProvider.php | 2 +- .../Model/Ui/PayPal/ConfigProviderTest.php | 27 ++---- app/code/Magento/Braintree/etc/config.xml | 3 +- .../Magento/Braintree/etc/frontend/di.xml | 7 ++ .../view/frontend/requirejs-config.js | 2 +- .../view/frontend/web/js/paypal/button.js | 6 +- .../js/view/payment/method-renderer/paypal.js | 14 ++- .../frontend/js/paypal/button.test.js | 85 +++++++++++++++++ .../payment/method-renderer/paypal.test.js | 79 ++++++++++++++++ 11 files changed, 299 insertions(+), 29 deletions(-) create mode 100644 app/code/Magento/Braintree/Model/LocaleResolver.php create mode 100644 dev/tests/js/jasmine/tests/app/code/Magento/Braintree/frontend/js/paypal/button.test.js create mode 100644 dev/tests/js/jasmine/tests/app/code/Magento/Braintree/frontend/js/view/payment/method-renderer/paypal.test.js diff --git a/app/code/Magento/Braintree/Block/Paypal/Button.php b/app/code/Magento/Braintree/Block/Paypal/Button.php index 8a90fc23ad123..efd9e473699c3 100644 --- a/app/code/Magento/Braintree/Block/Paypal/Button.php +++ b/app/code/Magento/Braintree/Block/Paypal/Button.php @@ -5,13 +5,13 @@ */ namespace Magento\Braintree\Block\Paypal; -use Magento\Checkout\Model\Session; +use Magento\Braintree\Gateway\Config\PayPal\Config; +use Magento\Braintree\Model\Ui\ConfigProvider; use Magento\Catalog\Block\ShortcutInterface; -use Magento\Framework\View\Element\Template; +use Magento\Checkout\Model\Session; use Magento\Framework\Locale\ResolverInterface; -use Magento\Braintree\Model\Ui\ConfigProvider; +use Magento\Framework\View\Element\Template; use Magento\Framework\View\Element\Template\Context; -use Magento\Braintree\Gateway\Config\PayPal\Config; use Magento\Payment\Model\MethodInterface; /** @@ -110,7 +110,7 @@ public function getContainerId() */ public function getLocale() { - return strtolower($this->localeResolver->getLocale()); + return $this->localeResolver->getLocale(); } /** diff --git a/app/code/Magento/Braintree/Model/LocaleResolver.php b/app/code/Magento/Braintree/Model/LocaleResolver.php new file mode 100644 index 0000000000000..cebd90dffc70e --- /dev/null +++ b/app/code/Magento/Braintree/Model/LocaleResolver.php @@ -0,0 +1,93 @@ +resolver = $resolver; + $this->config = $config; + } + + /** + * @inheritdoc + */ + public function getDefaultLocalePath() + { + return $this->resolver->getDefaultLocalePath(); + } + + /** + * @inheritdoc + */ + public function setDefaultLocale($locale) + { + return $this->resolver->setDefaultLocale($locale); + } + + /** + * @inheritdoc + */ + public function getDefaultLocale() + { + return $this->resolver->getDefaultLocale(); + } + + /** + * @inheritdoc + */ + public function setLocale($locale = null) + { + return $this->resolver->setLocale($locale); + } + + /** + * Gets store's locale or the `en_US` locale if store's locale does not supported by PayPal. + * + * @return string + */ + public function getLocale() + { + $locale = $this->resolver->getLocale(); + $allowedLocales = $this->config->getValue('supported_locales'); + + return strpos($allowedLocales, $locale) !== false ? $locale : 'en_US'; + } + + /** + * @inheritdoc + */ + public function emulate($scopeId) + { + return $this->resolver->emulate($scopeId); + } + + /** + * @inheritdoc + */ + public function revert() + { + return $this->resolver->revert(); + } +} diff --git a/app/code/Magento/Braintree/Model/Ui/PayPal/ConfigProvider.php b/app/code/Magento/Braintree/Model/Ui/PayPal/ConfigProvider.php index fc400cb375ea7..e06b913db8ef4 100644 --- a/app/code/Magento/Braintree/Model/Ui/PayPal/ConfigProvider.php +++ b/app/code/Magento/Braintree/Model/Ui/PayPal/ConfigProvider.php @@ -54,7 +54,7 @@ public function getConfig() 'title' => $this->config->getTitle(), 'isAllowShippingAddressOverride' => $this->config->isAllowToEditShippingAddress(), 'merchantName' => $this->config->getMerchantName(), - 'locale' => strtolower($this->resolver->getLocale()), + 'locale' => $this->resolver->getLocale(), 'paymentAcceptanceMarkSrc' => 'https://www.paypalobjects.com/webstatic/en_US/i/buttons/pp-acceptance-medium.png', 'vaultCode' => self::PAYPAL_VAULT_CODE, diff --git a/app/code/Magento/Braintree/Test/Unit/Model/Ui/PayPal/ConfigProviderTest.php b/app/code/Magento/Braintree/Test/Unit/Model/Ui/PayPal/ConfigProviderTest.php index 92d5f0a41716b..ea46d8ee77a8a 100644 --- a/app/code/Magento/Braintree/Test/Unit/Model/Ui/PayPal/ConfigProviderTest.php +++ b/app/code/Magento/Braintree/Test/Unit/Model/Ui/PayPal/ConfigProviderTest.php @@ -49,42 +49,35 @@ protected function setUp() /** * Run test getConfig method * - * @param array $config + * @param array $expected * @dataProvider getConfigDataProvider */ public function testGetConfig($expected) { - $this->config->expects(static::once()) - ->method('isActive') + $this->config->method('isActive') ->willReturn(true); - $this->config->expects(static::once()) - ->method('isAllowToEditShippingAddress') + $this->config->method('isAllowToEditShippingAddress') ->willReturn(true); - $this->config->expects(static::once()) - ->method('getMerchantName') + $this->config->method('getMerchantName') ->willReturn('Test'); - $this->config->expects(static::once()) - ->method('getTitle') + $this->config->method('getTitle') ->willReturn('Payment Title'); - $this->localeResolver->expects(static::once()) - ->method('getLocale') + $this->localeResolver->method('getLocale') ->willReturn('en_US'); - $this->config->expects(static::once()) - ->method('isSkipOrderReview') + $this->config->method('isSkipOrderReview') ->willReturn(false); - $this->config->expects(static::once()) - ->method('getPayPalIcon') + $this->config->method('getPayPalIcon') ->willReturn([ 'width' => 30, 'height' => 26, 'url' => 'https://icon.test.url' ]); - static::assertEquals($expected, $this->configProvider->getConfig()); + self::assertEquals($expected, $this->configProvider->getConfig()); } /** @@ -101,7 +94,7 @@ public function getConfigDataProvider() 'title' => 'Payment Title', 'isAllowShippingAddressOverride' => true, 'merchantName' => 'Test', - 'locale' => 'en_us', + 'locale' => 'en_US', 'paymentAcceptanceMarkSrc' => 'https://www.paypalobjects.com/webstatic/en_US/i/buttons/pp-acceptance-medium.png', 'vaultCode' => ConfigProvider::PAYPAL_VAULT_CODE, diff --git a/app/code/Magento/Braintree/etc/config.xml b/app/code/Magento/Braintree/etc/config.xml index f1bbdf79b7d7e..e91f59fb0740e 100644 --- a/app/code/Magento/Braintree/etc/config.xml +++ b/app/code/Magento/Braintree/etc/config.xml @@ -34,7 +34,7 @@ processing sandbox 0 - + cvv,number @@ -66,6 +66,7 @@ 1 processorResponseCode,processorResponseText,paymentId processorResponseCode,processorResponseText,paymentId,payerEmail + en_US,en_GB,en_AU,da_DK,fr_FR,fr_CA,de_DE,zh_HK,it_IT,nl_NL,no_NO,pl_PL,es_ES,sv_SE,tr_TR,pt_BR,ja_JP,id_ID,ko_KR,pt_PT,ru_RU,th_TH,zh_CN,zh_TW BraintreeCreditCardVaultFacade diff --git a/app/code/Magento/Braintree/etc/frontend/di.xml b/app/code/Magento/Braintree/etc/frontend/di.xml index 1983bb1f20e62..ea417c407dffd 100644 --- a/app/code/Magento/Braintree/etc/frontend/di.xml +++ b/app/code/Magento/Braintree/etc/frontend/di.xml @@ -46,6 +46,7 @@ + Magento\Braintree\Model\LocaleResolver Magento_Braintree::paypal/button.phtml braintree.paypal.mini-cart @@ -54,4 +55,10 @@ BraintreePayPalFacade + + + + Magento\Braintree\Model\LocaleResolver + + diff --git a/app/code/Magento/Braintree/view/frontend/requirejs-config.js b/app/code/Magento/Braintree/view/frontend/requirejs-config.js index 8b347d799007a..9fc38064677ef 100644 --- a/app/code/Magento/Braintree/view/frontend/requirejs-config.js +++ b/app/code/Magento/Braintree/view/frontend/requirejs-config.js @@ -6,7 +6,7 @@ var config = { map: { '*': { - braintree: 'https://js.braintreegateway.com/js/braintree-2.25.0.min.js' + braintree: 'https://js.braintreegateway.com/js/braintree-2.32.0.min.js' } } }; diff --git a/app/code/Magento/Braintree/view/frontend/web/js/paypal/button.js b/app/code/Magento/Braintree/view/frontend/web/js/paypal/button.js index eaac1cd116082..3ac50fbcb47cc 100644 --- a/app/code/Magento/Braintree/view/frontend/web/js/paypal/button.js +++ b/app/code/Magento/Braintree/view/frontend/web/js/paypal/button.js @@ -105,7 +105,11 @@ define( event.preventDefault(); registry.get(self.integrationName, function (integration) { - integration.paypal.initAuthFlow(); + try { + integration.paypal.initAuthFlow(); + } catch (e) { + $this.attr('disabled', 'disabled'); + } }); }); }.bind(this); diff --git a/app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/paypal.js b/app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/paypal.js index 182ec5e7168e8..9804ee8489625 100644 --- a/app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/paypal.js +++ b/app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/paypal.js @@ -13,7 +13,8 @@ define([ 'Magento_Checkout/js/model/full-screen-loader', 'Magento_Checkout/js/model/payment/additional-validators', 'Magento_Vault/js/view/payment/vault-enabler', - 'Magento_Checkout/js/action/create-billing-address' + 'Magento_Checkout/js/action/create-billing-address', + 'mage/translate' ], function ( $, _, @@ -23,7 +24,8 @@ define([ fullScreenLoader, additionalValidators, VaultEnabler, - createBillingAddress + createBillingAddress, + $t ) { 'use strict'; @@ -403,7 +405,13 @@ define([ */ payWithPayPal: function () { if (additionalValidators.validate()) { - Braintree.checkout.paypal.initAuthFlow(); + try { + Braintree.checkout.paypal.initAuthFlow(); + } catch (e) { + this.messageContainer.addErrorMessage({ + message: $t('Payment ' + this.getTitle() + ' can\'t be initialized.') + }); + } } }, diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Braintree/frontend/js/paypal/button.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Braintree/frontend/js/paypal/button.test.js new file mode 100644 index 0000000000000..a4767fb551ee3 --- /dev/null +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Braintree/frontend/js/paypal/button.test.js @@ -0,0 +1,85 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +/* eslint-disable max-nested-callbacks */ +define([ + 'squire', + 'jquery' +], function (Squire) { + 'use strict'; + + describe('Magento_Braintree/js/paypal/button', function () { + var injector, + mocks, + braintree, + component, + registry, + btnId = 'braintree_paypal_btn', + tplElement = jQuery('')[0]; + + require.config({ + map: { + '*': { + 'braintree': 'braintree' + } + } + }); + + injector = new Squire(); + mocks = { + 'braintree': { + paypal: { + /** Stub */ + initAuthFlow: function () {} + }, + + /** Stub */ + setup: function () {} + } + }; + + beforeEach(function (done) { + injector.mock(mocks); + + injector.require([ + 'braintree', + 'uiRegistry', + 'Magento_Braintree/js/paypal/button' + ], function (adapter, reg, Constr) { + braintree = adapter; + registry = reg; + jQuery(document.body).append(tplElement); + + spyOn(braintree, 'setup').and.callFake(function () { + registry.set('braintreePaypal.currentIntegration', braintree); + jQuery('#' + btnId).removeAttr('disabled'); + }); + + component = new Constr({ + id: btnId + }); + done(); + }); + }); + + afterAll(function (done) { + tplElement.remove(); + registry.remove(component.integrationName); + done(); + }); + + it('The PayPal::initAuthFlow throws an exception.', function () { + var $selector = jQuery('#' + component.id); + + spyOn(braintree.paypal, 'initAuthFlow').and.callFake(function () { + throw new TypeError('Cannot read property of undefined'); + }); + + $selector.trigger('click'); + + expect($selector.prop('disabled')).toEqual(true); + }); + }); +}); diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Braintree/frontend/js/view/payment/method-renderer/paypal.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Braintree/frontend/js/view/payment/method-renderer/paypal.test.js new file mode 100644 index 0000000000000..a9987f5e01ba8 --- /dev/null +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Braintree/frontend/js/view/payment/method-renderer/paypal.test.js @@ -0,0 +1,79 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +/* eslint-disable max-nested-callbacks */ +define([ + 'squire', + 'ko' +], function (Squire, ko) { + 'use strict'; + + describe('Magento_Braintree/js/view/payment/method-renderer/paypal', function () { + + var injector = new Squire(), + mocks = { + 'Magento_Checkout/js/model/quote': { + billingAddress: ko.observable(), + shippingAddress: ko.observable({ + postcode: '', + street: [], + canUseForBilling: ko.observable() + }), + paymentMethod: ko.observable(), + totals: ko.observable({ + 'base_grand_total': 0 + }) + }, + 'Magento_Braintree/js/view/payment/adapter': { + checkout: { + paypal: { + /** Stub */ + initAuthFlow: function () {} + } + } + } + }, + braintreeAdapter, + component, + additionalValidator; + + beforeEach(function (done) { + window.checkoutConfig = { + quoteData: {}, + payment: { + 'braintree_paypal': { + title: 'Braintree PayPal' + } + }, + vault: {} + }; + + injector.mock(mocks); + + injector.require([ + 'Magento_Braintree/js/view/payment/adapter', + 'Magento_Checkout/js/model/payment/additional-validators', + 'Magento_Braintree/js/view/payment/method-renderer/paypal' + ], function (adapter, validator, Constr) { + braintreeAdapter = adapter; + additionalValidator = validator; + component = new Constr(); + done(); + }); + }); + + it('The PayPal::initAuthFlow throws an exception.', function () { + + spyOn(additionalValidator, 'validate').and.returnValue(true); + spyOn(braintreeAdapter.checkout.paypal, 'initAuthFlow').and.callFake(function () { + throw new TypeError('Cannot read property of undefined'); + }); + spyOn(component.messageContainer, 'addErrorMessage'); + + component.payWithPayPal(); + expect(component.messageContainer.addErrorMessage).toHaveBeenCalled(); + }); + }); +}); From 4c576f43da6cf8db9b1edac31e5eda3750545249 Mon Sep 17 00:00:00 2001 From: Tibor Kotosz Date: Thu, 1 Jun 2017 14:20:02 +0200 Subject: [PATCH 28/60] Return array of pages as items instead of array of arrays Based on `PageSearchResultsInterface` the getItems() should return `\Magento\Cms\Api\Data\PageInterface[]`. --- app/code/Magento/Cms/Model/PageRepository.php | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/app/code/Magento/Cms/Model/PageRepository.php b/app/code/Magento/Cms/Model/PageRepository.php index 033289bf8fb8e..521a975c885dd 100644 --- a/app/code/Magento/Cms/Model/PageRepository.php +++ b/app/code/Magento/Cms/Model/PageRepository.php @@ -157,25 +157,10 @@ public function getList(\Magento\Framework\Api\SearchCriteriaInterface $criteria $this->collectionProcessor->process($criteria, $collection); - $pages = []; - /** @var Page $pageModel */ - foreach ($collection as $pageModel) { - $pageData = $this->dataPageFactory->create(); - $this->dataObjectHelper->populateWithArray( - $pageData, - $pageModel->getData(), - \Magento\Cms\Api\Data\PageInterface::class - ); - $pages[] = $this->dataObjectProcessor->buildOutputDataArray( - $pageData, - \Magento\Cms\Api\Data\PageInterface::class - ); - } - /** @var Data\PageSearchResultsInterface $searchResults */ $searchResults = $this->searchResultsFactory->create(); $searchResults->setSearchCriteria($criteria); - $searchResults->setItems($pages); + $searchResults->setItems($collection->getItems()); $searchResults->setTotalCount($collection->getSize()); return $searchResults; } From 3b435e6a7ab29fb5f0a6c4bf5929d5a90a2bbdf6 Mon Sep 17 00:00:00 2001 From: Michele Fantetti Date: Thu, 1 Jun 2017 16:26:38 +0200 Subject: [PATCH 29/60] Update send.phtml --- app/code/Magento/SendFriend/view/frontend/templates/send.phtml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/SendFriend/view/frontend/templates/send.phtml b/app/code/Magento/SendFriend/view/frontend/templates/send.phtml index e498a5ce789ef..528ec6f096be3 100644 --- a/app/code/Magento/SendFriend/view/frontend/templates/send.phtml +++ b/app/code/Magento/SendFriend/view/frontend/templates/send.phtml @@ -104,6 +104,7 @@
+ getChildHtml('form_additional_info'); ?>
From 29be479f6c3c9faab4b0d9e852bc11fb602d03f2 Mon Sep 17 00:00:00 2001 From: Michele Fantetti Date: Thu, 1 Jun 2017 16:38:09 +0200 Subject: [PATCH 30/60] Update sendfriend_product_send.xml --- .../view/frontend/layout/sendfriend_product_send.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/SendFriend/view/frontend/layout/sendfriend_product_send.xml b/app/code/Magento/SendFriend/view/frontend/layout/sendfriend_product_send.xml index 1790fe068ac4a..5c99ee377ddfa 100644 --- a/app/code/Magento/SendFriend/view/frontend/layout/sendfriend_product_send.xml +++ b/app/code/Magento/SendFriend/view/frontend/layout/sendfriend_product_send.xml @@ -13,7 +13,9 @@ - + + + From 00001fb195f239cad15abe9784a403175284e7a9 Mon Sep 17 00:00:00 2001 From: Maksim_Stsepantsevich Date: Thu, 18 May 2017 15:17:21 +0300 Subject: [PATCH 31/60] MAGETWO-69289: The "extra_customer_info" container duplicates in template - Exclude container from output --- .../Sales/Block/Adminhtml/Order/View/Info.php | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Info.php b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Info.php index a86d33a9ad762..0ff22646e1935 100644 --- a/app/code/Magento/Sales/Block/Adminhtml/Order/View/Info.php +++ b/app/code/Magento/Sales/Block/Adminhtml/Order/View/Info.php @@ -303,4 +303,26 @@ public function getFormattedAddress(Address $address) { return $this->addressRenderer->format($address, 'html'); } + + /** + * @inheritdoc + */ + public function getChildHtml($alias = '', $useCache = true) + { + $layout = $this->getLayout(); + + if ($alias || !$layout) { + return parent::getChildHtml($alias, $useCache); + } + + $childNames = $layout->getChildNames($this->getNameInLayout()); + $outputChildNames = array_diff($childNames, ['extra_customer_info']); + + $out = ''; + foreach ($outputChildNames as $childName) { + $out .= $layout->renderElement($childName, $useCache); + } + + return $out; + } } From 750e1ad6c8197e7b6c3d52b68d5b5b61c9a5de07 Mon Sep 17 00:00:00 2001 From: Anatol Burym Date: Wed, 31 May 2017 11:12:55 +0300 Subject: [PATCH 32/60] MAGETWO-63154: Special characters in store name converted to numerical character references in email subject - Integration test added. --- .../Customer/Controller/AccountTest.php | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/dev/tests/integration/testsuite/Magento/Customer/Controller/AccountTest.php b/dev/tests/integration/testsuite/Magento/Customer/Controller/AccountTest.php index 58d510afbd931..ff5afe939d133 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Controller/AccountTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Controller/AccountTest.php @@ -64,6 +64,38 @@ public function testLogoutAction() $this->assertRedirect($this->stringContains('customer/account/logoutSuccess')); } + /** + * Test that forgot password email message displays special characters correctly. + * + * @magentoConfigFixture current_store customer/password/limit_password_reset_requests_method 0 + * @magentoConfigFixture current_store customer/password/forgot_email_template customer_password_forgot_email_template + * @magentoConfigFixture current_store customer/password/forgot_email_identity support + * @magentoConfigFixture current_store general/store_information/name Test special' characters + * @magentoDataFixture Magento/Customer/_files/customer.php + */ + public function testForgotPasswordEmailMessageWithSpecialCharacters() + { + $email = 'customer@example.com'; + + $this->getRequest() + ->setPostValue([ + 'email' => $email, + ]); + + $this->dispatch('customer/account/forgotPasswordPost'); + $this->assertRedirect($this->stringContains('customer/account/')); + + /** @var \Magento\TestFramework\Mail\Template\TransportBuilderMock $transportBuilder */ + $transportBuilder = $this->_objectManager->get( + \Magento\TestFramework\Mail\Template\TransportBuilderMock::class + ); + $subject = $transportBuilder->getSentMessage()->getSubject(); + $this->assertContains( + 'Test special\' characters', + $subject + ); + } + /** * @magentoDataFixture Magento/Customer/_files/customer.php */ From 66a8db2e1e4ab6f8c70231b986aa98d43a159729 Mon Sep 17 00:00:00 2001 From: Vital_Pantsialeyeu Date: Wed, 31 May 2017 13:17:16 +0300 Subject: [PATCH 33/60] MAGETWO-60692: GithubBundle product order - create invoice via REST API #6988 - API-functional test added. --- .../Bundle/Api/OrderInvoiceCreateTest.php | 143 ++++++++++++++++++ .../_files/order_items_simple_and_bundle.php | 23 +++ ...order_items_simple_and_bundle_rollback.php | 9 ++ 3 files changed, 175 insertions(+) create mode 100644 dev/tests/api-functional/testsuite/Magento/Bundle/Api/OrderInvoiceCreateTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Bundle/_files/order_items_simple_and_bundle.php create mode 100644 dev/tests/integration/testsuite/Magento/Bundle/_files/order_items_simple_and_bundle_rollback.php diff --git a/dev/tests/api-functional/testsuite/Magento/Bundle/Api/OrderInvoiceCreateTest.php b/dev/tests/api-functional/testsuite/Magento/Bundle/Api/OrderInvoiceCreateTest.php new file mode 100644 index 0000000000000..ddeb6616e0fc5 --- /dev/null +++ b/dev/tests/api-functional/testsuite/Magento/Bundle/Api/OrderInvoiceCreateTest.php @@ -0,0 +1,143 @@ +objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + $this->invoiceRepository = $this->objectManager->get( + \Magento\Sales\Api\InvoiceRepositoryInterface::class + ); + } + + /** + * Test create a partial invoice for order with bundle and Simple products. + * + * @return void + * @magentoApiDataFixture Magento/Bundle/_files/order_items_simple_and_bundle.php + */ + public function testInvoiceWithSimpleAndBundleCreate() + { + /** @var \Magento\Sales\Api\Data\OrderInterface $existingOrder*/ + $existingOrder = $this->objectManager->create(\Magento\Sales\Api\Data\OrderInterface::class) + ->loadByIncrementId('100000001'); + + $serviceInfo = [ + 'rest' => [ + 'resourcePath' => '/V1/order/' . $existingOrder->getId() . '/invoice', + 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_POST, + ], + 'soap' => [ + 'service' => self::SERVICE_READ_NAME, + 'serviceVersion' => self::SERVICE_VERSION, + 'operation' => self::SERVICE_READ_NAME . 'execute', + ], + ]; + + $requestData = [ + 'orderId' => $existingOrder->getId(), + 'items' => [], + 'comment' => [ + 'comment' => 'Test Comment', + 'is_visible_on_front' => 1, + ], + ]; + $grantTotal = 0; + foreach ($existingOrder->getAllItems() as $item) { + $requestData['items'] = []; + $requestData['items'][] = [ + 'order_item_id' => $item->getItemId(), + 'qty' => $item->getQtyOrdered(), + ]; + $result = $this->_webApiCall($serviceInfo, $requestData); + $this->assertNotEmpty($result); + try { + $invoice = $this->invoiceRepository->get($result); + $grantTotal += $invoice->getGrandTotal(); + } catch (\Magento\Framework\Exception\NoSuchEntityException $e) { + $this->fail('Failed asserting that Invoice was created'); + } + } + $this->assertNotEquals( + $existingOrder->getGrandTotal(), + $grantTotal, + 'Failed asserting that invoice is correct.' + ); + } + + /** + * Test create invoice with Bundle product. + * + * @return void + * @magentoApiDataFixture Magento/Bundle/_files/order_item_with_bundle_and_options.php + */ + public function testInvoiceWithBundleCreate() + { + /** @var \Magento\Sales\Api\Data\OrderInterface $existingOrder*/ + $existingOrder = $this->objectManager->create(\Magento\Sales\Api\Data\OrderInterface::class) + ->loadByIncrementId('100000001'); + + $serviceInfo = [ + 'rest' => [ + 'resourcePath' => '/V1/order/' . $existingOrder->getId() . '/invoice', + 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_POST, + ], + 'soap' => [ + 'service' => self::SERVICE_READ_NAME, + 'serviceVersion' => self::SERVICE_VERSION, + 'operation' => self::SERVICE_READ_NAME . 'execute', + ], + ]; + + $requestData = [ + 'orderId' => $existingOrder->getId(), + 'items' => [], + 'comment' => [ + 'comment' => 'Test Comment', + 'is_visible_on_front' => 1, + ], + ]; + + /** @var \Magento\Sales\Api\Data\OrderItemInterface $item */ + foreach ($existingOrder->getAllItems() as $item) { + $requestData['items'][] = [ + 'order_item_id' => $item->getItemId(), + 'qty' => $item->getQtyOrdered(), + ]; + } + $result = $this->_webApiCall($serviceInfo, $requestData); + $this->assertNotEmpty($result); + $invoice = $this->invoiceRepository->get($result); + $this->assertNotEquals( + $existingOrder->getGrandTotal(), + $invoice->getGrandTotal(), + 'Failed asserting that invoice is correct.' + ); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Bundle/_files/order_items_simple_and_bundle.php b/dev/tests/integration/testsuite/Magento/Bundle/_files/order_items_simple_and_bundle.php new file mode 100644 index 0000000000000..8ca201225f842 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Bundle/_files/order_items_simple_and_bundle.php @@ -0,0 +1,23 @@ +create(\Magento\Sales\Model\Order\Item::class); +/** @var $product \Magento\Catalog\Model\Product */ +$orderItem->setProductId($product->getId())->setQtyOrdered(1); +$orderItem->setBasePrice($product->getPrice()); +$orderItem->setPrice($product->getPrice()); +$orderItem->setRowTotal($product->getPrice()); +$orderItem->setProductType('simple'); + +/** @var \Magento\Sales\Model\Order $order */ +$order->addItem($orderItem); +$order->save(); diff --git a/dev/tests/integration/testsuite/Magento/Bundle/_files/order_items_simple_and_bundle_rollback.php b/dev/tests/integration/testsuite/Magento/Bundle/_files/order_items_simple_and_bundle_rollback.php new file mode 100644 index 0000000000000..a3b4dd410913f --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Bundle/_files/order_items_simple_and_bundle_rollback.php @@ -0,0 +1,9 @@ + Date: Wed, 31 May 2017 15:28:24 +0300 Subject: [PATCH 34/60] MAGETWO-64885: Wrong cookies set for store views with multidomain - Integration test added. --- .../Magento/Store/Block/SwitcherTest.php | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 dev/tests/integration/testsuite/Magento/Store/Block/SwitcherTest.php diff --git a/dev/tests/integration/testsuite/Magento/Store/Block/SwitcherTest.php b/dev/tests/integration/testsuite/Magento/Store/Block/SwitcherTest.php new file mode 100644 index 0000000000000..382dc01590ff6 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Store/Block/SwitcherTest.php @@ -0,0 +1,47 @@ +_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); + } + + /** + * Test that GetTargetStorePostData() method return correct store URL. + * + * @magentoDataFixture Magento/Store/_files/store.php + * @return void + */ + public function testGetTargetStorePostData() + { + $storeCode = 'test'; + /** @var \Magento\Store\Block\Switcher $block */ + $block = $this->_objectManager->create(\Magento\Store\Block\Switcher::class); + /** @var \Magento\Store\Api\StoreRepositoryInterface $storeRepository */ + $storeRepository = $this->_objectManager->create(\Magento\Store\Api\StoreRepositoryInterface::class); + $store = $storeRepository->get($storeCode); + $result = json_decode($block->getTargetStorePostData($store), true); + + $this->assertContains($storeCode, $result['action']); + } +} From 432c45898cbf6b3fd27145336dc4e9d48247021a Mon Sep 17 00:00:00 2001 From: Anatol Burym Date: Wed, 31 May 2017 15:44:22 +0300 Subject: [PATCH 35/60] MAGETWO-64885: Wrong cookies set for store views with multidomain - Integration test. Code style fix. --- .../integration/testsuite/Magento/Store/Block/SwitcherTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/dev/tests/integration/testsuite/Magento/Store/Block/SwitcherTest.php b/dev/tests/integration/testsuite/Magento/Store/Block/SwitcherTest.php index 382dc01590ff6..d67825ea6ec8f 100644 --- a/dev/tests/integration/testsuite/Magento/Store/Block/SwitcherTest.php +++ b/dev/tests/integration/testsuite/Magento/Store/Block/SwitcherTest.php @@ -22,7 +22,6 @@ class SwitcherTest extends \PHPUnit_Framework_TestCase */ protected function setUp() { - /** @var $objectManager \Magento\TestFramework\ObjectManager */ $this->_objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); } From 85fd01f132b0eab6574e60d61057405f6af7157f Mon Sep 17 00:00:00 2001 From: Vital_Pantsialeyeu Date: Wed, 31 May 2017 15:36:08 +0300 Subject: [PATCH 36/60] MAGETWO-63054: [Catalog] MSRP field is not displayed for bundle products with fixed price - Added variation to functional test --- .../Product/Edit/Section/AdvancedPricing.php | 38 ++++++++++++ ...rtProductEditPageAdvancedPricingFields.php | 58 +++++++++++++++++++ .../Msrp/Test/TestCase/ApplyMapTest.xml | 4 ++ 3 files changed, 100 insertions(+) create mode 100644 dev/tests/functional/tests/app/Magento/Msrp/Test/Constraint/AssertProductEditPageAdvancedPricingFields.php diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Section/AdvancedPricing.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Section/AdvancedPricing.php index 7aeb5c1e238d9..f45429168c3e1 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Section/AdvancedPricing.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Section/AdvancedPricing.php @@ -10,6 +10,7 @@ use Magento\Mtf\Client\Element\SimpleElement; use Magento\Ui\Test\Block\Adminhtml\Section; use Magento\Catalog\Test\Block\Adminhtml\Product\Edit\Section\Options\AbstractOptions; +use Magento\Mtf\Client\Locator; /** * Product advanced pricing section. @@ -37,6 +38,20 @@ class AdvancedPricing extends Section */ protected $doneButton = '.action-primary[data-role="action"]'; + /** + * Selector for field. + * + * @var string + */ + private $fieldByName = '//*[contains(text(),"%s")]/preceding::div[2]/ancestor::div[1]'; + + /** + * Selector for previous field. + * + * @var string + */ + private $previousField = '//*[contains(text(),"%s")]/preceding::div[2]//label'; + /** * Fill 'Advanced price' product form on tab. * @@ -104,4 +119,27 @@ public function getTierPriceForm(SimpleElement $element = null) ['element' => $element] ); } + + /** + * Check if the field is displayed correctly. + * + * @param string $fieldName + * @param string|null $previousFieldName + * @return bool + */ + public function checkField($fieldName, $previousFieldName = null) + { + $field = $this->_rootElement->find(sprintf($this->fieldByName, $fieldName), Locator::SELECTOR_XPATH); + if ($field->isVisible()) { + if ($previousFieldName) { + return $this->_rootElement->find( + sprintf($this->previousField, $fieldName), + Locator::SELECTOR_XPATH + )->getText() == $previousFieldName; + } else { + return $field->isVisible(); + } + } + return false; + } } diff --git a/dev/tests/functional/tests/app/Magento/Msrp/Test/Constraint/AssertProductEditPageAdvancedPricingFields.php b/dev/tests/functional/tests/app/Magento/Msrp/Test/Constraint/AssertProductEditPageAdvancedPricingFields.php new file mode 100644 index 0000000000000..e150997e32728 --- /dev/null +++ b/dev/tests/functional/tests/app/Magento/Msrp/Test/Constraint/AssertProductEditPageAdvancedPricingFields.php @@ -0,0 +1,58 @@ +open(['id' => $product->getId()]); + $catalogProductEdit->getProductForm()->openSection('advanced-pricing'); + $advancedPricing = $catalogProductEdit->getProductForm()->getSection('advanced-pricing'); + + \PHPUnit_Framework_Assert::assertTrue( + $advancedPricing->checkField($this->manufacturerFieldTitle, $this->priceFieldTitle), + '"Manufacturer\'s Suggested Retail Price" field is not correct.' + ); + } + + /** + * Returns a string representation of the object. + * + * @return string + */ + public function toString() + { + return '"Manufacturer\'s Suggested Retail Price" field is correct.'; + } +} diff --git a/dev/tests/functional/tests/app/Magento/Msrp/Test/TestCase/ApplyMapTest.xml b/dev/tests/functional/tests/app/Magento/Msrp/Test/TestCase/ApplyMapTest.xml index a5efdc3d5e917..32d86dec7a52a 100644 --- a/dev/tests/functional/tests/app/Magento/Msrp/Test/TestCase/ApplyMapTest.xml +++ b/dev/tests/functional/tests/app/Magento/Msrp/Test/TestCase/ApplyMapTest.xml @@ -46,5 +46,9 @@ + + bundleProduct::bundle_fixed_product + + From a26b24f71fd41dbdd203b78a409f11c6e197664c Mon Sep 17 00:00:00 2001 From: Mikalai_Shostka Date: Wed, 31 May 2017 17:58:43 +0300 Subject: [PATCH 37/60] MAGETWO-60692: GithubBundle product order - create invoice via REST API #6988 --- .../testsuite/Magento/Bundle/Api/OrderInvoiceCreateTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/api-functional/testsuite/Magento/Bundle/Api/OrderInvoiceCreateTest.php b/dev/tests/api-functional/testsuite/Magento/Bundle/Api/OrderInvoiceCreateTest.php index ddeb6616e0fc5..3a40e510326a4 100644 --- a/dev/tests/api-functional/testsuite/Magento/Bundle/Api/OrderInvoiceCreateTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Bundle/Api/OrderInvoiceCreateTest.php @@ -3,7 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ -namespace Magento\Bundle\V1; +namespace Magento\Bundle\Api; /** * API test for creation of Invoice for order with bundle product. From 57d2a8385539ba3d9cb5c84c8075afa51c2042f0 Mon Sep 17 00:00:00 2001 From: Volodymyr Kublytskyi Date: Wed, 31 May 2017 15:12:17 +0300 Subject: [PATCH 38/60] MAGETWO-69539: PHP "soap" extension is not declared in composer.json but can be used by Magento modules --- .../Test/Integrity/ComposerLockTest.php | 120 +++++++++++++++++- 1 file changed, 113 insertions(+), 7 deletions(-) diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/ComposerLockTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/ComposerLockTest.php index 001d7b1327dcc..c856296102095 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/ComposerLockTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/ComposerLockTest.php @@ -10,15 +10,121 @@ */ class ComposerLockTest extends \PHPUnit_Framework_TestCase { - public function testUpToDate() + /** + * @return string + */ + public function testLockFileExists() { - $hash = hash_file('md5', BP . '/composer.json'); $lockFilePath = BP . '/composer.lock'; - if (!file_exists($lockFilePath)) { - $this->markTestSkipped('composer.lock file doesn\'t exist'); + $this->assertLockFileExists($lockFilePath); + return $lockFilePath; + } + + /** + * @depends testLockFileExists + * @param string $lockFilePath + * @return string + */ + public function testLockFileReadable($lockFilePath) + { + $this->assertLockFileReadable($lockFilePath); + return $lockFilePath; + } + + /** + * @depends testLockFileReadable + * @param string $lockFilePath + * @return string + */ + public function testLockFileContainsJson($lockFilePath) + { + $lockFileContent = file_get_contents($lockFilePath); + $this->assertLockFileContainsValidJson($lockFileContent); + return $lockFileContent; + } + + /** + * @depends testLockFileContainsJson + * @param string $lockFileContent + */ + public function testUpToDate($lockFileContent) + { + $lockData = json_decode($lockFileContent, true); + $composerFilePath = BP . '/composer.json'; + $this->assertLockDataRelevantToComposerFile($lockData, $composerFilePath); + } + + /** + * @param string $lockFilePath + */ + private function assertLockFileExists($lockFilePath) + { + $this->assertFileExists($lockFilePath, 'composer.lock file does not exist'); + } + + /** + * @param string $lockFilePath + */ + private function assertLockFileReadable($lockFilePath) + { + if (!is_readable($lockFilePath)) { + $this->fail('composer.lock file is not readable'); } - $jsonData = file_get_contents($lockFilePath); - $json = json_decode($jsonData); - $this->assertSame($hash, $json->hash, 'composer.lock file is not up to date'); + } + + /** + * @param string $lockFileContent + */ + private function assertLockFileContainsValidJson($lockFileContent) + { + $this->assertJson($lockFileContent, 'composer.lock file does not contains valid json'); + } + + /** + * @param array $lockData + * @param string $composerFilePath + */ + private function assertLockDataRelevantToComposerFile(array $lockData, $composerFilePath) + { + if (isset($lockData['content-hash'])) { + $this->assertLockDataRelevantToMeaningfulComposerConfig($lockData, $composerFilePath); + } else if (isset($lockData['hash'])) { + $this->assertLockDataRelevantToFullComposerConfig($lockData, $composerFilePath); + } else { + $this->fail('composer.lock does not linked to composer.json data'); + } + } + + /** + * @param array $lockData + * @param string $composerFilePath + */ + private function assertLockDataRelevantToMeaningfulComposerConfig(array $lockData, $composerFilePath) + { + $contentHashCalculator = 'Composer\Package\Locker::getContentHash'; + if (!is_callable($contentHashCalculator)) { + $this->markTestSkipped('Unable to check composer.lock file by content hash'); + } + + $composerContentHash = call_user_func($contentHashCalculator, file_get_contents($composerFilePath)); + $this->assertSame( + $composerContentHash, + $lockData['content-hash'], + 'composer.lock file is not up to date (composer.json file was modified)' + ); + } + + /** + * @param array $lockData + * @param string $composerFilePath + */ + private function assertLockDataRelevantToFullComposerConfig(array $lockData, $composerFilePath) + { + $composerFileHash = hash_file('md5', $composerFilePath); + $this->assertSame( + $composerFileHash, + $lockData['hash'], + 'composer.lock file is not up to date (composer.json file was modified)' + ); } } From 33fc68d6d3a97645db6d3b040992fded27e29ce3 Mon Sep 17 00:00:00 2001 From: Ihor Savchuk Date: Tue, 6 Jun 2017 14:04:01 +0300 Subject: [PATCH 39/60] MAGETWO-69539: PHP "soap" extension is not declared in composer.json but can be used by Magento modules - Changed composer.lock file --- composer.lock | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/composer.lock b/composer.lock index 119ad0b8059c3..362c4a0a24cd5 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "468277cb85ede262e3dd3155da88a15a", - "content-hash": "83b07861c465af490d6cf0c75adc78fd", + "hash": "958a942af6aa31a3fb3c0e476fce876f", + "content-hash": "1bc90f92ebb53912b7f58e7fef0cc57e", "packages": [ { "name": "braintree/braintree_php", @@ -5449,7 +5449,8 @@ "ext-mbstring": "*", "ext-openssl": "*", "ext-zip": "*", - "ext-pdo_mysql": "*" + "ext-pdo_mysql": "*", + "ext-soap": "*" }, "platform-dev": [] } From d9f4f47949ce470bf9a770ae4e14ac9b12012998 Mon Sep 17 00:00:00 2001 From: Vital_Pantsialeyeu Date: Tue, 6 Jun 2017 18:16:11 +0300 Subject: [PATCH 40/60] MAGETWO-63054: [Catalog] MSRP field is not displayed for bundle products with fixed price - Added variation to functional test --- .../Product/Edit/Section/AdvancedPricing.php | 16 ++-------------- ...ssertProductEditPageAdvancedPricingFields.php | 9 +-------- 2 files changed, 3 insertions(+), 22 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Section/AdvancedPricing.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Section/AdvancedPricing.php index f45429168c3e1..3e86e1f019580 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Section/AdvancedPricing.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Section/AdvancedPricing.php @@ -124,22 +124,10 @@ public function getTierPriceForm(SimpleElement $element = null) * Check if the field is displayed correctly. * * @param string $fieldName - * @param string|null $previousFieldName * @return bool */ - public function checkField($fieldName, $previousFieldName = null) + public function checkField($fieldName) { - $field = $this->_rootElement->find(sprintf($this->fieldByName, $fieldName), Locator::SELECTOR_XPATH); - if ($field->isVisible()) { - if ($previousFieldName) { - return $this->_rootElement->find( - sprintf($this->previousField, $fieldName), - Locator::SELECTOR_XPATH - )->getText() == $previousFieldName; - } else { - return $field->isVisible(); - } - } - return false; + return $this->_rootElement->find(sprintf($this->fieldByName, $fieldName), Locator::SELECTOR_XPATH)->isVisible(); } } diff --git a/dev/tests/functional/tests/app/Magento/Msrp/Test/Constraint/AssertProductEditPageAdvancedPricingFields.php b/dev/tests/functional/tests/app/Magento/Msrp/Test/Constraint/AssertProductEditPageAdvancedPricingFields.php index e150997e32728..a9860ab7b7715 100644 --- a/dev/tests/functional/tests/app/Magento/Msrp/Test/Constraint/AssertProductEditPageAdvancedPricingFields.php +++ b/dev/tests/functional/tests/app/Magento/Msrp/Test/Constraint/AssertProductEditPageAdvancedPricingFields.php @@ -15,13 +15,6 @@ */ class AssertProductEditPageAdvancedPricingFields extends AbstractConstraint { - /** - * Title of "Price View". - * - * @var string - */ - private $priceFieldTitle = 'Price View'; - /** * Title of "Manufacturer's Suggested Retail Price" field. * @@ -41,7 +34,7 @@ public function processAssert(CatalogProductEdit $catalogProductEdit, FixtureInt $advancedPricing = $catalogProductEdit->getProductForm()->getSection('advanced-pricing'); \PHPUnit_Framework_Assert::assertTrue( - $advancedPricing->checkField($this->manufacturerFieldTitle, $this->priceFieldTitle), + $advancedPricing->checkField($this->manufacturerFieldTitle), '"Manufacturer\'s Suggested Retail Price" field is not correct.' ); } From 4869c54d6e89652db8e68e921c73a03a7c7e0fee Mon Sep 17 00:00:00 2001 From: Stanislav Lopukhov Date: Wed, 7 Jun 2017 19:50:35 +0300 Subject: [PATCH 41/60] MAGETWO-67087: Saving category deletes url-rewrites for products in anchor categories --- .../Product/AnchorUrlRewriteGenerator.php | 2 +- .../Product/CanonicalUrlRewriteGenerator.php | 2 +- .../Product/CategoriesUrlRewriteGenerator.php | 2 +- .../Product/CurrentUrlRewritesRegenerator.php | 53 ++++++++++++++++++- .../Model/ProductScopeRewriteGenerator.php | 9 +++- .../Observer/UrlRewriteHandler.php | 18 +++++-- 6 files changed, 75 insertions(+), 11 deletions(-) diff --git a/app/code/Magento/CatalogUrlRewrite/Model/Product/AnchorUrlRewriteGenerator.php b/app/code/Magento/CatalogUrlRewrite/Model/Product/AnchorUrlRewriteGenerator.php index d600cc892be7d..77ea3e1c312e1 100644 --- a/app/code/Magento/CatalogUrlRewrite/Model/Product/AnchorUrlRewriteGenerator.php +++ b/app/code/Magento/CatalogUrlRewrite/Model/Product/AnchorUrlRewriteGenerator.php @@ -41,7 +41,7 @@ public function __construct( } /** - * Generate list based on categories + * Generate product rewrites for anchor categories * * @param int $storeId * @param Product $product diff --git a/app/code/Magento/CatalogUrlRewrite/Model/Product/CanonicalUrlRewriteGenerator.php b/app/code/Magento/CatalogUrlRewrite/Model/Product/CanonicalUrlRewriteGenerator.php index 69705c072e494..41e1a880d7ad7 100644 --- a/app/code/Magento/CatalogUrlRewrite/Model/Product/CanonicalUrlRewriteGenerator.php +++ b/app/code/Magento/CatalogUrlRewrite/Model/Product/CanonicalUrlRewriteGenerator.php @@ -30,7 +30,7 @@ public function __construct(ProductUrlPathGenerator $productUrlPathGenerator, Ur } /** - * Generate list based on store view + * Generate product rewrites without categories * * @param int $storeId * @param Product $product diff --git a/app/code/Magento/CatalogUrlRewrite/Model/Product/CategoriesUrlRewriteGenerator.php b/app/code/Magento/CatalogUrlRewrite/Model/Product/CategoriesUrlRewriteGenerator.php index 1d60565f28b98..ddad00b42a1da 100644 --- a/app/code/Magento/CatalogUrlRewrite/Model/Product/CategoriesUrlRewriteGenerator.php +++ b/app/code/Magento/CatalogUrlRewrite/Model/Product/CategoriesUrlRewriteGenerator.php @@ -31,7 +31,7 @@ public function __construct(ProductUrlPathGenerator $productUrlPathGenerator, Ur } /** - * Generate list based on categories + * Generate product rewrites with categories * * @param int $storeId * @param Product $product diff --git a/app/code/Magento/CatalogUrlRewrite/Model/Product/CurrentUrlRewritesRegenerator.php b/app/code/Magento/CatalogUrlRewrite/Model/Product/CurrentUrlRewritesRegenerator.php index 70e4ec3d92875..6b3b3cb1e6d84 100644 --- a/app/code/Magento/CatalogUrlRewrite/Model/Product/CurrentUrlRewritesRegenerator.php +++ b/app/code/Magento/CatalogUrlRewrite/Model/Product/CurrentUrlRewritesRegenerator.php @@ -6,6 +6,7 @@ namespace Magento\CatalogUrlRewrite\Model\Product; use Magento\Catalog\Model\Category; +use Magento\Catalog\Model\CategoryRepository; use Magento\Catalog\Model\Product; use Magento\UrlRewrite\Service\V1\Data\UrlRewrite; use Magento\UrlRewrite\Model\OptionProvider; @@ -56,19 +57,24 @@ class CurrentUrlRewritesRegenerator /** @var \Magento\UrlRewrite\Model\MergeDataProvider */ private $mergeDataProviderPrototype; + /** @var CategoryRepository */ + private $categoryRepository; + /** * @param UrlFinderInterface $urlFinder * @param ProductUrlPathGenerator $productUrlPathGenerator * @param UrlRewriteFactory $urlRewriteFactory * @param UrlRewriteFinder|null $urlRewriteFinder * @param \Magento\UrlRewrite\Model\MergeDataProviderFactory|null $mergeDataProviderFactory + * @param CategoryRepository|null $categoryRepository */ public function __construct( UrlFinderInterface $urlFinder, ProductUrlPathGenerator $productUrlPathGenerator, UrlRewriteFactory $urlRewriteFactory, UrlRewriteFinder $urlRewriteFinder = null, - MergeDataProviderFactory $mergeDataProviderFactory = null + MergeDataProviderFactory $mergeDataProviderFactory = null, + CategoryRepository $categoryRepository = null ) { $this->urlFinder = $urlFinder; $this->productUrlPathGenerator = $productUrlPathGenerator; @@ -78,11 +84,12 @@ public function __construct( if (!isset($mergeDataProviderFactory)) { $mergeDataProviderFactory = ObjectManager::getInstance()->get(MergeDataProviderFactory::class); } + $this->categoryRepository = $categoryRepository ?: ObjectManager::getInstance()->get(CategoryRepository::class); $this->mergeDataProviderPrototype = $mergeDataProviderFactory->create(); } /** - * Generate list based on current rewrites + * Generate product rewrites based on current rewrites without anchor categories * * @param int $storeId * @param Product $product @@ -115,6 +122,48 @@ public function generate($storeId, Product $product, ObjectRegistry $productCate return $mergeDataProvider->getData(); } + /** + * Generate product rewrites for anchor categories based on current rewrites + * + * @param int $storeId + * @param Product $product + * @param ObjectRegistry $productCategories + * @param int|null $rootCategoryId + * @return UrlRewrite[] + */ + public function generateAnchor($storeId, Product $product, ObjectRegistry $productCategories, $rootCategoryId = null) + { + $anchorCategoryIds = []; + $mergeDataProvider = clone $this->mergeDataProviderPrototype; + + $currentUrlRewrites = $this->urlRewriteFinder->findAllByData( + $product->getEntityId(), + $storeId, + ProductUrlRewriteGenerator::ENTITY_TYPE, + $rootCategoryId + ); + + foreach ($productCategories->getList() as $productCategory) { + $anchorCategoryIds = array_merge($productCategory->getAnchorsAbove(), $anchorCategoryIds); + } + + foreach ($currentUrlRewrites as $currentUrlRewrite) { + $metadata = $currentUrlRewrite->getMetadata(); + if (isset($metadata['category_id']) && $metadata['category_id'] > 0) { + $category = $this->categoryRepository->get($metadata['category_id'], $storeId); + if (in_array($category->getId(), $anchorCategoryIds)) { + $mergeDataProvider->merge( + $currentUrlRewrite->getIsAutogenerated() + ? $this->generateForAutogenerated($currentUrlRewrite, $storeId, $category, $product) + : $this->generateForCustom($currentUrlRewrite, $storeId, $category, $product) + ); + } + } + } + + return $mergeDataProvider->getData(); + } + /** * @param UrlRewrite $url * @param int $storeId diff --git a/app/code/Magento/CatalogUrlRewrite/Model/ProductScopeRewriteGenerator.php b/app/code/Magento/CatalogUrlRewrite/Model/ProductScopeRewriteGenerator.php index eb9a1881f5baa..2795bb02e9612 100644 --- a/app/code/Magento/CatalogUrlRewrite/Model/ProductScopeRewriteGenerator.php +++ b/app/code/Magento/CatalogUrlRewrite/Model/ProductScopeRewriteGenerator.php @@ -171,7 +171,14 @@ public function generateForSpecificStoreView($storeId, $productCategories, Produ $mergeDataProvider->merge( $this->anchorUrlRewriteGenerator->generate($storeId, $product, $productCategories) ); - + $mergeDataProvider->merge( + $this->currentUrlRewritesRegenerator->generateAnchor( + $storeId, + $product, + $productCategories, + $rootCategoryId + ) + ); return $mergeDataProvider->getData(); } diff --git a/app/code/Magento/CatalogUrlRewrite/Observer/UrlRewriteHandler.php b/app/code/Magento/CatalogUrlRewrite/Observer/UrlRewriteHandler.php index e1a670e9d3597..d2e83497a1900 100644 --- a/app/code/Magento/CatalogUrlRewrite/Observer/UrlRewriteHandler.php +++ b/app/code/Magento/CatalogUrlRewrite/Observer/UrlRewriteHandler.php @@ -80,11 +80,11 @@ public function __construct( public function generateProductUrlRewrites(\Magento\Catalog\Model\Category $category) { $mergeDataProvider = clone $this->mergeDataProviderPrototype; - $this->isSkippedProduct = []; + $this->isSkippedProduct[$category->getEntityId()] = []; $saveRewriteHistory = $category->getData('save_rewrites_history'); $storeId = $category->getStoreId(); if ($category->getAffectedProductIds()) { - $this->isSkippedProduct = $category->getAffectedProductIds(); + $this->isSkippedProduct[$category->getEntityId()] = $category->getAffectedProductIds(); $collection = $this->productCollectionFactory->create() ->setStoreId($storeId) ->addIdFilter($category->getAffectedProductIds()) @@ -137,17 +137,25 @@ public function getCategoryProductsUrlRewrites( $rootCategoryId = null ) { $mergeDataProvider = clone $this->mergeDataProviderPrototype; + /** @var \Magento\Catalog\Model\ResourceModel\Product\Collection $productCollection */ - $productCollection = $category->getProductCollection() + $productCollection = $this->productCollectionFactory->create();//$category->getProductCollection() + + $productCollection->addCategoriesFilter(['eq' => [$category->getEntityId()]]) + ->setStoreId($storeId) ->addAttributeToSelect('name') ->addAttributeToSelect('visibility') ->addAttributeToSelect('url_key') ->addAttributeToSelect('url_path'); + foreach ($productCollection as $product) { - if (in_array($product->getId(), $this->isSkippedProduct)) { + if ( + isset($this->isSkippedProduct[$category->getEntityId()]) && + in_array($product->getId(), $this->isSkippedProduct[$category->getEntityId()]) + ) { continue; } - $this->isSkippedProduct[] = $product->getId(); + $this->isSkippedProduct[$category->getEntityId()][] = $product->getId(); $product->setStoreId($storeId); $product->setData('save_rewrites_history', $saveRewriteHistory); $mergeDataProvider->merge( From 333e3834e295ba1dc0fc8e8adcbc1d3ce20af430 Mon Sep 17 00:00:00 2001 From: Stanislav Lopukhov Date: Wed, 7 Jun 2017 20:12:48 +0300 Subject: [PATCH 42/60] MAGETWO-67087: Saving category deletes url-rewrites for products in anchor categories --- .../Magento/CatalogUrlRewrite/Observer/UrlRewriteHandler.php | 2 +- .../Test/Unit/Model/ProductScopeRewriteGeneratorTest.php | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/CatalogUrlRewrite/Observer/UrlRewriteHandler.php b/app/code/Magento/CatalogUrlRewrite/Observer/UrlRewriteHandler.php index d2e83497a1900..c8816b8e4daf7 100644 --- a/app/code/Magento/CatalogUrlRewrite/Observer/UrlRewriteHandler.php +++ b/app/code/Magento/CatalogUrlRewrite/Observer/UrlRewriteHandler.php @@ -139,7 +139,7 @@ public function getCategoryProductsUrlRewrites( $mergeDataProvider = clone $this->mergeDataProviderPrototype; /** @var \Magento\Catalog\Model\ResourceModel\Product\Collection $productCollection */ - $productCollection = $this->productCollectionFactory->create();//$category->getProductCollection() + $productCollection = $this->productCollectionFactory->create(); $productCollection->addCategoriesFilter(['eq' => [$category->getEntityId()]]) ->setStoreId($storeId) diff --git a/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/ProductScopeRewriteGeneratorTest.php b/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/ProductScopeRewriteGeneratorTest.php index 16f6c5a1d9d03..d2334c862b17c 100644 --- a/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/ProductScopeRewriteGeneratorTest.php +++ b/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/ProductScopeRewriteGeneratorTest.php @@ -137,6 +137,8 @@ public function testGenerationForGlobalScope() ->setStoreId(3); $this->currentUrlRewritesRegenerator->expects($this->any())->method('generate') ->will($this->returnValue([$current])); + $this->currentUrlRewritesRegenerator->expects($this->any())->method('generateAnchor') + ->will($this->returnValue([$current])); $anchorCategories = new \Magento\UrlRewrite\Service\V1\Data\UrlRewrite([], $this->serializer); $anchorCategories->setRequestPath('category-4') ->setStoreId(4); @@ -178,6 +180,8 @@ public function testGenerationForSpecificStore() ->will($this->returnValue([])); $this->currentUrlRewritesRegenerator->expects($this->any())->method('generate') ->will($this->returnValue([])); + $this->currentUrlRewritesRegenerator->expects($this->any())->method('generateAnchor') + ->will($this->returnValue([])); $this->anchorUrlRewriteGenerator->expects($this->any())->method('generate') ->will($this->returnValue([])); From dd2f9c30e7b92c18aa48d21231f4a8f50e4e3f3c Mon Sep 17 00:00:00 2001 From: Stanislav Lopukhov Date: Thu, 8 Jun 2017 09:17:19 +0300 Subject: [PATCH 43/60] MAGETWO-67087: Saving category deletes url-rewrites for products in anchor categories --- .../Model/CategoryUrlRewriteGeneratorTest.php | 116 +++++++++++++++++- 1 file changed, 114 insertions(+), 2 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/Model/CategoryUrlRewriteGeneratorTest.php b/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/Model/CategoryUrlRewriteGeneratorTest.php index 30bf4d222cdf9..b373fffae8151 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/Model/CategoryUrlRewriteGeneratorTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/Model/CategoryUrlRewriteGeneratorTest.php @@ -10,6 +10,7 @@ use Magento\UrlRewrite\Model\OptionProvider; use Magento\UrlRewrite\Service\V1\Data\UrlRewrite; +use Magento\CatalogUrlRewrite\Model\ProductUrlRewriteGenerator; /** * @magentoAppArea adminhtml @@ -25,7 +26,7 @@ protected function setUp() } /** - * @magentoDataFixture Magento/CatalogUrlRewrite/_files/categories.php + * @magentoDataFixture Magento/CatalogUrlRewrite/_files/categories_with_products.php * @magentoDbIsolation enabled * @magentoAppIsolation enabled */ @@ -50,11 +51,57 @@ public function testGenerateUrlRewritesWithoutSaveHistory() ]; $this->assertResults($categoryExpectedResult, $actualResults); + + $productIds = []; + foreach ($category->getProductCollection() as $product) { + $productIds = $product->getId(); + } + $this->assertTrue(isset($productIds[0]), 'Product for testing does not exist'); + $productForTest = $productIds[0]; + $productFilter = [ + UrlRewrite::ENTITY_TYPE => ProductUrlRewriteGenerator::ENTITY_TYPE, + UrlRewrite::ENTITY_ID => [$productForTest] + ]; + $actualResults = $this->getActualResults($productFilter); + $productExpectedResult = [ + [ + 'simple-product-two.html', + 'catalog/product/view/id/' . $productForTest, + 1, + 0 + ], + [ + 'new-url/category-1-1/category-1-1-1/simple-product-two.html', + 'catalog/product/view/id/' . $productForTest . '/category/5', + 1, + 0 + ], + [ + 'new-url/simple-product-two.html', + 'catalog/product/view/id/' . $productForTest . '/category/3', + 1, + 0 + ], + [ + 'new-url/category-1-1/simple-product-two.html', + 'catalog/product/view/id/' . $productForTest . '/category/4', + 1, + 0 + ], + [ + '/simple-product-two.html', + 'catalog/product/view/id/' . $productForTest . '/category/2', + 1, + 0 + ] + ]; + + $this->assertResults($productExpectedResult, $actualResults); } /** * @magentoDbIsolation enabled - * @magentoDataFixture Magento/CatalogUrlRewrite/_files/categories.php + * @magentoDataFixture Magento/CatalogUrlRewrite/_files/categories_with_products.php * @magentoAppIsolation enabled */ public function testGenerateUrlRewritesWithSaveHistory() @@ -86,6 +133,70 @@ public function testGenerateUrlRewritesWithSaveHistory() ]; $this->assertResults($categoryExpectedResult, $actualResults); + + $productIds = []; + foreach ($category->getProductCollection() as $product) { + $productIds = $product->getId(); + } + $this->assertTrue(isset($productIds[0]), 'Product for testing does not exist'); + $productForTest = $productIds[0]; + $productFilter = [ + UrlRewrite::ENTITY_TYPE => ProductUrlRewriteGenerator::ENTITY_TYPE, + UrlRewrite::ENTITY_ID => [$productForTest] + ]; + $actualResults = $this->getActualResults($productFilter); + $productExpectedResult = [ + [ + 'simple-product-two.html', + 'catalog/product/view/id/' . $productForTest, + 1, + 0 + ], + [ + 'new-url/category-1-1/category-1-1-1/simple-product-two.html', + 'catalog/product/view/id/' . $productForTest . '/category/5', + 1, + 0 + ], + [ + 'category-1/category-1-1/category-1-1-1/simple-product-two.html', + 'new-url/category-1-1/category-1-1-1/simple-product-two.html', + 0, + OptionProvider::PERMANENT + ], + [ + 'new-url/simple-product-two.html', + 'catalog/product/view/id/' . $productForTest . '/category/3', + 1, + 0 + ], + [ + 'new-url/category-1-1/simple-product-two.html', + 'catalog/product/view/id/' . $productForTest . '/category/4', + 1, + 0 + ], + [ + '/simple-product-two.html', + 'catalog/product/view/id/' . $productForTest . '/category/2', + 1, + 0 + ], + [ + 'category-1/simple-product-two.html', + 'new-url/simple-product-two.html', + 0, + OptionProvider::PERMANENT + ], + [ + 'category-1/category-1-1/simple-product-two.html', + 'new-url/category-1-1/simple-product-two.html', + 0, + OptionProvider::PERMANENT + ], + ]; + + $this->assertResults($productExpectedResult, $actualResults); } /** @@ -145,6 +256,7 @@ protected function getActualResults(array $filter) */ protected function assertResults($expected, $actual) { + $this->assertEquals(count($expected), count($actual), 'Number of rewrites does not match'); foreach ($expected as $row) { $this->assertContains( $row, From 0d3e766d45243938b14b28893f9897d49738b267 Mon Sep 17 00:00:00 2001 From: Stanislav Lopukhov Date: Thu, 8 Jun 2017 10:34:05 +0300 Subject: [PATCH 44/60] MAGETWO-67087: Saving category deletes url-rewrites for products in anchor categories --- .../Product/CurrentUrlRewritesRegenerator.php | 12 ++++++---- .../Model/CategoryUrlRewriteGeneratorTest.php | 22 +++++++++---------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/app/code/Magento/CatalogUrlRewrite/Model/Product/CurrentUrlRewritesRegenerator.php b/app/code/Magento/CatalogUrlRewrite/Model/Product/CurrentUrlRewritesRegenerator.php index 6b3b3cb1e6d84..d163ef8f067f3 100644 --- a/app/code/Magento/CatalogUrlRewrite/Model/Product/CurrentUrlRewritesRegenerator.php +++ b/app/code/Magento/CatalogUrlRewrite/Model/Product/CurrentUrlRewritesRegenerator.php @@ -131,8 +131,12 @@ public function generate($storeId, Product $product, ObjectRegistry $productCate * @param int|null $rootCategoryId * @return UrlRewrite[] */ - public function generateAnchor($storeId, Product $product, ObjectRegistry $productCategories, $rootCategoryId = null) - { + public function generateAnchor( + $storeId, + Product $product, + ObjectRegistry $productCategories, + $rootCategoryId = null + ) { $anchorCategoryIds = []; $mergeDataProvider = clone $this->mergeDataProviderPrototype; @@ -154,8 +158,8 @@ public function generateAnchor($storeId, Product $product, ObjectRegistry $produ if (in_array($category->getId(), $anchorCategoryIds)) { $mergeDataProvider->merge( $currentUrlRewrite->getIsAutogenerated() - ? $this->generateForAutogenerated($currentUrlRewrite, $storeId, $category, $product) - : $this->generateForCustom($currentUrlRewrite, $storeId, $category, $product) + ? $this->generateForAutogenerated($currentUrlRewrite, $storeId, $category, $product) + : $this->generateForCustom($currentUrlRewrite, $storeId, $category, $product) ); } } diff --git a/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/Model/CategoryUrlRewriteGeneratorTest.php b/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/Model/CategoryUrlRewriteGeneratorTest.php index b373fffae8151..a2b97d1136e4d 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/Model/CategoryUrlRewriteGeneratorTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/Model/CategoryUrlRewriteGeneratorTest.php @@ -52,12 +52,11 @@ public function testGenerateUrlRewritesWithoutSaveHistory() $this->assertResults($categoryExpectedResult, $actualResults); - $productIds = []; - foreach ($category->getProductCollection() as $product) { - $productIds = $product->getId(); - } - $this->assertTrue(isset($productIds[0]), 'Product for testing does not exist'); - $productForTest = $productIds[0]; + /** @var \Magento\Catalog\Model\ProductRepository $productRepository */ + $productRepository = $this->objectManager->create(\Magento\Catalog\Model\ProductRepository::class); + $product = $productRepository->get('12345'); + $productForTest = $product->getId(); + $productFilter = [ UrlRewrite::ENTITY_TYPE => ProductUrlRewriteGenerator::ENTITY_TYPE, UrlRewrite::ENTITY_ID => [$productForTest] @@ -134,12 +133,11 @@ public function testGenerateUrlRewritesWithSaveHistory() $this->assertResults($categoryExpectedResult, $actualResults); - $productIds = []; - foreach ($category->getProductCollection() as $product) { - $productIds = $product->getId(); - } - $this->assertTrue(isset($productIds[0]), 'Product for testing does not exist'); - $productForTest = $productIds[0]; + /** @var \Magento\Catalog\Model\ProductRepository $productRepository */ + $productRepository = $this->objectManager->create(\Magento\Catalog\Model\ProductRepository::class); + $product = $productRepository->get('12345'); + $productForTest = $product->getId(); + $productFilter = [ UrlRewrite::ENTITY_TYPE => ProductUrlRewriteGenerator::ENTITY_TYPE, UrlRewrite::ENTITY_ID => [$productForTest] From 9baccc765b2be03b89f0b1c51f41f20c487615b6 Mon Sep 17 00:00:00 2001 From: Stanislav Lopukhov Date: Thu, 8 Jun 2017 15:12:45 +0300 Subject: [PATCH 45/60] MAGETWO-67087: Saving category deletes url-rewrites for products in anchor categories --- .../Model/CategoryUrlRewriteGeneratorTest.php | 12 ------------ .../_files/categories_with_products.php | 2 +- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/Model/CategoryUrlRewriteGeneratorTest.php b/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/Model/CategoryUrlRewriteGeneratorTest.php index a2b97d1136e4d..3a6c96fd87ea8 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/Model/CategoryUrlRewriteGeneratorTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/Model/CategoryUrlRewriteGeneratorTest.php @@ -86,12 +86,6 @@ public function testGenerateUrlRewritesWithoutSaveHistory() 'catalog/product/view/id/' . $productForTest . '/category/4', 1, 0 - ], - [ - '/simple-product-two.html', - 'catalog/product/view/id/' . $productForTest . '/category/2', - 1, - 0 ] ]; @@ -174,12 +168,6 @@ public function testGenerateUrlRewritesWithSaveHistory() 1, 0 ], - [ - '/simple-product-two.html', - 'catalog/product/view/id/' . $productForTest . '/category/2', - 1, - 0 - ], [ 'category-1/simple-product-two.html', 'new-url/simple-product-two.html', diff --git a/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/_files/categories_with_products.php b/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/_files/categories_with_products.php index 745d471bdb4f5..6f2ace6b36382 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/_files/categories_with_products.php +++ b/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/_files/categories_with_products.php @@ -42,7 +42,7 @@ ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH) ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED) ->save(); -$categoryLinkManagement->assignProductToCategories($product->getSku(), [2, 3, 4]); +$categoryLinkManagement->assignProductToCategories($product->getSku(), [3, 4]); $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Product::class); $product->setTypeId(\Magento\Catalog\Model\Product\Type::TYPE_SIMPLE) From 94e89715b3a4cf79175573b9d3400c37c3f62f46 Mon Sep 17 00:00:00 2001 From: Mikalai_Shostka Date: Thu, 8 Jun 2017 17:54:22 +0300 Subject: [PATCH 46/60] MAGETWO-63054: [Catalog] MSRP field is not displayed for bundle products with fixed price --- .../Adminhtml/Product/Edit/Section/AdvancedPricing.php | 7 ------- 1 file changed, 7 deletions(-) diff --git a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Section/AdvancedPricing.php b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Section/AdvancedPricing.php index 3e86e1f019580..bc64f6ab6f23d 100644 --- a/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Section/AdvancedPricing.php +++ b/dev/tests/functional/tests/app/Magento/Catalog/Test/Block/Adminhtml/Product/Edit/Section/AdvancedPricing.php @@ -45,13 +45,6 @@ class AdvancedPricing extends Section */ private $fieldByName = '//*[contains(text(),"%s")]/preceding::div[2]/ancestor::div[1]'; - /** - * Selector for previous field. - * - * @var string - */ - private $previousField = '//*[contains(text(),"%s")]/preceding::div[2]//label'; - /** * Fill 'Advanced price' product form on tab. * From 450bec052d7c411b1d3d44d18a4fbc2cdb3d6398 Mon Sep 17 00:00:00 2001 From: Stanislav Lopukhov Date: Fri, 9 Jun 2017 15:01:09 +0300 Subject: [PATCH 47/60] MAGETWO-67087: Saving category deletes url-rewrites for products in anchor categories --- .../Model/CategoryUrlRewriteGeneratorTest.php | 12 ++++++++++++ .../_files/categories_with_products.php | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/Model/CategoryUrlRewriteGeneratorTest.php b/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/Model/CategoryUrlRewriteGeneratorTest.php index 3a6c96fd87ea8..a2b97d1136e4d 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/Model/CategoryUrlRewriteGeneratorTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/Model/CategoryUrlRewriteGeneratorTest.php @@ -86,6 +86,12 @@ public function testGenerateUrlRewritesWithoutSaveHistory() 'catalog/product/view/id/' . $productForTest . '/category/4', 1, 0 + ], + [ + '/simple-product-two.html', + 'catalog/product/view/id/' . $productForTest . '/category/2', + 1, + 0 ] ]; @@ -168,6 +174,12 @@ public function testGenerateUrlRewritesWithSaveHistory() 1, 0 ], + [ + '/simple-product-two.html', + 'catalog/product/view/id/' . $productForTest . '/category/2', + 1, + 0 + ], [ 'category-1/simple-product-two.html', 'new-url/simple-product-two.html', diff --git a/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/_files/categories_with_products.php b/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/_files/categories_with_products.php index 6f2ace6b36382..745d471bdb4f5 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/_files/categories_with_products.php +++ b/dev/tests/integration/testsuite/Magento/CatalogUrlRewrite/_files/categories_with_products.php @@ -42,7 +42,7 @@ ->setVisibility(\Magento\Catalog\Model\Product\Visibility::VISIBILITY_BOTH) ->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_ENABLED) ->save(); -$categoryLinkManagement->assignProductToCategories($product->getSku(), [3, 4]); +$categoryLinkManagement->assignProductToCategories($product->getSku(), [2, 3, 4]); $product = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(\Magento\Catalog\Model\Product::class); $product->setTypeId(\Magento\Catalog\Model\Product\Type::TYPE_SIMPLE) From 0006383459896ed384162d1a96be64ce7b017125 Mon Sep 17 00:00:00 2001 From: Ihor Savchuk Date: Fri, 9 Jun 2017 16:28:19 +0300 Subject: [PATCH 48/60] MAGETWO-69539: PHP "soap" extension is not declared in composer.json but can be used by Magento modules - Updated composer.lock --- composer.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.lock b/composer.lock index e5a009d8ba59e..845d2bbf5576d 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "f6383328a3387e72091eddc2ed464cd1", - "content-hash": "466e4d122888ecfdcc9705c880a4dd69", + "hash": "943975c96428352b445c2636c6c53e9b", + "content-hash": "c7ae72ad7777ba197d1ba038a50df230", "packages": [ { "name": "braintree/braintree_php", From e85558ac02c0f4d00c7ddca3a62cdc555e0916f0 Mon Sep 17 00:00:00 2001 From: Oleksii Korshenko Date: Fri, 9 Jun 2017 16:22:22 -0500 Subject: [PATCH 49/60] MAGETWO-69723: Email to a Friend feature #9824 - fixed template configuration format --- .../SendFriend/view/frontend/layout/sendfriend_product_send.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/SendFriend/view/frontend/layout/sendfriend_product_send.xml b/app/code/Magento/SendFriend/view/frontend/layout/sendfriend_product_send.xml index ec118a339b682..8065b7e236132 100644 --- a/app/code/Magento/SendFriend/view/frontend/layout/sendfriend_product_send.xml +++ b/app/code/Magento/SendFriend/view/frontend/layout/sendfriend_product_send.xml @@ -13,7 +13,7 @@ - + From 02172bdb87e2aca3edac55fdc3b07b08f007fd73 Mon Sep 17 00:00:00 2001 From: Oleksii Korshenko Date: Fri, 9 Jun 2017 17:35:46 -0500 Subject: [PATCH 50/60] MAGETWO-69666: Return array of pages as items instead of array of arrays #9823 - fixed unit tests --- .../Cms/Test/Unit/Model/PageRepositoryTest.php | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/app/code/Magento/Cms/Test/Unit/Model/PageRepositoryTest.php b/app/code/Magento/Cms/Test/Unit/Model/PageRepositoryTest.php index 7d064c73b3259..1bd742048c51e 100644 --- a/app/code/Magento/Cms/Test/Unit/Model/PageRepositoryTest.php +++ b/app/code/Magento/Cms/Test/Unit/Model/PageRepositoryTest.php @@ -261,22 +261,8 @@ public function testGetList() ->willReturnSelf(); $this->pageSearchResult->expects($this->once()) ->method('setItems') - ->with(['someData']) + ->with([$this->page]) ->willReturnSelf(); - - $this->page->expects($this->once()) - ->method('getData') - ->willReturn(['data']); - - $this->dataHelper->expects($this->once()) - ->method('populateWithArray') - ->with($this->pageData, ['data'], \Magento\Cms\Api\Data\PageInterface::class); - - $this->dataObjectProcessor->expects($this->once()) - ->method('buildOutputDataArray') - ->with($this->pageData, \Magento\Cms\Api\Data\PageInterface::class) - ->willReturn('someData'); - $this->assertEquals($this->pageSearchResult, $this->repository->getList($criteria)); } } From e091cfd28aa7a4abd4362df350de0fdbe8940979 Mon Sep 17 00:00:00 2001 From: Oleksii Korshenko Date: Fri, 9 Jun 2017 17:39:26 -0500 Subject: [PATCH 51/60] MAGETWO-69805: Return array of blocks as items instead of array of arrays #9157 - fixed unit tests --- .../Cms/Test/Unit/Model/BlockRepositoryTest.php | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/app/code/Magento/Cms/Test/Unit/Model/BlockRepositoryTest.php b/app/code/Magento/Cms/Test/Unit/Model/BlockRepositoryTest.php index dd43f4a0b2287..6e4440ef97b25 100644 --- a/app/code/Magento/Cms/Test/Unit/Model/BlockRepositoryTest.php +++ b/app/code/Magento/Cms/Test/Unit/Model/BlockRepositoryTest.php @@ -263,22 +263,8 @@ public function testGetList() ->willReturnSelf(); $this->blockSearchResult->expects($this->once()) ->method('setItems') - ->with(['someData']) + ->with([$this->block]) ->willReturnSelf(); - - $this->block->expects($this->once()) - ->method('getData') - ->willReturn(['data']); - - $this->dataHelper->expects($this->once()) - ->method('populateWithArray') - ->with($this->blockData, ['data'], \Magento\Cms\Api\Data\BlockInterface::class); - - $this->dataObjectProcessor->expects($this->once()) - ->method('buildOutputDataArray') - ->with($this->blockData, \Magento\Cms\Api\Data\BlockInterface::class) - ->willReturn('someData'); - $this->assertEquals($this->blockSearchResult, $this->repository->getList($criteria)); } } From c9f2797a68bca589a5b8cc4a5f684107d80e9102 Mon Sep 17 00:00:00 2001 From: Matias Montes Date: Sun, 11 Jun 2017 13:38:22 -0300 Subject: [PATCH 52/60] Handling CLI error as a failure when validating composer.json file --- .../testsuite/Magento/Test/Integrity/ComposerTest.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/ComposerTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/ComposerTest.php index e6a036487fc5a..18a27eb1a81f6 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/ComposerTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/ComposerTest.php @@ -99,7 +99,12 @@ private function validateComposerJsonFile($path) /** @var \Magento\Framework\Composer\MagentoComposerApplicationFactory $appFactory */ $appFactory = self::$objectManager->get(\Magento\Framework\Composer\MagentoComposerApplicationFactory::class); $app = $appFactory->create(); - $app->runComposerCommand(['command' => 'validate'], $path); + + try { + $app->runComposerCommand(['command' => 'validate'], $path); + } catch (\RuntimeException $exception) { + $this->fail("Failed validation of {$path}"); + } } /** From 729cedf10ca0dc662cb72ec4363b743087abc636 Mon Sep 17 00:00:00 2001 From: Matias Montes Date: Sun, 11 Jun 2017 15:55:44 -0300 Subject: [PATCH 53/60] Using Command output as message which actually provides more information for debugging than just the path --- .../static/testsuite/Magento/Test/Integrity/ComposerTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/ComposerTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/ComposerTest.php index 18a27eb1a81f6..04e440154e96c 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/ComposerTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/ComposerTest.php @@ -103,7 +103,7 @@ private function validateComposerJsonFile($path) try { $app->runComposerCommand(['command' => 'validate'], $path); } catch (\RuntimeException $exception) { - $this->fail("Failed validation of {$path}"); + $this->fail($exception->getMessage()); } } From f3c7406253938c70742cac308c12729a99f50a1c Mon Sep 17 00:00:00 2001 From: Anton Evers Date: Tue, 14 Mar 2017 12:11:45 +0100 Subject: [PATCH 54/60] add middle name to checkout address html templates #8878 --- .../view/frontend/web/template/billing-address/details.html | 2 +- .../web/template/shipping-address/address-renderer/default.html | 2 +- .../template/shipping-information/address-renderer/default.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Checkout/view/frontend/web/template/billing-address/details.html b/app/code/Magento/Checkout/view/frontend/web/template/billing-address/details.html index 17754b81849f5..f2baf5d50030e 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/billing-address/details.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/billing-address/details.html @@ -5,7 +5,7 @@ */ -->
- +

,
diff --git a/app/code/Magento/Checkout/view/frontend/web/template/shipping-address/address-renderer/default.html b/app/code/Magento/Checkout/view/frontend/web/template/shipping-address/address-renderer/default.html index 4c3ce84baac4d..f9400227fae09 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/shipping-address/address-renderer/default.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/shipping-address/address-renderer/default.html @@ -5,7 +5,7 @@ */ -->
- +

,
diff --git a/app/code/Magento/Checkout/view/frontend/web/template/shipping-information/address-renderer/default.html b/app/code/Magento/Checkout/view/frontend/web/template/shipping-information/address-renderer/default.html index c3afce6c4537f..ec41cae0bdc5e 100644 --- a/app/code/Magento/Checkout/view/frontend/web/template/shipping-information/address-renderer/default.html +++ b/app/code/Magento/Checkout/view/frontend/web/template/shipping-information/address-renderer/default.html @@ -5,7 +5,7 @@ */ --> - +

,
From 5f1b460249428e6c80910b672d769099d37619c7 Mon Sep 17 00:00:00 2001 From: Anton Evers Date: Mon, 12 Jun 2017 17:05:32 +0600 Subject: [PATCH 55/60] Fix prefix, middle name and suffix were not prefilled in the checkout --- .../Checkout/Block/Checkout/AttributeMerger.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/app/code/Magento/Checkout/Block/Checkout/AttributeMerger.php b/app/code/Magento/Checkout/Block/Checkout/AttributeMerger.php index a2880c28844ac..1905826133c2a 100644 --- a/app/code/Magento/Checkout/Block/Checkout/AttributeMerger.php +++ b/app/code/Magento/Checkout/Block/Checkout/AttributeMerger.php @@ -326,6 +326,21 @@ protected function getDefaultValue($attributeCode) return $this->getCustomer()->getLastname(); } break; + case 'middlename': + if ($this->getCustomer()) { + return $this->getCustomer()->getMiddlename(); + } + break; + case 'prefix': + if ($this->getCustomer()) { + return $this->getCustomer()->getPrefix(); + } + break; + case 'suffix': + if ($this->getCustomer()) { + return $this->getCustomer()->getSuffix(); + } + break; case 'country_id': return $this->directoryHelper->getDefaultCountry(); } From e4276a7dd63a572d5d52203122129823c2351a9e Mon Sep 17 00:00:00 2001 From: Oleksii Korshenko Date: Mon, 12 Jun 2017 11:29:29 -0500 Subject: [PATCH 56/60] MAGETWO-67500: setup:di:compile returns exit code 0 if errors are found #7780 - fixed false positive failures --- setup/src/Magento/Setup/Module/Di/Compiler/Log/Log.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/setup/src/Magento/Setup/Module/Di/Compiler/Log/Log.php b/setup/src/Magento/Setup/Module/Di/Compiler/Log/Log.php index 181573b5d67bb..a757cda7ba79a 100644 --- a/setup/src/Magento/Setup/Module/Di/Compiler/Log/Log.php +++ b/setup/src/Magento/Setup/Module/Di/Compiler/Log/Log.php @@ -86,7 +86,9 @@ public function report() { $this->_successWriter->write($this->_successEntries); $this->_errorWriter->write($this->_errorEntries); - if (count($this->_errorEntries) > 0) { + //do not take into account empty items since they are initialized in constructor. + $errors = array_filter($this->_errorEntries); + if (count($errors) > 0) { throw new \Magento\Framework\Validator\Exception(__('Error during compilation')); } } From 76b45a71c15975eab37a4c9ff7d2e701096564ef Mon Sep 17 00:00:00 2001 From: Pieter Hoste Date: Mon, 12 Jun 2017 22:10:43 +0200 Subject: [PATCH 57/60] Revert "MAGETWO-69728: Fixes layered navigation options being cached using the wrong store id. #9873" This reverts commit 58b4c7c312395dfe93ca12d8478a2379a104a476. --- .../Model/Entity/Attribute/Frontend/AbstractFrontend.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Frontend/AbstractFrontend.php b/app/code/Magento/Eav/Model/Entity/Attribute/Frontend/AbstractFrontend.php index d1794aff97fb9..8f1324195b382 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Frontend/AbstractFrontend.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Frontend/AbstractFrontend.php @@ -68,8 +68,8 @@ abstract class AbstractFrontend implements \Magento\Eav\Model\Entity\Attribute\F * @param CacheInterface $cache * @param $storeResolver @deprecated * @param array $cacheTags - * @param Serializer $serializer * @param StoreManagerInterface $storeManager + * @param Serializer $serializer * @codeCoverageIgnore * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ @@ -78,8 +78,8 @@ public function __construct( CacheInterface $cache = null, $storeResolver = null, array $cacheTags = null, - Serializer $serializer = null, - StoreManagerInterface $storeManager = null + StoreManagerInterface $storeManager = null, + Serializer $serializer = null ) { $this->_attrBooleanFactory = $attrBooleanFactory; $this->cache = $cache ?: ObjectManager::getInstance()->get(CacheInterface::class); From 1884fd87356b85de4bc7ba427b5e0d869ca8e33d Mon Sep 17 00:00:00 2001 From: Oleksii Korshenko Date: Mon, 12 Jun 2017 16:28:17 -0500 Subject: [PATCH 58/60] MAGETWO-68877: Issue #7988 Typo changed also added comments for each index, getters and setters. #9484 - fixed merge conflict --- .../view/frontend/web/js/checkout-data.js | 43 ++++++++++--------- 1 file changed, 22 insertions(+), 21 deletions(-) diff --git a/app/code/Magento/Checkout/view/frontend/web/js/checkout-data.js b/app/code/Magento/Checkout/view/frontend/web/js/checkout-data.js index 4ebe145b11d06..9c0ef8bb58c07 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/checkout-data.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/checkout-data.js @@ -15,35 +15,36 @@ define([ 'use strict'; var cacheKey = 'checkout-data', - checkoutData, - - /** - * @return {*} - */ - getData = function () { - return storage.get(cacheKey)(); - }, /** * @param {Object} data */ saveData = function (data) { storage.set(cacheKey, data); - }; + }, - if ($.isEmptyObject(getData())) { - checkoutData = { - 'selectedShippingAddress': null, //Selected shipping address pulled from persistence storage - 'shippingAddressFromData': null, //Shipping address pulled from persistence storage - 'newCustomerShippingAddress': null, //Shipping address pulled from persistence storage for new customer - 'selectedShippingRate': null, //Shipping rate pulled from persistence storage - 'selectedPaymentMethod': null, //Payment method pulled from persistence storage - 'selectedBillingAddress': null, //Selected billing address pulled from persistence storage - 'billingAddressFromData': null, //Billing address pulled from persistence storage - 'newCustomerBillingAddress': null //Billing address pulled from persistence storage for new customer + /** + * @return {*} + */ + getData = function () { + var data = storage.get(cacheKey)(); + + if ($.isEmptyObject(data)) { + data = { + 'selectedShippingAddress': null, //Selected shipping address pulled from persistence storage + 'shippingAddressFromData': null, //Shipping address pulled from persistence storage + 'newCustomerShippingAddress': null, //Shipping address pulled from persistence storage for customer + 'selectedShippingRate': null, //Shipping rate pulled from persistence storage + 'selectedPaymentMethod': null, //Payment method pulled from persistence storage + 'selectedBillingAddress': null, //Selected billing address pulled from persistence storage + 'billingAddressFromData': null, //Billing address pulled from persistence storage + 'newCustomerBillingAddress': null //Billing address pulled from persistence storage for new customer + }; + saveData(data); + } + + return data; }; - saveData(checkoutData); - } return { /** From 3c632aa90963107c3450b5e67d6cc1aeafb680f2 Mon Sep 17 00:00:00 2001 From: Anton Evers Date: Tue, 13 Jun 2017 11:31:15 +0600 Subject: [PATCH 59/60] Move prefix and suffix default values to a new PR --- .../Checkout/Block/Checkout/AttributeMerger.php | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/app/code/Magento/Checkout/Block/Checkout/AttributeMerger.php b/app/code/Magento/Checkout/Block/Checkout/AttributeMerger.php index 1905826133c2a..dcfe1cd5e2038 100644 --- a/app/code/Magento/Checkout/Block/Checkout/AttributeMerger.php +++ b/app/code/Magento/Checkout/Block/Checkout/AttributeMerger.php @@ -321,24 +321,14 @@ protected function getDefaultValue($attributeCode) return $this->getCustomer()->getFirstname(); } break; - case 'lastname': - if ($this->getCustomer()) { - return $this->getCustomer()->getLastname(); - } - break; case 'middlename': if ($this->getCustomer()) { return $this->getCustomer()->getMiddlename(); } break; - case 'prefix': - if ($this->getCustomer()) { - return $this->getCustomer()->getPrefix(); - } - break; - case 'suffix': + case 'lastname': if ($this->getCustomer()) { - return $this->getCustomer()->getSuffix(); + return $this->getCustomer()->getLastname(); } break; case 'country_id': From 7e65ae4b5218c188c749efd5ffda4194ee08571c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anna=20V=C3=B6lkl?= Date: Tue, 13 Jun 2017 15:18:29 +0200 Subject: [PATCH 60/60] Fix typo in comment --- .../tests/app/Magento/Checkout/Test/Block/Cart/Shipping.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Cart/Shipping.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Cart/Shipping.php index 9f0c6cb6f3a27..10299486a08ce 100644 --- a/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Cart/Shipping.php +++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Cart/Shipping.php @@ -37,7 +37,7 @@ class Shipping extends Form protected $shippingMethod = '//span[text()="%s"]/following::label[contains(., "%s")]/../input'; /** - * From with shipping available shipping methods. + * Form with shipping available shipping methods. * * @var string */