From 020ca367e590f5ac49df197f6002b66af5048544 Mon Sep 17 00:00:00 2001 From: Maxim Baibakov Date: Sat, 11 Aug 2018 13:20:32 +1000 Subject: [PATCH 01/30] Adding Australian regions into Magento Core --- app/code/Magento/Directory/Setup/InstallData.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/code/Magento/Directory/Setup/InstallData.php b/app/code/Magento/Directory/Setup/InstallData.php index 33c3ae4558e16..0556a7229d5e5 100644 --- a/app/code/Magento/Directory/Setup/InstallData.php +++ b/app/code/Magento/Directory/Setup/InstallData.php @@ -809,6 +809,14 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface ['BR', 'SE', 'Sergipe'], ['BR', 'TO', 'Tocantins'], ['BR', 'DF', 'Distrito Federal'], + ['AU', 'ACT', 'Australian Capital Territory'], + ['AU', 'NSW', 'New South Wales'], + ['AU', 'VIC', 'Victoria'], + ['AU', 'QLD', 'Queensland'], + ['AU', 'SA', 'South Australia'], + ['AU', 'TAS', 'Tasmania'], + ['AU', 'WA', 'Western Australia'], + ['AU', 'NT', 'Northern Territory'], ]; foreach ($data as $row) { From ebb517b4e4886eb176158bac0412557c5b2b4764 Mon Sep 17 00:00:00 2001 From: Maxim Baibakov Date: Mon, 27 Aug 2018 20:22:09 +1000 Subject: [PATCH 02/30] Adding Australian regions into for existing installs --- .../Magento/Directory/Setup/UpgradeData.php | 22 +++++++++++++++++++ app/code/Magento/Directory/etc/module.xml | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Directory/Setup/UpgradeData.php b/app/code/Magento/Directory/Setup/UpgradeData.php index 4ee9ea33673d7..3f9b510550719 100644 --- a/app/code/Magento/Directory/Setup/UpgradeData.php +++ b/app/code/Magento/Directory/Setup/UpgradeData.php @@ -46,6 +46,9 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface if (version_compare($context->getVersion(), '2.0.2', '<')) { $this->addCountryRegions($setup, $this->getDataForIndia()); } + if (version_compare($context->getVersion(), '2.0.3', '<')) { + $this->addCountryRegions($setup, $this->getDataForAustralia()); + } } /** @@ -127,6 +130,25 @@ private function getDataForIndia() ]; } + /** + * Australian states data. + * + * @return array + */ + private function getDataForAustralia() + { + return [ + ['AU', 'ACT', 'Australian Capital Territory'], + ['AU', 'NSW', 'New South Wales'], + ['AU', 'VIC', 'Victoria'], + ['AU', 'QLD', 'Queensland'], + ['AU', 'SA', 'South Australia'], + ['AU', 'TAS', 'Tasmania'], + ['AU', 'WA', 'Western Australia'], + ['AU', 'NT', 'Northern Territory'] + ]; + } + /** * Add country regions data to appropriate tables. * diff --git a/app/code/Magento/Directory/etc/module.xml b/app/code/Magento/Directory/etc/module.xml index a3735ca6ddde1..cc8023b9b3873 100644 --- a/app/code/Magento/Directory/etc/module.xml +++ b/app/code/Magento/Directory/etc/module.xml @@ -6,7 +6,7 @@ */ --> - + From 7965c9bfd532889bca0752a9ef318dae43feb26c Mon Sep 17 00:00:00 2001 From: francesco Date: Fri, 7 Sep 2018 14:15:48 +0200 Subject: [PATCH 03/30] Fix issue 12479, customer custom attributes lost after save --- app/code/Magento/Customer/Model/Customer.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/app/code/Magento/Customer/Model/Customer.php b/app/code/Magento/Customer/Model/Customer.php index e0a7281776de9..50125b7eb5098 100644 --- a/app/code/Magento/Customer/Model/Customer.php +++ b/app/code/Magento/Customer/Model/Customer.php @@ -1051,6 +1051,21 @@ public function beforeDelete() return parent::beforeDelete(); } + /** + * Processing object before save data + * + * @return $this + */ + public function beforeSave() { + // Need to use attribute set or future updates can cause data loss + if (!$this->getAttributeSetId()) { + $this->setAttributeSetId( + CustomerMetadataInterface::ATTRIBUTE_SET_ID_CUSTOMER + ); + } + return parent::beforeSave(); + } + /** * Processing object after save data * From 44fe03f6f067d4f93819b4353f82e2b8caec6c8f Mon Sep 17 00:00:00 2001 From: francesco Date: Fri, 7 Sep 2018 15:15:20 +0200 Subject: [PATCH 04/30] Opening brace should be on a new line --- app/code/Magento/Customer/Model/Customer.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Customer/Model/Customer.php b/app/code/Magento/Customer/Model/Customer.php index 50125b7eb5098..f30a7ceccbcff 100644 --- a/app/code/Magento/Customer/Model/Customer.php +++ b/app/code/Magento/Customer/Model/Customer.php @@ -1056,7 +1056,8 @@ public function beforeDelete() * * @return $this */ - public function beforeSave() { + public function beforeSave() + { // Need to use attribute set or future updates can cause data loss if (!$this->getAttributeSetId()) { $this->setAttributeSetId( From 99f6c1a84637e047996f9d6af3d3e95396c85965 Mon Sep 17 00:00:00 2001 From: Andreas von Studnitz Date: Thu, 20 Sep 2018 12:08:26 +0200 Subject: [PATCH 05/30] Fix type hint of @message declaration as the "setWidgetParameters" method allows arrays too --- app/code/Magento/Widget/Model/Widget/Instance.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Widget/Model/Widget/Instance.php b/app/code/Magento/Widget/Model/Widget/Instance.php index afe7ef3766f7c..1ccb75ad6611a 100644 --- a/app/code/Magento/Widget/Model/Widget/Instance.php +++ b/app/code/Magento/Widget/Model/Widget/Instance.php @@ -15,7 +15,7 @@ * @method string getTitle() * @method \Magento\Widget\Model\Widget\Instance setTitle(string $value) * @method \Magento\Widget\Model\Widget\Instance setStoreIds(string $value) - * @method \Magento\Widget\Model\Widget\Instance setWidgetParameters(string $value) + * @method \Magento\Widget\Model\Widget\Instance setWidgetParameters(string|array $value) * @method int getSortOrder() * @method \Magento\Widget\Model\Widget\Instance setSortOrder(int $value) * @method \Magento\Widget\Model\Widget\Instance setThemeId(int $value) From b7f7093f538e4c4ee446b725d4f23a6b8b606d1d Mon Sep 17 00:00:00 2001 From: Oleksandr Iegorov Date: Fri, 21 Sep 2018 17:23:34 +0300 Subject: [PATCH 06/30] MAGETWO-69650: Simple product with flat tables enabled not showing correct price in shopping cart --- .../Model/Indexer/Product/Flat/FlatTableBuilder.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php index fbe0d4b550fa6..abe1b3eedbc84 100644 --- a/app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php +++ b/app/code/Magento/Catalog/Model/Indexer/Product/Flat/FlatTableBuilder.php @@ -341,6 +341,12 @@ protected function _updateTemporaryTableByStoreValues( if (!empty($changedIds)) { $select->where($this->_connection->quoteInto('et.entity_id IN (?)', $changedIds)); } + + /* + * According to \Magento\Framework\DB\SelectRendererInterface select rendering may be updated + * so we need to trigger select renderer for correct update + */ + $select->assemble(); $sql = $select->crossUpdateFromSelect(['et' => $temporaryFlatTableName]); $this->_connection->query($sql); } @@ -355,6 +361,7 @@ protected function _updateTemporaryTableByStoreValues( if (!empty($changedIds)) { $select->where($this->_connection->quoteInto('et.entity_id IN (?)', $changedIds)); } + $select->assemble(); $sql = $select->crossUpdateFromSelect(['et' => $temporaryFlatTableName]); $this->_connection->query($sql); } From 6a701a94118122f617ae92ebf1818228ef0b0147 Mon Sep 17 00:00:00 2001 From: Vitalii Zabaznov Date: Tue, 2 Oct 2018 18:25:45 +0300 Subject: [PATCH 07/30] MAGETWO-94670: Product Export fails --- .../Magento/CatalogImportExport/Model/Export/Product.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/CatalogImportExport/Model/Export/Product.php b/app/code/Magento/CatalogImportExport/Model/Export/Product.php index 86196cbe652a2..4ece425e53ce5 100644 --- a/app/code/Magento/CatalogImportExport/Model/Export/Product.php +++ b/app/code/Magento/CatalogImportExport/Model/Export/Product.php @@ -517,10 +517,13 @@ protected function getMediaGallery(array $productIds) if (empty($productIds)) { return []; } + + $productEntityJoinField = $this->getProductEntityLinkField(); + $select = $this->_connection->select()->from( ['mgvte' => $this->_resourceModel->getTableName('catalog_product_entity_media_gallery_value_to_entity')], [ - "mgvte.{$this->getProductEntityLinkField()}", + "mgvte.$productEntityJoinField", 'mgvte.value_id' ] )->joinLeft( @@ -532,7 +535,7 @@ protected function getMediaGallery(array $productIds) ] )->joinLeft( ['mgv' => $this->_resourceModel->getTableName('catalog_product_entity_media_gallery_value')], - '(mg.value_id = mgv.value_id)', + "(mg.value_id = mgv.value_id) and (mgvte.$productEntityJoinField = mgv.$productEntityJoinField)", [ 'mgv.label', 'mgv.position', From a885eacd7b84e780539bd60076934c1d6050846b Mon Sep 17 00:00:00 2001 From: Vitalii Zabaznov Date: Tue, 2 Oct 2018 18:40:42 +0300 Subject: [PATCH 08/30] MAGETWO-94670: Product Export fails --- app/code/Magento/CatalogImportExport/Model/Export/Product.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/CatalogImportExport/Model/Export/Product.php b/app/code/Magento/CatalogImportExport/Model/Export/Product.php index 4ece425e53ce5..e77c01b658eea 100644 --- a/app/code/Magento/CatalogImportExport/Model/Export/Product.php +++ b/app/code/Magento/CatalogImportExport/Model/Export/Product.php @@ -543,14 +543,14 @@ protected function getMediaGallery(array $productIds) 'mgv.store_id' ] )->where( - "mgvte.{$this->getProductEntityLinkField()} IN (?)", + "mgvte.$productEntityJoinField IN (?)", $productIds ); $rowMediaGallery = []; $stmt = $this->_connection->query($select); while ($mediaRow = $stmt->fetch()) { - $rowMediaGallery[$mediaRow[$this->getProductEntityLinkField()]][] = [ + $rowMediaGallery[$mediaRow[$productEntityJoinField]][] = [ '_media_attribute_id' => $mediaRow['attribute_id'], '_media_image' => $mediaRow['filename'], '_media_label' => $mediaRow['label'], From 6a098a7d21b101d1d1ee058917a15ff6ea4406b4 Mon Sep 17 00:00:00 2001 From: francesco Date: Wed, 3 Oct 2018 14:30:36 +0200 Subject: [PATCH 09/30] Issue 12479 refactor, attribute_set_id always not null on customer and customer address --- app/code/Magento/Customer/Model/Address.php | 3 -- app/code/Magento/Customer/Model/Customer.php | 33 ++++++------------- .../ResourceModel/CustomerRepository.php | 6 ---- .../Customer/Test/Unit/Model/CustomerTest.php | 2 -- .../ResourceModel/CustomerRepositoryTest.php | 12 ------- 5 files changed, 10 insertions(+), 46 deletions(-) diff --git a/app/code/Magento/Customer/Model/Address.php b/app/code/Magento/Customer/Model/Address.php index 1dcd8516af69f..c39420542248e 100644 --- a/app/code/Magento/Customer/Model/Address.php +++ b/app/code/Magento/Customer/Model/Address.php @@ -154,9 +154,6 @@ public function updateData(AddressInterface $address) // Need to explicitly set this due to discrepancy in the keys between model and data object $this->setIsDefaultBilling($address->isDefaultBilling()); $this->setIsDefaultShipping($address->isDefaultShipping()); - if (!$this->getAttributeSetId()) { - $this->setAttributeSetId(AddressMetadataInterface::ATTRIBUTE_SET_ID_ADDRESS); - } $customAttributes = $address->getCustomAttributes(); if ($customAttributes !== null) { foreach ($customAttributes as $attribute) { diff --git a/app/code/Magento/Customer/Model/Customer.php b/app/code/Magento/Customer/Model/Customer.php index f30a7ceccbcff..e359b904347ef 100644 --- a/app/code/Magento/Customer/Model/Customer.php +++ b/app/code/Magento/Customer/Model/Customer.php @@ -358,13 +358,6 @@ public function updateData($customer) $this->setId($customerId); } - // Need to use attribute set or future updates can cause data loss - if (!$this->getAttributeSetId()) { - $this->setAttributeSetId( - CustomerMetadataInterface::ATTRIBUTE_SET_ID_CUSTOMER - ); - } - return $this; } @@ -960,6 +953,16 @@ public function getSharedWebsiteIds() return $ids; } + /** + * Retrieve attribute set id for customer. + * + * @return int + */ + public function getAttributeSetId() + { + return parent::getAttributeSetId() ?: CustomerMetadataInterface::ATTRIBUTE_SET_ID_CUSTOMER; + } + /** * Set store to customer * @@ -1051,22 +1054,6 @@ public function beforeDelete() return parent::beforeDelete(); } - /** - * Processing object before save data - * - * @return $this - */ - public function beforeSave() - { - // Need to use attribute set or future updates can cause data loss - if (!$this->getAttributeSetId()) { - $this->setAttributeSetId( - CustomerMetadataInterface::ATTRIBUTE_SET_ID_CUSTOMER - ); - } - return parent::beforeSave(); - } - /** * Processing object after save data * diff --git a/app/code/Magento/Customer/Model/ResourceModel/CustomerRepository.php b/app/code/Magento/Customer/Model/ResourceModel/CustomerRepository.php index 12d9dc9bcaa22..29f97d9f643a7 100644 --- a/app/code/Magento/Customer/Model/ResourceModel/CustomerRepository.php +++ b/app/code/Magento/Customer/Model/ResourceModel/CustomerRepository.php @@ -205,12 +205,6 @@ public function save(\Magento\Customer\Api\Data\CustomerInterface $customer, $pa $customerModel->setStoreId($this->storeManager->getStore()->getId()); } - // Need to use attribute set or future updates can cause data loss - if (!$customerModel->getAttributeSetId()) { - $customerModel->setAttributeSetId( - \Magento\Customer\Api\CustomerMetadataInterface::ATTRIBUTE_SET_ID_CUSTOMER - ); - } $this->populateCustomerWithSecureData($customerModel, $passwordHash); // If customer email was changed, reset RpToken info diff --git a/app/code/Magento/Customer/Test/Unit/Model/CustomerTest.php b/app/code/Magento/Customer/Test/Unit/Model/CustomerTest.php index f5b7f08d2906d..b9e73a6613bab 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/CustomerTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/CustomerTest.php @@ -307,8 +307,6 @@ public function testUpdateData() } $expectedResult[$attribute->getAttributeCode()] = $attribute->getValue(); - $expectedResult['attribute_set_id'] = - \Magento\Customer\Api\CustomerMetadataInterface::ATTRIBUTE_SET_ID_CUSTOMER; $this->assertEquals($this->_model->getData(), $expectedResult); } diff --git a/app/code/Magento/Customer/Test/Unit/Model/ResourceModel/CustomerRepositoryTest.php b/app/code/Magento/Customer/Test/Unit/Model/ResourceModel/CustomerRepositoryTest.php index 41816d26982d6..215cc32193b18 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/ResourceModel/CustomerRepositoryTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/ResourceModel/CustomerRepositoryTest.php @@ -334,12 +334,6 @@ public function testSave() $customerModel->expects($this->once()) ->method('setId') ->with($customerId); - $customerModel->expects($this->once()) - ->method('getAttributeSetId') - ->willReturn(null); - $customerModel->expects($this->once()) - ->method('setAttributeSetId') - ->with(\Magento\Customer\Api\CustomerMetadataInterface::ATTRIBUTE_SET_ID_CUSTOMER); $customerAttributesMetaData->expects($this->atLeastOnce()) ->method('getId') ->willReturn($customerId); @@ -616,12 +610,6 @@ public function testSaveWithPasswordHash() $customerModel->expects($this->once()) ->method('setId') ->with($customerId); - $customerModel->expects($this->once()) - ->method('getAttributeSetId') - ->willReturn(null); - $customerModel->expects($this->once()) - ->method('setAttributeSetId') - ->with(\Magento\Customer\Api\CustomerMetadataInterface::ATTRIBUTE_SET_ID_CUSTOMER); $customerModel->expects($this->atLeastOnce()) ->method('getId') ->willReturn($customerId); From 43d3a5fac1607400acffb4a2c12d1211d5e1c943 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Corr=C3=AAa=20Gomes?= Date: Fri, 5 Oct 2018 10:40:07 -0400 Subject: [PATCH 10/30] Admin > Footer > Aligning Proportionally --- .../backend/Magento_Backend/web/css/source/module/_footer.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/_footer.less b/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/_footer.less index 2958708e51deb..0244775fad0b6 100644 --- a/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/_footer.less +++ b/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/_footer.less @@ -25,7 +25,7 @@ border-top: @footer__border-width solid @footer__border-color; color: @footer__color; margin-top: auto; - padding: 2.6rem 2rem 6rem 3rem; + padding: 2.6rem 3rem 6rem; a { .lib-link( From f6a94595ace124761b9c423f7655b63db48e6545 Mon Sep 17 00:00:00 2001 From: Bartosz Kubicki Date: Sat, 22 Sep 2018 19:07:05 +0200 Subject: [PATCH 11/30] Fix for custom product attribute changing 'backend_type' when 'is_user_defined = 1' and get updated/saved in Admin Backend Fix for custom product attribute changing 'backend_type' when 'is_user_defined = 1' and get updated/saved in Admin Backend Fix for custom product attribute changing 'backend_type' when 'is_user_defined = 1' and get updated/saved in Admin Backend --- .../Controller/Adminhtml/Product/Attribute/Save.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php index b9f9b739f4fa3..de27143c6c1ad 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Attribute/Save.php @@ -222,14 +222,14 @@ public function execute() $data['backend_model'] = $this->productHelper->getAttributeBackendModelByInputType( $data['frontend_input'] ); + + if ($model->getIsUserDefined() === null) { + $data['backend_type'] = $model->getBackendTypeByInput($data['frontend_input']); + } } $data += ['is_filterable' => 0, 'is_filterable_in_search' => 0]; - if ($model->getIsUserDefined() === null || $model->getIsUserDefined() != 0) { - $data['backend_type'] = $model->getBackendTypeByInput($data['frontend_input']); - } - $defaultValueField = $model->getDefaultValueByInput($data['frontend_input']); if ($defaultValueField) { $data['default_value'] = $this->getRequest()->getParam($defaultValueField); From e7f70abdd40b9bb1f46c45230412dbda0b421246 Mon Sep 17 00:00:00 2001 From: Ihor Sviziev Date: Tue, 9 Oct 2018 17:05:33 +0300 Subject: [PATCH 12/30] magento/magento2#18164 Checkout - Fix "Cannot read property 'code' on undefined" issue --- .../Checkout/view/frontend/web/js/view/progress-bar.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Checkout/view/frontend/web/js/view/progress-bar.js b/app/code/Magento/Checkout/view/frontend/web/js/view/progress-bar.js index e4b1e464348b9..47ad45e192851 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/view/progress-bar.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/view/progress-bar.js @@ -24,11 +24,17 @@ define([ /** @inheritdoc */ initialize: function () { + var steps; + this._super(); $(window).hashchange(_.bind(stepNavigator.handleHash, stepNavigator)); if (!window.location.hash) { - stepNavigator.setHash(stepNavigator.steps().sort(stepNavigator.sortItems)[0].code); + steps = stepNavigator.steps(); + + if (steps.length) { + stepNavigator.setHash(steps.sort(stepNavigator.sortItems)[0].code); + } } stepNavigator.handleHash(); From 407cc51b5a42ef6ee13d0055225c586b30eae492 Mon Sep 17 00:00:00 2001 From: nmalevanec Date: Tue, 9 Oct 2018 18:31:52 +0300 Subject: [PATCH 13/30] ENGCOM-2747: Feature australian regions #17516. Remove regions duplication during install. --- app/code/Magento/Directory/Setup/InstallData.php | 8 -------- 1 file changed, 8 deletions(-) diff --git a/app/code/Magento/Directory/Setup/InstallData.php b/app/code/Magento/Directory/Setup/InstallData.php index 0556a7229d5e5..33c3ae4558e16 100644 --- a/app/code/Magento/Directory/Setup/InstallData.php +++ b/app/code/Magento/Directory/Setup/InstallData.php @@ -809,14 +809,6 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface ['BR', 'SE', 'Sergipe'], ['BR', 'TO', 'Tocantins'], ['BR', 'DF', 'Distrito Federal'], - ['AU', 'ACT', 'Australian Capital Territory'], - ['AU', 'NSW', 'New South Wales'], - ['AU', 'VIC', 'Victoria'], - ['AU', 'QLD', 'Queensland'], - ['AU', 'SA', 'South Australia'], - ['AU', 'TAS', 'Tasmania'], - ['AU', 'WA', 'Western Australia'], - ['AU', 'NT', 'Northern Territory'], ]; foreach ($data as $row) { From 25e3cfe56545df3a4dc502f0fa0d96f63f2e5e88 Mon Sep 17 00:00:00 2001 From: Ihor Sviziev Date: Wed, 10 Oct 2018 11:56:31 +0300 Subject: [PATCH 14/30] magento/magento2#18164 Checkout - Fix "Cannot read property 'code' on undefined" issue --- .../Checkout/view/frontend/web/js/view/progress-bar.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/Checkout/view/frontend/web/js/view/progress-bar.js b/app/code/Magento/Checkout/view/frontend/web/js/view/progress-bar.js index 47ad45e192851..db49683129f2b 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/view/progress-bar.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/view/progress-bar.js @@ -24,16 +24,16 @@ define([ /** @inheritdoc */ initialize: function () { - var steps; + var stepsValue; this._super(); $(window).hashchange(_.bind(stepNavigator.handleHash, stepNavigator)); if (!window.location.hash) { - steps = stepNavigator.steps(); + stepsValue = stepNavigator.steps(); - if (steps.length) { - stepNavigator.setHash(steps.sort(stepNavigator.sortItems)[0].code); + if (stepsValue.length) { + stepNavigator.setHash(stepsValue.sort(stepNavigator.sortItems)[0].code); } } From 0a3352c66c8aac99dd0d8974f50a9548aaa0fa62 Mon Sep 17 00:00:00 2001 From: Vitalii Zabaznov Date: Thu, 11 Oct 2018 11:01:01 +0300 Subject: [PATCH 15/30] MAGETWO-94670: Product Export fails --- .../Model/Export/Product.php | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/app/code/Magento/CatalogImportExport/Model/Export/Product.php b/app/code/Magento/CatalogImportExport/Model/Export/Product.php index e77c01b658eea..bf46c0efb2a74 100644 --- a/app/code/Magento/CatalogImportExport/Model/Export/Product.php +++ b/app/code/Magento/CatalogImportExport/Model/Export/Product.php @@ -352,7 +352,7 @@ class Product extends \Magento\ImportExport\Model\Export\Entity\AbstractEntity * @param \Magento\Framework\App\ResourceConnection $resource * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Psr\Log\LoggerInterface $logger - * @param \Magento\Catalog\Model\ResourceModel\Product\Collection $collection + * @param \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory $collectionFactory * @param \Magento\ImportExport\Model\Export\ConfigInterface $exportConfig * @param \Magento\Catalog\Model\ResourceModel\ProductFactory $productFactory * @param \Magento\Eav\Model\ResourceModel\Entity\Attribute\Set\CollectionFactory $attrSetColFactory @@ -361,9 +361,10 @@ class Product extends \Magento\ImportExport\Model\Export\Entity\AbstractEntity * @param \Magento\Catalog\Model\ResourceModel\Product\Option\CollectionFactory $optionColFactory * @param \Magento\Catalog\Model\ResourceModel\Product\Attribute\CollectionFactory $attributeColFactory * @param Product\Type\Factory $_typeFactory - * @param \Magento\Catalog\Model\Product\LinkTypeProvider $linkTypeProvider - * @param \Magento\CatalogImportExport\Model\Export\RowCustomizerInterface $rowCustomizer + * @param ProductEntity\LinkTypeProvider $linkTypeProvider + * @param RowCustomizerInterface $rowCustomizer * @param array $dateAttrCodes + * @throws \Magento\Framework\Exception\LocalizedException * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -692,6 +693,8 @@ protected function updateDataWithCategoryColumns(&$dataRow, &$rowCategories, $pr } /** + * Get header columns + * * {@inheritdoc} */ public function _getHeaderColumns() @@ -751,6 +754,8 @@ protected function _getExportMainAttrCodes() } /** + * Get entity collection + * * {@inheritdoc} */ protected function _getEntityCollection($resetCollection = false) @@ -821,9 +826,8 @@ protected function paginateCollection($page, $pageSize) } /** - * Export process - * * @return string + * @throws \Magento\Framework\Exception\LocalizedException */ public function export() { @@ -857,7 +861,11 @@ public function export() } /** - * {@inheritdoc} + * Apply filter to collection and add not skipped attributes to select. + * + * @param \Magento\Eav\Model\Entity\Collection\AbstractCollection $collection + * @return \Magento\Eav\Model\Entity\Collection\AbstractCollection + * * @since 100.2.0 */ protected function _prepareEntityCollection(\Magento\Eav\Model\Entity\Collection\AbstractCollection $collection) @@ -919,11 +927,10 @@ protected function getExportData() } /** - * Load products' data from the collection - * and filter it (if needed). + * Load products' data from the collection and filter it (if needed). * - * @return array Keys are product IDs, values arrays with keys as store IDs - * and values as store-specific versions of Product entity. + * @return array Keys are product IDs, values arrays with keys as store ID + * and values as store-specific versions of Product entity. */ protected function loadCollection(): array { From 9f1fe7fa97f3e6fac0ca332c7928650f7c5581b3 Mon Sep 17 00:00:00 2001 From: Stanislav Idolov Date: Thu, 11 Oct 2018 14:29:53 +0300 Subject: [PATCH 16/30] magento-engcom/magento2ce#2240: Fixed issue with directory upgrade script --- .../Magento/Directory/Setup/UpgradeData.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/code/Magento/Directory/Setup/UpgradeData.php b/app/code/Magento/Directory/Setup/UpgradeData.php index f87272fb9ec56..8ef73e2ef36b0 100644 --- a/app/code/Magento/Directory/Setup/UpgradeData.php +++ b/app/code/Magento/Directory/Setup/UpgradeData.php @@ -47,7 +47,7 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $this->addCountryRegions($setup, 'IN', $this->getDataForIndia()); } if (version_compare($context->getVersion(), '2.0.3', '<')) { - $this->addCountryRegions($setup, $this->getDataForAustralia()); + $this->addCountryRegions($setup, 'AU', $this->getDataForAustralia()); } } @@ -138,14 +138,14 @@ private function getDataForIndia() private function getDataForAustralia() { return [ - ['AU', 'ACT', 'Australian Capital Territory'], - ['AU', 'NSW', 'New South Wales'], - ['AU', 'VIC', 'Victoria'], - ['AU', 'QLD', 'Queensland'], - ['AU', 'SA', 'South Australia'], - ['AU', 'TAS', 'Tasmania'], - ['AU', 'WA', 'Western Australia'], - ['AU', 'NT', 'Northern Territory'] + 'ACT' => 'Australian Capital Territory', + 'NSW' => 'New South Wales', + 'VIC' => 'Victoria', + 'QLD' => 'Queensland', + 'SA' => 'South Australia', + 'TAS' => 'Tasmania', + 'WA' => 'Western Australia', + 'NT' => 'Northern Territory' ]; } From db4ac896b7827e73b7948f1744ab40d9c661468f Mon Sep 17 00:00:00 2001 From: vgelani Date: Tue, 9 Oct 2018 15:01:40 +0530 Subject: [PATCH 17/30] Added validation on maximum quantity allowed in shopping cart --- .../view/adminhtml/ui_component/product_form.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/CatalogInventory/view/adminhtml/ui_component/product_form.xml b/app/code/Magento/CatalogInventory/view/adminhtml/ui_component/product_form.xml index 3472f4368d617..ecdac1a28ed92 100644 --- a/app/code/Magento/CatalogInventory/view/adminhtml/ui_component/product_form.xml +++ b/app/code/Magento/CatalogInventory/view/adminhtml/ui_component/product_form.xml @@ -285,7 +285,7 @@ [GLOBAL] - true + true max_sale_qty From 3109909d76b0402a941518bc9306697e4431ef54 Mon Sep 17 00:00:00 2001 From: Artsiom Bruneuski Date: Sat, 6 Oct 2018 14:06:43 +0200 Subject: [PATCH 18/30] throw exception InvalidArgumentException during validate scheme --- .../Magento/Framework/Communication/Config/Validator.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/internal/Magento/Framework/Communication/Config/Validator.php b/lib/internal/Magento/Framework/Communication/Config/Validator.php index 5e2687c3b08c1..3bcc44bd44873 100644 --- a/lib/internal/Magento/Framework/Communication/Config/Validator.php +++ b/lib/internal/Magento/Framework/Communication/Config/Validator.php @@ -46,6 +46,8 @@ public function validateResponseSchemaType($responseSchema, $topicName) { try { $this->validateType($responseSchema); + } catch (\InvalidArgumentException $e) { + throw $e; } catch (\Exception $e) { throw new \LogicException( sprintf( @@ -67,6 +69,8 @@ public function validateRequestSchemaType($requestSchema, $topicName) { try { $this->validateType($requestSchema); + } catch (\InvalidArgumentException $e) { + throw $e; } catch (\Exception $e) { throw new \LogicException( sprintf( @@ -90,6 +94,8 @@ public function validateResponseHandlersType($serviceName, $methodName, $handler { try { $this->methodsMap->getMethodParams($serviceName, $methodName); + } catch (\InvalidArgumentException $e) { + throw $e; } catch (\Exception $e) { throw new \LogicException( sprintf( From 9afdfee251b7ef9098b3ae22e59cf0673c557bb3 Mon Sep 17 00:00:00 2001 From: Artsiom Bruneuski Date: Sat, 6 Oct 2018 15:20:07 +0200 Subject: [PATCH 19/30] catch InvalidArgumentException, throw correct message, unit test --- .../Communication/Config/Validator.php | 16 +++-- .../Communication/Config/ValidatorTest.php | 58 +++++++++++++++++++ 2 files changed, 70 insertions(+), 4 deletions(-) create mode 100644 lib/internal/Magento/Framework/Test/Unit/Communication/Config/ValidatorTest.php diff --git a/lib/internal/Magento/Framework/Communication/Config/Validator.php b/lib/internal/Magento/Framework/Communication/Config/Validator.php index 3bcc44bd44873..c3b2d03089f49 100644 --- a/lib/internal/Magento/Framework/Communication/Config/Validator.php +++ b/lib/internal/Magento/Framework/Communication/Config/Validator.php @@ -13,6 +13,7 @@ */ class Validator { + const INVALID_ANNOTATIONS = 123; /** * @var TypeProcessor */ @@ -47,7 +48,11 @@ public function validateResponseSchemaType($responseSchema, $topicName) try { $this->validateType($responseSchema); } catch (\InvalidArgumentException $e) { - throw $e; + throw new \LogicException( + 'Response schema definition has wrong annotations', + self::INVALID_ANNOTATIONS, + $e + ); } catch (\Exception $e) { throw new \LogicException( sprintf( @@ -70,7 +75,11 @@ public function validateRequestSchemaType($requestSchema, $topicName) try { $this->validateType($requestSchema); } catch (\InvalidArgumentException $e) { - throw $e; + throw new \LogicException( + 'Response schema definition has wrong annotations', + self::INVALID_ANNOTATIONS, + $e + ); } catch (\Exception $e) { throw new \LogicException( sprintf( @@ -94,8 +103,6 @@ public function validateResponseHandlersType($serviceName, $methodName, $handler { try { $this->methodsMap->getMethodParams($serviceName, $methodName); - } catch (\InvalidArgumentException $e) { - throw $e; } catch (\Exception $e) { throw new \LogicException( sprintf( @@ -115,6 +122,7 @@ public function validateResponseHandlersType($serviceName, $methodName, $handler * @param string $typeName * @return $this * @throws \Exception In case when type is invalid + * @throws \InvalidArgumentException */ protected function validateType($typeName) { diff --git a/lib/internal/Magento/Framework/Test/Unit/Communication/Config/ValidatorTest.php b/lib/internal/Magento/Framework/Test/Unit/Communication/Config/ValidatorTest.php new file mode 100644 index 0000000000000..0f54ae015a08b --- /dev/null +++ b/lib/internal/Magento/Framework/Test/Unit/Communication/Config/ValidatorTest.php @@ -0,0 +1,58 @@ +methodsMap = $this->createMock(MethodsMap::class); + + $this->methodsMap->expects(static::any()) + ->method('getMethodsMap') + ->will($this->throwException(new \InvalidArgumentException())); + + + $this->typeProcessor = $this->createMock(TypeProcessor::class); + $this->typeProcessor->expects(static::any()) + ->method('isTypeSimple') + ->willReturn(false); + + $this->typeProcessor->expects(static::any()) + ->method('isTypeSimple') + ->willReturn(false); + } + + /** + * @expectedException \LogicException + * @expectedExceptionCode 123 + */ + public function testValidateResponseSchemaType() + { + /** @var Validator $validator */ + $validator = new Validator($this->typeProcessor, $this->methodsMap); + $validator->validateResponseSchemaType('123', '123'); + } + + /** + * @expectedException \LogicException + * @expectedExceptionCode 123 + */ + public function testValidateRequestSchemaType() + { + /** @var Validator $validator */ + $validator = new Validator($this->typeProcessor, $this->methodsMap); + $validator->validateRequestSchemaType('123', '123'); + } +} \ No newline at end of file From 791609c7ec59700694609937deeecd1916fda2b6 Mon Sep 17 00:00:00 2001 From: Artsiom Bruneuski Date: Sat, 6 Oct 2018 15:22:37 +0200 Subject: [PATCH 20/30] annotations --- lib/internal/Magento/Framework/Reflection/MethodsMap.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/internal/Magento/Framework/Reflection/MethodsMap.php b/lib/internal/Magento/Framework/Reflection/MethodsMap.php index 944cd8771ee33..77015be8437a0 100644 --- a/lib/internal/Magento/Framework/Reflection/MethodsMap.php +++ b/lib/internal/Magento/Framework/Reflection/MethodsMap.php @@ -94,6 +94,8 @@ public function getMethodReturnType($typeName, $methodName) * 'validatePassword' => 'boolean' * ] * + * @throws \InvalidArgumentException + * @throws \ReflectionException */ public function getMethodsMap($interfaceName) { @@ -148,6 +150,8 @@ public function getMethodParams($serviceClassName, $serviceMethodName) * * @param string $interfaceName * @return array + * @throws \ReflectionException + * @throws \InvalidArgumentException */ private function getMethodMapViaReflection($interfaceName) { From beeecafdb28a20b39e06c17554e49bbffa1f7632 Mon Sep 17 00:00:00 2001 From: Artsiom Bruneuski Date: Sat, 6 Oct 2018 15:25:04 +0200 Subject: [PATCH 21/30] remove annotations --- .../Test/Unit/Communication/Config/ValidatorTest.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/internal/Magento/Framework/Test/Unit/Communication/Config/ValidatorTest.php b/lib/internal/Magento/Framework/Test/Unit/Communication/Config/ValidatorTest.php index 0f54ae015a08b..633cf7b6abbf3 100644 --- a/lib/internal/Magento/Framework/Test/Unit/Communication/Config/ValidatorTest.php +++ b/lib/internal/Magento/Framework/Test/Unit/Communication/Config/ValidatorTest.php @@ -1,8 +1,4 @@ Date: Sat, 6 Oct 2018 16:02:05 +0200 Subject: [PATCH 22/30] throw exception code from previous exception --- .../Magento/Framework/Communication/Config/Validator.php | 5 ++--- .../Test/Unit/Communication/Config/ValidatorTest.php | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/internal/Magento/Framework/Communication/Config/Validator.php b/lib/internal/Magento/Framework/Communication/Config/Validator.php index c3b2d03089f49..0bd3763028def 100644 --- a/lib/internal/Magento/Framework/Communication/Config/Validator.php +++ b/lib/internal/Magento/Framework/Communication/Config/Validator.php @@ -13,7 +13,6 @@ */ class Validator { - const INVALID_ANNOTATIONS = 123; /** * @var TypeProcessor */ @@ -50,7 +49,7 @@ public function validateResponseSchemaType($responseSchema, $topicName) } catch (\InvalidArgumentException $e) { throw new \LogicException( 'Response schema definition has wrong annotations', - self::INVALID_ANNOTATIONS, + $e->getCode(), $e ); } catch (\Exception $e) { @@ -77,7 +76,7 @@ public function validateRequestSchemaType($requestSchema, $topicName) } catch (\InvalidArgumentException $e) { throw new \LogicException( 'Response schema definition has wrong annotations', - self::INVALID_ANNOTATIONS, + $e->getCode(), $e ); } catch (\Exception $e) { diff --git a/lib/internal/Magento/Framework/Test/Unit/Communication/Config/ValidatorTest.php b/lib/internal/Magento/Framework/Test/Unit/Communication/Config/ValidatorTest.php index 633cf7b6abbf3..c440d39f0188b 100644 --- a/lib/internal/Magento/Framework/Test/Unit/Communication/Config/ValidatorTest.php +++ b/lib/internal/Magento/Framework/Test/Unit/Communication/Config/ValidatorTest.php @@ -17,7 +17,7 @@ public function setUp() $this->methodsMap->expects(static::any()) ->method('getMethodsMap') - ->will($this->throwException(new \InvalidArgumentException())); + ->will($this->throwException(new \InvalidArgumentException('message', 333))); $this->typeProcessor = $this->createMock(TypeProcessor::class); @@ -32,7 +32,7 @@ public function setUp() /** * @expectedException \LogicException - * @expectedExceptionCode 123 + * @expectedExceptionCode 333 */ public function testValidateResponseSchemaType() { @@ -43,7 +43,7 @@ public function testValidateResponseSchemaType() /** * @expectedException \LogicException - * @expectedExceptionCode 123 + * @expectedExceptionCode 333 */ public function testValidateRequestSchemaType() { From a20968db7a29a3b6f26a46979179851121eea336 Mon Sep 17 00:00:00 2001 From: Artsiom Bruneuski Date: Sat, 6 Oct 2018 16:09:56 +0200 Subject: [PATCH 23/30] modified exception message --- .../Magento/Framework/Communication/Config/Validator.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/internal/Magento/Framework/Communication/Config/Validator.php b/lib/internal/Magento/Framework/Communication/Config/Validator.php index 0bd3763028def..73d245d79e111 100644 --- a/lib/internal/Magento/Framework/Communication/Config/Validator.php +++ b/lib/internal/Magento/Framework/Communication/Config/Validator.php @@ -48,7 +48,7 @@ public function validateResponseSchemaType($responseSchema, $topicName) $this->validateType($responseSchema); } catch (\InvalidArgumentException $e) { throw new \LogicException( - 'Response schema definition has wrong annotations', + 'Response schema definition has service class with wrong annotated methods', $e->getCode(), $e ); @@ -75,7 +75,7 @@ public function validateRequestSchemaType($requestSchema, $topicName) $this->validateType($requestSchema); } catch (\InvalidArgumentException $e) { throw new \LogicException( - 'Response schema definition has wrong annotations', + 'Request schema definition has service class with wrong annotated methods', $e->getCode(), $e ); From 2f2cafee687d81d95854b1629ef8eec7c5a4e548 Mon Sep 17 00:00:00 2001 From: Artsiom Bruneuski Date: Sat, 6 Oct 2018 17:26:58 +0200 Subject: [PATCH 24/30] Was added description to exceptions, annotations to properties and classes. Implemented validation of exception message in unit test --- .../Communication/Config/Validator.php | 2 +- .../Framework/Reflection/MethodsMap.php | 8 ++++---- .../Communication/Config/ValidatorTest.php | 18 ++++++++++++++++-- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/lib/internal/Magento/Framework/Communication/Config/Validator.php b/lib/internal/Magento/Framework/Communication/Config/Validator.php index 73d245d79e111..f08c3700a33ba 100644 --- a/lib/internal/Magento/Framework/Communication/Config/Validator.php +++ b/lib/internal/Magento/Framework/Communication/Config/Validator.php @@ -121,7 +121,7 @@ public function validateResponseHandlersType($serviceName, $methodName, $handler * @param string $typeName * @return $this * @throws \Exception In case when type is invalid - * @throws \InvalidArgumentException +` * @throws \InvalidArgumentException if methods don't have annotation */ protected function validateType($typeName) { diff --git a/lib/internal/Magento/Framework/Reflection/MethodsMap.php b/lib/internal/Magento/Framework/Reflection/MethodsMap.php index 77015be8437a0..6b0ddfbfc2127 100644 --- a/lib/internal/Magento/Framework/Reflection/MethodsMap.php +++ b/lib/internal/Magento/Framework/Reflection/MethodsMap.php @@ -94,8 +94,8 @@ public function getMethodReturnType($typeName, $methodName) * 'validatePassword' => 'boolean' * ] * - * @throws \InvalidArgumentException - * @throws \ReflectionException + * @throws \InvalidArgumentException if methods don't have annotation + * @throws \ReflectionException for missing DocBock or invalid reflection class */ public function getMethodsMap($interfaceName) { @@ -150,8 +150,8 @@ public function getMethodParams($serviceClassName, $serviceMethodName) * * @param string $interfaceName * @return array - * @throws \ReflectionException - * @throws \InvalidArgumentException + * @throws \ReflectionException for missing DocBock or invalid reflection class + * @throws \InvalidArgumentException if methods don't have annotation */ private function getMethodMapViaReflection($interfaceName) { diff --git a/lib/internal/Magento/Framework/Test/Unit/Communication/Config/ValidatorTest.php b/lib/internal/Magento/Framework/Test/Unit/Communication/Config/ValidatorTest.php index c440d39f0188b..36e43de928019 100644 --- a/lib/internal/Magento/Framework/Test/Unit/Communication/Config/ValidatorTest.php +++ b/lib/internal/Magento/Framework/Test/Unit/Communication/Config/ValidatorTest.php @@ -1,14 +1,27 @@ method('getMethodsMap') ->will($this->throwException(new \InvalidArgumentException('message', 333))); - $this->typeProcessor = $this->createMock(TypeProcessor::class); $this->typeProcessor->expects(static::any()) ->method('isTypeSimple') @@ -33,6 +45,7 @@ public function setUp() /** * @expectedException \LogicException * @expectedExceptionCode 333 + * @expectedExceptionMessage Response schema definition has service class with wrong annotated methods */ public function testValidateResponseSchemaType() { @@ -44,6 +57,7 @@ public function testValidateResponseSchemaType() /** * @expectedException \LogicException * @expectedExceptionCode 333 + * @expectedExceptionMessage Request schema definition has service class with wrong annotated methods */ public function testValidateRequestSchemaType() { From 72b31c952619104e1b176fe9c03074437c8a58b9 Mon Sep 17 00:00:00 2001 From: Artsiom Bruneuski Date: Sun, 7 Oct 2018 11:01:25 +0200 Subject: [PATCH 25/30] short descriptions was added --- .../Magento/Framework/Communication/Config/Validator.php | 6 ++++++ .../Test/Unit/Communication/Config/ValidatorTest.php | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/internal/Magento/Framework/Communication/Config/Validator.php b/lib/internal/Magento/Framework/Communication/Config/Validator.php index f08c3700a33ba..bf21b3dcf95e1 100644 --- a/lib/internal/Magento/Framework/Communication/Config/Validator.php +++ b/lib/internal/Magento/Framework/Communication/Config/Validator.php @@ -38,6 +38,8 @@ public function __construct( } /** + * Validate response schema definition for topic + * * @param string $responseSchema * @param string $topicName * @return void @@ -65,6 +67,8 @@ public function validateResponseSchemaType($responseSchema, $topicName) } /** + * Validate request schema definition for topic + * * @param string $requestSchema * @param string $topicName * @return void @@ -92,6 +96,8 @@ public function validateRequestSchemaType($requestSchema, $topicName) } /** + * Validate service method specified in the definition of handler + * * @param string $serviceName * @param string $methodName * @param string $handlerName diff --git a/lib/internal/Magento/Framework/Test/Unit/Communication/Config/ValidatorTest.php b/lib/internal/Magento/Framework/Test/Unit/Communication/Config/ValidatorTest.php index 36e43de928019..6829bdab59253 100644 --- a/lib/internal/Magento/Framework/Test/Unit/Communication/Config/ValidatorTest.php +++ b/lib/internal/Magento/Framework/Test/Unit/Communication/Config/ValidatorTest.php @@ -1,4 +1,4 @@ -typeProcessor, $this->methodsMap); $validator->validateRequestSchemaType('123', '123'); } -} \ No newline at end of file +} From a7cdae0e4f80aa8596d4b3a3b958ae2b9938a346 Mon Sep 17 00:00:00 2001 From: Artsiom Bruneuski Date: Sun, 7 Oct 2018 12:04:19 +0200 Subject: [PATCH 26/30] moved strict_types block --- .../Test/Unit/Communication/Config/ValidatorTest.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/Test/Unit/Communication/Config/ValidatorTest.php b/lib/internal/Magento/Framework/Test/Unit/Communication/Config/ValidatorTest.php index 6829bdab59253..55410af176af0 100644 --- a/lib/internal/Magento/Framework/Test/Unit/Communication/Config/ValidatorTest.php +++ b/lib/internal/Magento/Framework/Test/Unit/Communication/Config/ValidatorTest.php @@ -1,8 +1,10 @@ - Date: Sun, 7 Oct 2018 13:08:35 +0200 Subject: [PATCH 27/30] removed wrong symbol --- .../Magento/Framework/Communication/Config/Validator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/Communication/Config/Validator.php b/lib/internal/Magento/Framework/Communication/Config/Validator.php index bf21b3dcf95e1..76ef1b85b63eb 100644 --- a/lib/internal/Magento/Framework/Communication/Config/Validator.php +++ b/lib/internal/Magento/Framework/Communication/Config/Validator.php @@ -127,7 +127,7 @@ public function validateResponseHandlersType($serviceName, $methodName, $handler * @param string $typeName * @return $this * @throws \Exception In case when type is invalid -` * @throws \InvalidArgumentException if methods don't have annotation + * @throws \InvalidArgumentException if methods don't have annotation */ protected function validateType($typeName) { From aedb6c92f2491ab89ebfac1d674a3cbc4d9c6b78 Mon Sep 17 00:00:00 2001 From: peterjaap Date: Wed, 10 Oct 2018 11:05:24 +0200 Subject: [PATCH 28/30] Fixed typo from filed to field --- app/code/Magento/Catalog/Model/ResourceModel/Category.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Category.php b/app/code/Magento/Catalog/Model/ResourceModel/Category.php index 1f3b2642953c8..b03657545b41c 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Category.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Category.php @@ -920,7 +920,7 @@ public function changeParent( $childrenCount = $this->getChildrenCount($category->getId()) + 1; $table = $this->getEntityTable(); $connection = $this->getConnection(); - $levelFiled = $connection->quoteIdentifier('level'); + $levelField = $connection->quoteIdentifier('level'); $pathField = $connection->quoteIdentifier('path'); /** @@ -960,7 +960,7 @@ public function changeParent( $newPath . '/' ) . ')' ), - 'level' => new \Zend_Db_Expr($levelFiled . ' + ' . $levelDisposition) + 'level' => new \Zend_Db_Expr($levelField . ' + ' . $levelDisposition) ], [$pathField . ' LIKE ?' => $category->getPath() . '/%'] ); From a2b69ed27708cedf575437e9f09e259962828ed1 Mon Sep 17 00:00:00 2001 From: eduard13 Date: Tue, 9 Oct 2018 18:27:53 +0300 Subject: [PATCH 29/30] Covering the AssignOrderToCustomerObserver by Unit Test --- .../AssignOrderToCustomerObserverTest.php | 91 +++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 app/code/Magento/Sales/Test/Unit/Observer/AssignOrderToCustomerObserverTest.php diff --git a/app/code/Magento/Sales/Test/Unit/Observer/AssignOrderToCustomerObserverTest.php b/app/code/Magento/Sales/Test/Unit/Observer/AssignOrderToCustomerObserverTest.php new file mode 100644 index 0000000000000..c6e02151b9bc1 --- /dev/null +++ b/app/code/Magento/Sales/Test/Unit/Observer/AssignOrderToCustomerObserverTest.php @@ -0,0 +1,91 @@ +orderRepositoryMock = $this->getMockBuilder(OrderRepositoryInterface::class) + ->disableOriginalConstructor() + ->getMock(); + $this->sut = new AssignOrderToCustomerObserver($this->orderRepositoryMock); + } + + /** + * Test assigning order to customer after issuing guest order + * + * @dataProvider getCustomerIds + * @param null|int $customerId + * @return void + */ + public function testAssignOrderToCustomerAfterGuestOrder($customerId) + { + $orderId = 1; + /** @var Observer|PHPUnit_Framework_MockObject_MockObject $observerMock */ + $observerMock = $this->createMock(Observer::class); + /** @var Event|PHPUnit_Framework_MockObject_MockObject $eventMock */ + $eventMock = $this->getMockBuilder(Event::class)->disableOriginalConstructor() + ->setMethods(['getData']) + ->getMock(); + /** @var CustomerInterface|PHPUnit_Framework_MockObject_MockObject $customerMock */ + $customerMock = $this->createMock(CustomerInterface::class); + /** @var OrderInterface|PHPUnit_Framework_MockObject_MockObject $orderMock */ + $orderMock = $this->getMockBuilder(OrderInterface::class) + ->disableOriginalConstructor() + ->getMockForAbstractClass(); + $observerMock->expects($this->once())->method('getEvent')->willReturn($eventMock); + $eventMock->expects($this->any())->method('getData') + ->willReturnMap([ + ['delegate_data', null, ['__sales_assign_order_id' => $orderId]], + ['customer_data_object', null, $customerMock] + ]); + $orderMock->expects($this->once())->method('getCustomerId')->willReturn($customerId); + $this->orderRepositoryMock->expects($this->once())->method('get')->with($orderId) + ->willReturn($orderMock); + if (!$customerId) { + $this->orderRepositoryMock->expects($this->once())->method('save')->with($orderMock); + $this->sut->execute($observerMock); + return ; + } + + $this->orderRepositoryMock->expects($this->never())->method('save')->with($orderMock); + $this->sut->execute($observerMock); + } + + /** + * Customer id assigned to order + * + * @return array + */ + public function getCustomerIds() + { + return [[null, 1]]; + } +} From ba9a1b245a2e7cd49dde7000a3ba5b69c136f143 Mon Sep 17 00:00:00 2001 From: Vincent MARMIESSE Date: Mon, 24 Sep 2018 13:30:50 +0200 Subject: [PATCH 30/30] Label should always be blank even if attribute is required --- .../Magento/Eav/Model/Entity/Attribute/Source/Table.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Source/Table.php b/app/code/Magento/Eav/Model/Entity/Attribute/Source/Table.php index bd77b952a07b8..58993b4928b3a 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Source/Table.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Source/Table.php @@ -10,6 +10,8 @@ use Magento\Framework\Escaper; /** + * Eav attribute default source when values are coming from another table + * * @api * @since 100.0.2 */ @@ -136,12 +138,14 @@ public function getSpecificOptions($ids, $withEmpty = true) } /** + * Add an empty option to the array + * * @param array $options * @return array */ private function addEmptyOption(array $options) { - array_unshift($options, ['label' => $this->getAttribute()->getIsRequired() ? '' : ' ', 'value' => '']); + array_unshift($options, ['label' => ' ', 'value' => '']); return $options; }