Date: Mon, 30 Apr 2018 11:57:03 +0200
Subject: [PATCH 07/75] FIX for issue #14849 - In Sales Emails no translation
using order.getStatusLabel()
\Magento\Sales\Model\Order\Config::getStatusLabel(), used by template email
was forcing the usage of getLabel() when in adminhtml area. I added a new
method getFrontendStatusLabel() in \Magento\Sales\Model\Order and modified
email template files to use it instead of the original implementation. I did
not modify the original implementation because still in use by backend and
frontend.
---
app/code/Magento/Sales/Model/Order.php | 12 ++++++++++++
app/code/Magento/Sales/Model/Order/Config.php | 6 ++++--
.../Sales/view/frontend/email/creditmemo_update.html | 4 ++--
.../view/frontend/email/creditmemo_update_guest.html | 4 ++--
.../Sales/view/frontend/email/invoice_update.html | 4 ++--
.../view/frontend/email/invoice_update_guest.html | 4 ++--
.../Sales/view/frontend/email/order_update.html | 4 ++--
.../view/frontend/email/order_update_guest.html | 4 ++--
.../Sales/view/frontend/email/shipment_update.html | 4 ++--
.../view/frontend/email/shipment_update_guest.html | 4 ++--
.../luma/Magento_Sales/email/creditmemo_update.html | 4 ++--
.../Magento_Sales/email/creditmemo_update_guest.html | 4 ++--
.../luma/Magento_Sales/email/invoice_update.html | 4 ++--
.../Magento_Sales/email/invoice_update_guest.html | 4 ++--
.../luma/Magento_Sales/email/order_update.html | 4 ++--
.../luma/Magento_Sales/email/order_update_guest.html | 4 ++--
.../luma/Magento_Sales/email/shipment_update.html | 4 ++--
.../Magento_Sales/email/shipment_update_guest.html | 4 ++--
18 files changed, 48 insertions(+), 34 deletions(-)
diff --git a/app/code/Magento/Sales/Model/Order.php b/app/code/Magento/Sales/Model/Order.php
index 85443ee7f4f11..25ba1a9594174 100644
--- a/app/code/Magento/Sales/Model/Order.php
+++ b/app/code/Magento/Sales/Model/Order.php
@@ -977,10 +977,22 @@ public function setState($state)
return $this->setData(self::STATE, $state);
}
+ /**
+ * Retrieve frontend label of order status
+ *
+ * @return string
+ * @throws \Magento\Framework\Exception\LocalizedException
+ */
+ public function getFrontendStatusLabel()
+ {
+ return $this->getConfig()->getStatusLabel($this->getStatus(), \Magento\Framework\App\Area::AREA_FRONTEND);
+ }
+
/**
* Retrieve label of order status
*
* @return string
+ * @throws \Magento\Framework\Exception\LocalizedException
*/
public function getStatusLabel()
{
diff --git a/app/code/Magento/Sales/Model/Order/Config.php b/app/code/Magento/Sales/Model/Order/Config.php
index e00eda647dc8d..2e8ea910eb5b0 100644
--- a/app/code/Magento/Sales/Model/Order/Config.php
+++ b/app/code/Magento/Sales/Model/Order/Config.php
@@ -118,11 +118,13 @@ public function getStateDefaultStatus($state)
* Retrieve status label
*
* @param string $code
+ * @param null $forceArea
* @return string
+ * @throws \Magento\Framework\Exception\LocalizedException
*/
- public function getStatusLabel($code)
+ public function getStatusLabel($code, $forceArea = null)
{
- $area = $this->state->getAreaCode();
+ $area = $forceArea ?: $this->state->getAreaCode();
$code = $this->maskStatusForArea($area, $code);
$status = $this->orderStatusFactory->create()->load($code);
diff --git a/app/code/Magento/Sales/view/frontend/email/creditmemo_update.html b/app/code/Magento/Sales/view/frontend/email/creditmemo_update.html
index 3a4aab19e9e7c..a6a10fb49e3f5 100644
--- a/app/code/Magento/Sales/view/frontend/email/creditmemo_update.html
+++ b/app/code/Magento/Sales/view/frontend/email/creditmemo_update.html
@@ -11,7 +11,7 @@
"var this.getUrl($store, 'customer/account/')":"Customer Account URL",
"var order.getCustomerName()":"Customer Name",
"var order.increment_id":"Order Id",
-"var order.getStatusLabel()":"Order Status"
+"var order.getFrontendStatusLabel()":"Order Status"
} @-->
{{template config_path="design/email/header_template"}}
@@ -24,7 +24,7 @@
"Your order #%increment_id has been updated with a status of %order_status ."
increment_id=$order.increment_id
- order_status=$order.getStatusLabel()
+ order_status=$order.getFrontendStatusLabel()
|raw}}
{{trans 'You can check the status of your order by logging into your account .' account_url=$this.getUrl($store,'customer/account/',[_nosid:1]) |raw}}
diff --git a/app/code/Magento/Sales/view/frontend/email/creditmemo_update_guest.html b/app/code/Magento/Sales/view/frontend/email/creditmemo_update_guest.html
index bc7c079d7f21b..b7411d80d2ba6 100644
--- a/app/code/Magento/Sales/view/frontend/email/creditmemo_update_guest.html
+++ b/app/code/Magento/Sales/view/frontend/email/creditmemo_update_guest.html
@@ -10,7 +10,7 @@
"var creditmemo.increment_id":"Credit Memo Id",
"var billing.getName()":"Guest Customer Name",
"var order.increment_id":"Order Id",
-"var order.getStatusLabel()":"Order Status"
+"var order.getFrontendStatusLabel()":"Order Status"
} @-->
{{template config_path="design/email/header_template"}}
@@ -23,7 +23,7 @@
"Your order #%increment_id has been updated with a status of %order_status ."
increment_id=$order.increment_id
- order_status=$order.getStatusLabel()
+ order_status=$order.getFrontendStatusLabel()
|raw}}
diff --git a/app/code/Magento/Sales/view/frontend/email/invoice_update.html b/app/code/Magento/Sales/view/frontend/email/invoice_update.html
index cafdd65ff5208..4043e59f9d7d6 100644
--- a/app/code/Magento/Sales/view/frontend/email/invoice_update.html
+++ b/app/code/Magento/Sales/view/frontend/email/invoice_update.html
@@ -11,7 +11,7 @@
"var comment":"Invoice Comment",
"var invoice.increment_id":"Invoice Id",
"var order.increment_id":"Order Id",
-"var order.getStatusLabel()":"Order Status"
+"var order.getFrontendStatusLabel()":"Order Status"
} @-->
{{template config_path="design/email/header_template"}}
@@ -24,7 +24,7 @@
"Your order #%increment_id has been updated with a status of %order_status ."
increment_id=$order.increment_id
- order_status=$order.getStatusLabel()
+ order_status=$order.getFrontendStatusLabel()
|raw}}
{{trans 'You can check the status of your order by logging into your account .' account_url=$this.getUrl($store,'customer/account/',[_nosid:1]) |raw}}
diff --git a/app/code/Magento/Sales/view/frontend/email/invoice_update_guest.html b/app/code/Magento/Sales/view/frontend/email/invoice_update_guest.html
index fafb533301efb..40cdec7fb4cab 100644
--- a/app/code/Magento/Sales/view/frontend/email/invoice_update_guest.html
+++ b/app/code/Magento/Sales/view/frontend/email/invoice_update_guest.html
@@ -10,7 +10,7 @@
"var comment":"Invoice Comment",
"var invoice.increment_id":"Invoice Id",
"var order.increment_id":"Order Id",
-"var order.getStatusLabel()":"Order Status"
+"var order.getFrontendStatusLabel()":"Order Status"
} @-->
{{template config_path="design/email/header_template"}}
@@ -23,7 +23,7 @@
"Your order #%increment_id has been updated with a status of %order_status ."
increment_id=$order.increment_id
- order_status=$order.getStatusLabel()
+ order_status=$order.getFrontendStatusLabel()
|raw}}
diff --git a/app/code/Magento/Sales/view/frontend/email/order_update.html b/app/code/Magento/Sales/view/frontend/email/order_update.html
index a709a9ed8a7f1..a8f0068b70e87 100644
--- a/app/code/Magento/Sales/view/frontend/email/order_update.html
+++ b/app/code/Magento/Sales/view/frontend/email/order_update.html
@@ -10,7 +10,7 @@
"var order.getCustomerName()":"Customer Name",
"var comment":"Order Comment",
"var order.increment_id":"Order Id",
-"var order.getStatusLabel()":"Order Status"
+"var order.getFrontendStatusLabel()":"Order Status"
} @-->
{{template config_path="design/email/header_template"}}
@@ -23,7 +23,7 @@
"Your order #%increment_id has been updated with a status of %order_status ."
increment_id=$order.increment_id
- order_status=$order.getStatusLabel()
+ order_status=$order.getFrontendStatusLabel()
|raw}}
{{trans 'You can check the status of your order by logging into your account .' account_url=$this.getUrl($store,'customer/account/',[_nosid:1]) |raw}}
diff --git a/app/code/Magento/Sales/view/frontend/email/order_update_guest.html b/app/code/Magento/Sales/view/frontend/email/order_update_guest.html
index 5a39b01810c18..749fa3b60ad59 100644
--- a/app/code/Magento/Sales/view/frontend/email/order_update_guest.html
+++ b/app/code/Magento/Sales/view/frontend/email/order_update_guest.html
@@ -9,7 +9,7 @@
"var billing.getName()":"Guest Customer Name",
"var comment":"Order Comment",
"var order.increment_id":"Order Id",
-"var order.getStatusLabel()":"Order Status"
+"var order.getFrontendStatusLabel()":"Order Status"
} @-->
{{template config_path="design/email/header_template"}}
@@ -22,7 +22,7 @@
"Your order #%increment_id has been updated with a status of %order_status ."
increment_id=$order.increment_id
- order_status=$order.getStatusLabel()
+ order_status=$order.getFrontendStatusLabel()
|raw}}
diff --git a/app/code/Magento/Sales/view/frontend/email/shipment_update.html b/app/code/Magento/Sales/view/frontend/email/shipment_update.html
index 6d9efc37004bc..9d1c93287549a 100644
--- a/app/code/Magento/Sales/view/frontend/email/shipment_update.html
+++ b/app/code/Magento/Sales/view/frontend/email/shipment_update.html
@@ -10,7 +10,7 @@
"var order.getCustomerName()":"Customer Name",
"var comment":"Order Comment",
"var order.increment_id":"Order Id",
-"var order.getStatusLabel()":"Order Status",
+"var order.getFrontendStatusLabel()":"Order Status",
"var shipment.increment_id":"Shipment Id"
} @-->
{{template config_path="design/email/header_template"}}
@@ -24,7 +24,7 @@
"Your order #%increment_id has been updated with a status of %order_status ."
increment_id=$order.increment_id
- order_status=$order.getStatusLabel()
+ order_status=$order.getFrontendStatusLabel()
|raw}}
{{trans 'You can check the status of your order by logging into your account .' account_url=$this.getUrl($store,'customer/account/',[_nosid:1]) |raw}}
diff --git a/app/code/Magento/Sales/view/frontend/email/shipment_update_guest.html b/app/code/Magento/Sales/view/frontend/email/shipment_update_guest.html
index 4896a00b7bc5a..0d2dccd3377d2 100644
--- a/app/code/Magento/Sales/view/frontend/email/shipment_update_guest.html
+++ b/app/code/Magento/Sales/view/frontend/email/shipment_update_guest.html
@@ -9,7 +9,7 @@
"var billing.getName()":"Guest Customer Name",
"var comment":"Order Comment",
"var order.increment_id":"Order Id",
-"var order.getStatusLabel()":"Order Status",
+"var order.getFrontendStatusLabel()":"Order Status",
"var shipment.increment_id":"Shipment Id"
} @-->
{{template config_path="design/email/header_template"}}
@@ -23,7 +23,7 @@
"Your order #%increment_id has been updated with a status of %order_status ."
increment_id=$order.increment_id
- order_status=$order.getStatusLabel()
+ order_status=$order.getFrontendStatusLabel()
|raw}}
diff --git a/app/design/frontend/Magento/luma/Magento_Sales/email/creditmemo_update.html b/app/design/frontend/Magento/luma/Magento_Sales/email/creditmemo_update.html
index a7b9b330ab9ce..269e46d752084 100644
--- a/app/design/frontend/Magento/luma/Magento_Sales/email/creditmemo_update.html
+++ b/app/design/frontend/Magento/luma/Magento_Sales/email/creditmemo_update.html
@@ -11,7 +11,7 @@
"var this.getUrl($store, 'customer/account/')":"Customer Account URL",
"var order.getCustomerName()":"Customer Name",
"var order.increment_id":"Order Id",
-"var order.getStatusLabel()":"Order Status"
+"var order.getFrontendStatusLabel()":"Order Status"
} @-->
{{template config_path="design/email/header_template"}}
@@ -24,7 +24,7 @@
"Your order #%increment_id has been updated with a status of %order_status ."
increment_id=$order.increment_id
- order_status=$order.getStatusLabel()
+ order_status=$order.getFrontendStatusLabel()
|raw}}
{{trans 'You can check the status of your order by logging into your account .' account_url=$this.getUrl($store,'customer/account/',[_nosid:1]) |raw}}
diff --git a/app/design/frontend/Magento/luma/Magento_Sales/email/creditmemo_update_guest.html b/app/design/frontend/Magento/luma/Magento_Sales/email/creditmemo_update_guest.html
index 36279eb26005e..c8bdae7b08fa5 100644
--- a/app/design/frontend/Magento/luma/Magento_Sales/email/creditmemo_update_guest.html
+++ b/app/design/frontend/Magento/luma/Magento_Sales/email/creditmemo_update_guest.html
@@ -10,7 +10,7 @@
"var creditmemo.increment_id":"Credit Memo Id",
"var billing.getName()":"Guest Customer Name",
"var order.increment_id":"Order Id",
-"var order.getStatusLabel()":"Order Status"
+"var order.getFrontendStatusLabel()":"Order Status"
} @-->
{{template config_path="design/email/header_template"}}
@@ -23,7 +23,7 @@
"Your order #%increment_id has been updated with a status of %order_status ."
increment_id=$order.increment_id
- order_status=$order.getStatusLabel()
+ order_status=$order.getFrontendStatusLabel()
|raw}}
diff --git a/app/design/frontend/Magento/luma/Magento_Sales/email/invoice_update.html b/app/design/frontend/Magento/luma/Magento_Sales/email/invoice_update.html
index a739c9f54b08f..8ec54f1e64d9c 100644
--- a/app/design/frontend/Magento/luma/Magento_Sales/email/invoice_update.html
+++ b/app/design/frontend/Magento/luma/Magento_Sales/email/invoice_update.html
@@ -11,7 +11,7 @@
"var comment":"Invoice Comment",
"var invoice.increment_id":"Invoice Id",
"var order.increment_id":"Order Id",
-"var order.getStatusLabel()":"Order Status"
+"var order.getFrontendStatusLabel()":"Order Status"
} @-->
{{template config_path="design/email/header_template"}}
@@ -24,7 +24,7 @@
"Your order #%increment_id has been updated with a status of %order_status ."
increment_id=$order.increment_id
- order_status=$order.getStatusLabel()
+ order_status=$order.getFrontendStatusLabel()
|raw}}
{{trans 'You can check the status of your order by logging into your account .' account_url=$this.getUrl($store,'customer/account/',[_nosid:1]) |raw}}
diff --git a/app/design/frontend/Magento/luma/Magento_Sales/email/invoice_update_guest.html b/app/design/frontend/Magento/luma/Magento_Sales/email/invoice_update_guest.html
index a56ee6da9fa25..6028db7b97730 100644
--- a/app/design/frontend/Magento/luma/Magento_Sales/email/invoice_update_guest.html
+++ b/app/design/frontend/Magento/luma/Magento_Sales/email/invoice_update_guest.html
@@ -10,7 +10,7 @@
"var comment":"Invoice Comment",
"var invoice.increment_id":"Invoice Id",
"var order.increment_id":"Order Id",
-"var order.getStatusLabel()":"Order Status"
+"var order.getFrontendStatusLabel()":"Order Status"
} @-->
{{template config_path="design/email/header_template"}}
@@ -23,7 +23,7 @@
"Your order #%increment_id has been updated with a status of %order_status ."
increment_id=$order.increment_id
- order_status=$order.getStatusLabel()
+ order_status=$order.getFrontendStatusLabel()
|raw}}
diff --git a/app/design/frontend/Magento/luma/Magento_Sales/email/order_update.html b/app/design/frontend/Magento/luma/Magento_Sales/email/order_update.html
index 3e4bf8df2f107..fa16ac2196bf4 100644
--- a/app/design/frontend/Magento/luma/Magento_Sales/email/order_update.html
+++ b/app/design/frontend/Magento/luma/Magento_Sales/email/order_update.html
@@ -10,7 +10,7 @@
"var order.getCustomerName()":"Customer Name",
"var comment":"Order Comment",
"var order.increment_id":"Order Id",
-"var order.getStatusLabel()":"Order Status"
+"var order.getFrontendStatusLabel()":"Order Status"
} @-->
{{template config_path="design/email/header_template"}}
@@ -23,7 +23,7 @@
"Your order #%increment_id has been updated with a status of %order_status ."
increment_id=$order.increment_id
- order_status=$order.getStatusLabel()
+ order_status=$order.getFrontendStatusLabel()
|raw}}
{{trans 'You can check the status of your order by logging into your account .' account_url=$this.getUrl($store,'customer/account/',[_nosid:1]) |raw}}
diff --git a/app/design/frontend/Magento/luma/Magento_Sales/email/order_update_guest.html b/app/design/frontend/Magento/luma/Magento_Sales/email/order_update_guest.html
index 1075608db4341..8ead615fe01ca 100644
--- a/app/design/frontend/Magento/luma/Magento_Sales/email/order_update_guest.html
+++ b/app/design/frontend/Magento/luma/Magento_Sales/email/order_update_guest.html
@@ -9,7 +9,7 @@
"var billing.getName()":"Guest Customer Name",
"var comment":"Order Comment",
"var order.increment_id":"Order Id",
-"var order.getStatusLabel()":"Order Status"
+"var order.getFrontendStatusLabel()":"Order Status"
} @-->
{{template config_path="design/email/header_template"}}
@@ -22,7 +22,7 @@
"Your order #%increment_id has been updated with a status of %order_status ."
increment_id=$order.increment_id
- order_status=$order.getStatusLabel()
+ order_status=$order.getFrontendStatusLabel()
|raw}}
diff --git a/app/design/frontend/Magento/luma/Magento_Sales/email/shipment_update.html b/app/design/frontend/Magento/luma/Magento_Sales/email/shipment_update.html
index 37bf92b866c74..4f9b7286f3ae4 100644
--- a/app/design/frontend/Magento/luma/Magento_Sales/email/shipment_update.html
+++ b/app/design/frontend/Magento/luma/Magento_Sales/email/shipment_update.html
@@ -10,7 +10,7 @@
"var order.getCustomerName()":"Customer Name",
"var comment":"Order Comment",
"var order.increment_id":"Order Id",
-"var order.getStatusLabel()":"Order Status",
+"var order.getFrontendStatusLabel()":"Order Status",
"var shipment.increment_id":"Shipment Id"
} @-->
{{template config_path="design/email/header_template"}}
@@ -24,7 +24,7 @@
"Your order #%increment_id has been updated with a status of %order_status ."
increment_id=$order.increment_id
- order_status=$order.getStatusLabel()
+ order_status=$order.getFrontendStatusLabel()
|raw}}
{{trans 'You can check the status of your order by logging into your account .' account_url=$this.getUrl($store,'customer/account/',[_nosid:1]) |raw}}
diff --git a/app/design/frontend/Magento/luma/Magento_Sales/email/shipment_update_guest.html b/app/design/frontend/Magento/luma/Magento_Sales/email/shipment_update_guest.html
index 954819949860b..3ef26463ea755 100644
--- a/app/design/frontend/Magento/luma/Magento_Sales/email/shipment_update_guest.html
+++ b/app/design/frontend/Magento/luma/Magento_Sales/email/shipment_update_guest.html
@@ -9,7 +9,7 @@
"var billing.getName()":"Guest Customer Name",
"var comment":"Order Comment",
"var order.increment_id":"Order Id",
-"var order.getStatusLabel()":"Order Status",
+"var order.getFrontendStatusLabel()":"Order Status",
"var shipment.increment_id":"Shipment Id"
} @-->
{{template config_path="design/email/header_template"}}
@@ -23,7 +23,7 @@
"Your order #%increment_id has been updated with a status of %order_status ."
increment_id=$order.increment_id
- order_status=$order.getStatusLabel()
+ order_status=$order.getFrontendStatusLabel()
|raw}}
From 5d2b5be882918e36aa328b735c8bd00599b3b5c8 Mon Sep 17 00:00:00 2001
From: Riccardo Tempesta
Date: Mon, 28 May 2018 10:10:20 +0200
Subject: [PATCH 08/75] FIX cs & docblock
---
app/code/Magento/Sales/Model/Order.php | 17 +++++++++--------
app/code/Magento/Sales/Model/Order/Config.php | 13 +++++++------
2 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/app/code/Magento/Sales/Model/Order.php b/app/code/Magento/Sales/Model/Order.php
index 25ba1a9594174..93909b5815616 100644
--- a/app/code/Magento/Sales/Model/Order.php
+++ b/app/code/Magento/Sales/Model/Order.php
@@ -8,6 +8,7 @@
use Magento\Directory\Model\Currency;
use Magento\Framework\Api\AttributeValueFactory;
use Magento\Framework\App\ObjectManager;
+use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Locale\ResolverInterface;
use Magento\Framework\Pricing\PriceCurrencyInterface;
use Magento\Sales\Api\Data\OrderInterface;
@@ -981,7 +982,7 @@ public function setState($state)
* Retrieve frontend label of order status
*
* @return string
- * @throws \Magento\Framework\Exception\LocalizedException
+ * @throws LocalizedException
*/
public function getFrontendStatusLabel()
{
@@ -992,7 +993,7 @@ public function getFrontendStatusLabel()
* Retrieve label of order status
*
* @return string
- * @throws \Magento\Framework\Exception\LocalizedException
+ * @throws LocalizedException
*/
public function getStatusLabel()
{
@@ -1078,12 +1079,12 @@ public function place()
/**
* @return $this
- * @throws \Magento\Framework\Exception\LocalizedException
+ * @throws LocalizedException
*/
public function hold()
{
if (!$this->canHold()) {
- throw new \Magento\Framework\Exception\LocalizedException(__('A hold action is not available.'));
+ throw new LocalizedException(__('A hold action is not available.'));
}
$this->setHoldBeforeState($this->getState());
$this->setHoldBeforeStatus($this->getStatus());
@@ -1096,12 +1097,12 @@ public function hold()
* Attempt to unhold the order
*
* @return $this
- * @throws \Magento\Framework\Exception\LocalizedException
+ * @throws LocalizedException
*/
public function unhold()
{
if (!$this->canUnhold()) {
- throw new \Magento\Framework\Exception\LocalizedException(__('You cannot remove the hold.'));
+ throw new LocalizedException(__('You cannot remove the hold.'));
}
$this->setState($this->getHoldBeforeState())
@@ -1145,7 +1146,7 @@ public function isFraudDetected()
* @param string $comment
* @param bool $graceful
* @return $this
- * @throws \Magento\Framework\Exception\LocalizedException
+ * @throws LocalizedException
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
public function registerCancellation($comment = '', $graceful = true)
@@ -1184,7 +1185,7 @@ public function registerCancellation($comment = '', $graceful = true)
$this->addStatusHistoryComment($comment, false);
}
} elseif (!$graceful) {
- throw new \Magento\Framework\Exception\LocalizedException(__('We cannot cancel this order.'));
+ throw new LocalizedException(__('We cannot cancel this order.'));
}
return $this;
}
diff --git a/app/code/Magento/Sales/Model/Order/Config.php b/app/code/Magento/Sales/Model/Order/Config.php
index 2e8ea910eb5b0..d0875135c3c8f 100644
--- a/app/code/Magento/Sales/Model/Order/Config.php
+++ b/app/code/Magento/Sales/Model/Order/Config.php
@@ -4,6 +4,7 @@
* See COPYING.txt for license details.
*/
namespace Magento\Sales\Model\Order;
+use Magento\Framework\Exception\LocalizedException;
/**
* Order configuration model
@@ -85,7 +86,7 @@ protected function _getCollection()
/**
* @param string $state
- * @return Status|null
+ * @return Status
*/
protected function _getState($state)
{
@@ -101,7 +102,7 @@ protected function _getState($state)
* Retrieve default status for state
*
* @param string $state
- * @return string
+ * @return string|null
*/
public function getStateDefaultStatus($state)
{
@@ -117,10 +118,10 @@ public function getStateDefaultStatus($state)
/**
* Retrieve status label
*
- * @param string $code
- * @param null $forceArea
- * @return string
- * @throws \Magento\Framework\Exception\LocalizedException
+ * @param string $code
+ * @param string|null $forceArea
+ * @return string
+ * @throws LocalizedException
*/
public function getStatusLabel($code, $forceArea = null)
{
From 1c9ce8467d3297703e1d899314728df8b387e716 Mon Sep 17 00:00:00 2001
From: Riccardo Tempesta
Date: Tue, 29 May 2018 11:33:35 +0200
Subject: [PATCH 09/75] FIX CS
---
app/code/Magento/Sales/Model/Order/Config.php | 1 +
1 file changed, 1 insertion(+)
diff --git a/app/code/Magento/Sales/Model/Order/Config.php b/app/code/Magento/Sales/Model/Order/Config.php
index d0875135c3c8f..c0c374b05226b 100644
--- a/app/code/Magento/Sales/Model/Order/Config.php
+++ b/app/code/Magento/Sales/Model/Order/Config.php
@@ -4,6 +4,7 @@
* See COPYING.txt for license details.
*/
namespace Magento\Sales\Model\Order;
+
use Magento\Framework\Exception\LocalizedException;
/**
From 99c14084df3eaa2272019447ceba8c14c439859f Mon Sep 17 00:00:00 2001
From: iGerchak <34220204+iGerchak@users.noreply.github.com>
Date: Tue, 17 Jul 2018 18:32:18 +0300
Subject: [PATCH 10/75] Fix blocked a frame with origin
---
.../view/frontend/web/js/page-cache.js | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/app/code/Magento/PageCache/view/frontend/web/js/page-cache.js b/app/code/Magento/PageCache/view/frontend/web/js/page-cache.js
index fccc8510ffc70..08e23d0f4d3f5 100644
--- a/app/code/Magento/PageCache/view/frontend/web/js/page-cache.js
+++ b/app/code/Magento/PageCache/view/frontend/web/js/page-cache.js
@@ -53,7 +53,22 @@ define([
}
}
- $(element).contents().each(function (index, el) {
+ // rewrite jQuery contents()
+ var contents = function (element) {
+ return $.map(element, function (elem) {
+ try {
+ return $.nodeName(elem, "iframe") ?
+ elem.contentDocument || (elem.contentWindow ? elem.contentWindow.document : []) :
+ $.merge([], elem.childNodes);
+ } catch (e) {
+ return [];
+ }
+ });
+ };
+
+ var elementContents = contents($(element));
+
+ $.each(elementContents, function (index, el) {
switch (el.nodeType) {
case 1: // ELEMENT_NODE
lookup(el);
From e9451e0f337cc48e285905c99e83221defc78a36 Mon Sep 17 00:00:00 2001
From: Magently
Date: Fri, 24 Aug 2018 16:58:02 +0200
Subject: [PATCH 11/75] Fix addExpressionFieldToSelect method generated columns
get overwriten by addFieldToSelect()
---
.../Model/ResourceModel/Db/Collection/AbstractCollection.php | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lib/internal/Magento/Framework/Model/ResourceModel/Db/Collection/AbstractCollection.php b/lib/internal/Magento/Framework/Model/ResourceModel/Db/Collection/AbstractCollection.php
index b57755ed7eafa..a88e013f5d2fe 100644
--- a/lib/internal/Magento/Framework/Model/ResourceModel/Db/Collection/AbstractCollection.php
+++ b/lib/internal/Magento/Framework/Model/ResourceModel/Db/Collection/AbstractCollection.php
@@ -346,7 +346,9 @@ public function addExpressionFieldToSelect($alias, $expression, $fields)
$fullExpression = str_replace('{{' . $fieldKey . '}}', $fieldItem, $fullExpression);
}
- $this->getSelect()->columns([$alias => $fullExpression]);
+ $fullExpression = new \Zend_Db_Expr($fullExpression);
+ $this->_fieldsToSelect[$alias] = $fullExpression;
+ $this->_fieldsToSelectChanged = true;
return $this;
}
From 29680f7653167268f474af8929b87aa2d863b9b5 Mon Sep 17 00:00:00 2001
From: Magently
Date: Tue, 4 Sep 2018 13:53:08 +0200
Subject: [PATCH 12/75] Fix integration test
Changed test method to fit the new implementation of the class method
---
.../ResourceModel/Db/Collection/AbstractCollectionTest.php | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/lib/internal/Magento/Framework/Model/Test/Unit/ResourceModel/Db/Collection/AbstractCollectionTest.php b/lib/internal/Magento/Framework/Model/Test/Unit/ResourceModel/Db/Collection/AbstractCollectionTest.php
index 4f27f083509d7..7989a265e0db1 100644
--- a/lib/internal/Magento/Framework/Model/Test/Unit/ResourceModel/Db/Collection/AbstractCollectionTest.php
+++ b/lib/internal/Magento/Framework/Model/Test/Unit/ResourceModel/Db/Collection/AbstractCollectionTest.php
@@ -267,10 +267,11 @@ public function addFieldToSelectDataProvider()
/**
* @dataProvider addExpressionFieldToSelectDataProvider
*/
- public function testAddExpressionFieldToSelect($alias, $expression, $fields, $expected)
+ public function testAddExpressionFieldToSelect($alias, $expression, $fields, $expectedFieldsToSelect)
{
- $this->selectMock->expects($this->once())->method('columns')->with($expected);
$this->assertTrue($this->uut->addExpressionFieldToSelect($alias, $expression, $fields) instanceof Uut);
+ $this->assertEquals($expectedFieldsToSelect, $this->uut->getFieldsToSelect());
+ $this->assertTrue($this->uut->wereFieldsToSelectChanged());
}
/**
From 5a702eff42e1907d8887281ed32857534d4066bd Mon Sep 17 00:00:00 2001
From: Magently
Date: Tue, 4 Sep 2018 15:24:11 +0200
Subject: [PATCH 13/75] Fix variable name in test class too long
---
.../ResourceModel/Db/Collection/AbstractCollectionTest.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/internal/Magento/Framework/Model/Test/Unit/ResourceModel/Db/Collection/AbstractCollectionTest.php b/lib/internal/Magento/Framework/Model/Test/Unit/ResourceModel/Db/Collection/AbstractCollectionTest.php
index 7989a265e0db1..0eae94dabbbe8 100644
--- a/lib/internal/Magento/Framework/Model/Test/Unit/ResourceModel/Db/Collection/AbstractCollectionTest.php
+++ b/lib/internal/Magento/Framework/Model/Test/Unit/ResourceModel/Db/Collection/AbstractCollectionTest.php
@@ -267,10 +267,10 @@ public function addFieldToSelectDataProvider()
/**
* @dataProvider addExpressionFieldToSelectDataProvider
*/
- public function testAddExpressionFieldToSelect($alias, $expression, $fields, $expectedFieldsToSelect)
+ public function testAddExpressionFieldToSelect($alias, $expression, $fields, $expected)
{
$this->assertTrue($this->uut->addExpressionFieldToSelect($alias, $expression, $fields) instanceof Uut);
- $this->assertEquals($expectedFieldsToSelect, $this->uut->getFieldsToSelect());
+ $this->assertEquals($expected, $this->uut->getFieldsToSelect());
$this->assertTrue($this->uut->wereFieldsToSelectChanged());
}
From 85660e6ad8dfad744d97c591c8bd543c9289422e Mon Sep 17 00:00:00 2001
From: Ihor Sviziev
Date: Fri, 14 Sep 2018 08:51:24 +0300
Subject: [PATCH 14/75] magento/magento2#16887 Fix blocked a frame with origin
Add logging of exception
---
app/code/Magento/PageCache/view/frontend/web/js/page-cache.js | 2 ++
1 file changed, 2 insertions(+)
diff --git a/app/code/Magento/PageCache/view/frontend/web/js/page-cache.js b/app/code/Magento/PageCache/view/frontend/web/js/page-cache.js
index 08e23d0f4d3f5..e455102d3bf7e 100644
--- a/app/code/Magento/PageCache/view/frontend/web/js/page-cache.js
+++ b/app/code/Magento/PageCache/view/frontend/web/js/page-cache.js
@@ -6,6 +6,7 @@
define([
'jquery',
'domReady',
+ 'consoleLogger',
'jquery/ui',
'mage/cookies'
], function ($, domReady) {
@@ -61,6 +62,7 @@ define([
elem.contentDocument || (elem.contentWindow ? elem.contentWindow.document : []) :
$.merge([], elem.childNodes);
} catch (e) {
+ consoleLogger.error(e);
return [];
}
});
From 3bf066a5a5d5ba17d8b0c38bbc981af974d2b244 Mon Sep 17 00:00:00 2001
From: Ihor Sviziev
Date: Fri, 14 Sep 2018 08:53:55 +0300
Subject: [PATCH 15/75] magento/magento2#16887 Fix blocked a frame with origin
Add logging of exception
---
app/code/Magento/PageCache/view/frontend/web/js/page-cache.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/code/Magento/PageCache/view/frontend/web/js/page-cache.js b/app/code/Magento/PageCache/view/frontend/web/js/page-cache.js
index e455102d3bf7e..2a43ff29a3593 100644
--- a/app/code/Magento/PageCache/view/frontend/web/js/page-cache.js
+++ b/app/code/Magento/PageCache/view/frontend/web/js/page-cache.js
@@ -9,7 +9,7 @@ define([
'consoleLogger',
'jquery/ui',
'mage/cookies'
-], function ($, domReady) {
+], function ($, domReady, consoleLogger) {
'use strict';
/**
From 25569626180d1eaef2bbfb3640e24116e029fd75 Mon Sep 17 00:00:00 2001
From: Bohdan Korablov
Date: Tue, 2 Oct 2018 09:49:35 +0300
Subject: [PATCH 16/75] MAGETWO-95411: [Backport 2.2.x] Add the ability to
install Magento without creating an administrator
---
.../Command/AdminUserCreateCommand.php | 43 ++++-
.../Setup/Console/Command/InstallCommand.php | 27 ++-
setup/src/Magento/Setup/Model/Installer.php | 27 ++-
.../Command/AdminUserCreateCommandTest.php | 36 +++-
.../Console/Command/InstallCommandTest.php | 37 ++--
.../Setup/Test/Unit/Model/InstallerTest.php | 168 +++++++++++++-----
6 files changed, 261 insertions(+), 77 deletions(-)
diff --git a/setup/src/Magento/Setup/Console/Command/AdminUserCreateCommand.php b/setup/src/Magento/Setup/Console/Command/AdminUserCreateCommand.php
index 00fa272e74962..173ea9e49a8a4 100644
--- a/setup/src/Magento/Setup/Console/Command/AdminUserCreateCommand.php
+++ b/setup/src/Magento/Setup/Console/Command/AdminUserCreateCommand.php
@@ -15,6 +15,9 @@
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\Question;
+/**
+ * Command to create an admin user.
+ */
class AdminUserCreateCommand extends AbstractSetupCommand
{
/**
@@ -52,6 +55,8 @@ protected function configure()
}
/**
+ * Creation admin user in interaction mode.
+ *
* @param \Symfony\Component\Console\Input\InputInterface $input
* @param \Symfony\Component\Console\Output\OutputInterface $output
*
@@ -129,6 +134,8 @@ protected function interact(InputInterface $input, OutputInterface $output)
}
/**
+ * Add not empty validator.
+ *
* @param \Symfony\Component\Console\Question\Question $question
* @return void
*/
@@ -144,7 +151,7 @@ private function addNotEmptyValidator(Question $question)
}
/**
- * {@inheritdoc}
+ * @inheritdoc
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
@@ -165,25 +172,43 @@ protected function execute(InputInterface $input, OutputInterface $output)
/**
* Get list of arguments for the command
*
+ * @param int $mode The mode of options.
* @return InputOption[]
*/
- public function getOptionsList()
+ public function getOptionsList($mode = InputOption::VALUE_REQUIRED)
{
+ $requiredStr = ($mode === InputOption::VALUE_REQUIRED ? '(Required) ' : '');
+
return [
- new InputOption(AdminAccount::KEY_USER, null, InputOption::VALUE_REQUIRED, '(Required) Admin user'),
- new InputOption(AdminAccount::KEY_PASSWORD, null, InputOption::VALUE_REQUIRED, '(Required) Admin password'),
- new InputOption(AdminAccount::KEY_EMAIL, null, InputOption::VALUE_REQUIRED, '(Required) Admin email'),
+ new InputOption(
+ AdminAccount::KEY_USER,
+ null,
+ $mode,
+ $requiredStr . 'Admin user'
+ ),
+ new InputOption(
+ AdminAccount::KEY_PASSWORD,
+ null,
+ $mode,
+ $requiredStr . 'Admin password'
+ ),
+ new InputOption(
+ AdminAccount::KEY_EMAIL,
+ null,
+ $mode,
+ $requiredStr . 'Admin email'
+ ),
new InputOption(
AdminAccount::KEY_FIRST_NAME,
null,
- InputOption::VALUE_REQUIRED,
- '(Required) Admin first name'
+ $mode,
+ $requiredStr . 'Admin first name'
),
new InputOption(
AdminAccount::KEY_LAST_NAME,
null,
- InputOption::VALUE_REQUIRED,
- '(Required) Admin last name'
+ $mode,
+ $requiredStr . 'Admin last name'
),
];
}
diff --git a/setup/src/Magento/Setup/Console/Command/InstallCommand.php b/setup/src/Magento/Setup/Console/Command/InstallCommand.php
index a2e8715b02233..dd5509d61865a 100644
--- a/setup/src/Magento/Setup/Console/Command/InstallCommand.php
+++ b/setup/src/Magento/Setup/Console/Command/InstallCommand.php
@@ -11,12 +11,14 @@
use Symfony\Component\Console\Output\OutputInterface;
use Magento\Setup\Model\InstallerFactory;
use Magento\Framework\Setup\ConsoleLogger;
+use Magento\Setup\Model\AdminAccount;
use Symfony\Component\Console\Input\InputOption;
use Magento\Setup\Model\ConfigModel;
use Symfony\Component\Console\Question\Question;
use Symfony\Component\Console\Question\ChoiceQuestion;
use Symfony\Component\Console\Helper\QuestionHelper;
+
/**
* Command to install Magento application
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -103,7 +105,7 @@ protected function configure()
{
$inputOptions = $this->configModel->getAvailableOptions();
$inputOptions = array_merge($inputOptions, $this->userConfig->getOptionsList());
- $inputOptions = array_merge($inputOptions, $this->adminUser->getOptionsList());
+ $inputOptions = array_merge($inputOptions, $this->adminUser->getOptionsList(InputOption::VALUE_OPTIONAL));
$inputOptions = array_merge($inputOptions, [
new InputOption(
self::INPUT_KEY_CLEANUP_DB,
@@ -178,7 +180,7 @@ protected function initialize(InputInterface $input, OutputInterface $output)
}
$errors = $this->configModel->validate($configOptionsToValidate);
- $errors = array_merge($errors, $this->adminUser->validate($input));
+ $errors = array_merge($errors, $this->validateAdmin($input));
$errors = array_merge($errors, $this->validate($input));
$errors = array_merge($errors, $this->userConfig->validate($input));
@@ -247,7 +249,7 @@ private function interactiveQuestions(InputInterface $input, OutputInterface $ou
$output->writeln("");
- foreach ($this->adminUser->getOptionsList() as $option) {
+ foreach ($this->adminUser->getOptionsList(InputOption::VALUE_OPTIONAL) as $option) {
$configOptionsToValidate[$option->getName()] = $this->askQuestion(
$input,
$output,
@@ -338,4 +340,23 @@ private function askQuestion(
return $value;
}
+
+ /**
+ * Performs validation of admin options if at least one of them was set.
+ *
+ * @param InputInterface $input
+ * @return array
+ */
+ private function validateAdmin(InputInterface $input): array
+ {
+ if ($input->getOption(AdminAccount::KEY_FIRST_NAME)
+ || $input->getOption(AdminAccount::KEY_LAST_NAME)
+ || $input->getOption(AdminAccount::KEY_EMAIL)
+ || $input->getOption(AdminAccount::KEY_USER)
+ || $input->getOption(AdminAccount::KEY_PASSWORD)
+ ) {
+ return $this->adminUser->validate($input);
+ }
+ return [];
+ }
}
diff --git a/setup/src/Magento/Setup/Model/Installer.php b/setup/src/Magento/Setup/Model/Installer.php
index 438df0e0ae14b..60c98c01f34db 100644
--- a/setup/src/Magento/Setup/Model/Installer.php
+++ b/setup/src/Magento/Setup/Model/Installer.php
@@ -316,7 +316,9 @@ public function install($request)
[$request[InstallCommand::INPUT_KEY_SALES_ORDER_INCREMENT_PREFIX]],
];
}
- $script[] = ['Installing admin user...', 'installAdminUser', [$request]];
+ if ($this->isAdminDataSet($request)) {
+ $script[] = ['Installing admin user...', 'installAdminUser', [$request]];
+ }
$script[] = ['Caches clearing:', 'cleanCaches', []];
$script[] = ['Disabling Maintenance Mode:', 'setMaintenanceMode', [0]];
$script[] = ['Post installation file permissions check...', 'checkApplicationFilePermissions', []];
@@ -1318,4 +1320,27 @@ private function cleanupGeneratedFiles()
$this->log->log($message);
}
}
+
+ /**
+ * Checks that admin data is not empty in request array
+ *
+ * @param \ArrayObject|array $request
+ * @return bool
+ */
+ private function isAdminDataSet($request)
+ {
+ $adminData = array_filter($request, function ($value, $key) {
+ return in_array(
+ $key,
+ [
+ AdminAccount::KEY_EMAIL,
+ AdminAccount::KEY_FIRST_NAME,
+ AdminAccount::KEY_LAST_NAME,
+ AdminAccount::KEY_USER,
+ AdminAccount::KEY_PASSWORD,
+ ]
+ ) && $value !== null;
+ }, ARRAY_FILTER_USE_BOTH);
+ return !empty($adminData);
+ }
}
diff --git a/setup/src/Magento/Setup/Test/Unit/Console/Command/AdminUserCreateCommandTest.php b/setup/src/Magento/Setup/Test/Unit/Console/Command/AdminUserCreateCommandTest.php
index d244f48d4e1ea..eda8c819e052a 100644
--- a/setup/src/Magento/Setup/Test/Unit/Console/Command/AdminUserCreateCommandTest.php
+++ b/setup/src/Magento/Setup/Test/Unit/Console/Command/AdminUserCreateCommandTest.php
@@ -11,8 +11,12 @@
use Magento\User\Model\UserValidationRules;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Helper\QuestionHelper;
+use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Tester\CommandTester;
+/**
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
+ */
class AdminUserCreateCommandTest extends \PHPUnit\Framework\TestCase
{
/**
@@ -125,11 +129,34 @@ public function testInteraction()
);
}
- public function testGetOptionsList()
+ /**
+ * @param int $mode
+ * @param string $description
+ * @dataProvider getOptionListDataProvider
+ */
+ public function testGetOptionsList($mode, $description)
{
/* @var $argsList \Symfony\Component\Console\Input\InputArgument[] */
- $argsList = $this->command->getOptionsList();
+ $argsList = $this->command->getOptionsList($mode);
$this->assertEquals(AdminAccount::KEY_EMAIL, $argsList[2]->getName());
+ $this->assertEquals($description, $argsList[2]->getDescription());
+ }
+
+ /**
+ * @return array
+ */
+ public function getOptionListDataProvider()
+ {
+ return [
+ [
+ 'mode' => InputOption::VALUE_REQUIRED,
+ 'description' => '(Required) Admin email',
+ ],
+ [
+ 'mode' => InputOption::VALUE_OPTIONAL,
+ 'description' => 'Admin email',
+ ],
+ ];
}
/**
@@ -158,7 +185,10 @@ public function testValidate(array $options, array $errors)
public function validateDataProvider()
{
return [
- [[null, 'Doe', 'admin', 'test@test.com', '123123q', '123123q'], ['First Name is a required field.']],
+ [
+ [null, 'Doe', 'admin', 'test@test.com', '123123q', '123123q'],
+ ['First Name is a required field.']
+ ],
[
['John', null, null, 'test@test.com', '123123q', '123123q'],
['User Name is a required field.', 'Last Name is a required field.'],
diff --git a/setup/src/Magento/Setup/Test/Unit/Console/Command/InstallCommandTest.php b/setup/src/Magento/Setup/Test/Unit/Console/Command/InstallCommandTest.php
index 5b7b6c1626911..3c3a875a278e8 100644
--- a/setup/src/Magento/Setup/Test/Unit/Console/Command/InstallCommandTest.php
+++ b/setup/src/Magento/Setup/Test/Unit/Console/Command/InstallCommandTest.php
@@ -16,6 +16,7 @@
use Magento\Backend\Setup\ConfigOptionsList as BackendConfigOptionsList;
use Magento\Framework\Config\ConfigOptionsListConstants as SetupConfigOptionsList;
use Magento\Setup\Model\StoreConfigurationDataMapper;
+use Magento\Setup\Console\Command\AdminUserCreateCommand;
/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -62,6 +63,11 @@ class InstallCommandTest extends \PHPUnit\Framework\TestCase
*/
private $configImportMock;
+ /**
+ * @var AdminUserCreateCommand|\PHPUnit_Framework_MockObject_MockObject
+ */
+ private $adminUserMock;
+
public function setUp()
{
$this->input = [
@@ -73,11 +79,6 @@ public function setUp()
'--' . StoreConfigurationDataMapper::KEY_LANGUAGE => 'en_US',
'--' . StoreConfigurationDataMapper::KEY_TIMEZONE => 'America/Chicago',
'--' . StoreConfigurationDataMapper::KEY_CURRENCY => 'USD',
- '--' . AdminAccount::KEY_USER => 'user',
- '--' . AdminAccount::KEY_PASSWORD => '123123q',
- '--' . AdminAccount::KEY_EMAIL => 'test@test.com',
- '--' . AdminAccount::KEY_FIRST_NAME => 'John',
- '--' . AdminAccount::KEY_LAST_NAME => 'Doe',
];
$configModel = $this->createMock(\Magento\Setup\Model\ConfigModel::class);
@@ -100,15 +101,11 @@ public function setUp()
->method('validate')
->will($this->returnValue([]));
- $adminUser = $this->createMock(\Magento\Setup\Console\Command\AdminUserCreateCommand::class);
- $adminUser
+ $this->adminUserMock = $this->createMock(AdminUserCreateCommand::class);
+ $this->adminUserMock
->expects($this->once())
->method('getOptionsList')
->will($this->returnValue($this->getOptionsListAdminUser()));
- $adminUser
- ->expects($this->once())
- ->method('validate')
- ->will($this->returnValue([]));
$this->installerFactory = $this->createMock(\Magento\Setup\Model\InstallerFactory::class);
$this->installer = $this->createMock(\Magento\Setup\Model\Installer::class);
@@ -143,7 +140,7 @@ public function setUp()
$this->installerFactory,
$configModel,
$userConfig,
- $adminUser
+ $this->adminUserMock
);
$this->command->setApplication(
$this->applicationMock
@@ -152,6 +149,16 @@ public function setUp()
public function testExecute()
{
+ $this->input['--' . AdminAccount::KEY_USER] = 'user';
+ $this->input['--' . AdminAccount::KEY_PASSWORD] = '123123q';
+ $this->input['--' . AdminAccount::KEY_EMAIL] = 'test@test.com';
+ $this->input['--' . AdminAccount::KEY_FIRST_NAME] = 'John';
+ $this->input['--' . AdminAccount::KEY_LAST_NAME] = 'Doe';
+
+ $this->adminUserMock
+ ->expects($this->once())
+ ->method('validate')
+ ->willReturn([]);
$this->installerFactory->expects($this->once())
->method('create')
->will($this->returnValue($this->installer));
@@ -269,6 +276,9 @@ private function getOptionsListAdminUser()
*/
public function testValidate($prefixValue)
{
+ $this->adminUserMock
+ ->expects($this->never())
+ ->method('validate');
$this->installerFactory->expects($this->once())
->method('create')
->will($this->returnValue($this->installer));
@@ -288,6 +298,9 @@ public function testValidate($prefixValue)
*/
public function testValidateWithException($prefixValue)
{
+ $this->adminUserMock
+ ->expects($this->never())
+ ->method('validate');
$this->installerFactory->expects($this->never())
->method('create')
->will($this->returnValue($this->installer));
diff --git a/setup/src/Magento/Setup/Test/Unit/Model/InstallerTest.php b/setup/src/Magento/Setup/Test/Unit/Model/InstallerTest.php
index ca8799393320f..6e57f452a997d 100644
--- a/setup/src/Magento/Setup/Test/Unit/Model/InstallerTest.php
+++ b/setup/src/Magento/Setup/Test/Unit/Model/InstallerTest.php
@@ -14,6 +14,7 @@
use Magento\Framework\Config\File\ConfigFilePool;
use Magento\Framework\App\State\CleanupFiles;
use Magento\Setup\Validator\DbValidator;
+use Magento\Setup\Model\AdminAccount;
/**
* @SuppressWarnings(PHPMD.TooManyFields)
@@ -227,15 +228,15 @@ private function createObject($connectionFactory = false, $objectManagerProvider
);
}
- public function testInstall()
+ /**
+ * @param array $request
+ * @param array $logMessages
+ * @dataProvider installDataProvider
+ * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
+ * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
+ */
+ public function testInstall(array $request, array $logMessages)
{
- $request = [
- ConfigOptionsListConstants::INPUT_KEY_DB_HOST => '127.0.0.1',
- ConfigOptionsListConstants::INPUT_KEY_DB_NAME => 'magento',
- ConfigOptionsListConstants::INPUT_KEY_DB_USER => 'magento',
- ConfigOptionsListConstants::INPUT_KEY_ENCRYPTION_KEY => 'encryption_key',
- ConfigOptionsList::INPUT_KEY_BACKEND_FRONTNAME => 'backend',
- ];
$this->config->expects($this->atLeastOnce())
->method('get')
->willReturnMap(
@@ -285,7 +286,7 @@ public function testInstall()
[\Magento\Framework\Module\ModuleResource::class, [], $moduleResource],
[\Magento\Framework\Registry::class, $registry]
]));
- $this->adminFactory->expects($this->once())->method('create')->willReturn(
+ $this->adminFactory->expects($this->any())->method('create')->willReturn(
$this->createMock(\Magento\Setup\Model\AdminAccount::class)
);
$this->sampleDataState->expects($this->once())->method('hasError')->willReturn(true);
@@ -298,11 +299,119 @@ public function testInstall()
$this->filePermissions->expects($this->once())
->method('getMissingWritableDirectoriesForDbUpgrade')
->willReturn([]);
- $this->setupLoggerExpectsForInstall();
+ call_user_func_array(
+ [
+ $this->logger->expects($this->exactly(count($logMessages)))->method('log'),
+ 'withConsecutive'
+ ],
+ $logMessages
+ );
+ $this->logger->expects($this->exactly(2))
+ ->method('logSuccess')
+ ->withConsecutive(
+ ['Magento installation complete.'],
+ ['Magento Admin URI: /']
+ );
$this->object->install($request);
}
+ /**
+ * @return array
+ */
+ public function installDataProvider()
+ {
+ return [
+ [
+ 'request' => [
+ ConfigOptionsListConstants::INPUT_KEY_DB_HOST => '127.0.0.1',
+ ConfigOptionsListConstants::INPUT_KEY_DB_NAME => 'magento',
+ ConfigOptionsListConstants::INPUT_KEY_DB_USER => 'magento',
+ ConfigOptionsListConstants::INPUT_KEY_ENCRYPTION_KEY => 'encryption_key',
+ ConfigOptionsList::INPUT_KEY_BACKEND_FRONTNAME => 'backend',
+ ],
+ 'logMessages' => [
+ ['Starting Magento installation:'],
+ ['File permissions check...'],
+ ['Required extensions check...'],
+ ['Enabling Maintenance Mode...'],
+ ['Installing deployment configuration...'],
+ ['Installing database schema:'],
+ ['Schema creation/updates:'],
+ ['Module \'Foo_One\':'],
+ ['Module \'Bar_Two\':'],
+ ['Schema post-updates:'],
+ ['Module \'Foo_One\':'],
+ ['Module \'Bar_Two\':'],
+ ['Installing user configuration...'],
+ ['Enabling caches:'],
+ ['Current status:'],
+ [''],
+ ['Installing data...'],
+ ['Data install/update:'],
+ ['Module \'Foo_One\':'],
+ ['Module \'Bar_Two\':'],
+ ['Data post-updates:'],
+ ['Module \'Foo_One\':'],
+ ['Module \'Bar_Two\':'],
+ //['Installing admin user...'],
+ ['Caches clearing:'],
+ ['Cache cleared successfully'],
+ ['Disabling Maintenance Mode:'],
+ ['Post installation file permissions check...'],
+ ['Write installation date...'],
+ ['Sample Data is installed with errors. See log file for details']
+ ],
+ ],
+ [
+ 'request' => [
+ ConfigOptionsListConstants::INPUT_KEY_DB_HOST => '127.0.0.1',
+ ConfigOptionsListConstants::INPUT_KEY_DB_NAME => 'magento',
+ ConfigOptionsListConstants::INPUT_KEY_DB_USER => 'magento',
+ ConfigOptionsListConstants::INPUT_KEY_ENCRYPTION_KEY => 'encryption_key',
+ ConfigOptionsList::INPUT_KEY_BACKEND_FRONTNAME => 'backend',
+ AdminAccount::KEY_USER => 'admin',
+ AdminAccount::KEY_PASSWORD => '123',
+ AdminAccount::KEY_EMAIL => 'admin@example.com',
+ AdminAccount::KEY_FIRST_NAME => 'John',
+ AdminAccount::KEY_LAST_NAME => 'Doe',
+ ],
+ 'logMessages' => [
+ ['Starting Magento installation:'],
+ ['File permissions check...'],
+ ['Required extensions check...'],
+ ['Enabling Maintenance Mode...'],
+ ['Installing deployment configuration...'],
+ ['Installing database schema:'],
+ ['Schema creation/updates:'],
+ ['Module \'Foo_One\':'],
+ ['Module \'Bar_Two\':'],
+ ['Schema post-updates:'],
+ ['Module \'Foo_One\':'],
+ ['Module \'Bar_Two\':'],
+ ['Installing user configuration...'],
+ ['Enabling caches:'],
+ ['Current status:'],
+ [''],
+ ['Installing data...'],
+ ['Data install/update:'],
+ ['Module \'Foo_One\':'],
+ ['Module \'Bar_Two\':'],
+ ['Data post-updates:'],
+ ['Module \'Foo_One\':'],
+ ['Module \'Bar_Two\':'],
+ ['Installing admin user...'],
+ ['Caches clearing:'],
+ ['Cache cleared successfully'],
+ ['Disabling Maintenance Mode:'],
+ ['Post installation file permissions check...'],
+ ['Write installation date...'],
+ ['Sample Data is installed with errors. See log file for details']
+ ],
+ ],
+ ];
+ }
+
public function testCheckInstallationFilePermissions()
{
$this->filePermissions
@@ -512,45 +621,6 @@ private function prepareForUpdateModulesTests()
return $newObject;
}
-
- /**
- * Set up logger expectations for install method
- *
- * @return void
- */
- private function setupLoggerExpectsForInstall()
- {
- $this->logger->expects($this->at(0))->method('log')->with('Starting Magento installation:');
- $this->logger->expects($this->at(1))->method('log')->with('File permissions check...');
- $this->logger->expects($this->at(3))->method('log')->with('Required extensions check...');
- // at(2) invokes logMeta()
- $this->logger->expects($this->at(5))->method('log')->with('Enabling Maintenance Mode...');
- // at(4) - logMeta and so on...
- $this->logger->expects($this->at(7))->method('log')->with('Installing deployment configuration...');
- $this->logger->expects($this->at(9))->method('log')->with('Installing database schema:');
- $this->logger->expects($this->at(11))->method('log')->with("Module 'Foo_One':");
- $this->logger->expects($this->at(13))->method('log')->with("Module 'Bar_Two':");
- $this->logger->expects($this->at(15))->method('log')->with('Schema post-updates:');
- $this->logger->expects($this->at(16))->method('log')->with("Module 'Foo_One':");
- $this->logger->expects($this->at(18))->method('log')->with("Module 'Bar_Two':");
- $this->logger->expects($this->at(21))->method('log')->with('Installing user configuration...');
- $this->logger->expects($this->at(23))->method('log')->with('Enabling caches:');
- $this->logger->expects($this->at(27))->method('log')->with('Installing data...');
- $this->logger->expects($this->at(28))->method('log')->with('Data install/update:');
- $this->logger->expects($this->at(29))->method('log')->with("Module 'Foo_One':");
- $this->logger->expects($this->at(31))->method('log')->with("Module 'Bar_Two':");
- $this->logger->expects($this->at(33))->method('log')->with('Data post-updates:');
- $this->logger->expects($this->at(34))->method('log')->with("Module 'Foo_One':");
- $this->logger->expects($this->at(36))->method('log')->with("Module 'Bar_Two':");
- $this->logger->expects($this->at(39))->method('log')->with('Installing admin user...');
- $this->logger->expects($this->at(41))->method('log')->with('Caches clearing:');
- $this->logger->expects($this->at(44))->method('log')->with('Disabling Maintenance Mode:');
- $this->logger->expects($this->at(46))->method('log')->with('Post installation file permissions check...');
- $this->logger->expects($this->at(48))->method('log')->with('Write installation date...');
- $this->logger->expects($this->at(50))->method('logSuccess')->with('Magento installation complete.');
- $this->logger->expects($this->at(52))->method('log')
- ->with('Sample Data is installed with errors. See log file for details');
- }
}
namespace Magento\Setup\Model;
From 000b45967dfb70fc921363b102709ec49cb91f12 Mon Sep 17 00:00:00 2001
From: Bohdan Korablov
Date: Tue, 2 Oct 2018 11:50:09 +0300
Subject: [PATCH 17/75] MAGETWO-95411: [Backport 2.2.x] Add the ability to
install Magento without creating an administrator
---
setup/src/Magento/Setup/Console/Command/InstallCommand.php | 1 -
1 file changed, 1 deletion(-)
diff --git a/setup/src/Magento/Setup/Console/Command/InstallCommand.php b/setup/src/Magento/Setup/Console/Command/InstallCommand.php
index dd5509d61865a..1276a443697c8 100644
--- a/setup/src/Magento/Setup/Console/Command/InstallCommand.php
+++ b/setup/src/Magento/Setup/Console/Command/InstallCommand.php
@@ -18,7 +18,6 @@
use Symfony\Component\Console\Question\ChoiceQuestion;
use Symfony\Component\Console\Helper\QuestionHelper;
-
/**
* Command to install Magento application
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
From ee004f432ae187b911d76e10ac041154fe01b67e Mon Sep 17 00:00:00 2001
From: Iurii Ivashchenko
Date: Wed, 26 Sep 2018 16:02:54 +0300
Subject: [PATCH 18/75] MAGETWO-93985: Magnifier does not work with Windows
Chrome/FF
---
lib/web/magnifier/magnify.js | 7 -------
1 file changed, 7 deletions(-)
diff --git a/lib/web/magnifier/magnify.js b/lib/web/magnifier/magnify.js
index 1fb73ea28bff1..9d673092b806c 100644
--- a/lib/web/magnifier/magnify.js
+++ b/lib/web/magnifier/magnify.js
@@ -35,13 +35,6 @@ define([
allowZoomOut = false,
allowZoomIn = true;
- if (isTouchEnabled) {
- $(element).on('fotorama:showend fotorama:load', function () {
- $(magnifierSelector).remove();
- $(magnifierZoomSelector).remove();
- });
- }
-
(function () {
var style = document.documentElement.style,
transitionEnabled = style.transition !== undefined ||
From 03698da2ebc0cdb02ec1a0c4e65eb00097c61d42 Mon Sep 17 00:00:00 2001
From: Thiago Lima
Date: Mon, 8 Oct 2018 14:29:53 +0200
Subject: [PATCH 19/75] fix Fatal Error when save configurable product in
Magento 2.2.5 #18082
---
.../Product/Initialization/Helper/Plugin/Configurable.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/code/Magento/ConfigurableProduct/Controller/Adminhtml/Product/Initialization/Helper/Plugin/Configurable.php b/app/code/Magento/ConfigurableProduct/Controller/Adminhtml/Product/Initialization/Helper/Plugin/Configurable.php
index 5cd8b6a7d0b95..556939ec112f1 100644
--- a/app/code/Magento/ConfigurableProduct/Controller/Adminhtml/Product/Initialization/Helper/Plugin/Configurable.php
+++ b/app/code/Magento/ConfigurableProduct/Controller/Adminhtml/Product/Initialization/Helper/Plugin/Configurable.php
@@ -158,7 +158,7 @@ protected function getVariationMatrix()
$configurableMatrix = json_decode($configurableMatrix, true);
foreach ($configurableMatrix as $item) {
- if ($item['newProduct']) {
+ if (isset($item['newProduct'])) {
$result[$item['variationKey']] = $this->mapData($item);
if (isset($item['qty'])) {
From 38854b5fe8775a3b7a945ee8882a3661e10662b4 Mon Sep 17 00:00:00 2001
From: Thiago Lima
Date: Wed, 10 Oct 2018 11:26:56 +0200
Subject: [PATCH 20/75] 18082 fix phpunit
---
.../Product/Initialization/Helper/Plugin/Configurable.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/code/Magento/ConfigurableProduct/Controller/Adminhtml/Product/Initialization/Helper/Plugin/Configurable.php b/app/code/Magento/ConfigurableProduct/Controller/Adminhtml/Product/Initialization/Helper/Plugin/Configurable.php
index 556939ec112f1..b5940e36aa792 100644
--- a/app/code/Magento/ConfigurableProduct/Controller/Adminhtml/Product/Initialization/Helper/Plugin/Configurable.php
+++ b/app/code/Magento/ConfigurableProduct/Controller/Adminhtml/Product/Initialization/Helper/Plugin/Configurable.php
@@ -158,7 +158,7 @@ protected function getVariationMatrix()
$configurableMatrix = json_decode($configurableMatrix, true);
foreach ($configurableMatrix as $item) {
- if (isset($item['newProduct'])) {
+ if (isset($item['newProduct']) && $item['newProduct']) {
$result[$item['variationKey']] = $this->mapData($item);
if (isset($item['qty'])) {
From 3e8d72aeea51e1cbfc08fdf7e078d439d5f901d8 Mon Sep 17 00:00:00 2001
From: Pavel Bystritsky
Date: Wed, 10 Oct 2018 15:26:40 +0300
Subject: [PATCH 21/75] ENGCOM-970: Fix integration test failures.
---
.../Model/Product/Type/GroupedTest.php | 47 ++++++-------------
1 file changed, 14 insertions(+), 33 deletions(-)
diff --git a/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/Product/Type/GroupedTest.php b/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/Product/Type/GroupedTest.php
index 7e1dc4246e3fb..d53c7983e5b1e 100644
--- a/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/Product/Type/GroupedTest.php
+++ b/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/Product/Type/GroupedTest.php
@@ -170,15 +170,14 @@ public function testOutOfStockSubProduct(bool $outOfStockShown, array $data, arr
count($expected),
count($actual)
);
- /** @var array $element */
- foreach ($expected as $number => $element) {
- foreach ($element as $key => $value) {
- self::assertEquals(
- $value,
- $actual[$number]->getData($key),
- "Failed asserting that value $key matches expected"
- );
- }
+ /** @var Product $product */
+ foreach ($actual as $product) {
+ $sku = $product->getSku();
+ self::assertEquals(
+ $expected[$sku],
+ $product->getCartQty(),
+ "Failed asserting that Product Cart Quantity matches expected"
+ );
}
}
@@ -201,14 +200,8 @@ public function outOfStockSubProductDataProvider()
],
],
[
- [
- 'sku' => 'virtual-product',
- 'cart_qty' => 5,
- ],
- [
- 'sku' => 'simple',
- 'cart_qty' => 4,
- ],
+ 'virtual-product' => 5,
+ 'simple' => 4
],
],
'Out of stock product are shown #2' => [
@@ -221,10 +214,7 @@ public function outOfStockSubProductDataProvider()
],
],
[
- [
- 'sku' => 'virtual-product',
- 'cart_qty' => 2, // This is a default quantity.
- ],
+ 'virtual-product' => 2, // This is a default quantity.
],
],
'Out of stock product are hidden #1' => [
@@ -238,14 +228,8 @@ public function outOfStockSubProductDataProvider()
],
],
[
- [
- 'sku' => 'virtual-product',
- 'cart_qty' => 5,
- ],
- [
- 'sku' => 'simple',
- 'cart_qty' => 4,
- ],
+ 'virtual-product' => 5,
+ 'simple' => 4,
],
],
'Out of stock product are hidden #2' => [
@@ -258,10 +242,7 @@ public function outOfStockSubProductDataProvider()
],
],
[
- [
- 'sku' => 'virtual-product',
- 'cart_qty' => 2, // This is a default quantity.
- ],
+ 'virtual-product' => 2, // This is a default quantity.
],
],
];
From 382e550fe3161fb667f4673d53066d4918aedb74 Mon Sep 17 00:00:00 2001
From: mahesh
Date: Tue, 16 Oct 2018 18:52:20 +0530
Subject: [PATCH 22/75] issue #18617 in v2.2.6
---
app/code/Magento/Weee/Model/Sales/Pdf/Weee.php | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/app/code/Magento/Weee/Model/Sales/Pdf/Weee.php b/app/code/Magento/Weee/Model/Sales/Pdf/Weee.php
index fa71e81281763..62019426feb37 100644
--- a/app/code/Magento/Weee/Model/Sales/Pdf/Weee.php
+++ b/app/code/Magento/Weee/Model/Sales/Pdf/Weee.php
@@ -70,4 +70,17 @@ public function getTotalsForDisplay()
return $totals;
}
+
+ /**
+ * Check if we can display Weee total information in PDF
+ *
+ * @return bool
+ */
+ public function canDisplay()
+ {
+ $items = $this->getSource()->getAllItems();
+ $store = $this->getSource()->getStore();
+ $amount = $this->_weeeData->getTotalAmounts($items, $store);
+ return $this->getDisplayZero() === 'true' || $amount != 0;
+ }
}
From 365df7ebfabaa80e7cb409c3b1c9851ddeae889c Mon Sep 17 00:00:00 2001
From: vtymchynskyi
Date: Wed, 17 Oct 2018 12:11:19 +0300
Subject: [PATCH 23/75] MAGETWO-95497: Please check the shipping address
information. Invalid value of "GB" provided for the regionId field.
---
.../ValidationRules/AllowedCountryValidationRule.php | 10 ++++++++--
.../ValidationRules/BillingAddressValidationRule.php | 6 +++++-
.../ValidationRules/ShippingAddressValidationRule.php | 5 ++++-
.../ValidationRules/ShippingMethodValidationRule.php | 6 ++++--
.../Magento/Quote/Model/QuoteValidatorTest.php | 2 +-
5 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/app/code/Magento/Quote/Model/ValidationRules/AllowedCountryValidationRule.php b/app/code/Magento/Quote/Model/ValidationRules/AllowedCountryValidationRule.php
index 840e94e3ece1f..2498e9976f009 100644
--- a/app/code/Magento/Quote/Model/ValidationRules/AllowedCountryValidationRule.php
+++ b/app/code/Magento/Quote/Model/ValidationRules/AllowedCountryValidationRule.php
@@ -10,6 +10,7 @@
use Magento\Directory\Model\AllowedCountries;
use Magento\Framework\Validation\ValidationResultFactory;
use Magento\Quote\Model\Quote;
+use Magento\Store\Model\ScopeInterface;
/**
* @inheritdoc
@@ -54,10 +55,15 @@ public function validate(Quote $quote): array
$validationErrors = [];
if (!$quote->isVirtual()) {
+ $shippingAddress = $quote->getShippingAddress();
+ $shippingAddress->setStoreId($quote->getStoreId());
$validationResult =
in_array(
- $quote->getShippingAddress()->getCountryId(),
- $this->allowedCountryReader->getAllowedCountries()
+ $shippingAddress->getCountryId(),
+ $this->allowedCountryReader->getAllowedCountries(
+ ScopeInterface::SCOPE_STORE,
+ $quote->getStoreId()
+ )
);
if (!$validationResult) {
$validationErrors = [__($this->generalMessage)];
diff --git a/app/code/Magento/Quote/Model/ValidationRules/BillingAddressValidationRule.php b/app/code/Magento/Quote/Model/ValidationRules/BillingAddressValidationRule.php
index fbacbf1c8d30c..2c02c9f9eacc4 100644
--- a/app/code/Magento/Quote/Model/ValidationRules/BillingAddressValidationRule.php
+++ b/app/code/Magento/Quote/Model/ValidationRules/BillingAddressValidationRule.php
@@ -43,7 +43,11 @@ public function __construct(
public function validate(Quote $quote): array
{
$validationErrors = [];
- $validationResult = $quote->getBillingAddress()->validate();
+
+ $billingAddress = $quote->getBillingAddress();
+ $billingAddress->setStoreId($quote->getStoreId());
+ $validationResult = $billingAddress->validate();
+
if ($validationResult !== true) {
$validationErrors = [__($this->generalMessage)];
}
diff --git a/app/code/Magento/Quote/Model/ValidationRules/ShippingAddressValidationRule.php b/app/code/Magento/Quote/Model/ValidationRules/ShippingAddressValidationRule.php
index f5eebe241acc9..1ced36b9bccf3 100644
--- a/app/code/Magento/Quote/Model/ValidationRules/ShippingAddressValidationRule.php
+++ b/app/code/Magento/Quote/Model/ValidationRules/ShippingAddressValidationRule.php
@@ -45,7 +45,10 @@ public function validate(Quote $quote): array
$validationErrors = [];
if (!$quote->isVirtual()) {
- $validationResult = $quote->getShippingAddress()->validate();
+ $shippingAddress = $quote->getShippingAddress();
+ $shippingAddress->setStoreId($quote->getStoreId());
+ $validationResult = $shippingAddress->validate();
+
if ($validationResult !== true) {
$validationErrors = [__($this->generalMessage)];
}
diff --git a/app/code/Magento/Quote/Model/ValidationRules/ShippingMethodValidationRule.php b/app/code/Magento/Quote/Model/ValidationRules/ShippingMethodValidationRule.php
index 6df7f663b0630..3ef079f5a019a 100644
--- a/app/code/Magento/Quote/Model/ValidationRules/ShippingMethodValidationRule.php
+++ b/app/code/Magento/Quote/Model/ValidationRules/ShippingMethodValidationRule.php
@@ -45,8 +45,10 @@ public function validate(Quote $quote): array
$validationErrors = [];
if (!$quote->isVirtual()) {
- $shippingMethod = $quote->getShippingAddress()->getShippingMethod();
- $shippingRate = $quote->getShippingAddress()->getShippingRateByCode($shippingMethod);
+ $shippingAddress = $quote->getShippingAddress();
+ $shippingAddress->setStoreId($quote->getStoreId());
+ $shippingMethod = $shippingAddress->getShippingMethod();
+ $shippingRate = $shippingAddress->getShippingRateByCode($shippingMethod);
$validationResult = $shippingMethod && $shippingRate;
if (!$validationResult) {
$validationErrors = [__($this->generalMessage)];
diff --git a/dev/tests/integration/testsuite/Magento/Quote/Model/QuoteValidatorTest.php b/dev/tests/integration/testsuite/Magento/Quote/Model/QuoteValidatorTest.php
index 1088d0f4fbeb0..14ecf3a7301e2 100644
--- a/dev/tests/integration/testsuite/Magento/Quote/Model/QuoteValidatorTest.php
+++ b/dev/tests/integration/testsuite/Magento/Quote/Model/QuoteValidatorTest.php
@@ -64,7 +64,7 @@ public function testValidateBeforeSubmitCountryIsNotAllowed()
)->setValue(
'general/country/allow',
'US',
- \Magento\Store\Model\ScopeInterface::SCOPE_WEBSITES
+ \Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
$quote = $this->objectManager->create(Quote::class);
$quote->load('quote123', 'reserved_order_id');
From e40b9c7396d98dd136883cda2112ef98f8fcfe7e Mon Sep 17 00:00:00 2001
From: vgelani
Date: Mon, 22 Oct 2018 18:23:19 +0530
Subject: [PATCH 24/75] Added tier price logic for special price
---
.../Model/Product/Attribute/Backend/Tierprice.php | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Tierprice.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Tierprice.php
index 92b9a2e4239b2..55b5c6c925b05 100644
--- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Tierprice.php
+++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Tierprice.php
@@ -159,8 +159,22 @@ protected function validatePrice(array $priceRow)
*/
protected function modifyPriceData($object, $data)
{
+ /** @var \Magento\Catalog\Model\Product $object */
$data = parent::modifyPriceData($object, $data);
$price = $object->getPrice();
+
+ $specialPrice = $object->getSpecialPrice();
+ $specialPriceFromDate = $object->getSpecialFromDate();
+ $specialPriceToDate = $object->getSpecialToDate();
+ $today = time();
+
+ if ($specialPrice && ($object->getPrice() > $object->getFinalPrice())){
+ if ($today >= strtotime($specialPriceFromDate) && $today <= strtotime($specialPriceToDate) ||
+ $today >= strtotime($specialPriceFromDate) && is_null($specialPriceToDate)) {
+ $price = $specialPrice;
+ }
+ }
+
foreach ($data as $key => $tierPrice) {
$percentageValue = $this->getPercentage($tierPrice);
if ($percentageValue) {
From 451b6baf59a14eb7284e8263905853215d6448cd Mon Sep 17 00:00:00 2001
From: Vishal Gelani
Date: Tue, 23 Oct 2018 08:19:55 +0530
Subject: [PATCH 25/75] Fixed code standard error
---
.../Catalog/Model/Product/Attribute/Backend/Tierprice.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Tierprice.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Tierprice.php
index 55b5c6c925b05..88d8198d0249e 100644
--- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Tierprice.php
+++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Tierprice.php
@@ -168,9 +168,9 @@ protected function modifyPriceData($object, $data)
$specialPriceToDate = $object->getSpecialToDate();
$today = time();
- if ($specialPrice && ($object->getPrice() > $object->getFinalPrice())){
+ if ($specialPrice && ($object->getPrice() > $object->getFinalPrice())) {
if ($today >= strtotime($specialPriceFromDate) && $today <= strtotime($specialPriceToDate) ||
- $today >= strtotime($specialPriceFromDate) && is_null($specialPriceToDate)) {
+ $today >= strtotime($specialPriceFromDate) && is_null($specialPriceToDate) === TRUE) {
$price = $specialPrice;
}
}
From edf09b3c171685ad9ea6419275838ee3a4f1a870 Mon Sep 17 00:00:00 2001
From: Vishal Gelani
Date: Tue, 23 Oct 2018 16:27:07 +0530
Subject: [PATCH 26/75] Update Tierprice.php
---
.../Catalog/Model/Product/Attribute/Backend/Tierprice.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Tierprice.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Tierprice.php
index 88d8198d0249e..b74be1372a3c0 100644
--- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Tierprice.php
+++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Tierprice.php
@@ -170,7 +170,7 @@ protected function modifyPriceData($object, $data)
if ($specialPrice && ($object->getPrice() > $object->getFinalPrice())) {
if ($today >= strtotime($specialPriceFromDate) && $today <= strtotime($specialPriceToDate) ||
- $today >= strtotime($specialPriceFromDate) && is_null($specialPriceToDate) === TRUE) {
+ $today >= strtotime($specialPriceFromDate) && is_null($specialPriceToDate)) {
$price = $specialPrice;
}
}
From 4209ac32efcba076283812ad92d8aac2b049ee9c Mon Sep 17 00:00:00 2001
From: "rostyslav.hymon"
Date: Wed, 24 Oct 2018 14:56:54 +0300
Subject: [PATCH 27/75] MAGETWO-94860: Moving Category generate duplicate
url_rewrite when 4th level category exist and is translated
---
.../Model/Category/Plugin/Category/Move.php | 60 +++++++++++++++++--
.../Model/CategoryUrlRewriteGenerator.php | 8 +++
.../Category/Plugin/Category/MoveTest.php | 33 +++++++---
3 files changed, 89 insertions(+), 12 deletions(-)
diff --git a/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Category/Move.php b/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Category/Move.php
index 17d12ba563ebd..f3984bf7d62ab 100644
--- a/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Category/Move.php
+++ b/app/code/Magento/CatalogUrlRewrite/Model/Category/Plugin/Category/Move.php
@@ -6,9 +6,14 @@
namespace Magento\CatalogUrlRewrite\Model\Category\Plugin\Category;
use Magento\Catalog\Model\Category;
+use Magento\Catalog\Model\CategoryFactory;
use Magento\CatalogUrlRewrite\Model\CategoryUrlPathGenerator;
use Magento\CatalogUrlRewrite\Model\Category\ChildrenCategoriesProvider;
+use Magento\Store\Model\Store;
+/**
+ * Perform url updating for children categories.
+ */
class Move
{
/**
@@ -21,16 +26,24 @@ class Move
*/
private $childrenCategoriesProvider;
+ /**
+ * @var CategoryFactory
+ */
+ private $categoryFactory;
+
/**
* @param CategoryUrlPathGenerator $categoryUrlPathGenerator
* @param ChildrenCategoriesProvider $childrenCategoriesProvider
+ * @param CategoryFactory $categoryFactory
*/
public function __construct(
CategoryUrlPathGenerator $categoryUrlPathGenerator,
- ChildrenCategoriesProvider $childrenCategoriesProvider
+ ChildrenCategoriesProvider $childrenCategoriesProvider,
+ CategoryFactory $categoryFactory
) {
$this->categoryUrlPathGenerator = $categoryUrlPathGenerator;
$this->childrenCategoriesProvider = $childrenCategoriesProvider;
+ $this->categoryFactory = $categoryFactory;
}
/**
@@ -51,20 +64,57 @@ public function afterChangeParent(
Category $newParent,
$afterCategoryId
) {
- $category->setUrlPath($this->categoryUrlPathGenerator->getUrlPath($category));
- $category->getResource()->saveAttribute($category, 'url_path');
- $this->updateUrlPathForChildren($category);
+ $categoryStoreId = $category->getStoreId();
+ foreach ($category->getStoreIds() as $storeId) {
+ $category->setStoreId($storeId);
+ if (!$this->isGlobalScope($storeId)) {
+ $this->updateCategoryUrlKeyForStore($category);
+ $category->unsUrlPath();
+ $category->setUrlPath($this->categoryUrlPathGenerator->getUrlPath($category));
+ $category->getResource()->saveAttribute($category, 'url_path');
+ $this->updateUrlPathForChildren($category);
+ }
+ }
+ $category->setStoreId($categoryStoreId);
return $result;
}
/**
+ * Set category url_key according to current category store id.
+ *
+ * @param Category $category
+ * @return void
+ */
+ private function updateCategoryUrlKeyForStore(Category $category)
+ {
+ $item = $this->categoryFactory->create();
+ $item->setStoreId($category->getStoreId());
+ $item->load($category->getId());
+ $category->setUrlKey($item->getUrlKey());
+ }
+
+ /**
+ * Check is global scope.
+ *
+ * @param int|null $storeId
+ * @return bool
+ */
+ private function isGlobalScope($storeId)
+ {
+ return null === $storeId || $storeId == Store::DEFAULT_STORE_ID;
+ }
+
+ /**
+ * Updates url_path for child categories.
+ *
* @param Category $category
* @return void
*/
- protected function updateUrlPathForChildren($category)
+ private function updateUrlPathForChildren($category)
{
foreach ($this->childrenCategoriesProvider->getChildren($category, true) as $childCategory) {
+ $childCategory->setStoreId($category->getStoreId());
$childCategory->unsUrlPath();
$childCategory->setUrlPath($this->categoryUrlPathGenerator->getUrlPath($childCategory));
$childCategory->getResource()->saveAttribute($childCategory, 'url_path');
diff --git a/app/code/Magento/CatalogUrlRewrite/Model/CategoryUrlRewriteGenerator.php b/app/code/Magento/CatalogUrlRewrite/Model/CategoryUrlRewriteGenerator.php
index b2da0ab39f31f..a86604672e2b4 100644
--- a/app/code/Magento/CatalogUrlRewrite/Model/CategoryUrlRewriteGenerator.php
+++ b/app/code/Magento/CatalogUrlRewrite/Model/CategoryUrlRewriteGenerator.php
@@ -15,6 +15,9 @@
use Magento\Framework\App\ObjectManager;
use Magento\UrlRewrite\Model\MergeDataProviderFactory;
+/**
+ * Generate list of urls.
+ */
class CategoryUrlRewriteGenerator
{
/** Entity type code */
@@ -84,6 +87,8 @@ public function __construct(
}
/**
+ * Generate list of urls.
+ *
* @param \Magento\Catalog\Model\Category $category
* @param bool $overrideStoreUrls
* @param int|null $rootCategoryId
@@ -119,6 +124,7 @@ protected function generateForGlobalScope(
$mergeDataProvider = clone $this->mergeDataProviderPrototype;
$categoryId = $category->getId();
foreach ($category->getStoreIds() as $storeId) {
+ $category->setStoreId($storeId);
if (!$this->isGlobalScope($storeId)
&& $this->isOverrideUrlsForStore($storeId, $categoryId, $overrideStoreUrls)
) {
@@ -131,6 +137,8 @@ protected function generateForGlobalScope(
}
/**
+ * Checks if urls should be overridden for store.
+ *
* @param int $storeId
* @param int $categoryId
* @param bool $overrideStoreUrls
diff --git a/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/Category/Plugin/Category/MoveTest.php b/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/Category/Plugin/Category/MoveTest.php
index f91a55c11b974..85e8837027151 100644
--- a/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/Category/Plugin/Category/MoveTest.php
+++ b/app/code/Magento/CatalogUrlRewrite/Test/Unit/Model/Category/Plugin/Category/MoveTest.php
@@ -5,6 +5,7 @@
*/
namespace Magento\CatalogUrlRewrite\Test\Unit\Model\Category\Plugin\Category;
+use Magento\Catalog\Model\CategoryFactory;
use Magento\CatalogUrlRewrite\Model\Category\Plugin\Category\Move as CategoryMovePlugin;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
use Magento\CatalogUrlRewrite\Model\CategoryUrlPathGenerator;
@@ -39,6 +40,11 @@ class MoveTest extends \PHPUnit\Framework\TestCase
*/
private $categoryMock;
+ /**
+ * @var CategoryFactory|\PHPUnit_Framework_MockObject_MockObject
+ */
+ private $categoryFactory;
+
/**
* @var CategoryMovePlugin
*/
@@ -55,28 +61,44 @@ protected function setUp()
->disableOriginalConstructor()
->setMethods(['getChildren'])
->getMock();
+ $this->categoryFactory = $this->getMockBuilder(CategoryFactory::class)
+ ->disableOriginalConstructor()
+ ->getMock();
$this->subjectMock = $this->getMockBuilder(CategoryResourceModel::class)
->disableOriginalConstructor()
->getMock();
$this->categoryMock = $this->getMockBuilder(Category::class)
->disableOriginalConstructor()
- ->setMethods(['getResource', 'setUrlPath'])
+ ->setMethods(['getResource', 'setUrlPath', 'getStoreIds', 'getStoreId', 'setStoreId'])
->getMock();
$this->plugin = $this->objectManager->getObject(
CategoryMovePlugin::class,
[
'categoryUrlPathGenerator' => $this->categoryUrlPathGeneratorMock,
- 'childrenCategoriesProvider' => $this->childrenCategoriesProviderMock
+ 'childrenCategoriesProvider' => $this->childrenCategoriesProviderMock,
+ 'categoryFactory' => $this->categoryFactory
]
);
}
+ /**
+ * Tests url updating for children categories.
+ */
public function testAfterChangeParent()
{
$urlPath = 'test/path';
- $this->categoryMock->expects($this->once())
- ->method('getResource')
+ $storeIds = [1];
+ $originalCategory = $this->getMockBuilder(Category::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->categoryFactory->method('create')
+ ->willReturn($originalCategory);
+
+ $this->categoryMock->method('getResource')
->willReturn($this->subjectMock);
+ $this->categoryMock->expects($this->once())
+ ->method('getStoreIds')
+ ->willReturn($storeIds);
$this->childrenCategoriesProviderMock->expects($this->once())
->method('getChildren')
->with($this->categoryMock, true)
@@ -85,9 +107,6 @@ public function testAfterChangeParent()
->method('getUrlPath')
->with($this->categoryMock)
->willReturn($urlPath);
- $this->categoryMock->expects($this->once())
- ->method('getResource')
- ->willReturn($this->subjectMock);
$this->categoryMock->expects($this->once())
->method('setUrlPath')
->with($urlPath);
From 18ca5f033382e5ba547faa8700eaabe0e4ce3822 Mon Sep 17 00:00:00 2001
From: Riccardo Tempesta
Date: Wed, 24 Oct 2018 15:46:22 +0200
Subject: [PATCH 28/75] Rework without method's contract modification for BW
compatibility
---
app/code/Magento/Sales/Model/Order.php | 3 +-
app/code/Magento/Sales/Model/Order/Config.php | 31 ++++++++++++++++---
2 files changed, 27 insertions(+), 7 deletions(-)
diff --git a/app/code/Magento/Sales/Model/Order.php b/app/code/Magento/Sales/Model/Order.php
index 93909b5815616..0ccee16ce910b 100644
--- a/app/code/Magento/Sales/Model/Order.php
+++ b/app/code/Magento/Sales/Model/Order.php
@@ -982,11 +982,10 @@ public function setState($state)
* Retrieve frontend label of order status
*
* @return string
- * @throws LocalizedException
*/
public function getFrontendStatusLabel()
{
- return $this->getConfig()->getStatusLabel($this->getStatus(), \Magento\Framework\App\Area::AREA_FRONTEND);
+ return $this->getConfig()->getStatusFrontendLabel($this->getStatus());
}
/**
diff --git a/app/code/Magento/Sales/Model/Order/Config.php b/app/code/Magento/Sales/Model/Order/Config.php
index c0c374b05226b..6aab7b912d936 100644
--- a/app/code/Magento/Sales/Model/Order/Config.php
+++ b/app/code/Magento/Sales/Model/Order/Config.php
@@ -117,16 +117,14 @@ public function getStateDefaultStatus($state)
}
/**
- * Retrieve status label
+ * Get status label for a specified area
*
* @param string $code
- * @param string|null $forceArea
+ * @param string $area
* @return string
- * @throws LocalizedException
*/
- public function getStatusLabel($code, $forceArea = null)
+ private function getStatusLabelForArea(string $code, string $area): string
{
- $area = $forceArea ?: $this->state->getAreaCode();
$code = $this->maskStatusForArea($area, $code);
$status = $this->orderStatusFactory->create()->load($code);
@@ -137,6 +135,29 @@ public function getStatusLabel($code, $forceArea = null)
return $status->getStoreLabel();
}
+ /**
+ * Retrieve status label for detected area
+ *
+ * @param string $code
+ * @return string
+ * @throws LocalizedException
+ */
+ public function getStatusLabel($code)
+ {
+ return $this->getStatusLabelForArea($code, $this->state->getAreaCode());
+ }
+
+ /**
+ * Retrieve status label for area
+ *
+ * @param string $code
+ * @return string
+ */
+ public function getStatusFrontendLabel(string $code): string
+ {
+ return $this->getStatusLabelForArea($code, \Magento\Framework\App\Area::AREA_FRONTEND);
+ }
+
/**
* Mask status for order for specified area
*
From bd80b1ad6b9d68b9b1fb8a2855ac796ad87cd498 Mon Sep 17 00:00:00 2001
From: Riccardo Tempesta
Date: Wed, 24 Oct 2018 15:48:25 +0200
Subject: [PATCH 29/75] Missing strict compare in new method
---
app/code/Magento/Sales/Model/Order/Config.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/code/Magento/Sales/Model/Order/Config.php b/app/code/Magento/Sales/Model/Order/Config.php
index 6aab7b912d936..51e314bd297ef 100644
--- a/app/code/Magento/Sales/Model/Order/Config.php
+++ b/app/code/Magento/Sales/Model/Order/Config.php
@@ -128,7 +128,7 @@ private function getStatusLabelForArea(string $code, string $area): string
$code = $this->maskStatusForArea($area, $code);
$status = $this->orderStatusFactory->create()->load($code);
- if ($area == 'adminhtml') {
+ if ($area === 'adminhtml') {
return $status->getLabel();
}
From 2e634e43bda15e01140c46989f2ecea807aa9f9a Mon Sep 17 00:00:00 2001
From: Riccardo Tempesta
Date: Thu, 25 Oct 2018 09:54:23 +0200
Subject: [PATCH 30/75] Missing fallback on AREA_FRONTEND when area is not set
---
app/code/Magento/Sales/Model/Order/Config.php | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/app/code/Magento/Sales/Model/Order/Config.php b/app/code/Magento/Sales/Model/Order/Config.php
index 51e314bd297ef..8999fca174de9 100644
--- a/app/code/Magento/Sales/Model/Order/Config.php
+++ b/app/code/Magento/Sales/Model/Order/Config.php
@@ -144,7 +144,8 @@ private function getStatusLabelForArea(string $code, string $area): string
*/
public function getStatusLabel($code)
{
- return $this->getStatusLabelForArea($code, $this->state->getAreaCode());
+ $area = $this->state->getAreaCode() ?: \Magento\Framework\App\Area::AREA_FRONTEND;
+ return $this->getStatusLabelForArea($code, $area);
}
/**
From f0d6a81955c7d7992efc04985ca579974db169f7 Mon Sep 17 00:00:00 2001
From: "rostyslav.hymon"
Date: Thu, 25 Oct 2018 13:20:46 +0300
Subject: [PATCH 31/75] MAGETWO-93947: Recently viewed block shows the product
which is currenly open
---
.../view/frontend/web/js/product/provider.js | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/app/code/Magento/Catalog/view/frontend/web/js/product/provider.js b/app/code/Magento/Catalog/view/frontend/web/js/product/provider.js
index c53b2fa6e2a7a..b29ebe7d57d1c 100644
--- a/app/code/Magento/Catalog/view/frontend/web/js/product/provider.js
+++ b/app/code/Magento/Catalog/view/frontend/web/js/product/provider.js
@@ -5,11 +5,13 @@
define([
'underscore',
+ 'jquery',
'mageUtils',
'uiElement',
'Magento_Catalog/js/product/storage/storage-service',
- 'Magento_Customer/js/customer-data'
-], function (_, utils, Element, storage, customerData) {
+ 'Magento_Customer/js/customer-data',
+ 'Magento_Catalog/js/product/view/product-ids-resolver'
+], function (_, $, utils, Element, storage, customerData, productResolver) {
'use strict';
return Element.extend({
@@ -135,11 +137,16 @@ define([
*/
filterIds: function (ids) {
var _ids = {},
- currentTime = new Date().getTime() / 1000;
+ currentTime = new Date().getTime() / 1000,
+ currentProductIds = productResolver($('#product_addtocart_form'));
_.each(ids, function (id) {
- if (currentTime - id['added_at'] < ~~this.idsStorage.lifetime) {
+ if (
+ currentTime - id['added_at'] < ~~this.idsStorage.lifetime &&
+ !_.contains(currentProductIds, id['product_id'])
+ ) {
_ids[id['product_id']] = id;
+
}
}, this);
From 102196bfd0069189da530d6bde43862c16732f4f Mon Sep 17 00:00:00 2001
From: Serhiy Yelahin
Date: Thu, 25 Oct 2018 16:25:23 +0300
Subject: [PATCH 32/75] MAGETWO-93988: Product Review "Save and Next" and "Save
and Previous" not working
---
.../Review/Product/Collection.php | 21 +++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/app/code/Magento/Review/Model/ResourceModel/Review/Product/Collection.php b/app/code/Magento/Review/Model/ResourceModel/Review/Product/Collection.php
index 99c963501a9d4..4e55484e5dd94 100644
--- a/app/code/Magento/Review/Model/ResourceModel/Review/Product/Collection.php
+++ b/app/code/Magento/Review/Model/ResourceModel/Review/Product/Collection.php
@@ -3,6 +3,7 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
+
namespace Magento\Review\Model\ResourceModel\Review\Product;
use Magento\Eav\Model\Entity\Attribute\AbstractAttribute;
@@ -403,12 +404,20 @@ public function getAllIds($limit = null, $offset = null)
public function getResultingIds()
{
$idsSelect = clone $this->getSelect();
- $idsSelect->reset(Select::LIMIT_COUNT);
- $idsSelect->reset(Select::LIMIT_OFFSET);
- $idsSelect->reset(Select::COLUMNS);
- $idsSelect->reset(Select::ORDER);
- $idsSelect->columns('rt.review_id');
- return $this->getConnection()->fetchCol($idsSelect);
+ $data = $this->getConnection()
+ ->fetchAll(
+ $idsSelect
+ ->reset(Select::LIMIT_COUNT)
+ ->reset(Select::LIMIT_OFFSET)
+ ->columns('rt.review_id')
+ );
+
+ return array_map(
+ function ($value) {
+ return $value['review_id'];
+ },
+ $data
+ );
}
/**
From bf700aa60fe7a958ef5fe828f3de931e799af2fc Mon Sep 17 00:00:00 2001
From: Mahesh Singh
Date: Fri, 26 Oct 2018 01:54:57 +0530
Subject: [PATCH 33/75] Issue #18150 fixed for 2.2.6
---
app/code/Magento/Backup/Controller/Adminhtml/Index.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/code/Magento/Backup/Controller/Adminhtml/Index.php b/app/code/Magento/Backup/Controller/Adminhtml/Index.php
index dcafbc7370d2d..142211fe90a44 100644
--- a/app/code/Magento/Backup/Controller/Adminhtml/Index.php
+++ b/app/code/Magento/Backup/Controller/Adminhtml/Index.php
@@ -19,7 +19,7 @@ abstract class Index extends \Magento\Backend\App\Action
*
* @see _isAllowed()
*/
- const ADMIN_RESOURCE = 'Magento_Backend::backup';
+ const ADMIN_RESOURCE = 'Magento_Backup::backup';
/**
* Core registry
From d43759cb99c704e0e16635dffc6452cccefcbe5e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Samuel=20Ca=C3=A7ador?=
<20863811+samuel27m@users.noreply.github.com>
Date: Thu, 25 Oct 2018 23:37:05 +0100
Subject: [PATCH 34/75] Backport [PR 18772] Remove unnecesary "header" block
redeclaration
Backport [PR 18772] Remove unnecesary header block redeclaration on Magento Luma Theme, which made impossible to set the header template through custom modules.
---
.../Magento/luma/Magento_Customer/layout/default.xml | 5 -----
1 file changed, 5 deletions(-)
diff --git a/app/design/frontend/Magento/luma/Magento_Customer/layout/default.xml b/app/design/frontend/Magento/luma/Magento_Customer/layout/default.xml
index 1f8c162ef923a..4b08bf28ece9f 100644
--- a/app/design/frontend/Magento/luma/Magento_Customer/layout/default.xml
+++ b/app/design/frontend/Magento/luma/Magento_Customer/layout/default.xml
@@ -15,11 +15,6 @@
-
From 5b0bab59bcb071295b934970a82fea57c074fbdc Mon Sep 17 00:00:00 2001
From: Serhiy Yelahin
Date: Fri, 26 Oct 2018 12:14:40 +0300
Subject: [PATCH 35/75] MAGETWO-93780: CAPTCHA does not appear in "Log in"
popup window
---
.../Model/Customer/Plugin/AjaxLogin.php | 30 +-
.../Model/Customer/Plugin/AjaxLoginTest.php | 2 +-
app/code/Magento/Captcha/etc/di.xml | 2 +-
.../view/frontend/web/js/model/captcha.js | 8 +-
.../web/js/view/checkout/defaultCaptcha.js | 7 +
.../web/js/view/checkout/loginCaptcha.js | 66 ++--
.../web/template/checkout/captcha.html | 6 +-
.../Customer/Controller/Ajax/Login.php | 21 +-
.../Test/Unit/Controller/Ajax/LoginTest.php | 326 ++++++++++--------
.../view/frontend/web/js/action/login.js | 4 +-
.../web/js/view/authentication-popup.js | 1 -
11 files changed, 260 insertions(+), 213 deletions(-)
diff --git a/app/code/Magento/Captcha/Model/Customer/Plugin/AjaxLogin.php b/app/code/Magento/Captcha/Model/Customer/Plugin/AjaxLogin.php
index 91f3a785df36b..cc1eb42b9a9c7 100644
--- a/app/code/Magento/Captcha/Model/Customer/Plugin/AjaxLogin.php
+++ b/app/code/Magento/Captcha/Model/Customer/Plugin/AjaxLogin.php
@@ -7,9 +7,14 @@
namespace Magento\Captcha\Model\Customer\Plugin;
use Magento\Captcha\Helper\Data as CaptchaHelper;
-use Magento\Framework\Session\SessionManagerInterface;
+use Magento\Customer\Controller\Ajax\Login;
+use Magento\Framework\Controller\Result\Json;
use Magento\Framework\Controller\Result\JsonFactory;
+use Magento\Framework\Session\SessionManagerInterface;
+/**
+ * The plugin for ajax login controller.
+ */
class AjaxLogin
{
/**
@@ -61,14 +66,14 @@ public function __construct(
}
/**
- * @param \Magento\Customer\Controller\Ajax\Login $subject
+ * Validates captcha during request execution.
+ *
+ * @param Login $subject
* @param \Closure $proceed
* @return $this
- * @SuppressWarnings(PHPMD.NPathComplexity)
- * @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
public function aroundExecute(
- \Magento\Customer\Controller\Ajax\Login $subject,
+ Login $subject,
\Closure $proceed
) {
$captchaFormIdField = 'captcha_form_id';
@@ -93,26 +98,31 @@ public function aroundExecute(
foreach ($this->formIds as $formId) {
if ($formId === $loginFormId) {
$captchaModel = $this->helper->getCaptcha($formId);
+
if ($captchaModel->isRequired($username)) {
- $captchaModel->logAttempt($username);
if (!$captchaModel->isCorrect($captchaString)) {
$this->sessionManager->setUsername($username);
- return $this->returnJsonError(__('Incorrect CAPTCHA'));
+ $captchaModel->logAttempt($username);
+ return $this->returnJsonError(__('Incorrect CAPTCHA'), true);
}
}
+
+ $captchaModel->logAttempt($username);
}
}
return $proceed();
}
/**
+ * Gets Json response.
*
* @param \Magento\Framework\Phrase $phrase
- * @return \Magento\Framework\Controller\Result\Json
+ * @param bool $isCaptchaRequired
+ * @return Json
*/
- private function returnJsonError(\Magento\Framework\Phrase $phrase): \Magento\Framework\Controller\Result\Json
+ private function returnJsonError(\Magento\Framework\Phrase $phrase, bool $isCaptchaRequired = false): Json
{
$resultJson = $this->resultJsonFactory->create();
- return $resultJson->setData(['errors' => true, 'message' => $phrase]);
+ return $resultJson->setData(['errors' => true, 'message' => $phrase, 'captcha' => $isCaptchaRequired]);
}
}
diff --git a/app/code/Magento/Captcha/Test/Unit/Model/Customer/Plugin/AjaxLoginTest.php b/app/code/Magento/Captcha/Test/Unit/Model/Customer/Plugin/AjaxLoginTest.php
index bda0d9705d3df..315bc9afb5431 100644
--- a/app/code/Magento/Captcha/Test/Unit/Model/Customer/Plugin/AjaxLoginTest.php
+++ b/app/code/Magento/Captcha/Test/Unit/Model/Customer/Plugin/AjaxLoginTest.php
@@ -149,7 +149,7 @@ public function testAroundExecuteIncorrectCaptcha()
$this->resultJsonMock
->expects($this->once())
->method('setData')
- ->with(['errors' => true, 'message' => __('Incorrect CAPTCHA')])
+ ->with(['errors' => true, 'message' => __('Incorrect CAPTCHA'), 'captcha' => true])
->will($this->returnSelf());
$closure = function () {
diff --git a/app/code/Magento/Captcha/etc/di.xml b/app/code/Magento/Captcha/etc/di.xml
index 3a929f5e6cc00..83c4e8aa1e2c1 100644
--- a/app/code/Magento/Captcha/etc/di.xml
+++ b/app/code/Magento/Captcha/etc/di.xml
@@ -27,7 +27,7 @@
-
+
diff --git a/app/code/Magento/Captcha/view/frontend/web/js/model/captcha.js b/app/code/Magento/Captcha/view/frontend/web/js/model/captcha.js
index 3a235df73a916..52968e507e6bf 100644
--- a/app/code/Magento/Captcha/view/frontend/web/js/model/captcha.js
+++ b/app/code/Magento/Captcha/view/frontend/web/js/model/captcha.js
@@ -17,7 +17,7 @@ define([
imageSource: ko.observable(captchaData.imageSrc),
visibility: ko.observable(false),
captchaValue: ko.observable(null),
- isRequired: captchaData.isRequired,
+ isRequired: ko.observable(captchaData.isRequired),
isCaseSensitive: captchaData.isCaseSensitive,
imageHeight: captchaData.imageHeight,
refreshUrl: captchaData.refreshUrl,
@@ -41,7 +41,7 @@ define([
* @return {Boolean}
*/
getIsVisible: function () {
- return this.visibility;
+ return this.visibility();
},
/**
@@ -55,14 +55,14 @@ define([
* @return {Boolean}
*/
getIsRequired: function () {
- return this.isRequired;
+ return this.isRequired();
},
/**
* @param {Boolean} flag
*/
setIsRequired: function (flag) {
- this.isRequired = flag;
+ this.isRequired(flag);
},
/**
diff --git a/app/code/Magento/Captcha/view/frontend/web/js/view/checkout/defaultCaptcha.js b/app/code/Magento/Captcha/view/frontend/web/js/view/checkout/defaultCaptcha.js
index f80b2ab163ffd..f78b848312702 100644
--- a/app/code/Magento/Captcha/view/frontend/web/js/view/checkout/defaultCaptcha.js
+++ b/app/code/Magento/Captcha/view/frontend/web/js/view/checkout/defaultCaptcha.js
@@ -89,6 +89,13 @@ define([
return this.currentCaptcha !== null ? this.currentCaptcha.getIsRequired() : false;
},
+ /**
+ * @param {Boolean} flag
+ */
+ setIsRequired: function (flag) {
+ this.currentCaptcha.setIsRequired(flag);
+ },
+
/**
* @return {Boolean}
*/
diff --git a/app/code/Magento/Captcha/view/frontend/web/js/view/checkout/loginCaptcha.js b/app/code/Magento/Captcha/view/frontend/web/js/view/checkout/loginCaptcha.js
index 7709febea60a3..a8efd0865bbb8 100644
--- a/app/code/Magento/Captcha/view/frontend/web/js/view/checkout/loginCaptcha.js
+++ b/app/code/Magento/Captcha/view/frontend/web/js/view/checkout/loginCaptcha.js
@@ -4,34 +4,44 @@
*/
define([
- 'Magento_Captcha/js/view/checkout/defaultCaptcha',
- 'Magento_Captcha/js/model/captchaList',
- 'Magento_Customer/js/action/login'
-],
-function (defaultCaptcha, captchaList, loginAction) {
- 'use strict';
-
- return defaultCaptcha.extend({
- /** @inheritdoc */
- initialize: function () {
- var self = this,
- currentCaptcha;
-
- this._super();
- currentCaptcha = captchaList.getCaptchaByFormId(this.formId);
-
- if (currentCaptcha != null) {
- currentCaptcha.setIsVisible(true);
- this.setCurrentCaptcha(currentCaptcha);
-
- loginAction.registerLoginCallback(function (loginData) {
- if (loginData['captcha_form_id'] &&
- loginData['captcha_form_id'] == self.formId //eslint-disable-line eqeqeq
- ) {
+ 'underscore',
+ 'Magento_Captcha/js/view/checkout/defaultCaptcha',
+ 'Magento_Captcha/js/model/captchaList',
+ 'Magento_Customer/js/action/login'
+ ],
+ function (_, defaultCaptcha, captchaList, loginAction) {
+ 'use strict';
+
+ return defaultCaptcha.extend({
+ /** @inheritdoc */
+ initialize: function () {
+ var self = this,
+ currentCaptcha;
+
+ this._super();
+ currentCaptcha = captchaList.getCaptchaByFormId(this.formId);
+
+ if (currentCaptcha != null) {
+ currentCaptcha.setIsVisible(true);
+ this.setCurrentCaptcha(currentCaptcha);
+
+ loginAction.registerLoginCallback(function (loginData, response) {
+ if (!loginData['captcha_form_id'] || loginData['captcha_form_id'] !== self.formId) {
+ return;
+ }
+
+ if (_.isUndefined(response) || !response.errors) {
+ return;
+ }
+
+ // check if captcha should be required after login attempt
+ if (!self.isRequired() && response.captcha && self.isRequired() !== response.captcha) {
+ self.setIsRequired(response.captcha);
+ }
+
self.refresh();
- }
- });
+ });
+ }
}
- }
+ });
});
-});
diff --git a/app/code/Magento/Captcha/view/frontend/web/template/checkout/captcha.html b/app/code/Magento/Captcha/view/frontend/web/template/checkout/captcha.html
index 575b3ca6f732e..8923c81bf4bb3 100644
--- a/app/code/Magento/Captcha/view/frontend/web/template/checkout/captcha.html
+++ b/app/code/Magento/Captcha/view/frontend/web/template/checkout/captcha.html
@@ -4,12 +4,14 @@
* See COPYING.txt for license details.
*/
-->
+
+
+
-
-
+
diff --git a/app/code/Magento/Customer/Controller/Ajax/Login.php b/app/code/Magento/Customer/Controller/Ajax/Login.php
index 8664e0cbf87ea..ab4e411243d28 100644
--- a/app/code/Magento/Customer/Controller/Ajax/Login.php
+++ b/app/code/Magento/Customer/Controller/Ajax/Login.php
@@ -108,7 +108,6 @@ public function __construct(
/**
* Get account redirect.
- * For release backward compatibility.
*
* @deprecated 100.0.10
* @return AccountRedirect
@@ -134,6 +133,8 @@ public function setAccountRedirect($value)
}
/**
+ * Initializes config dependency.
+ *
* @deprecated 100.0.10
* @return ScopeConfigInterface
*/
@@ -146,6 +147,8 @@ protected function getScopeConfig()
}
/**
+ * Sets config dependency.
+ *
* @deprecated 100.0.10
* @param ScopeConfigInterface $value
* @return void
@@ -200,25 +203,17 @@ public function execute()
$response['redirectUrl'] = $this->_redirect->success($redirectRoute);
$this->getAccountRedirect()->clearRedirectCookie();
}
- } catch (EmailNotConfirmedException $e) {
- $response = [
- 'errors' => true,
- 'message' => $e->getMessage()
- ];
- } catch (InvalidEmailOrPasswordException $e) {
- $response = [
- 'errors' => true,
- 'message' => $e->getMessage()
- ];
} catch (LocalizedException $e) {
$response = [
'errors' => true,
- 'message' => $e->getMessage()
+ 'message' => $e->getMessage(),
+ 'captcha' => $this->customerSession->getData('user_login_show_captcha')
];
} catch (\Exception $e) {
$response = [
'errors' => true,
- 'message' => __('Invalid login or password.')
+ 'message' => __('Invalid login or password.'),
+ 'captcha' => $this->customerSession->getData('user_login_show_captcha')
];
}
/** @var \Magento\Framework\Controller\Result\Json $resultJson */
diff --git a/app/code/Magento/Customer/Test/Unit/Controller/Ajax/LoginTest.php b/app/code/Magento/Customer/Test/Unit/Controller/Ajax/LoginTest.php
index 2fca6c99be319..c0ef4e342559c 100644
--- a/app/code/Magento/Customer/Test/Unit/Controller/Ajax/LoginTest.php
+++ b/app/code/Magento/Customer/Test/Unit/Controller/Ajax/LoginTest.php
@@ -6,12 +6,30 @@
// @codingStandardsIgnoreFile
-/**
- * Test customer ajax login controller
- */
namespace Magento\Customer\Test\Unit\Controller\Ajax;
+use Magento\Customer\Api\Data\CustomerInterface;
+use Magento\Customer\Controller\Ajax\Login;
+use Magento\Customer\Model\Account\Redirect;
+use Magento\Customer\Model\AccountManagement;
+use Magento\Customer\Model\Session;
+use Magento\Framework\App\Action\Context;
+use Magento\Framework\App\Config\ScopeConfigInterface;
+use Magento\Framework\App\Request\Http;
+use Magento\Framework\App\Response\RedirectInterface;
+use Magento\Framework\App\ResponseInterface;
+use Magento\Framework\Controller\Result\Json;
+use Magento\Framework\Controller\Result\JsonFactory;
+use Magento\Framework\Controller\Result\Raw;
+use Magento\Framework\Controller\Result\RawFactory;
use Magento\Framework\Exception\InvalidEmailOrPasswordException;
+use Magento\Framework\Json\Helper\Data;
+use Magento\Framework\ObjectManager\ObjectManager as FakeObjectManager;
+use Magento\Framework\Stdlib\Cookie\CookieMetadata;
+use Magento\Framework\Stdlib\Cookie\CookieMetadataFactory;
+use Magento\Framework\Stdlib\CookieManagerInterface;
+use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
+use PHPUnit_Framework_MockObject_MockObject as MockObject;
/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -19,217 +37,187 @@
class LoginTest extends \PHPUnit\Framework\TestCase
{
/**
- * @var \Magento\Customer\Controller\Ajax\Login
+ * @var Login
*/
- protected $object;
+ private $controller;
/**
- * @var \Magento\Framework\App\Request\Http|\PHPUnit_Framework_MockObject_MockObject
+ * @var Http|MockObject
*/
- protected $request;
+ private $request;
/**
- * @var \Magento\Framework\App\ResponseInterface|\PHPUnit_Framework_MockObject_MockObject
+ * @var ResponseInterface|MockObject
*/
- protected $response;
+ private $response;
/**
- * @var \Magento\Customer\Model\Session|\PHPUnit_Framework_MockObject_MockObject
+ * @var Session|MockObject
*/
- protected $customerSession;
+ private $customerSession;
/**
- * @var \Magento\Framework\ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject
+ * @var FakeObjectManager|MockObject
*/
- protected $objectManager;
+ private $objectManager;
/**
- * @var \Magento\Customer\Api\AccountManagementInterface|\PHPUnit_Framework_MockObject_MockObject
+ * @var AccountManagement|MockObject
*/
- protected $customerAccountManagementMock;
+ private $accountManagement;
/**
- * @var \Magento\Framework\Json\Helper\Data|\PHPUnit_Framework_MockObject_MockObject
+ * @var Data|MockObject
*/
- protected $jsonHelperMock;
+ private $jsonHelper;
/**
- * @var \Magento\Framework\Controller\Result\Json|\PHPUnit_Framework_MockObject_MockObject
+ * @var Json|MockObject
*/
- protected $resultJson;
+ private $resultJson;
/**
- * @var \Magento\Framework\Controller\Result\JsonFactory| \PHPUnit_Framework_MockObject_MockObject
+ * @var JsonFactory|MockObject
*/
- protected $resultJsonFactory;
+ private $resultJsonFactory;
/**
- * @var \Magento\Framework\Controller\Result\Raw| \PHPUnit_Framework_MockObject_MockObject
+ * @var Raw|MockObject
*/
- protected $resultRaw;
+ private $resultRaw;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var RedirectInterface|MockObject
*/
- protected $redirectMock;
+ private $redirect;
/**
- * @var \Magento\Framework\Stdlib\CookieManagerInterface| \PHPUnit_Framework_MockObject_MockObject
+ * @var CookieManagerInterface|MockObject
*/
private $cookieManager;
/**
- * @var \Magento\Framework\Stdlib\Cookie\CookieMetadataFactory| \PHPUnit_Framework_MockObject_MockObject
+ * @var CookieMetadataFactory|MockObject
*/
private $cookieMetadataFactory;
/**
- * @var \Magento\Framework\Stdlib\Cookie\CookieMetadata| \PHPUnit_Framework_MockObject_MockObject
+ * @inheritdoc
*/
- private $cookieMetadata;
-
protected function setUp()
{
- $this->request = $this->getMockBuilder(\Magento\Framework\App\Request\Http::class)
- ->disableOriginalConstructor()->getMock();
- $this->response = $this->createPartialMock(\Magento\Framework\App\ResponseInterface::class, ['setRedirect', 'sendResponse', 'representJson', 'setHttpResponseCode']);
- $this->customerSession = $this->createPartialMock(\Magento\Customer\Model\Session::class, [
+ $this->request = $this->getMockBuilder(Http::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->response = $this->createPartialMock(ResponseInterface::class, ['setRedirect', 'sendResponse', 'representJson', 'setHttpResponseCode']);
+ $this->customerSession = $this->createPartialMock(Session::class, [
'isLoggedIn',
'getLastCustomerId',
'getBeforeAuthUrl',
'setBeforeAuthUrl',
'setCustomerDataAsLoggedIn',
- 'regenerateId'
+ 'regenerateId',
+ 'getData'
]);
- $this->objectManager = $this->createPartialMock(\Magento\Framework\ObjectManager\ObjectManager::class, ['get']);
- $this->customerAccountManagementMock =
- $this->createPartialMock(\Magento\Customer\Model\AccountManagement::class, ['authenticate']);
+ $this->objectManager = $this->createPartialMock(FakeObjectManager::class, ['get']);
+ $this->accountManagement = $this->createPartialMock(AccountManagement::class, ['authenticate']);
- $this->jsonHelperMock = $this->createPartialMock(\Magento\Framework\Json\Helper\Data::class, ['jsonDecode']);
+ $this->jsonHelper = $this->createPartialMock(Data::class, ['jsonDecode']);
- $this->resultJson = $this->getMockBuilder(\Magento\Framework\Controller\Result\Json::class)
+ $this->resultJson = $this->getMockBuilder(Json::class)
->disableOriginalConstructor()
->getMock();
- $this->resultJsonFactory = $this->getMockBuilder(\Magento\Framework\Controller\Result\JsonFactory::class)
+ $this->resultJsonFactory = $this->getMockBuilder(JsonFactory::class)
->disableOriginalConstructor()
->setMethods(['create'])
->getMock();
- $this->cookieManager = $this->getMockBuilder(\Magento\Framework\Stdlib\CookieManagerInterface::class)
+ $this->cookieManager = $this->getMockBuilder(CookieManagerInterface::class)
->setMethods(['getCookie', 'deleteCookie'])
->getMockForAbstractClass();
- $this->cookieMetadataFactory = $this->getMockBuilder(\Magento\Framework\Stdlib\Cookie\CookieMetadataFactory::class)
+ $this->cookieMetadataFactory = $this->getMockBuilder(CookieMetadataFactory::class)
->disableOriginalConstructor()
->getMock();
- $this->cookieMetadata = $this->getMockBuilder(\Magento\Framework\Stdlib\Cookie\CookieMetadata::class)
+ $this->cookieMetadata = $this->getMockBuilder(CookieMetadata::class)
->disableOriginalConstructor()
->getMock();
- $this->resultRaw = $this->getMockBuilder(\Magento\Framework\Controller\Result\Raw::class)
+ $this->resultRaw = $this->getMockBuilder(Raw::class)
->disableOriginalConstructor()
->getMock();
- $resultRawFactory = $this->getMockBuilder(\Magento\Framework\Controller\Result\RawFactory::class)
+ $resultRawFactory = $this->getMockBuilder(RawFactory::class)
->disableOriginalConstructor()
->setMethods(['create'])
->getMock();
- $resultRawFactory->expects($this->atLeastOnce())
- ->method('create')
+ $resultRawFactory->method('create')
->willReturn($this->resultRaw);
- $contextMock = $this->createMock(\Magento\Framework\App\Action\Context::class);
- $this->redirectMock = $this->createMock(\Magento\Framework\App\Response\RedirectInterface::class);
- $contextMock->expects($this->atLeastOnce())->method('getRedirect')->willReturn($this->redirectMock);
- $contextMock->expects($this->atLeastOnce())->method('getRequest')->willReturn($this->request);
-
- $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
- $this->object = $objectManager->getObject(
- \Magento\Customer\Controller\Ajax\Login::class,
+ /** @var Context|MockObject $context */
+ $context = $this->createMock(Context::class);
+ $this->redirect = $this->createMock(RedirectInterface::class);
+ $context->method('getRedirect')
+ ->willReturn($this->redirect);
+ $context->method('getRequest')
+ ->willReturn($this->request);
+
+ $objectManager = new ObjectManager($this);
+ $this->controller = $objectManager->getObject(
+ Login::class,
[
- 'context' => $contextMock,
+ 'context' => $context,
'customerSession' => $this->customerSession,
- 'helper' => $this->jsonHelperMock,
+ 'helper' => $this->jsonHelper,
'response' => $this->response,
'resultRawFactory' => $resultRawFactory,
'resultJsonFactory' => $this->resultJsonFactory,
'objectManager' => $this->objectManager,
- 'customerAccountManagement' => $this->customerAccountManagementMock,
+ 'customerAccountManagement' => $this->accountManagement,
'cookieManager' => $this->cookieManager,
'cookieMetadataFactory' => $this->cookieMetadataFactory
]
);
}
+ /**
+ * Checks successful login.
+ */
public function testLogin()
{
$jsonRequest = '{"username":"customer@example.com", "password":"password"}';
$loginSuccessResponse = '{"errors": false, "message":"Login successful."}';
+ $this->withRequest($jsonRequest);
- $this->request
- ->expects($this->any())
- ->method('getContent')
- ->willReturn($jsonRequest);
-
- $this->request
- ->expects($this->any())
- ->method('getMethod')
- ->willReturn('POST');
-
- $this->request
- ->expects($this->any())
- ->method('isXmlHttpRequest')
- ->willReturn(true);
-
- $this->resultJsonFactory->expects($this->atLeastOnce())
- ->method('create')
+ $this->resultJsonFactory->method('create')
->willReturn($this->resultJson);
- $this->jsonHelperMock
- ->expects($this->any())
- ->method('jsonDecode')
+ $this->jsonHelper->method('jsonDecode')
->with($jsonRequest)
->willReturn(['username' => 'customer@example.com', 'password' => 'password']);
- $customerMock = $this->getMockForAbstractClass(\Magento\Customer\Api\Data\CustomerInterface::class);
- $this->customerAccountManagementMock
- ->expects($this->any())
- ->method('authenticate')
+ /** @var CustomerInterface|MockObject $customer */
+ $customer = $this->getMockForAbstractClass(CustomerInterface::class);
+ $this->accountManagement->method('authenticate')
->with('customer@example.com', 'password')
- ->willReturn($customerMock);
+ ->willReturn($customer);
- $this->customerSession->expects($this->once())
- ->method('setCustomerDataAsLoggedIn')
- ->with($customerMock);
+ $this->customerSession->method('setCustomerDataAsLoggedIn')
+ ->with($customer);
+ $this->customerSession->method('regenerateId');
- $this->customerSession->expects($this->once())->method('regenerateId');
+ /** @var Redirect|MockObject $redirect */
+ $redirect = $this->createMock(Redirect::class);
+ $this->controller->setAccountRedirect($redirect);
+ $redirect->method('getRedirectCookie')
+ ->willReturn('some_url1');
- $redirectMock = $this->createMock(\Magento\Customer\Model\Account\Redirect::class);
- $this->object->setAccountRedirect($redirectMock);
- $redirectMock->expects($this->once())->method('getRedirectCookie')->willReturn('some_url1');
+ $this->withCookieManager();
- $this->cookieManager->expects($this->once())
- ->method('getCookie')
- ->with('mage-cache-sessid')
- ->willReturn(true);
- $this->cookieMetadataFactory->expects($this->once())
- ->method('createCookieMetadata')
- ->willReturn($this->cookieMetadata);
- $this->cookieMetadata->expects($this->once())
- ->method('setPath')
- ->with('/')
- ->willReturnSelf();
- $this->cookieManager->expects($this->once())
- ->method('deleteCookie')
- ->with('mage-cache-sessid', $this->cookieMetadata)
- ->willReturnSelf();
+ $this->withScopeConfig();
- $scopeConfigMock = $this->createMock(\Magento\Framework\App\Config\ScopeConfigInterface::class);
- $this->object->setScopeConfig($scopeConfigMock);
- $scopeConfigMock->expects($this->once())->method('getValue')
- ->with('customer/startup/redirect_dashboard')
- ->willReturn(0);
-
- $this->redirectMock->expects($this->once())->method('success')->willReturn('some_url2');
- $this->resultRaw->expects($this->never())->method('setHttpResponseCode');
+ $this->redirect->method('success')
+ ->willReturn('some_url2');
+ $this->resultRaw->expects(self::never())
+ ->method('setHttpResponseCode');
$result = [
'errors' => false,
@@ -237,67 +225,103 @@ public function testLogin()
'redirectUrl' => 'some_url2',
];
- $this->resultJson
- ->expects($this->once())
- ->method('setData')
+ $this->resultJson->method('setData')
->with($result)
->willReturn($loginSuccessResponse);
- $this->assertEquals($loginSuccessResponse, $this->object->execute());
+ self::assertEquals($loginSuccessResponse, $this->controller->execute());
}
+ /**
+ * Checks unsuccessful login.
+ */
public function testLoginFailure()
{
$jsonRequest = '{"username":"invalid@example.com", "password":"invalid"}';
$loginFailureResponse = '{"message":"Invalid login or password."}';
+ $this->withRequest($jsonRequest);
- $this->request
- ->expects($this->any())
- ->method('getContent')
- ->willReturn($jsonRequest);
-
- $this->request
- ->expects($this->any())
- ->method('getMethod')
- ->willReturn('POST');
-
- $this->request
- ->expects($this->any())
- ->method('isXmlHttpRequest')
- ->willReturn(true);
-
- $this->resultJsonFactory->expects($this->once())
- ->method('create')
+ $this->resultJsonFactory->method('create')
->willReturn($this->resultJson);
- $this->jsonHelperMock
- ->expects($this->any())
- ->method('jsonDecode')
+ $this->jsonHelper->method('jsonDecode')
->with($jsonRequest)
->willReturn(['username' => 'invalid@example.com', 'password' => 'invalid']);
- $customerMock = $this->getMockForAbstractClass(\Magento\Customer\Api\Data\CustomerInterface::class);
- $this->customerAccountManagementMock
- ->expects($this->any())
- ->method('authenticate')
+ /** @var CustomerInterface|MockObject $customer */
+ $customer = $this->getMockForAbstractClass(CustomerInterface::class);
+ $this->accountManagement->method('authenticate')
->with('invalid@example.com', 'invalid')
->willThrowException(new InvalidEmailOrPasswordException(__('Invalid login or password.')));
- $this->customerSession->expects($this->never())
+ $this->customerSession->expects(self::never())
->method('setCustomerDataAsLoggedIn')
- ->with($customerMock);
-
- $this->customerSession->expects($this->never())->method('regenerateId');
+ ->with($customer);
+ $this->customerSession->expects(self::never())
+ ->method('regenerateId');
+ $this->customerSession->method('getData')
+ ->with('user_login_show_captcha')
+ ->willReturn(false);
$result = [
'errors' => true,
- 'message' => __('Invalid login or password.')
+ 'message' => __('Invalid login or password.'),
+ 'captcha' => false
];
- $this->resultJson
- ->expects($this->once())
- ->method('setData')
+ $this->resultJson->method('setData')
->with($result)
->willReturn($loginFailureResponse);
- $this->assertEquals($loginFailureResponse, $this->object->execute());
+ self::assertEquals($loginFailureResponse, $this->controller->execute());
+ }
+
+ /**
+ * Emulates request behavior.
+ *
+ * @param string $jsonRequest
+ */
+ private function withRequest(string $jsonRequest)
+ {
+ $this->request->method('getContent')
+ ->willReturn($jsonRequest);
+
+ $this->request->method('getMethod')
+ ->willReturn('POST');
+
+ $this->request->method('isXmlHttpRequest')
+ ->willReturn(true);
+ }
+
+ /**
+ * Emulates cookie manager behavior.
+ */
+ private function withCookieManager()
+ {
+ $this->cookieManager->method('getCookie')
+ ->with('mage-cache-sessid')
+ ->willReturn(true);
+ $cookieMetadata = $this->getMockBuilder(CookieMetadata::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->cookieMetadataFactory->method('createCookieMetadata')
+ ->willReturn($cookieMetadata);
+ $cookieMetadata->method('setPath')
+ ->with('/')
+ ->willReturnSelf();
+ $this->cookieManager->method('deleteCookie')
+ ->with('mage-cache-sessid', $cookieMetadata)
+ ->willReturnSelf();
+ }
+
+ /**
+ * Emulates config behavior.
+ */
+ private function withScopeConfig()
+ {
+ /** @var ScopeConfigInterface|MockObject $scopeConfig */
+ $scopeConfig = $this->createMock(ScopeConfigInterface::class);
+ $this->controller->setScopeConfig($scopeConfig);
+ $scopeConfig->method('getValue')
+ ->with('customer/startup/redirect_dashboard')
+ ->willReturn(0);
}
}
diff --git a/app/code/Magento/Customer/view/frontend/web/js/action/login.js b/app/code/Magento/Customer/view/frontend/web/js/action/login.js
index 6c7096190e38f..34cfa39e01c43 100644
--- a/app/code/Magento/Customer/view/frontend/web/js/action/login.js
+++ b/app/code/Magento/Customer/view/frontend/web/js/action/login.js
@@ -31,11 +31,11 @@ define([
if (response.errors) {
messageContainer.addErrorMessage(response);
callbacks.forEach(function (callback) {
- callback(loginData);
+ callback(loginData, response);
});
} else {
callbacks.forEach(function (callback) {
- callback(loginData);
+ callback(loginData, response);
});
customerData.invalidate(['customer']);
diff --git a/app/code/Magento/Customer/view/frontend/web/js/view/authentication-popup.js b/app/code/Magento/Customer/view/frontend/web/js/view/authentication-popup.js
index c14a59af49706..37bd3a19df638 100644
--- a/app/code/Magento/Customer/view/frontend/web/js/view/authentication-popup.js
+++ b/app/code/Magento/Customer/view/frontend/web/js/view/authentication-popup.js
@@ -84,7 +84,6 @@ define([
if (formElement.validation() &&
formElement.validation('isValid')
) {
- this.isLoading(true);
loginAction(loginData);
}
From 5a84c5a483386fdcf297126ecba90db1e1b13f89 Mon Sep 17 00:00:00 2001
From: U1PR01
Date: Sat, 27 Oct 2018 12:30:34 +0530
Subject: [PATCH 36/75] Fixed - Default tax region/state appears in customer &
order data #16684
---
.../Checkout/view/frontend/web/js/model/new-customer-address.js | 2 ++
1 file changed, 2 insertions(+)
diff --git a/app/code/Magento/Checkout/view/frontend/web/js/model/new-customer-address.js b/app/code/Magento/Checkout/view/frontend/web/js/model/new-customer-address.js
index f9dae2691e5f3..22e03c86f5d0a 100644
--- a/app/code/Magento/Checkout/view/frontend/web/js/model/new-customer-address.js
+++ b/app/code/Magento/Checkout/view/frontend/web/js/model/new-customer-address.js
@@ -25,6 +25,8 @@ define([
if (countryId) {
if (addressData.region && addressData.region['region_id']) {
regionId = addressData.region['region_id'];
+ } else if (!addressData['region_id']) {
+ regionId = null;
} else if (countryId === window.checkoutConfig.defaultCountryId) {
regionId = window.checkoutConfig.defaultRegionId;
}
From e4b430a89a1d4e5ed92dccbed8c0c93aef7f82f4 Mon Sep 17 00:00:00 2001
From: U1PR01
Date: Mon, 29 Oct 2018 13:17:48 +0530
Subject: [PATCH 37/75] Update code for fixed issue #16684
---
.../Checkout/view/frontend/web/js/model/new-customer-address.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/code/Magento/Checkout/view/frontend/web/js/model/new-customer-address.js b/app/code/Magento/Checkout/view/frontend/web/js/model/new-customer-address.js
index 22e03c86f5d0a..7b858c92bee34 100644
--- a/app/code/Magento/Checkout/view/frontend/web/js/model/new-customer-address.js
+++ b/app/code/Magento/Checkout/view/frontend/web/js/model/new-customer-address.js
@@ -26,7 +26,7 @@ define([
if (addressData.region && addressData.region['region_id']) {
regionId = addressData.region['region_id'];
} else if (!addressData['region_id']) {
- regionId = null;
+ regionId = undefined;
} else if (countryId === window.checkoutConfig.defaultCountryId) {
regionId = window.checkoutConfig.defaultRegionId;
}
From 7ceea962f0eab3baff1a4881a80b3cc2ac96c51f Mon Sep 17 00:00:00 2001
From: Serhiy Yelahin
Date: Mon, 29 Oct 2018 09:56:28 +0200
Subject: [PATCH 38/75] MAGETWO-93988: Product Review "Save and Next" and "Save
and Previous" not working
---
.../Review/Product/CollectionTest.php | 83 +++++++++++++++++--
1 file changed, 76 insertions(+), 7 deletions(-)
diff --git a/dev/tests/integration/testsuite/Magento/Review/Model/ResourceModel/Review/Product/CollectionTest.php b/dev/tests/integration/testsuite/Magento/Review/Model/ResourceModel/Review/Product/CollectionTest.php
index a7f859b23dfa2..b44ef7aa20c6a 100644
--- a/dev/tests/integration/testsuite/Magento/Review/Model/ResourceModel/Review/Product/CollectionTest.php
+++ b/dev/tests/integration/testsuite/Magento/Review/Model/ResourceModel/Review/Product/CollectionTest.php
@@ -3,20 +3,89 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
+
namespace Magento\Review\Model\ResourceModel\Review\Product;
+use Magento\Review\Model\Review;
+use Magento\TestFramework\Helper\Bootstrap;
+
+/**
+ * Tests some functionality of the Product Review collection
+ */
class CollectionTest extends \PHPUnit\Framework\TestCase
{
/**
+ * Checks resulting ids count
+ *
+ * @param int $status
+ * @param int $expectedCount
+ * @param string $sortAttribute
+ * @param string $dir
+ * @param callable $assertion
+ * @dataProvider sortOrderAssertionsDataProvider
* @magentoDataFixture Magento/Review/_files/different_reviews.php
*/
- public function testGetResultingIds()
- {
- $collection = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
- \Magento\Review\Model\ResourceModel\Review\Product\Collection::class
- );
- $collection->addStatusFilter(\Magento\Review\Model\Review::STATUS_APPROVED);
+ public function testGetResultingIds(
+ int $status,
+ int $expectedCount,
+ string $sortAttribute,
+ string $dir,
+ callable $assertion
+ ) {
+ $collection = Bootstrap::getObjectManager()->create(Collection::class);
+ if ($status > 0) {
+ $collection->addStatusFilter($status);
+ }
+ $collection->setOrder($sortAttribute, $dir);
$actual = $collection->getResultingIds();
- $this->assertCount(2, $actual);
+ $this->assertCount($expectedCount, $actual);
+ $assertion($actual);
+ }
+
+ /**
+ * Sort order assertions data provider
+ *
+ * @return array
+ */
+ public function sortOrderAssertionsDataProvider(): array
+ {
+ return [
+ [
+ Review::STATUS_APPROVED,
+ 2,
+ 'rt.review_id',
+ 'DESC',
+ function (array $actual) {
+ $this->assertLessThan($actual[0], $actual[1]);
+ }
+ ],
+ [
+ Review::STATUS_APPROVED,
+ 2,
+ 'rt.review_id',
+ 'ASC',
+ function (array $actual) {
+ $this->assertLessThan($actual[1], $actual[0]);
+ }
+ ],
+ [
+ Review::STATUS_APPROVED,
+ 2,
+ 'rt.created_at',
+ 'ASC',
+ function (array $actual) {
+ $this->assertLessThan($actual[1], $actual[0]);
+ }
+ ],
+ [
+ 0,
+ 3,
+ 'rt.review_id',
+ 'ASC',
+ function (array $actual) {
+ $this->assertLessThan($actual[1], $actual[0]);
+ }
+ ]
+ ];
}
}
From ea8da0d9b1f96e01af6cecb8620e9f7dc3def754 Mon Sep 17 00:00:00 2001
From: Mastiuhin Olexandr
Date: Mon, 29 Oct 2018 12:40:15 +0200
Subject: [PATCH 39/75] MAGETWO-93072: Value of Customer Address Attribute is
not shown in the Customers grid
---
.../Magento/Customer/Model/Indexer/Source.php | 35 ++++++++++++++-----
1 file changed, 27 insertions(+), 8 deletions(-)
diff --git a/app/code/Magento/Customer/Model/Indexer/Source.php b/app/code/Magento/Customer/Model/Indexer/Source.php
index e4bf03e08a9ad..983cda7063903 100644
--- a/app/code/Magento/Customer/Model/Indexer/Source.php
+++ b/app/code/Magento/Customer/Model/Indexer/Source.php
@@ -5,6 +5,7 @@
*/
namespace Magento\Customer\Model\Indexer;
+use Magento\Customer\Model\ResourceModel\Customer\Indexer\CollectionFactory;
use Magento\Customer\Model\ResourceModel\Customer\Indexer\Collection;
use Magento\Framework\App\ResourceConnection\SourceProviderInterface;
use Traversable;
@@ -25,11 +26,11 @@ class Source implements \IteratorAggregate, \Countable, SourceProviderInterface
private $batchSize;
/**
- * @param \Magento\Customer\Model\ResourceModel\Customer\Indexer\CollectionFactory $collection
+ * @param CollectionFactory $collectionFactory
* @param int $batchSize
*/
public function __construct(
- \Magento\Customer\Model\ResourceModel\Customer\Indexer\CollectionFactory $collectionFactory,
+ CollectionFactory $collectionFactory,
$batchSize = 10000
) {
$this->customerCollection = $collectionFactory->create();
@@ -37,7 +38,7 @@ public function __construct(
}
/**
- * {@inheritdoc}
+ * @inheritdoc
*/
public function getMainTable()
{
@@ -45,7 +46,7 @@ public function getMainTable()
}
/**
- * {@inheritdoc}
+ * @inheritdoc
*/
public function getIdFieldName()
{
@@ -53,7 +54,7 @@ public function getIdFieldName()
}
/**
- * {@inheritdoc}
+ * @inheritdoc
*/
public function addFieldToSelect($fieldName, $alias = null)
{
@@ -62,7 +63,7 @@ public function addFieldToSelect($fieldName, $alias = null)
}
/**
- * {@inheritdoc}
+ * @inheritdoc
*/
public function getSelect()
{
@@ -70,7 +71,7 @@ public function getSelect()
}
/**
- * {@inheritdoc}
+ * @inheritdoc
*/
public function addFieldToFilter($attribute, $condition = null)
{
@@ -79,7 +80,7 @@ public function addFieldToFilter($attribute, $condition = null)
}
/**
- * @return int
+ * @inheritdoc
*/
public function count()
{
@@ -105,4 +106,22 @@ public function getIterator()
$pageNumber++;
} while ($pageNumber <= $lastPage);
}
+
+ /**
+ * Joins Attribute
+ *
+ * @param string $alias alias for the joined attribute
+ * @param string|\Magento\Eav\Model\Entity\Attribute\AbstractAttribute $attribute
+ * @param string $bind attribute of the main entity to link with joined $filter
+ * @param string $filter primary key for the joined entity (entity_id default)
+ * @param string $joinType inner|left
+ * @param int|null $storeId
+ * @return void
+ * @throws \Magento\Framework\Exception\LocalizedException
+ * @see Collection::joinAttribute()
+ */
+ public function joinAttribute($alias, $attribute, $bind, $filter = null, $joinType = 'inner', $storeId = null)
+ {
+ $this->customerCollection->joinAttribute($alias, $attribute, $bind, $filter, $joinType, $storeId);
+ }
}
From 1226cb301699f642b9cdd4e541b9327df07a1b63 Mon Sep 17 00:00:00 2001
From: Serhiy Yelahin
Date: Mon, 29 Oct 2018 15:35:31 +0200
Subject: [PATCH 40/75] MAGETWO-69766: [Magento Cloud] - Cant flush Images
cache in admin
---
.../Framework/Filesystem/Directory/Write.php | 57 ++++++++++++++++++-
.../Framework/Filesystem/Driver/File.php | 21 +++++--
2 files changed, 72 insertions(+), 6 deletions(-)
diff --git a/lib/internal/Magento/Framework/Filesystem/Directory/Write.php b/lib/internal/Magento/Framework/Filesystem/Directory/Write.php
index 4566f61b15572..8be0fd9ae230a 100644
--- a/lib/internal/Magento/Framework/Filesystem/Directory/Write.php
+++ b/lib/internal/Magento/Framework/Filesystem/Directory/Write.php
@@ -3,10 +3,14 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
+
namespace Magento\Framework\Filesystem\Directory;
use Magento\Framework\Exception\FileSystemException;
+/**
+ * Write Interface implementation
+ */
class Write extends Read implements WriteInterface
{
/**
@@ -164,6 +168,7 @@ public function createSymlink($path, $destination, WriteInterface $targetDirecto
*/
public function delete($path = null)
{
+ $exceptionMessages = [];
if (!$this->isExist($path)) {
return true;
}
@@ -171,11 +176,59 @@ public function delete($path = null)
if ($this->driver->isFile($absolutePath)) {
$this->driver->deleteFile($absolutePath);
} else {
- $this->driver->deleteDirectory($absolutePath);
+ try {
+ $this->deleteFilesRecursively($absolutePath);
+ } catch (FileSystemException $e) {
+ $exceptionMessages[] = $e->getMessage();
+ }
+ try {
+ $this->driver->deleteDirectory($absolutePath);
+ } catch (FileSystemException $e) {
+ $exceptionMessages[] = $e->getMessage();
+ }
+
+ if (!empty($exceptionMessages)) {
+ throw new FileSystemException(
+ new \Magento\Framework\Phrase(
+ \implode(' ', $exceptionMessages)
+ )
+ );
+ }
}
return true;
}
+ /**
+ * Delete files recursively
+ *
+ * Implemented in order to delete as much files as possible and collect all exceptions
+ *
+ * @param string $path
+ * @return void
+ * @throws FileSystemException
+ */
+ private function deleteFilesRecursively(string $path)
+ {
+ $exceptionMessages = [];
+ $entitiesList = $this->driver->readDirectoryRecursively($path);
+ foreach ($entitiesList as $entityPath) {
+ if ($this->driver->isFile($entityPath)) {
+ try {
+ $this->driver->deleteFile($entityPath);
+ } catch (FileSystemException $e) {
+ $exceptionMessages[] = $e->getMessage();
+ }
+ }
+ }
+ if (!empty($exceptionMessages)) {
+ throw new FileSystemException(
+ new \Magento\Framework\Phrase(
+ \implode(' ', $exceptionMessages)
+ )
+ );
+ }
+ }
+
/**
* Change permissions of given path
*
@@ -224,7 +277,7 @@ public function touch($path, $modificationTime = null)
/**
* Check if given path is writable
*
- * @param null $path
+ * @param string|null $path
* @return bool
* @throws \Magento\Framework\Exception\FileSystemException
*/
diff --git a/lib/internal/Magento/Framework/Filesystem/Driver/File.php b/lib/internal/Magento/Framework/Filesystem/Driver/File.php
index c236228a00b75..53322f06bbc6f 100644
--- a/lib/internal/Magento/Framework/Filesystem/Driver/File.php
+++ b/lib/internal/Magento/Framework/Filesystem/Driver/File.php
@@ -5,6 +5,7 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
+
namespace Magento\Framework\Filesystem\Driver;
use Magento\Framework\Exception\FileSystemException;
@@ -396,16 +397,28 @@ public function deleteFile($path)
*/
public function deleteDirectory($path)
{
+ $exceptionMessages = [];
$flags = \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::UNIX_PATHS;
$iterator = new \FilesystemIterator($path, $flags);
/** @var \FilesystemIterator $entity */
foreach ($iterator as $entity) {
- if ($entity->isDir()) {
- $this->deleteDirectory($entity->getPathname());
- } else {
- $this->deleteFile($entity->getPathname());
+ try {
+ if ($entity->isDir()) {
+ $this->deleteDirectory($entity->getPathname());
+ } else {
+ $this->deleteFile($entity->getPathname());
+ }
+ } catch (FileSystemException $exception) {
+ $exceptionMessages[] = $exception->getMessage();
}
}
+ if (!empty($exceptionMessages)) {
+ throw new FileSystemException(
+ new \Magento\Framework\Phrase(
+ \implode(' ', $exceptionMessages)
+ )
+ );
+ }
$fullPath = $this->getScheme() . $path;
if (is_link($fullPath)) {
From e94a42313d6e8cec819475ea1de144ec34b4464a Mon Sep 17 00:00:00 2001
From: Pavel Bystritsky
Date: Tue, 30 Oct 2018 15:26:45 +0200
Subject: [PATCH 41/75] ENGCOM-970: Fixed cast to integer.
---
.../Magento/GroupedProduct/Model/Product/Type/Grouped.php | 2 +-
.../Magento/GroupedProduct/Model/Product/Type/GroupedTest.php | 4 ++--
.../_files/product_grouped_with_out_of_stock.php | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/app/code/Magento/GroupedProduct/Model/Product/Type/Grouped.php b/app/code/Magento/GroupedProduct/Model/Product/Type/Grouped.php
index 0b88f0f3a00f9..7bdf7c0112795 100644
--- a/app/code/Magento/GroupedProduct/Model/Product/Type/Grouped.php
+++ b/app/code/Magento/GroupedProduct/Model/Product/Type/Grouped.php
@@ -341,7 +341,7 @@ protected function getProductInfo(\Magento\Framework\DataObject $buyRequest, $pr
if ($isStrictProcessMode && !$subProduct->getQty()) {
return __('Please specify the quantity of product(s).')->render();
}
- $productsInfo[$subProduct->getId()] = $subProduct->isSalable() ? (int)$subProduct->getQty() : 0;
+ $productsInfo[$subProduct->getId()] = $subProduct->isSalable() ? (float)$subProduct->getQty() : 0;
}
}
diff --git a/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/Product/Type/GroupedTest.php b/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/Product/Type/GroupedTest.php
index d53c7983e5b1e..ed283d196e69c 100644
--- a/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/Product/Type/GroupedTest.php
+++ b/dev/tests/integration/testsuite/Magento/GroupedProduct/Model/Product/Type/GroupedTest.php
@@ -214,7 +214,7 @@ public function outOfStockSubProductDataProvider()
],
],
[
- 'virtual-product' => 2, // This is a default quantity.
+ 'virtual-product' => 2.5, // This is a default quantity.
],
],
'Out of stock product are hidden #1' => [
@@ -242,7 +242,7 @@ public function outOfStockSubProductDataProvider()
],
],
[
- 'virtual-product' => 2, // This is a default quantity.
+ 'virtual-product' => 2.5, // This is a default quantity.
],
],
];
diff --git a/dev/tests/integration/testsuite/Magento/GroupedProduct/_files/product_grouped_with_out_of_stock.php b/dev/tests/integration/testsuite/Magento/GroupedProduct/_files/product_grouped_with_out_of_stock.php
index b9f9046c4244c..7aa62b149b8c0 100644
--- a/dev/tests/integration/testsuite/Magento/GroupedProduct/_files/product_grouped_with_out_of_stock.php
+++ b/dev/tests/integration/testsuite/Magento/GroupedProduct/_files/product_grouped_with_out_of_stock.php
@@ -59,7 +59,7 @@
->setLinkedProductSku($sku)
->setLinkedProductType($linkedProduct->getTypeId())
->getExtensionAttributes()
- ->setQty(2);
+ ->setQty(2.5);
$newLinks[] = $productLink;
}
$product->setProductLinks($newLinks);
From 724b183b051db4e81e600a6836012c69042340ba Mon Sep 17 00:00:00 2001
From: nmalevanec
Date: Tue, 30 Oct 2018 17:35:31 +0200
Subject: [PATCH 42/75] ENGCOM-3086: Fix/add expresion #17915
---
.../Db/Collection/AbstractCollection.php | 14 ++++++++++----
.../Db/Collection/AbstractCollectionTest.php | 3 +--
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/lib/internal/Magento/Framework/Model/ResourceModel/Db/Collection/AbstractCollection.php b/lib/internal/Magento/Framework/Model/ResourceModel/Db/Collection/AbstractCollection.php
index a88e013f5d2fe..6e1ea24a61a4a 100644
--- a/lib/internal/Magento/Framework/Model/ResourceModel/Db/Collection/AbstractCollection.php
+++ b/lib/internal/Magento/Framework/Model/ResourceModel/Db/Collection/AbstractCollection.php
@@ -45,6 +45,13 @@ abstract class AbstractCollection extends AbstractDb implements SourceProviderIn
*/
protected $_fieldsToSelect = null;
+ /**
+ * Expression fields to select in query.
+ *
+ * @var array
+ */
+ private $expressionFieldsToSelect = [];
+
/**
* Fields initial fields to select like id_field
*
@@ -205,7 +212,7 @@ protected function _initSelectFields()
$columnsToSelect = [];
foreach ($columns as $columnEntry) {
list($correlationName, $column, $alias) = $columnEntry;
- if ($correlationName !== 'main_table') {
+ if ($correlationName !== 'main_table' || isset($this->expressionFieldsToSelect[$alias])) {
// Add joined fields to select
if ($column instanceof \Zend_Db_Expr) {
$column = $column->__toString();
@@ -346,9 +353,8 @@ public function addExpressionFieldToSelect($alias, $expression, $fields)
$fullExpression = str_replace('{{' . $fieldKey . '}}', $fieldItem, $fullExpression);
}
- $fullExpression = new \Zend_Db_Expr($fullExpression);
- $this->_fieldsToSelect[$alias] = $fullExpression;
- $this->_fieldsToSelectChanged = true;
+ $this->getSelect()->columns([$alias => $fullExpression]);
+ $this->expressionFieldsToSelect[$alias] = $fullExpression;
return $this;
}
diff --git a/lib/internal/Magento/Framework/Model/Test/Unit/ResourceModel/Db/Collection/AbstractCollectionTest.php b/lib/internal/Magento/Framework/Model/Test/Unit/ResourceModel/Db/Collection/AbstractCollectionTest.php
index 0eae94dabbbe8..4f27f083509d7 100644
--- a/lib/internal/Magento/Framework/Model/Test/Unit/ResourceModel/Db/Collection/AbstractCollectionTest.php
+++ b/lib/internal/Magento/Framework/Model/Test/Unit/ResourceModel/Db/Collection/AbstractCollectionTest.php
@@ -269,9 +269,8 @@ public function addFieldToSelectDataProvider()
*/
public function testAddExpressionFieldToSelect($alias, $expression, $fields, $expected)
{
+ $this->selectMock->expects($this->once())->method('columns')->with($expected);
$this->assertTrue($this->uut->addExpressionFieldToSelect($alias, $expression, $fields) instanceof Uut);
- $this->assertEquals($expected, $this->uut->getFieldsToSelect());
- $this->assertTrue($this->uut->wereFieldsToSelectChanged());
}
/**
From b51e3be2789eba8bb10f57c2714dffa482f3c4d8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Torben=20Ho=CC=88hn?=
Date: Tue, 30 Oct 2018 23:10:53 +0100
Subject: [PATCH 43/75] fixed js translation
---
.../Tax/view/frontend/web/js/view/checkout/summary/tax.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/code/Magento/Tax/view/frontend/web/js/view/checkout/summary/tax.js b/app/code/Magento/Tax/view/frontend/web/js/view/checkout/summary/tax.js
index 682378cd870f9..39220ae0fac66 100644
--- a/app/code/Magento/Tax/view/frontend/web/js/view/checkout/summary/tax.js
+++ b/app/code/Magento/Tax/view/frontend/web/js/view/checkout/summary/tax.js
@@ -14,7 +14,7 @@ define([
'Magento_Checkout/js/model/totals',
'jquery',
'mage/translate'
-], function (ko, Component, quote, totals, $) {
+], function (ko, Component, quote, totals, $, $t) {
'use strict';
var isTaxDisplayedInGrandTotal = window.checkoutConfig.includeTaxInGrandTotal,
@@ -24,7 +24,7 @@ define([
return Component.extend({
defaults: {
isTaxDisplayedInGrandTotal: isTaxDisplayedInGrandTotal,
- notCalculatedMessage: $.mage.__('Not yet calculated'),
+ notCalculatedMessage: $t('Not yet calculated'),
template: 'Magento_Tax/checkout/summary/tax'
},
totals: quote.getTotals(),
From 5b2560e7c970ddf06928718f4a18039ff1907b74 Mon Sep 17 00:00:00 2001
From: nmalevanec
Date: Wed, 31 Oct 2018 10:17:55 +0200
Subject: [PATCH 44/75] ENGCOM-3086: Fix/add expresion #17915. Add integration
tests.
---
.../Db/Collection/AbstractTest.php | 38 +++++++++++++++++++
1 file changed, 38 insertions(+)
diff --git a/dev/tests/integration/testsuite/Magento/Framework/Model/ResourceModel/Db/Collection/AbstractTest.php b/dev/tests/integration/testsuite/Magento/Framework/Model/ResourceModel/Db/Collection/AbstractTest.php
index 419a7d04b778a..2ee0953dcdbf1 100644
--- a/dev/tests/integration/testsuite/Magento/Framework/Model/ResourceModel/Db/Collection/AbstractTest.php
+++ b/dev/tests/integration/testsuite/Magento/Framework/Model/ResourceModel/Db/Collection/AbstractTest.php
@@ -72,4 +72,42 @@ public function testGetAllIdsWithBind()
$this->_model->addBindParam('code', 'admin');
$this->assertEquals(['0'], $this->_model->getAllIds());
}
+
+ /**
+ * Check add field to select doesn't remove expression field from select.
+ *
+ * @return void
+ */
+ public function testAddExpressionFieldToSelectWithAdditionalFields()
+ {
+ $expectedColumns = ['code', 'test_field'];
+ $actualColumns = [];
+
+ $testExpression = new \Zend_Db_Expr('(sort_order + group_id)');
+ $this->_model->addExpressionFieldToSelect('test_field', $testExpression, ['sort_order', 'group_id']);
+ $this->_model->addFieldToSelect('code', 'code');
+ $columns = $this->_model->getSelect()->getPart(\Magento\Framework\DB\Select::COLUMNS);
+ foreach ($columns as $columnEntry) {
+ $actualColumns[] = $columnEntry[2];
+ }
+
+ $this->assertEquals($expectedColumns, $actualColumns);
+ }
+
+ /**
+ * Check add expression field doesn't remove all fields from select.
+ *
+ * @return void
+ */
+ public function testAddExpressionFieldToSelectWithoutAdditionalFields()
+ {
+ $expectedColumns = ['*', 'test_field'];
+
+ $testExpression = new \Zend_Db_Expr('(sort_order + group_id)');
+ $this->_model->addExpressionFieldToSelect('test_field', $testExpression, ['sort_order', 'group_id']);
+ $columns = $this->_model->getSelect()->getPart(\Magento\Framework\DB\Select::COLUMNS);
+ $actualColumns = [$columns[0][1], $columns[1][2]];
+
+ $this->assertEquals($expectedColumns, $actualColumns);
+ }
}
From 070a6c15e5b8d344ea1213d95e42ecbaba0cd54a Mon Sep 17 00:00:00 2001
From: Mastiuhin Olexandr
Date: Wed, 31 Oct 2018 15:27:56 +0200
Subject: [PATCH 45/75] MAGETWO-95846: Customer Cart Checkout error
---
.../Item/ItemProductResolver.php | 50 +++---
.../Item/ItemProductResolverTest.php | 161 ++++++++++++------
2 files changed, 140 insertions(+), 71 deletions(-)
diff --git a/app/code/Magento/ConfigurableProduct/Model/Product/Configuration/Item/ItemProductResolver.php b/app/code/Magento/ConfigurableProduct/Model/Product/Configuration/Item/ItemProductResolver.php
index d63ff06b7a483..b32921a436ec8 100644
--- a/app/code/Magento/ConfigurableProduct/Model/Product/Configuration/Item/ItemProductResolver.php
+++ b/app/code/Magento/ConfigurableProduct/Model/Product/Configuration/Item/ItemProductResolver.php
@@ -13,9 +13,10 @@
use Magento\Catalog\Model\Product\Configuration\Item\ItemResolverInterface;
use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Catalog\Model\Product;
+use Magento\Store\Model\ScopeInterface;
/**
- * {@inheritdoc}
+ * Resolves the product from a configured item.
*/
class ItemProductResolver implements ItemResolverInterface
{
@@ -38,7 +39,10 @@ public function __construct(ScopeConfigInterface $scopeConfig)
}
/**
- * {@inheritdoc}
+ * Get the final product from a configured item by product type and selection.
+ *
+ * @param ItemInterface $item
+ * @return ProductInterface
*/
public function getFinalProduct(ItemInterface $item): ProductInterface
{
@@ -46,20 +50,11 @@ public function getFinalProduct(ItemInterface $item): ProductInterface
* Show parent product thumbnail if it must be always shown according to the related setting in system config
* or if child thumbnail is not available.
*/
- $parentProduct = $item->getProduct();
- $finalProduct = $parentProduct;
+ $finalProduct = $item->getProduct();
$childProduct = $this->getChildProduct($item);
- if ($childProduct !== $parentProduct) {
- $configValue = $this->scopeConfig->getValue(
- self::CONFIG_THUMBNAIL_SOURCE,
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE
- );
- $childThumb = $childProduct->getData('thumbnail');
- $finalProduct =
- ($configValue == Thumbnail::OPTION_USE_PARENT_IMAGE) || (!$childThumb || $childThumb == 'no_selection')
- ? $parentProduct
- : $childProduct;
+ if ($childProduct !== null && $this->isUseChildProduct($childProduct)) {
+ $finalProduct = $childProduct;
}
return $finalProduct;
@@ -69,17 +64,30 @@ public function getFinalProduct(ItemInterface $item): ProductInterface
* Get item configurable child product.
*
* @param ItemInterface $item
- * @return Product
+ * @return Product|null
*/
- private function getChildProduct(ItemInterface $item): Product
+ private function getChildProduct(ItemInterface $item)
{
$option = $item->getOptionByCode('simple_product');
- $product = $item->getProduct();
- if ($option) {
- $product = $option->getProduct();
- }
+ return $option ? $option->getProduct() : null;
+ }
- return $product;
+ /**
+ * Is need to use child product
+ *
+ * @param Product $childProduct
+ * @return bool
+ */
+ private function isUseChildProduct(Product $childProduct): bool
+ {
+ $configValue = $this->scopeConfig->getValue(
+ self::CONFIG_THUMBNAIL_SOURCE,
+ ScopeInterface::SCOPE_STORE
+ );
+ $childThumb = $childProduct->getData('thumbnail');
+ return $configValue !== Thumbnail::OPTION_USE_PARENT_IMAGE
+ && $childThumb !== NULL
+ && $childThumb !== 'no_selection';
}
}
diff --git a/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Product/Configuration/Item/ItemProductResolverTest.php b/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Product/Configuration/Item/ItemProductResolverTest.php
index 28e3e5e4cb5c6..8df6dddc3eb5a 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Product/Configuration/Item/ItemProductResolverTest.php
+++ b/app/code/Magento/ConfigurableProduct/Test/Unit/Model/Product/Configuration/Item/ItemProductResolverTest.php
@@ -3,7 +3,6 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-
declare(strict_types=1);
namespace Magento\ConfigurableProduct\Test\Unit\Model\Product\Configuration\Item;
@@ -14,86 +13,148 @@
use Magento\Catalog\Model\Product\Configuration\Item\Option\OptionInterface;
use Magento\ConfigurableProduct\Model\Product\Configuration\Item\ItemProductResolver;
use Magento\Framework\App\Config\ScopeConfigInterface;
-use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
-use Magento\Store\Model\ScopeInterface;
+use Magento\Quote\Model\Quote\Item\Option;
+use PHPUnit\Framework\TestCase;
/**
- * Tests \Magento\ConfigurableProduct\Model\Product\Configuration\Item\ItemProductResolver
+ * ItemProductResolver test
*/
-class ItemProductResolverTest extends \PHPUnit\Framework\TestCase
+class ItemProductResolverTest extends TestCase
{
/**
* @var ItemProductResolver
*/
- private $resolver;
+ private $model;
/**
- * @var ScopeConfigInterface|\PHPUnit_Framework_MockObject_MockObject
+ * @var ItemInterface | \PHPUnit_Framework_MockObject_MockObject
+ */
+ private $item;
+
+ /**
+ * @var Product | \PHPUnit_Framework_MockObject_MockObject
+ */
+ private $parentProduct;
+
+ /**
+ * @var ScopeConfigInterface | \PHPUnit_Framework_MockObject_MockObject
*/
private $scopeConfig;
/**
- * @inheritdoc
+ * @var OptionInterface | \PHPUnit_Framework_MockObject_MockObject
+ */
+ private $option;
+
+ /**
+ * @var Product | \PHPUnit_Framework_MockObject_MockObject
+ */
+ private $childProduct;
+
+ /**
+ * Set up method
+ *
+ * @return void
*/
protected function setUp()
{
- $objectManagerHelper = new ObjectManager($this);
- $this->scopeConfig = $this->createPartialMock(ScopeConfigInterface::class, ['getValue', 'isSetFlag']);
- $this->resolver = $objectManagerHelper->getObject(
- ItemProductResolver::class,
- ['scopeConfig' => $this->scopeConfig]
- );
+ parent::setUp();
+
+ $this->scopeConfig = $this->getMockBuilder(ScopeConfigInterface::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $this->parentProduct = $this->getMockBuilder(Product::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->parentProduct
+ ->method('getSku')
+ ->willReturn('parent_product');
+
+ $this->childProduct = $this->getMockBuilder(Product::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->childProduct
+ ->method('getSku')
+ ->willReturn('child_product');
+
+ $this->option = $this->getMockBuilder(Option::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $this->option
+ ->method('getProduct')
+ ->willReturn($this->childProduct);
+
+ $this->item = $this->getMockBuilder(ItemInterface::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $this->item
+ ->expects($this->once())
+ ->method('getProduct')
+ ->willReturn($this->parentProduct);
+
+ $this->model = new ItemProductResolver($this->scopeConfig);
}
/**
- * @param bool $existOption
- * @param string $configImageSource
+ * Test for deleted child product from configurable product
+ *
* @return void
- * @dataProvider getFinalProductDataProvider
*/
- public function testGetFinalProduct(bool $existOption, string $configImageSource)
+ public function testGetFinalProductChildIsNull()
{
- $option = null;
- $parentProduct = $this->createMock(Product::class);
- $finalProduct = $parentProduct;
-
- if ($existOption) {
- $childProduct = $this->createPartialMock(Product::class, ['getData']);
- $childProduct->expects($this->once())->method('getData')->with('thumbnail')->willReturn('someImage');
-
- $option = $this->createPartialMock(
- OptionInterface::class,
- ['getProduct', 'getValue']
- );
- $option->expects($this->once())->method('getProduct')->willReturn($childProduct);
-
- $this->scopeConfig->expects($this->once())
- ->method('getValue')
- ->with(ItemProductResolver::CONFIG_THUMBNAIL_SOURCE, ScopeInterface::SCOPE_STORE)
- ->willReturn($configImageSource);
-
- $finalProduct = ($configImageSource == Thumbnail::OPTION_USE_PARENT_IMAGE) ? $parentProduct : $childProduct;
- }
-
- $item = $this->createPartialMock(
- ItemInterface::class,
- ['getProduct', 'getOptionByCode', 'getFileDownloadParams']
+ $this->item->method('getOptionByCode')
+ ->willReturn(null);
+
+ $finalProduct = $this->model->getFinalProduct($this->item);
+ $this->assertEquals(
+ $this->parentProduct->getSku(),
+ $finalProduct->getSku()
);
- $item->expects($this->exactly(2))->method('getProduct')->willReturn($parentProduct);
- $item->expects($this->once())->method('getOptionByCode')->with('simple_product')->willReturn($option);
+ }
- $this->assertEquals($finalProduct, $this->resolver->getFinalProduct($item));
+ /**
+ * Tests child product from configurable product
+ *
+ * @dataProvider provideScopeConfig
+ * @param string $expectedSku
+ * @param string $scopeValue
+ * @param string | null $thumbnail
+ * @return void
+ */
+ public function testGetFinalProductChild($expectedSku, $scopeValue, $thumbnail)
+ {
+ $this->item->method('getOptionByCode')
+ ->willReturn($this->option);
+
+ $this->childProduct->method('getData')
+ ->willReturn($thumbnail);
+
+ $this->scopeConfig->method('getValue')
+ ->willReturn($scopeValue);
+
+ $finalProduct = $this->model->getFinalProduct($this->item);
+ $this->assertEquals($expectedSku, $finalProduct->getSku());
}
/**
+ * Data provider for scope test
+ *
* @return array
*/
- public function getFinalProductDataProvider(): array
+ public function provideScopeConfig(): array
{
return [
- [false, Thumbnail::OPTION_USE_PARENT_IMAGE],
- [true, Thumbnail::OPTION_USE_PARENT_IMAGE],
- [true, Thumbnail::OPTION_USE_OWN_IMAGE],
+ ['child_product', Thumbnail::OPTION_USE_OWN_IMAGE, 'thumbnail'],
+ ['parent_product', Thumbnail::OPTION_USE_PARENT_IMAGE, 'thumbnail'],
+
+ ['parent_product', Thumbnail::OPTION_USE_OWN_IMAGE, null],
+ ['parent_product', Thumbnail::OPTION_USE_OWN_IMAGE, 'no_selection'],
+
+ ['parent_product', Thumbnail::OPTION_USE_PARENT_IMAGE, null],
+ ['parent_product', Thumbnail::OPTION_USE_PARENT_IMAGE, 'no_selection'],
];
}
}
From 4f602ccae14e1d32a789176fb3ea5dbefaddf7bc Mon Sep 17 00:00:00 2001
From: Mastiuhin Olexandr
Date: Wed, 31 Oct 2018 15:42:20 +0200
Subject: [PATCH 46/75] MAGETWO-95846: Customer Cart Checkout error
---
.../Model/Product/Configuration/Item/ItemProductResolver.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/code/Magento/ConfigurableProduct/Model/Product/Configuration/Item/ItemProductResolver.php b/app/code/Magento/ConfigurableProduct/Model/Product/Configuration/Item/ItemProductResolver.php
index b32921a436ec8..ef757902097e4 100644
--- a/app/code/Magento/ConfigurableProduct/Model/Product/Configuration/Item/ItemProductResolver.php
+++ b/app/code/Magento/ConfigurableProduct/Model/Product/Configuration/Item/ItemProductResolver.php
@@ -87,7 +87,7 @@ private function isUseChildProduct(Product $childProduct): bool
);
$childThumb = $childProduct->getData('thumbnail');
return $configValue !== Thumbnail::OPTION_USE_PARENT_IMAGE
- && $childThumb !== NULL
+ && $childThumb !== null
&& $childThumb !== 'no_selection';
}
}
From 66294452bd0fc6bcadc7360c438da79ca1f6c314 Mon Sep 17 00:00:00 2001
From: Vasilii Burlacu
Date: Thu, 25 Oct 2018 11:44:36 +0300
Subject: [PATCH 47/75] Added form fieldset before html to
\Magento\Framework\Data\Form\Element\Fieldset in getElementHtml() method
---
lib/internal/Magento/Framework/Data/Form/Element/Fieldset.php | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/internal/Magento/Framework/Data/Form/Element/Fieldset.php b/lib/internal/Magento/Framework/Data/Form/Element/Fieldset.php
index 66b1299b98696..90482ab55fc71 100644
--- a/lib/internal/Magento/Framework/Data/Form/Element/Fieldset.php
+++ b/lib/internal/Magento/Framework/Data/Form/Element/Fieldset.php
@@ -43,7 +43,8 @@ public function __construct(
*/
public function getElementHtml()
{
- $html = 'serialize(
+ $html = $this->getBeforeElementHtml();
+ $html .= 'serialize(
['class']
) . $this->_getUiId() . '>' . "\n";
if ($this->getLegend()) {
From 09bd229cad810e57de4c31fcce1184a1c953e47a Mon Sep 17 00:00:00 2001
From: Vishal Gelani
Date: Thu, 1 Nov 2018 17:59:10 +0530
Subject: [PATCH 48/75] Update Tierprice.php
---
.../Catalog/Model/Product/Attribute/Backend/Tierprice.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Tierprice.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Tierprice.php
index b74be1372a3c0..23b2dfa01bfbd 100644
--- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Tierprice.php
+++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/Tierprice.php
@@ -170,7 +170,7 @@ protected function modifyPriceData($object, $data)
if ($specialPrice && ($object->getPrice() > $object->getFinalPrice())) {
if ($today >= strtotime($specialPriceFromDate) && $today <= strtotime($specialPriceToDate) ||
- $today >= strtotime($specialPriceFromDate) && is_null($specialPriceToDate)) {
+ $today >= strtotime($specialPriceFromDate) && $specialPriceToDate === null) {
$price = $specialPrice;
}
}
From f6eb7fb7f7d35dce7df81fd4fdf1b8dbee54b3db Mon Sep 17 00:00:00 2001
From: Cezary Zeglen
Date: Fri, 24 Aug 2018 17:18:40 +0200
Subject: [PATCH 49/75] Fix translations of category design theme not being
applied
---
app/code/Magento/Catalog/Model/Design.php | 13 ++++++++++++-
.../testsuite/Magento/Catalog/Model/DesignTest.php | 4 ++++
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/app/code/Magento/Catalog/Model/Design.php b/app/code/Magento/Catalog/Model/Design.php
index bd7cdabb40856..6c0629feaf6fd 100644
--- a/app/code/Magento/Catalog/Model/Design.php
+++ b/app/code/Magento/Catalog/Model/Design.php
@@ -5,6 +5,8 @@
*/
namespace Magento\Catalog\Model;
+use \Magento\Framework\TranslateInterface;
+
/**
* Catalog Custom Category design Model
*
@@ -31,6 +33,11 @@ class Design extends \Magento\Framework\Model\AbstractModel
*/
protected $_localeDate;
+ /**
+ * @var TranslateInterface
+ */
+ private $translator;
+
/**
* @param \Magento\Framework\Model\Context $context
* @param \Magento\Framework\Registry $registry
@@ -47,10 +54,13 @@ public function __construct(
\Magento\Framework\View\DesignInterface $design,
\Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
- array $data = []
+ array $data = [],
+ TranslateInterface $translator = null
) {
$this->_localeDate = $localeDate;
$this->_design = $design;
+ $this->translator = $translator ?:
+ \Magento\Framework\App\ObjectManager::getInstance()->get(TranslateInterface::class);
parent::__construct($context, $registry, $resource, $resourceCollection, $data);
}
@@ -63,6 +73,7 @@ public function __construct(
public function applyCustomDesign($design)
{
$this->_design->setDesignTheme($design);
+ $this->translator->loadData(null, true);
return $this;
}
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/DesignTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/DesignTest.php
index 33f26302394f4..38960ab66399a 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Model/DesignTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/DesignTest.php
@@ -32,8 +32,12 @@ public function testApplyCustomDesign($theme)
$design = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
\Magento\Framework\View\DesignInterface::class
);
+ $translate = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get(
+ \Magento\Framework\TranslateInterface::class
+ );
$this->assertEquals('package', $design->getDesignTheme()->getPackageCode());
$this->assertEquals('theme', $design->getDesignTheme()->getThemeCode());
+ $this->assertEquals('themepackage/theme', $translate->getTheme());
}
/**
From 8c98e82bbc0a6300d83dcf9269ca16a25edf46de Mon Sep 17 00:00:00 2001
From: Dmytro Cheshun
Date: Sun, 28 Oct 2018 09:40:23 +0200
Subject: [PATCH 50/75] Remove duplicated selector
---
.../luma/Magento_Checkout/web/css/source/module/_cart.less | 3 ---
1 file changed, 3 deletions(-)
diff --git a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_cart.less b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_cart.less
index 10b917635bd40..be5863f726d33 100644
--- a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_cart.less
+++ b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_cart.less
@@ -632,9 +632,6 @@
&-item-details {
padding-bottom: 35px;
- }
-
- &-item-details {
display: table-cell;
vertical-align: top;
white-space: normal;
From 1c7b6ccd4db558539da93509828230fd4992fbdf Mon Sep 17 00:00:00 2001
From: Nikita Shcherbatykh
Date: Fri, 2 Nov 2018 09:30:55 +0200
Subject: [PATCH 51/75] MAGETWO-95461: Cannot save product with Tier Prices
---
app/code/Magento/Catalog/Helper/Data.php | 19 ++-
.../Backend/TierPrice/UpdateHandler.php | 17 ++-
.../Controller/Adminhtml/ProductTest.php | 110 +++++++++++++++++-
3 files changed, 127 insertions(+), 19 deletions(-)
diff --git a/app/code/Magento/Catalog/Helper/Data.php b/app/code/Magento/Catalog/Helper/Data.php
index 7d153399f8ec0..495973176be12 100644
--- a/app/code/Magento/Catalog/Helper/Data.php
+++ b/app/code/Magento/Catalog/Helper/Data.php
@@ -7,6 +7,7 @@
use Magento\Catalog\Api\CategoryRepositoryInterface;
use Magento\Catalog\Api\ProductRepositoryInterface;
+use Magento\Store\Model\ScopeInterface;
use Magento\Customer\Model\Session as CustomerSession;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Framework\Pricing\PriceCurrencyInterface;
@@ -269,7 +270,8 @@ public function setStoreId($store)
/**
* Return current category path or get it from current category
- * and creating array of categories|product paths for breadcrumbs
+ *
+ * Creating array of categories|product paths for breadcrumbs
*
* @return array
*/
@@ -378,6 +380,7 @@ public function getLastViewedUrl()
/**
* Split SKU of an item by dashes and spaces
+ *
* Words will not be broken, unless this length is greater than $length
*
* @param string $sku
@@ -406,14 +409,15 @@ public function getAttributeHiddenFields()
/**
* Retrieve Catalog Price Scope
*
- * @return int
+ * @return int|null
*/
public function getPriceScope()
{
- return $this->scopeConfig->getValue(
+ $priceScope = $this->scopeConfig->getValue(
self::XML_PATH_PRICE_SCOPE,
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE
+ ScopeInterface::SCOPE_STORE
);
+ return isset($priceScope) ? (int)$priceScope : null;
}
/**
@@ -449,7 +453,7 @@ public function isUrlDirectivesParsingAllowed()
{
return $this->scopeConfig->isSetFlag(
self::CONFIG_PARSE_URL_DIRECTIVES,
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
+ ScopeInterface::SCOPE_STORE,
$this->_storeId
);
}
@@ -466,6 +470,7 @@ public function getPageTemplateProcessor()
/**
* Whether to display items count for each filter option
+ *
* @param int $storeId Store view ID
* @return bool
*/
@@ -473,12 +478,14 @@ public function shouldDisplayProductCountOnLayer($storeId = null)
{
return $this->scopeConfig->isSetFlag(
self::XML_PATH_DISPLAY_PRODUCT_COUNT,
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE,
+ ScopeInterface::SCOPE_STORE,
$storeId
);
}
/**
+ * Convert tax address array to address data object with country id and postcode
+ *
* @param array $taxAddress
* @return \Magento\Customer\Api\Data\AddressInterface|null
*/
diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/TierPrice/UpdateHandler.php b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/TierPrice/UpdateHandler.php
index b23dc6f30f8fa..9b9b007245b97 100644
--- a/app/code/Magento/Catalog/Model/Product/Attribute/Backend/TierPrice/UpdateHandler.php
+++ b/app/code/Magento/Catalog/Model/Product/Attribute/Backend/TierPrice/UpdateHandler.php
@@ -82,14 +82,14 @@ public function execute($entity, $arguments = [])
__('Tier prices data should be array, but actually other type is received')
);
}
- $websiteId = $this->storeManager->getStore($entity->getStoreId())->getWebsiteId();
+ $websiteId = (int)$this->storeManager->getStore($entity->getStoreId())->getWebsiteId();
$isGlobal = $attribute->isScopeGlobal() || $websiteId === 0;
$identifierField = $this->metadataPoll->getMetadata(ProductInterface::class)->getLinkField();
- $productId = $entity->getData($identifierField);
+ $productId = (int)$entity->getData($identifierField);
// prepare original data to compare
$origPrices = $entity->getOrigData($attribute->getName());
- $old = $this->prepareOriginalDataToCompare($origPrices, $isGlobal);
+ $old = $this->prepareOldTierPriceToCompare($origPrices);
// prepare data for save
$new = $this->prepareNewDataForSave($priceRows, $isGlobal);
@@ -262,19 +262,18 @@ private function isWebsiteGlobal(int $websiteId): bool
}
/**
+ * Prepare old data to compare.
+ *
* @param array|null $origPrices
- * @param bool $isGlobal
* @return array
*/
- private function prepareOriginalDataToCompare($origPrices, $isGlobal = true): array
+ private function prepareOldTierPriceToCompare($origPrices): array
{
$old = [];
if (is_array($origPrices)) {
foreach ($origPrices as $data) {
- if ($isGlobal === $this->isWebsiteGlobal((int)$data['website_id'])) {
- $key = $this->getPriceKey($data);
- $old[$key] = $data;
- }
+ $key = $this->getPriceKey($data);
+ $old[$key] = $data;
}
}
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/ProductTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/ProductTest.php
index e01f4aec401a2..ddd5edb21eb26 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/ProductTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/ProductTest.php
@@ -9,6 +9,8 @@
use Magento\Framework\Data\Form\FormKey;
use Magento\Framework\Message\Manager;
use Magento\TestFramework\Helper\Bootstrap;
+use Magento\Catalog\Api\ProductRepositoryInterface;
+use Magento\Framework\Message\MessageInterface;
/**
* @magentoAppArea adminhtml
@@ -21,7 +23,7 @@ public function testSaveActionWithDangerRequest()
$this->dispatch('backend/catalog/product/save');
$this->assertSessionMessages(
$this->equalTo(['Unable to save product']),
- \Magento\Framework\Message\MessageInterface::TYPE_ERROR
+ MessageInterface::TYPE_ERROR
);
$this->assertRedirect($this->stringContains('/backend/catalog/product/new'));
}
@@ -38,7 +40,7 @@ public function testSaveActionAndNew()
$this->assertRedirect($this->stringStartsWith('http://localhost/index.php/backend/catalog/product/new/'));
$this->assertSessionMessages(
$this->contains('You saved the product.'),
- \Magento\Framework\Message\MessageInterface::TYPE_SUCCESS
+ MessageInterface::TYPE_SUCCESS
);
}
@@ -61,11 +63,11 @@ public function testSaveActionAndDuplicate()
);
$this->assertSessionMessages(
$this->contains('You saved the product.'),
- \Magento\Framework\Message\MessageInterface::TYPE_SUCCESS
+ MessageInterface::TYPE_SUCCESS
);
$this->assertSessionMessages(
$this->contains('You duplicated the product.'),
- \Magento\Framework\Message\MessageInterface::TYPE_SUCCESS
+ MessageInterface::TYPE_SUCCESS
);
}
@@ -236,4 +238,104 @@ public function saveActionWithAlreadyExistingUrlKeyDataProvider()
]
];
}
+
+ /**
+ * Test product save with selected tier price
+ *
+ * @dataProvider saveActionTierPriceDataProvider
+ * @param array $postData
+ * @param array $tierPrice
+ * @magentoDataFixture Magento/Catalog/_files/product_has_tier_price_show_as_low_as.php
+ * @magentoConfigFixture current_store catalog/price/scope 1
+ */
+ public function testSaveActionTierPrice(array $postData, array $tierPrice)
+ {
+ $postData['product'] = $this->getProductData($tierPrice);
+ $this->getRequest()->setPostValue($postData);
+ $this->dispatch('backend/catalog/product/save/id/');
+ $this->assertSessionMessages(
+ $this->contains('You saved the product.'),
+ MessageInterface::TYPE_SUCCESS
+ );
+ }
+
+ /**
+ * Provide test data for testSaveActionWithAlreadyExistingUrlKey().
+ *
+ * @return array
+ */
+ public function saveActionTierPriceDataProvider()
+ {
+ return [
+ [
+ 'post_data' => [
+ 'id' => '1',
+ 'type' => 'simple',
+ 'store' => '0',
+ 'set' => '4',
+ 'back' => 'edit',
+ 'product' => [],
+ 'is_downloadable' => '0',
+ 'affect_configurable_product_attributes' => '1',
+ 'new_variation_attribute_set_id' => '4',
+ 'use_default' => [
+ 'gift_message_available' => '0',
+ 'gift_wrapping_available' => '0'
+ ],
+ 'configurable_matrix_serialized' => '[]',
+ 'associated_product_ids_serialized' => '[]'
+ ],
+ 'tier_price_for_request' => [
+ [
+ 'price_id' => '1',
+ 'website_id' => '0',
+ 'cust_group' => '32000',
+ 'price' => '111.00',
+ 'price_qty' => '100',
+ 'website_price' => '111.0000',
+ 'initialize' => 'true',
+ 'record_id' => '1',
+ 'value_type' => 'fixed'
+ ],
+ [
+ 'price_id' => '2',
+ 'website_id' => '1',
+ 'cust_group' => '32000',
+ 'price' => '222.00',
+ 'price_qty' => '200',
+ 'website_price' => '111.0000',
+ 'initialize' => 'true',
+ 'record_id' => '2',
+ 'value_type' => 'fixed'
+ ],
+ [
+ 'price_id' => '3',
+ 'website_id' => '1',
+ 'cust_group' => '32000',
+ 'price' => '333.00',
+ 'price_qty' => '300',
+ 'website_price' => '111.0000',
+ 'initialize' => 'true',
+ 'record_id' => '3',
+ 'value_type' => 'fixed'
+ ]
+ ]
+ ]
+ ];
+ }
+
+ /**
+ * Return product data for test without entity_id for further save
+ *
+ * @param array $tierPrice
+ * @return array
+ */
+ private function getProductData(array $tierPrice)
+ {
+ $productRepositoryInterface = $this->_objectManager->get(ProductRepositoryInterface::class);
+ $product = $productRepositoryInterface->get('tier_prices')->getData();
+ $product['tier_price'] = $tierPrice;
+ unset($product['entity_id']);
+ return $product;
+ }
}
From 0a1a807c5c3a17b0d80bdb34687b8b06cfd0c04f Mon Sep 17 00:00:00 2001
From: Nikita Shcherbatykh
Date: Fri, 2 Nov 2018 10:00:02 +0200
Subject: [PATCH 52/75] MAGETWO-95461: Cannot save product with Tier Prices
---
.../Magento/Catalog/Controller/Adminhtml/ProductTest.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/ProductTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/ProductTest.php
index ddd5edb21eb26..4761f13175d81 100644
--- a/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/ProductTest.php
+++ b/dev/tests/integration/testsuite/Magento/Catalog/Controller/Adminhtml/ProductTest.php
@@ -252,7 +252,7 @@ public function testSaveActionTierPrice(array $postData, array $tierPrice)
{
$postData['product'] = $this->getProductData($tierPrice);
$this->getRequest()->setPostValue($postData);
- $this->dispatch('backend/catalog/product/save/id/');
+ $this->dispatch('backend/catalog/product/save/id/' . $postData['id']);
$this->assertSessionMessages(
$this->contains('You saved the product.'),
MessageInterface::TYPE_SUCCESS
From 4c13ad766c85ea4514de90e0c9d0c035d5fc0172 Mon Sep 17 00:00:00 2001
From: Rostyslav Sabishchenko
Date: Fri, 2 Nov 2018 13:35:20 +0200
Subject: [PATCH 53/75] #18348 - In admin, last swatch option set to default
upon save
---
.../Swatches/view/adminhtml/web/js/product-attributes.js | 3 +++
1 file changed, 3 insertions(+)
diff --git a/app/code/Magento/Swatches/view/adminhtml/web/js/product-attributes.js b/app/code/Magento/Swatches/view/adminhtml/web/js/product-attributes.js
index 4c9df6ef657d7..3a40370fe8194 100644
--- a/app/code/Magento/Swatches/view/adminhtml/web/js/product-attributes.js
+++ b/app/code/Magento/Swatches/view/adminhtml/web/js/product-attributes.js
@@ -439,6 +439,9 @@ define([
activePanel.find('table input')
.each(function () {
+ if ($(this).is(':radio') && !$(this).prop("checked")) {
+ return;
+ }
swatchValues.push(this.name + '=' + $(this).val());
});
From 429815bee09f999ef3e38b93a5c097363fe2cbbd Mon Sep 17 00:00:00 2001
From: "al.kravchuk"
Date: Fri, 2 Nov 2018 16:42:45 +0200
Subject: [PATCH 54/75] magento/magento2#18323: Order confirmation email for
guest checkout does not include download links. - move save downloadable
items from 'save_commit_after' to 'save_after' event.
---
app/code/Magento/Downloadable/etc/events.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/code/Magento/Downloadable/etc/events.xml b/app/code/Magento/Downloadable/etc/events.xml
index e4f03ff238d4a..5a985fc33802e 100644
--- a/app/code/Magento/Downloadable/etc/events.xml
+++ b/app/code/Magento/Downloadable/etc/events.xml
@@ -6,10 +6,10 @@
*/
-->
-
+
-
+
From 52bfffc2d2f43891b27af2d6144c0b64be572f79 Mon Sep 17 00:00:00 2001
From: Vladyslav Podorozhnyi
Date: Fri, 2 Nov 2018 17:26:27 +0200
Subject: [PATCH 55/75] magento/magento2#14007: "Use in Layered Navigation:
Filterable (no results)" not working for `Price` attribute. - adjust comment
for "Use in Layered Navigation: Filterable (no results)" property to make it
more understandable
(cherry picked from commit e18df69)
---
.../Tab/Front/ProductAttributeFormBuildFrontTabObserver.php | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/app/code/Magento/LayeredNavigation/Observer/Edit/Tab/Front/ProductAttributeFormBuildFrontTabObserver.php b/app/code/Magento/LayeredNavigation/Observer/Edit/Tab/Front/ProductAttributeFormBuildFrontTabObserver.php
index fc1edeb1e2392..dc4d3579f4628 100644
--- a/app/code/Magento/LayeredNavigation/Observer/Edit/Tab/Front/ProductAttributeFormBuildFrontTabObserver.php
+++ b/app/code/Magento/LayeredNavigation/Observer/Edit/Tab/Front/ProductAttributeFormBuildFrontTabObserver.php
@@ -55,7 +55,11 @@ public function execute(\Magento\Framework\Event\Observer $observer)
'name' => 'is_filterable',
'label' => __("Use in Layered Navigation"),
'title' => __('Can be used only with catalog input type Yes/No, Dropdown, Multiple Select and Price'),
- 'note' => __('Can be used only with catalog input type Yes/No, Dropdown, Multiple Select and Price.'),
+ 'note' => __(
+ 'Can be used only with catalog input type Yes/No, Dropdown, Multiple Select and Price.
+ Price is not compatible with \'Filterable (no results)\' option -
+ it will make no affect on Price filter.'
+ ),
'values' => [
['value' => '0', 'label' => __('No')],
['value' => '1', 'label' => __('Filterable (with results)')],
From d3c36ea5de38847bd4cfab25afcc3896987622cc Mon Sep 17 00:00:00 2001
From: Mastiuhin Olexandr
Date: Mon, 5 Nov 2018 11:38:17 +0200
Subject: [PATCH 56/75] MAGETWO-94423: Admin users are deleted from role upon
Role save
---
.../Integration/Plugin/Model/AdminUser.php | 17 ++---
.../Adminhtml/User/Role/SaveRole.php | 63 ++++++++++++++-----
2 files changed, 55 insertions(+), 25 deletions(-)
diff --git a/app/code/Magento/Integration/Plugin/Model/AdminUser.php b/app/code/Magento/Integration/Plugin/Model/AdminUser.php
index df3766250caa7..80a459eda46fb 100644
--- a/app/code/Magento/Integration/Plugin/Model/AdminUser.php
+++ b/app/code/Magento/Integration/Plugin/Model/AdminUser.php
@@ -6,6 +6,8 @@
namespace Magento\Integration\Plugin\Model;
use Magento\Integration\Model\AdminTokenService;
+use Magento\Framework\DataObject;
+use Magento\User\Model\User;
/**
* Plugin to delete admin tokens when admin becomes inactive
@@ -29,16 +31,15 @@ public function __construct(
/**
* Check if admin is inactive - if so, invalidate their tokens
*
- * @param \Magento\User\Model\User $subject
- * @param \Magento\Framework\DataObject $object
- * @return $this
+ * @param User $subject
+ * @param DataObject $object
+ * @return User
+ * @throws \Magento\Framework\Exception\LocalizedException
*/
- public function afterSave(
- \Magento\User\Model\User $subject,
- \Magento\Framework\DataObject $object
- ) {
+ public function afterSave(User $subject, DataObject $object): User
+ {
$isActive = $object->getIsActive();
- if (isset($isActive) && $isActive == 0) {
+ if ($isActive !== null && $isActive == 0) {
$this->adminTokenService->revokeAdminAccessToken($object->getId());
}
return $subject;
diff --git a/app/code/Magento/User/Controller/Adminhtml/User/Role/SaveRole.php b/app/code/Magento/User/Controller/Adminhtml/User/Role/SaveRole.php
index c21e0ba7845a7..2ce9705ee1ceb 100644
--- a/app/code/Magento/User/Controller/Adminhtml/User/Role/SaveRole.php
+++ b/app/code/Magento/User/Controller/Adminhtml/User/Role/SaveRole.php
@@ -11,6 +11,7 @@
use Magento\Framework\Controller\ResultFactory;
use Magento\Framework\Exception\State\UserLockedException;
use Magento\Security\Model\SecurityCookie;
+use Magento\Framework\Exception\LocalizedException;
/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -74,10 +75,9 @@ public function execute()
$rid = $this->getRequest()->getParam('role_id', false);
$resource = $this->getRequest()->getParam('resource', false);
- $roleUsers = $this->getRequest()->getParam('in_role_user', null);
- parse_str($roleUsers, $roleUsers);
- $roleUsers = array_keys($roleUsers);
+ $oldRoleUsers = $this->parseRequestVariable('in_role_user_old');
+ $roleUsers = $this->parseRequestVariable('in_role_user');
$isAll = $this->getRequest()->getParam('all');
if ($isAll) {
$resource = [$this->_objectManager->get(\Magento\Framework\Acl\RootResource::class)->getId()];
@@ -104,12 +104,9 @@ public function execute()
$this->_rulesFactory->create()->setRoleId($role->getId())->setResources($resource)->saveRel();
- $this->processPreviousUsers($role);
-
- foreach ($roleUsers as $nRuid) {
- $this->_addUserToRole($nRuid, $role->getId());
- }
- $this->messageManager->addSuccess(__('You saved the role.'));
+ $this->processPreviousUsers($role, $oldRoleUsers);
+ $this->processCurrentUsers($role, $roleUsers);
+ $this->messageManager->addSuccessMessage(__('You saved the role.'));
} catch (UserLockedException $e) {
$this->_auth->logout();
$this->getSecurityCookie()->setLogoutReasonCookie(
@@ -119,10 +116,10 @@ public function execute()
} catch (\Magento\Framework\Exception\AuthenticationException $e) {
$this->messageManager->addError(__('You have entered an invalid password for current user.'));
return $this->saveDataToSessionAndRedirect($role, $this->getRequest()->getPostValue(), $resultRedirect);
- } catch (\Magento\Framework\Exception\LocalizedException $e) {
- $this->messageManager->addError($e->getMessage());
+ } catch (LocalizedException $e) {
+ $this->messageManager->addErrorMessage($e->getMessage());
} catch (\Exception $e) {
- $this->messageManager->addError(__('An error occurred while saving this role.'));
+ $this->messageManager->addErrorMessage(__('An error occurred while saving this role.'));
}
return $resultRedirect->setPath('*/*/');
@@ -146,17 +143,28 @@ protected function validateUser()
return $this;
}
+ /**
+ * Parse request value from string
+ *
+ * @param string $paramName
+ * @return array
+ */
+ private function parseRequestVariable($paramName): array
+ {
+ $value = $this->getRequest()->getParam($paramName, null);
+ parse_str($value, $value);
+ $value = array_keys($value);
+ return $value;
+ }
+
/**
* @param \Magento\Authorization\Model\Role $role
+ * @param array $oldRoleUsers
* @return $this
* @throws \Exception
*/
- protected function processPreviousUsers(\Magento\Authorization\Model\Role $role)
+ protected function processPreviousUsers(\Magento\Authorization\Model\Role $role, array $oldRoleUsers): self
{
- $oldRoleUsers = $this->getRequest()->getParam('in_role_user_old');
- parse_str($oldRoleUsers, $oldRoleUsers);
- $oldRoleUsers = array_keys($oldRoleUsers);
-
foreach ($oldRoleUsers as $oUid) {
$this->_deleteUserFromRole($oUid, $role->getId());
}
@@ -164,12 +172,33 @@ protected function processPreviousUsers(\Magento\Authorization\Model\Role $role)
return $this;
}
+ /**
+ * Processes users to be assigned to roles
+ *
+ * @param \Magento\Authorization\Model\Role $role
+ * @param array $roleUsers
+ * @return $this
+ */
+ private function processCurrentUsers(\Magento\Authorization\Model\Role $role, array $roleUsers): self
+ {
+ foreach ($roleUsers as $nRuid) {
+ try {
+ $this->_addUserToRole($nRuid, $role->getId());
+ } catch (LocalizedException $e) {
+ $this->messageManager->addErrorMessage($e->getMessage());
+ }
+ }
+
+ return $this;
+ }
+
/**
* Assign user to role
*
* @param int $userId
* @param int $roleId
* @return bool
+ * @throws LocalizedException
*/
protected function _addUserToRole($userId, $roleId)
{
From 9bce70e92d4b2292cbcb8670f9744bc020993fc3 Mon Sep 17 00:00:00 2001
From: Mastiuhin Olexandr
Date: Mon, 5 Nov 2018 15:44:07 +0200
Subject: [PATCH 57/75] MAGETWO-94423: Admin users are deleted from role upon
Role save
---
.../Controller/Adminhtml/User/Role/SaveRole.php | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/app/code/Magento/User/Controller/Adminhtml/User/Role/SaveRole.php b/app/code/Magento/User/Controller/Adminhtml/User/Role/SaveRole.php
index 2ce9705ee1ceb..7aa0d2368f67b 100644
--- a/app/code/Magento/User/Controller/Adminhtml/User/Role/SaveRole.php
+++ b/app/code/Magento/User/Controller/Adminhtml/User/Role/SaveRole.php
@@ -12,6 +12,7 @@
use Magento\Framework\Exception\State\UserLockedException;
use Magento\Security\Model\SecurityCookie;
use Magento\Framework\Exception\LocalizedException;
+use Magento\Authorization\Model\Role as RoleModel;
/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
@@ -149,7 +150,7 @@ protected function validateUser()
* @param string $paramName
* @return array
*/
- private function parseRequestVariable($paramName): array
+ private function parseRequestVariable(string $paramName): array
{
$value = $this->getRequest()->getParam($paramName, null);
parse_str($value, $value);
@@ -158,12 +159,12 @@ private function parseRequestVariable($paramName): array
}
/**
- * @param \Magento\Authorization\Model\Role $role
+ * @param RoleModel $role
* @param array $oldRoleUsers
* @return $this
* @throws \Exception
*/
- protected function processPreviousUsers(\Magento\Authorization\Model\Role $role, array $oldRoleUsers): self
+ protected function processPreviousUsers(RoleModel $role, array $oldRoleUsers): self
{
foreach ($oldRoleUsers as $oUid) {
$this->_deleteUserFromRole($oUid, $role->getId());
@@ -175,11 +176,11 @@ protected function processPreviousUsers(\Magento\Authorization\Model\Role $role,
/**
* Processes users to be assigned to roles
*
- * @param \Magento\Authorization\Model\Role $role
+ * @param RoleModel $role
* @param array $roleUsers
* @return $this
*/
- private function processCurrentUsers(\Magento\Authorization\Model\Role $role, array $roleUsers): self
+ private function processCurrentUsers(RoleModel $role, array $roleUsers): self
{
foreach ($roleUsers as $nRuid) {
try {
@@ -232,7 +233,7 @@ protected function _deleteUserFromRole($userId, $roleId)
}
/**
- * @param \Magento\Authorization\Model\Role $role
+ * @param RoleModel $role
* @param array $data
* @param \Magento\Backend\Model\View\Result\Redirect $resultRedirect
* @return \Magento\Backend\Model\View\Result\Redirect
From c8ead232063d3f4406cb77950643042643952609 Mon Sep 17 00:00:00 2001
From: Dmytro Salamatov
Date: Tue, 6 Nov 2018 00:11:18 +0200
Subject: [PATCH 58/75] magento/magento2#19071: Password strength indicator
shows No Password even when a password is entered
---
.../view/frontend/web/js/password-strength-indicator.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/code/Magento/Customer/view/frontend/web/js/password-strength-indicator.js b/app/code/Magento/Customer/view/frontend/web/js/password-strength-indicator.js
index 89d9b320c049d..9742e37f2df57 100644
--- a/app/code/Magento/Customer/view/frontend/web/js/password-strength-indicator.js
+++ b/app/code/Magento/Customer/view/frontend/web/js/password-strength-indicator.js
@@ -83,7 +83,7 @@ define([
} else {
isValid = $.validator.validateSingleElement(this.options.cache.input);
zxcvbnScore = zxcvbn(password).score;
- displayScore = isValid ? zxcvbnScore : 1;
+ displayScore = isValid && zxcvbnScore > 0 ? zxcvbnScore : 1;
}
}
From a5a0b0b5674b5fe19921d2cb9b403d0c6b9ecb54 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20Eisenf=C3=BChrer?=
Date: Sat, 6 Oct 2018 16:57:46 +0200
Subject: [PATCH 59/75] fix issue 12399
---
.../Controller/Adminhtml/Promo/Catalog/Save.php | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog/Save.php b/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog/Save.php
index f3046c58a389b..81541b8b2ff32 100644
--- a/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog/Save.php
+++ b/app/code/Magento/CatalogRule/Controller/Adminhtml/Promo/Catalog/Save.php
@@ -60,6 +60,17 @@ public function execute()
['request' => $this->getRequest()]
);
$data = $this->getRequest()->getPostValue();
+
+ $filterValues = ['from_date' => $this->_dateFilter];
+ if ($this->getRequest()->getParam('to_date')) {
+ $filterValues['to_date'] = $this->_dateFilter;
+ }
+ $inputFilter = new \Zend_Filter_Input(
+ $filterValues,
+ [],
+ $data
+ );
+ $data = $inputFilter->getUnescaped();
$id = $this->getRequest()->getParam('rule_id');
if ($id) {
$model = $ruleRepository->get($id);
From 09016828d776716fa6efac68df4a700477b604dd Mon Sep 17 00:00:00 2001
From: Stanislav Idolov
Date: Tue, 6 Nov 2018 16:47:07 +0200
Subject: [PATCH 60/75] magento-engcom/magento2ce#2308: Code style fixes
---
.../view/frontend/web/js/page-cache.js | 20 +++++++++++++------
.../adminhtml/web/js/product-attributes.js | 2 +-
2 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/app/code/Magento/PageCache/view/frontend/web/js/page-cache.js b/app/code/Magento/PageCache/view/frontend/web/js/page-cache.js
index 2a43ff29a3593..b8f0d14066707 100644
--- a/app/code/Magento/PageCache/view/frontend/web/js/page-cache.js
+++ b/app/code/Magento/PageCache/view/frontend/web/js/page-cache.js
@@ -42,7 +42,9 @@ define([
* @param {jQuery} element - Comment holder
*/
(function lookup(element) {
- var iframeHostName;
+ var iframeHostName,
+ contents,
+ elementContents;
// prevent cross origin iframe content reading
if ($(element).prop('tagName') === 'IFRAME') {
@@ -54,11 +56,17 @@ define([
}
}
- // rewrite jQuery contents()
- var contents = function (element) {
- return $.map(element, function (elem) {
+ /**
+ * Rewrite jQuery contents method
+ *
+ * @param {Object} el
+ * @returns {Object}
+ * @private
+ */
+ contents = function (el) {
+ return $.map(el, function (elem) {
try {
- return $.nodeName(elem, "iframe") ?
+ return $.nodeName(elem, 'iframe') ?
elem.contentDocument || (elem.contentWindow ? elem.contentWindow.document : []) :
$.merge([], elem.childNodes);
} catch (e) {
@@ -68,7 +76,7 @@ define([
});
};
- var elementContents = contents($(element));
+ elementContents = contents($(element));
$.each(elementContents, function (index, el) {
switch (el.nodeType) {
diff --git a/app/code/Magento/Swatches/view/adminhtml/web/js/product-attributes.js b/app/code/Magento/Swatches/view/adminhtml/web/js/product-attributes.js
index 3a40370fe8194..9534e039380d4 100644
--- a/app/code/Magento/Swatches/view/adminhtml/web/js/product-attributes.js
+++ b/app/code/Magento/Swatches/view/adminhtml/web/js/product-attributes.js
@@ -439,7 +439,7 @@ define([
activePanel.find('table input')
.each(function () {
- if ($(this).is(':radio') && !$(this).prop("checked")) {
+ if ($(this).is(':radio') && !$(this).prop('checked')) {
return;
}
swatchValues.push(this.name + '=' + $(this).val());
From 965a52268cfb7f1e82788ee62a1ac8af85baa897 Mon Sep 17 00:00:00 2001
From: Stanislav Idolov
Date: Tue, 6 Nov 2018 17:55:35 +0200
Subject: [PATCH 61/75] magento-engcom/magento2ce#2308: Code style fixes
---
app/code/Magento/PageCache/view/frontend/web/js/page-cache.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/app/code/Magento/PageCache/view/frontend/web/js/page-cache.js b/app/code/Magento/PageCache/view/frontend/web/js/page-cache.js
index b8f0d14066707..9ae916356d2b9 100644
--- a/app/code/Magento/PageCache/view/frontend/web/js/page-cache.js
+++ b/app/code/Magento/PageCache/view/frontend/web/js/page-cache.js
@@ -71,6 +71,7 @@ define([
$.merge([], elem.childNodes);
} catch (e) {
consoleLogger.error(e);
+
return [];
}
});
From a651b31ec990cdd06d4a605a46a602ac1def0048 Mon Sep 17 00:00:00 2001
From: "al.kravchuk"
Date: Tue, 6 Nov 2018 22:22:07 +0200
Subject: [PATCH 62/75] magento/magento#18901: Forgot password form should not
available while customer is logged in. - redirect logged in customers to My
Account.
---
.../Customer/Controller/Account/ForgotPassword.php | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/app/code/Magento/Customer/Controller/Account/ForgotPassword.php b/app/code/Magento/Customer/Controller/Account/ForgotPassword.php
index f115b64efebdd..cd2c46ff53043 100644
--- a/app/code/Magento/Customer/Controller/Account/ForgotPassword.php
+++ b/app/code/Magento/Customer/Controller/Account/ForgotPassword.php
@@ -40,10 +40,17 @@ public function __construct(
/**
* Forgot customer password page
*
- * @return \Magento\Framework\View\Result\Page
+ * @return \Magento\Framework\Controller\Result\Redirect|\Magento\Framework\View\Result\Page
*/
public function execute()
{
+ if ($this->session->isLoggedIn()) {
+ /** @var \Magento\Framework\Controller\Result\Redirect $resultRedirect */
+ $resultRedirect = $this->resultRedirectFactory->create();
+ $resultRedirect->setPath('*/*/');
+ return $resultRedirect;
+ }
+
/** @var \Magento\Framework\View\Result\Page $resultPage */
$resultPage = $this->resultPageFactory->create();
$resultPage->getLayout()->getBlock('forgotPassword')->setEmailValue($this->session->getForgottenEmail());
From d2392b1a03d8c318ed8751c1b46be3966064b4c0 Mon Sep 17 00:00:00 2001
From: Kevin Kozan
Date: Tue, 6 Nov 2018 15:21:48 -0600
Subject: [PATCH 63/75] MQE-1339: Bump MFTF version in Magento
- MFTF version upgrade to 2.3.10
---
composer.json | 2 +-
composer.lock | 207 ++++++++++++++++++++++++++------------------------
2 files changed, 107 insertions(+), 102 deletions(-)
diff --git a/composer.json b/composer.json
index 5a35f7c94a209..9c1ad3672d231 100644
--- a/composer.json
+++ b/composer.json
@@ -74,7 +74,7 @@
"ramsey/uuid": "~3.7.3"
},
"require-dev": {
- "magento/magento2-functional-testing-framework": "2.3.6",
+ "magento/magento2-functional-testing-framework": "2.3.10",
"phpunit/phpunit": "~6.2.0",
"squizlabs/php_codesniffer": "3.2.2",
"phpmd/phpmd": "@stable",
diff --git a/composer.lock b/composer.lock
index c765d467dfd0c..1097aeaa010b2 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "c9603f6f68dc6d6cc1ca6b6be242da74",
+ "content-hash": "ed7440f5db63647b663968c08869cf6d",
"packages": [
{
"name": "braintree/braintree_php",
@@ -204,16 +204,16 @@
},
{
"name": "composer/ca-bundle",
- "version": "1.1.2",
+ "version": "1.1.3",
"source": {
"type": "git",
"url": "https://github.com/composer/ca-bundle.git",
- "reference": "46afded9720f40b9dc63542af4e3e43a1177acb0"
+ "reference": "8afa52cd417f4ec417b4bfe86b68106538a87660"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/composer/ca-bundle/zipball/46afded9720f40b9dc63542af4e3e43a1177acb0",
- "reference": "46afded9720f40b9dc63542af4e3e43a1177acb0",
+ "url": "https://api.github.com/repos/composer/ca-bundle/zipball/8afa52cd417f4ec417b4bfe86b68106538a87660",
+ "reference": "8afa52cd417f4ec417b4bfe86b68106538a87660",
"shasum": ""
},
"require": {
@@ -256,7 +256,7 @@
"ssl",
"tls"
],
- "time": "2018-08-08T08:57:40+00:00"
+ "time": "2018-10-18T06:09:13+00:00"
},
{
"name": "composer/composer",
@@ -399,16 +399,16 @@
},
{
"name": "composer/spdx-licenses",
- "version": "1.4.0",
+ "version": "1.5.0",
"source": {
"type": "git",
"url": "https://github.com/composer/spdx-licenses.git",
- "reference": "cb17687e9f936acd7e7245ad3890f953770dec1b"
+ "reference": "7a9556b22bd9d4df7cad89876b00af58ef20d3a2"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/composer/spdx-licenses/zipball/cb17687e9f936acd7e7245ad3890f953770dec1b",
- "reference": "cb17687e9f936acd7e7245ad3890f953770dec1b",
+ "url": "https://api.github.com/repos/composer/spdx-licenses/zipball/7a9556b22bd9d4df7cad89876b00af58ef20d3a2",
+ "reference": "7a9556b22bd9d4df7cad89876b00af58ef20d3a2",
"shasum": ""
},
"require": {
@@ -456,7 +456,7 @@
"spdx",
"validator"
],
- "time": "2018-04-30T10:33:04+00:00"
+ "time": "2018-11-01T09:45:54+00:00"
},
{
"name": "container-interop/container-interop",
@@ -719,16 +719,16 @@
},
{
"name": "monolog/monolog",
- "version": "1.23.0",
+ "version": "1.24.0",
"source": {
"type": "git",
"url": "https://github.com/Seldaek/monolog.git",
- "reference": "fd8c787753b3a2ad11bc60c063cff1358a32a3b4"
+ "reference": "bfc9ebb28f97e7a24c45bdc3f0ff482e47bb0266"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/Seldaek/monolog/zipball/fd8c787753b3a2ad11bc60c063cff1358a32a3b4",
- "reference": "fd8c787753b3a2ad11bc60c063cff1358a32a3b4",
+ "url": "https://api.github.com/repos/Seldaek/monolog/zipball/bfc9ebb28f97e7a24c45bdc3f0ff482e47bb0266",
+ "reference": "bfc9ebb28f97e7a24c45bdc3f0ff482e47bb0266",
"shasum": ""
},
"require": {
@@ -793,7 +793,7 @@
"logging",
"psr-3"
],
- "time": "2017-06-19T01:22:40+00:00"
+ "time": "2018-11-05T09:00:11+00:00"
},
{
"name": "oyejorge/less.php",
@@ -977,16 +977,16 @@
},
{
"name": "phpseclib/phpseclib",
- "version": "2.0.11",
+ "version": "2.0.12",
"source": {
"type": "git",
"url": "https://github.com/phpseclib/phpseclib.git",
- "reference": "7053f06f91b3de78e143d430e55a8f7889efc08b"
+ "reference": "8814dc7841db159daed0b32c2b08fb7e03c6afe7"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/7053f06f91b3de78e143d430e55a8f7889efc08b",
- "reference": "7053f06f91b3de78e143d430e55a8f7889efc08b",
+ "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/8814dc7841db159daed0b32c2b08fb7e03c6afe7",
+ "reference": "8814dc7841db159daed0b32c2b08fb7e03c6afe7",
"shasum": ""
},
"require": {
@@ -1065,7 +1065,7 @@
"x.509",
"x509"
],
- "time": "2018-04-15T16:55:05+00:00"
+ "time": "2018-11-04T05:45:48+00:00"
},
{
"name": "psr/container",
@@ -1436,16 +1436,16 @@
},
{
"name": "symfony/console",
- "version": "v2.8.46",
+ "version": "v2.8.47",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
- "reference": "aca0dcc0c75496e17e2aa0303bb9c8e6d79ed789"
+ "reference": "48ed63767c4add573fb3e9e127d3426db27f78e8"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/console/zipball/aca0dcc0c75496e17e2aa0303bb9c8e6d79ed789",
- "reference": "aca0dcc0c75496e17e2aa0303bb9c8e6d79ed789",
+ "url": "https://api.github.com/repos/symfony/console/zipball/48ed63767c4add573fb3e9e127d3426db27f78e8",
+ "reference": "48ed63767c4add573fb3e9e127d3426db27f78e8",
"shasum": ""
},
"require": {
@@ -1493,7 +1493,7 @@
],
"description": "Symfony Console Component",
"homepage": "https://symfony.com",
- "time": "2018-09-30T03:33:07+00:00"
+ "time": "2018-10-30T14:26:34+00:00"
},
{
"name": "symfony/debug",
@@ -1554,16 +1554,16 @@
},
{
"name": "symfony/event-dispatcher",
- "version": "v2.8.46",
+ "version": "v2.8.47",
"source": {
"type": "git",
"url": "https://github.com/symfony/event-dispatcher.git",
- "reference": "84ae343f39947aa084426ed1138bb96bf94d1f12"
+ "reference": "76494bc38ff38d90d01913d23b5271acd4d78dd3"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/84ae343f39947aa084426ed1138bb96bf94d1f12",
- "reference": "84ae343f39947aa084426ed1138bb96bf94d1f12",
+ "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/76494bc38ff38d90d01913d23b5271acd4d78dd3",
+ "reference": "76494bc38ff38d90d01913d23b5271acd4d78dd3",
"shasum": ""
},
"require": {
@@ -1610,11 +1610,11 @@
],
"description": "Symfony EventDispatcher Component",
"homepage": "https://symfony.com",
- "time": "2018-07-26T09:03:18+00:00"
+ "time": "2018-10-20T23:16:31+00:00"
},
{
"name": "symfony/filesystem",
- "version": "v3.4.17",
+ "version": "v3.4.18",
"source": {
"type": "git",
"url": "https://github.com/symfony/filesystem.git",
@@ -1664,7 +1664,7 @@
},
{
"name": "symfony/finder",
- "version": "v3.4.17",
+ "version": "v3.4.18",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
@@ -1713,7 +1713,7 @@
},
{
"name": "symfony/polyfill-ctype",
- "version": "v1.9.0",
+ "version": "v1.10.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
@@ -1771,16 +1771,16 @@
},
{
"name": "symfony/polyfill-mbstring",
- "version": "v1.9.0",
+ "version": "v1.10.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
- "reference": "d0cd638f4634c16d8df4508e847f14e9e43168b8"
+ "reference": "c79c051f5b3a46be09205c73b80b346e4153e494"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/d0cd638f4634c16d8df4508e847f14e9e43168b8",
- "reference": "d0cd638f4634c16d8df4508e847f14e9e43168b8",
+ "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/c79c051f5b3a46be09205c73b80b346e4153e494",
+ "reference": "c79c051f5b3a46be09205c73b80b346e4153e494",
"shasum": ""
},
"require": {
@@ -1826,20 +1826,20 @@
"portable",
"shim"
],
- "time": "2018-08-06T14:22:27+00:00"
+ "time": "2018-09-21T13:07:52+00:00"
},
{
"name": "symfony/process",
- "version": "v2.8.46",
+ "version": "v2.8.47",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
- "reference": "f09e21b7c5aba06c47bbfad9cbcf13ac7f0db0a6"
+ "reference": "a15cb61190c6fe37168600922e82295eb5e5449b"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/process/zipball/f09e21b7c5aba06c47bbfad9cbcf13ac7f0db0a6",
- "reference": "f09e21b7c5aba06c47bbfad9cbcf13ac7f0db0a6",
+ "url": "https://api.github.com/repos/symfony/process/zipball/a15cb61190c6fe37168600922e82295eb5e5449b",
+ "reference": "a15cb61190c6fe37168600922e82295eb5e5449b",
"shasum": ""
},
"require": {
@@ -1875,7 +1875,7 @@
],
"description": "Symfony Process Component",
"homepage": "https://symfony.com",
- "time": "2018-09-06T17:11:15+00:00"
+ "time": "2018-10-05T07:35:28+00:00"
},
{
"name": "tedivm/jshrink",
@@ -4443,16 +4443,16 @@
},
{
"name": "consolidation/config",
- "version": "1.1.0",
+ "version": "1.1.1",
"source": {
"type": "git",
"url": "https://github.com/consolidation/config.git",
- "reference": "c9fc25e9088a708637e18a256321addc0670e578"
+ "reference": "925231dfff32f05b787e1fddb265e789b939cf4c"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/consolidation/config/zipball/c9fc25e9088a708637e18a256321addc0670e578",
- "reference": "c9fc25e9088a708637e18a256321addc0670e578",
+ "url": "https://api.github.com/repos/consolidation/config/zipball/925231dfff32f05b787e1fddb265e789b939cf4c",
+ "reference": "925231dfff32f05b787e1fddb265e789b939cf4c",
"shasum": ""
},
"require": {
@@ -4493,7 +4493,7 @@
}
],
"description": "Provide configuration services for a commandline tool.",
- "time": "2018-08-07T22:57:00+00:00"
+ "time": "2018-10-24T17:55:35+00:00"
},
{
"name": "consolidation/log",
@@ -4546,19 +4546,20 @@
},
{
"name": "consolidation/output-formatters",
- "version": "3.2.1",
+ "version": "3.4.0",
"source": {
"type": "git",
"url": "https://github.com/consolidation/output-formatters.git",
- "reference": "d78ef59aea19d3e2e5a23f90a055155ee78a0ad5"
+ "reference": "a942680232094c4a5b21c0b7e54c20cce623ae19"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/consolidation/output-formatters/zipball/d78ef59aea19d3e2e5a23f90a055155ee78a0ad5",
- "reference": "d78ef59aea19d3e2e5a23f90a055155ee78a0ad5",
+ "url": "https://api.github.com/repos/consolidation/output-formatters/zipball/a942680232094c4a5b21c0b7e54c20cce623ae19",
+ "reference": "a942680232094c4a5b21c0b7e54c20cce623ae19",
"shasum": ""
},
"require": {
+ "dflydev/dot-access-data": "^1.1.0",
"php": ">=5.4.0",
"symfony/console": "^2.8|^3|^4",
"symfony/finder": "^2.5|^3|^4"
@@ -4597,7 +4598,7 @@
}
],
"description": "Format text by applying transformations provided by plug-in formatters.",
- "time": "2018-05-25T18:02:34+00:00"
+ "time": "2018-10-19T22:35:38+00:00"
},
{
"name": "consolidation/robo",
@@ -4682,16 +4683,16 @@
},
{
"name": "consolidation/self-update",
- "version": "1.1.3",
+ "version": "1.1.5",
"source": {
"type": "git",
"url": "https://github.com/consolidation/self-update.git",
- "reference": "de33822f907e0beb0ffad24cf4b1b4fae5ada318"
+ "reference": "a1c273b14ce334789825a09d06d4c87c0a02ad54"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/consolidation/self-update/zipball/de33822f907e0beb0ffad24cf4b1b4fae5ada318",
- "reference": "de33822f907e0beb0ffad24cf4b1b4fae5ada318",
+ "url": "https://api.github.com/repos/consolidation/self-update/zipball/a1c273b14ce334789825a09d06d4c87c0a02ad54",
+ "reference": "a1c273b14ce334789825a09d06d4c87c0a02ad54",
"shasum": ""
},
"require": {
@@ -4728,7 +4729,7 @@
}
],
"description": "Provides a self:update command for Symfony Console applications.",
- "time": "2018-08-24T17:01:46+00:00"
+ "time": "2018-10-28T01:52:03+00:00"
},
{
"name": "dflydev/dot-access-data",
@@ -5670,16 +5671,16 @@
},
{
"name": "jms/metadata",
- "version": "1.6.0",
+ "version": "1.7.0",
"source": {
"type": "git",
"url": "https://github.com/schmittjoh/metadata.git",
- "reference": "6a06970a10e0a532fb52d3959547123b84a3b3ab"
+ "reference": "e5854ab1aa643623dc64adde718a8eec32b957a8"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/schmittjoh/metadata/zipball/6a06970a10e0a532fb52d3959547123b84a3b3ab",
- "reference": "6a06970a10e0a532fb52d3959547123b84a3b3ab",
+ "url": "https://api.github.com/repos/schmittjoh/metadata/zipball/e5854ab1aa643623dc64adde718a8eec32b957a8",
+ "reference": "e5854ab1aa643623dc64adde718a8eec32b957a8",
"shasum": ""
},
"require": {
@@ -5702,9 +5703,13 @@
},
"notification-url": "https://packagist.org/downloads/",
"license": [
- "Apache-2.0"
+ "MIT"
],
"authors": [
+ {
+ "name": "Asmir Mustafic",
+ "email": "goetas@gmail.com"
+ },
{
"name": "Johannes M. Schmitt",
"email": "schmittjoh@gmail.com"
@@ -5717,7 +5722,7 @@
"xml",
"yaml"
],
- "time": "2016-12-05T10:18:33+00:00"
+ "time": "2018-10-26T12:40:10+00:00"
},
{
"name": "jms/parser-lib",
@@ -5972,16 +5977,16 @@
},
{
"name": "magento/magento2-functional-testing-framework",
- "version": "2.3.6",
+ "version": "2.3.10",
"source": {
"type": "git",
"url": "https://github.com/magento/magento2-functional-testing-framework.git",
- "reference": "57021e12ded213a0031c4d4f6293e06ce6f144ce"
+ "reference": "7cd80dbf1af405473f1a976c3b75097a0f27725d"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/magento/magento2-functional-testing-framework/zipball/57021e12ded213a0031c4d4f6293e06ce6f144ce",
- "reference": "57021e12ded213a0031c4d4f6293e06ce6f144ce",
+ "url": "https://api.github.com/repos/magento/magento2-functional-testing-framework/zipball/7cd80dbf1af405473f1a976c3b75097a0f27725d",
+ "reference": "7cd80dbf1af405473f1a976c3b75097a0f27725d",
"shasum": ""
},
"require": {
@@ -6039,7 +6044,7 @@
"magento",
"testing"
],
- "time": "2018-09-05T15:17:20+00:00"
+ "time": "2018-11-06T20:54:16+00:00"
},
{
"name": "moontoast/math",
@@ -7796,7 +7801,7 @@
},
{
"name": "symfony/browser-kit",
- "version": "v3.4.17",
+ "version": "v3.4.18",
"source": {
"type": "git",
"url": "https://github.com/symfony/browser-kit.git",
@@ -7853,16 +7858,16 @@
},
{
"name": "symfony/config",
- "version": "v3.4.17",
+ "version": "v3.4.18",
"source": {
"type": "git",
"url": "https://github.com/symfony/config.git",
- "reference": "e5389132dc6320682de3643091121c048ff796b3"
+ "reference": "99b2fa8acc244e656cdf324ff419fbe6fd300a4d"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/config/zipball/e5389132dc6320682de3643091121c048ff796b3",
- "reference": "e5389132dc6320682de3643091121c048ff796b3",
+ "url": "https://api.github.com/repos/symfony/config/zipball/99b2fa8acc244e656cdf324ff419fbe6fd300a4d",
+ "reference": "99b2fa8acc244e656cdf324ff419fbe6fd300a4d",
"shasum": ""
},
"require": {
@@ -7913,11 +7918,11 @@
],
"description": "Symfony Config Component",
"homepage": "https://symfony.com",
- "time": "2018-09-08T13:15:14+00:00"
+ "time": "2018-10-31T09:06:03+00:00"
},
{
"name": "symfony/css-selector",
- "version": "v3.4.17",
+ "version": "v3.4.18",
"source": {
"type": "git",
"url": "https://github.com/symfony/css-selector.git",
@@ -8040,7 +8045,7 @@
},
{
"name": "symfony/dom-crawler",
- "version": "v3.4.17",
+ "version": "v3.4.18",
"source": {
"type": "git",
"url": "https://github.com/symfony/dom-crawler.git",
@@ -8097,16 +8102,16 @@
},
{
"name": "symfony/http-foundation",
- "version": "v3.4.17",
+ "version": "v3.4.18",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-foundation.git",
- "reference": "3a4498236ade473c52b92d509303e5fd1b211ab1"
+ "reference": "5aea7a86ca3203dd7a257e765b4b9c9cfd01c6c0"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/http-foundation/zipball/3a4498236ade473c52b92d509303e5fd1b211ab1",
- "reference": "3a4498236ade473c52b92d509303e5fd1b211ab1",
+ "url": "https://api.github.com/repos/symfony/http-foundation/zipball/5aea7a86ca3203dd7a257e765b4b9c9cfd01c6c0",
+ "reference": "5aea7a86ca3203dd7a257e765b4b9c9cfd01c6c0",
"shasum": ""
},
"require": {
@@ -8147,11 +8152,11 @@
],
"description": "Symfony HttpFoundation Component",
"homepage": "https://symfony.com",
- "time": "2018-10-03T08:48:18+00:00"
+ "time": "2018-10-31T08:57:11+00:00"
},
{
"name": "symfony/options-resolver",
- "version": "v3.4.17",
+ "version": "v3.4.18",
"source": {
"type": "git",
"url": "https://github.com/symfony/options-resolver.git",
@@ -8205,7 +8210,7 @@
},
{
"name": "symfony/polyfill-php54",
- "version": "v1.9.0",
+ "version": "v1.10.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php54.git",
@@ -8263,16 +8268,16 @@
},
{
"name": "symfony/polyfill-php55",
- "version": "v1.9.0",
+ "version": "v1.10.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php55.git",
- "reference": "578b8528da843de0fc65ec395900fa3181f2ead7"
+ "reference": "42a4c00a347625ac8853c3358c47eeadc7fd4e96"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-php55/zipball/578b8528da843de0fc65ec395900fa3181f2ead7",
- "reference": "578b8528da843de0fc65ec395900fa3181f2ead7",
+ "url": "https://api.github.com/repos/symfony/polyfill-php55/zipball/42a4c00a347625ac8853c3358c47eeadc7fd4e96",
+ "reference": "42a4c00a347625ac8853c3358c47eeadc7fd4e96",
"shasum": ""
},
"require": {
@@ -8315,20 +8320,20 @@
"portable",
"shim"
],
- "time": "2018-08-06T14:22:27+00:00"
+ "time": "2018-10-31T12:13:01+00:00"
},
{
"name": "symfony/polyfill-php70",
- "version": "v1.9.0",
+ "version": "v1.10.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php70.git",
- "reference": "1e24b0c4a56d55aaf368763a06c6d1c7d3194934"
+ "reference": "6b88000cdd431cd2e940caa2cb569201f3f84224"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/1e24b0c4a56d55aaf368763a06c6d1c7d3194934",
- "reference": "1e24b0c4a56d55aaf368763a06c6d1c7d3194934",
+ "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/6b88000cdd431cd2e940caa2cb569201f3f84224",
+ "reference": "6b88000cdd431cd2e940caa2cb569201f3f84224",
"shasum": ""
},
"require": {
@@ -8374,20 +8379,20 @@
"portable",
"shim"
],
- "time": "2018-08-06T14:22:27+00:00"
+ "time": "2018-09-21T06:26:08+00:00"
},
{
"name": "symfony/polyfill-php72",
- "version": "v1.9.0",
+ "version": "v1.10.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php72.git",
- "reference": "95c50420b0baed23852452a7f0c7b527303ed5ae"
+ "reference": "9050816e2ca34a8e916c3a0ae8b9c2fccf68b631"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/95c50420b0baed23852452a7f0c7b527303ed5ae",
- "reference": "95c50420b0baed23852452a7f0c7b527303ed5ae",
+ "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/9050816e2ca34a8e916c3a0ae8b9c2fccf68b631",
+ "reference": "9050816e2ca34a8e916c3a0ae8b9c2fccf68b631",
"shasum": ""
},
"require": {
@@ -8429,11 +8434,11 @@
"portable",
"shim"
],
- "time": "2018-08-06T14:22:27+00:00"
+ "time": "2018-09-21T13:07:52+00:00"
},
{
"name": "symfony/stopwatch",
- "version": "v3.4.17",
+ "version": "v3.4.18",
"source": {
"type": "git",
"url": "https://github.com/symfony/stopwatch.git",
From e67d68847412edb049d03b97b49110344032efcd Mon Sep 17 00:00:00 2001
From: Serhiy Yelahin
Date: Wed, 7 Nov 2018 14:26:31 +0200
Subject: [PATCH 64/75] MAGETWO-93780: CAPTCHA does not appear in "Log in"
popup window
---
app/code/Magento/Customer/Controller/Ajax/Login.php | 7 +++++--
.../Checkout/Test/TestStep/SelectCheckoutMethodStep.php | 1 +
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/app/code/Magento/Customer/Controller/Ajax/Login.php b/app/code/Magento/Customer/Controller/Ajax/Login.php
index ab4e411243d28..9aa76d6202bc9 100644
--- a/app/code/Magento/Customer/Controller/Ajax/Login.php
+++ b/app/code/Magento/Customer/Controller/Ajax/Login.php
@@ -7,8 +7,6 @@
namespace Magento\Customer\Controller\Ajax;
use Magento\Customer\Api\AccountManagementInterface;
-use Magento\Framework\Exception\EmailNotConfirmedException;
-use Magento\Framework\Exception\InvalidEmailOrPasswordException;
use Magento\Framework\App\ObjectManager;
use Magento\Customer\Model\Account\Redirect as AccountRedirect;
use Magento\Framework\App\Config\ScopeConfigInterface;
@@ -70,6 +68,11 @@ class Login extends \Magento\Framework\App\Action\Action
*/
private $cookieMetadataFactory;
+ /**
+ * @var \Magento\Customer\Model\Session
+ */
+ private $customerSession;
+
/**
* Initialize Login controller
*
diff --git a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/SelectCheckoutMethodStep.php b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/SelectCheckoutMethodStep.php
index d951d84bab78d..d16da19cfe8b8 100644
--- a/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/SelectCheckoutMethodStep.php
+++ b/dev/tests/functional/tests/app/Magento/Checkout/Test/TestStep/SelectCheckoutMethodStep.php
@@ -107,6 +107,7 @@ private function processLogin()
if ($this->checkoutMethod === 'login') {
if ($this->checkoutOnepage->getAuthenticationPopupBlock()->isVisible()) {
$this->checkoutOnepage->getAuthenticationPopupBlock()->loginCustomer($this->customer);
+ sleep(5);
$this->clickProceedToCheckoutStep->run();
} else {
$this->checkoutOnepage->getLoginBlock()->loginCustomer($this->customer);
From 101c16cf756e965b5e8923ace819b9314fa6968f Mon Sep 17 00:00:00 2001
From: Serhiy Yelahin
Date: Wed, 7 Nov 2018 15:05:03 +0200
Subject: [PATCH 65/75] MAGETWO-95990: Customer address issue when creating or
updating via API
---
.../ResourceModel/CustomerRepository.php | 99 +++++-----
.../ResourceModel/CustomerRepositoryTest.php | 180 +++++++++++++-----
2 files changed, 186 insertions(+), 93 deletions(-)
diff --git a/app/code/Magento/Customer/Model/ResourceModel/CustomerRepository.php b/app/code/Magento/Customer/Model/ResourceModel/CustomerRepository.php
index 29f97d9f643a7..9e745769e2c36 100644
--- a/app/code/Magento/Customer/Model/ResourceModel/CustomerRepository.php
+++ b/app/code/Magento/Customer/Model/ResourceModel/CustomerRepository.php
@@ -7,69 +7,80 @@
namespace Magento\Customer\Model\ResourceModel;
use Magento\Customer\Api\CustomerMetadataInterface;
-use Magento\Customer\Model\Delegation\Data\NewOperation;
+use Magento\Customer\Api\Data\CustomerSearchResultsInterfaceFactory;
+use Magento\Framework\Api\ExtensibleDataObjectConverter;
+use Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface;
+use Magento\Customer\Model\CustomerFactory;
+use Magento\Customer\Model\CustomerRegistry;
+use Magento\Customer\Model\Data\CustomerSecureFactory;
use Magento\Customer\Model\Customer\NotificationStorage;
+use Magento\Customer\Model\Delegation\Data\NewOperation;
+use Magento\Customer\Api\CustomerRepositoryInterface;
use Magento\Framework\Api\DataObjectHelper;
use Magento\Framework\Api\ImageProcessorInterface;
use Magento\Framework\Api\SearchCriteria\CollectionProcessorInterface;
use Magento\Framework\Api\SearchCriteriaInterface;
+use Magento\Framework\Api\Search\FilterGroup;
+use Magento\Framework\Event\ManagerInterface;
use Magento\Customer\Model\Delegation\Storage as DelegatedStorage;
use Magento\Framework\App\ObjectManager;
+use Magento\Store\Model\StoreManagerInterface;
/**
* Customer repository.
+ *
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @SuppressWarnings(PHPMD.TooManyFields)
*/
-class CustomerRepository implements \Magento\Customer\Api\CustomerRepositoryInterface
+class CustomerRepository implements CustomerRepositoryInterface
{
/**
- * @var \Magento\Customer\Model\CustomerFactory
+ * @var CustomerFactory
*/
protected $customerFactory;
/**
- * @var \Magento\Customer\Model\Data\CustomerSecureFactory
+ * @var CustomerSecureFactory
*/
protected $customerSecureFactory;
/**
- * @var \Magento\Customer\Model\CustomerRegistry
+ * @var CustomerRegistry
*/
protected $customerRegistry;
/**
- * @var \Magento\Customer\Model\ResourceModel\AddressRepository
+ * @var AddressRepository
*/
protected $addressRepository;
/**
- * @var \Magento\Customer\Model\ResourceModel\Customer
+ * @var Customer
*/
protected $customerResourceModel;
/**
- * @var \Magento\Customer\Api\CustomerMetadataInterface
+ * @var CustomerMetadataInterface
*/
protected $customerMetadata;
/**
- * @var \Magento\Customer\Api\Data\CustomerSearchResultsInterfaceFactory
+ * @var CustomerSearchResultsInterfaceFactory
*/
protected $searchResultsFactory;
/**
- * @var \Magento\Framework\Event\ManagerInterface
+ * @var ManagerInterface
*/
protected $eventManager;
/**
- * @var \Magento\Store\Model\StoreManagerInterface
+ * @var StoreManagerInterface
*/
protected $storeManager;
/**
- * @var \Magento\Framework\Api\ExtensibleDataObjectConverter
+ * @var ExtensibleDataObjectConverter
*/
protected $extensibleDataObjectConverter;
@@ -84,7 +95,7 @@ class CustomerRepository implements \Magento\Customer\Api\CustomerRepositoryInte
protected $imageProcessor;
/**
- * @var \Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface
+ * @var JoinProcessorInterface
*/
protected $extensionAttributesJoinProcessor;
@@ -104,38 +115,38 @@ class CustomerRepository implements \Magento\Customer\Api\CustomerRepositoryInte
private $delegatedStorage;
/**
- * @param \Magento\Customer\Model\CustomerFactory $customerFactory
- * @param \Magento\Customer\Model\Data\CustomerSecureFactory $customerSecureFactory
- * @param \Magento\Customer\Model\CustomerRegistry $customerRegistry
- * @param \Magento\Customer\Model\ResourceModel\AddressRepository $addressRepository
- * @param \Magento\Customer\Model\ResourceModel\Customer $customerResourceModel
- * @param \Magento\Customer\Api\CustomerMetadataInterface $customerMetadata
- * @param \Magento\Customer\Api\Data\CustomerSearchResultsInterfaceFactory $searchResultsFactory
- * @param \Magento\Framework\Event\ManagerInterface $eventManager
- * @param \Magento\Store\Model\StoreManagerInterface $storeManager
- * @param \Magento\Framework\Api\ExtensibleDataObjectConverter $extensibleDataObjectConverter
+ * @param CustomerFactory $customerFactory
+ * @param CustomerSecureFactory $customerSecureFactory
+ * @param CustomerRegistry $customerRegistry
+ * @param AddressRepository $addressRepository
+ * @param Customer $customerResourceModel
+ * @param CustomerMetadataInterface $customerMetadata
+ * @param CustomerSearchResultsInterfaceFactory $searchResultsFactory
+ * @param ManagerInterface $eventManager
+ * @param StoreManagerInterface $storeManager
+ * @param ExtensibleDataObjectConverter $extensibleDataObjectConverter
* @param DataObjectHelper $dataObjectHelper
* @param ImageProcessorInterface $imageProcessor
- * @param \Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface $extensionAttributesJoinProcessor
+ * @param JoinProcessorInterface $extensionAttributesJoinProcessor
* @param CollectionProcessorInterface $collectionProcessor
* @param NotificationStorage $notificationStorage
* @param DelegatedStorage|null $delegatedStorage
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/
public function __construct(
- \Magento\Customer\Model\CustomerFactory $customerFactory,
- \Magento\Customer\Model\Data\CustomerSecureFactory $customerSecureFactory,
- \Magento\Customer\Model\CustomerRegistry $customerRegistry,
- \Magento\Customer\Model\ResourceModel\AddressRepository $addressRepository,
- \Magento\Customer\Model\ResourceModel\Customer $customerResourceModel,
- \Magento\Customer\Api\CustomerMetadataInterface $customerMetadata,
- \Magento\Customer\Api\Data\CustomerSearchResultsInterfaceFactory $searchResultsFactory,
- \Magento\Framework\Event\ManagerInterface $eventManager,
- \Magento\Store\Model\StoreManagerInterface $storeManager,
- \Magento\Framework\Api\ExtensibleDataObjectConverter $extensibleDataObjectConverter,
+ CustomerFactory $customerFactory,
+ CustomerSecureFactory $customerSecureFactory,
+ CustomerRegistry $customerRegistry,
+ AddressRepository $addressRepository,
+ Customer $customerResourceModel,
+ CustomerMetadataInterface $customerMetadata,
+ CustomerSearchResultsInterfaceFactory $searchResultsFactory,
+ ManagerInterface $eventManager,
+ StoreManagerInterface $storeManager,
+ ExtensibleDataObjectConverter $extensibleDataObjectConverter,
DataObjectHelper $dataObjectHelper,
ImageProcessorInterface $imageProcessor,
- \Magento\Framework\Api\ExtensionAttribute\JoinProcessorInterface $extensionAttributesJoinProcessor,
+ JoinProcessorInterface $extensionAttributesJoinProcessor,
CollectionProcessorInterface $collectionProcessor,
NotificationStorage $notificationStorage,
DelegatedStorage $delegatedStorage = null
@@ -155,8 +166,7 @@ public function __construct(
$this->extensionAttributesJoinProcessor = $extensionAttributesJoinProcessor;
$this->collectionProcessor = $collectionProcessor;
$this->notificationStorage = $notificationStorage;
- $this->delegatedStorage = $delegatedStorage
- ?? ObjectManager::getInstance()->get(DelegatedStorage::class);
+ $this->delegatedStorage = $delegatedStorage ?? ObjectManager::getInstance()->get(DelegatedStorage::class);
}
/**
@@ -214,7 +224,7 @@ public function save(\Magento\Customer\Api\Data\CustomerInterface $customer, $pa
$customerModel->setRpToken(null);
$customerModel->setRpTokenCreatedAt(null);
}
- if (!array_key_exists('default_billing', $customerArr)
+ if (!array_key_exists('addresses', $customerArr)
&& null !== $prevCustomerDataArr
&& array_key_exists('default_billing', $prevCustomerDataArr)
) {
@@ -222,7 +232,7 @@ public function save(\Magento\Customer\Api\Data\CustomerInterface $customer, $pa
$prevCustomerDataArr['default_billing']
);
}
- if (!array_key_exists('default_shipping', $customerArr)
+ if (!array_key_exists('addresses', $customerArr)
&& null !== $prevCustomerDataArr
&& array_key_exists('default_shipping', $prevCustomerDataArr)
) {
@@ -395,15 +405,12 @@ public function deleteById($customerId)
* Helper function that adds a FilterGroup to the collection.
*
* @deprecated 100.2.0
- * @param \Magento\Framework\Api\Search\FilterGroup $filterGroup
- * @param \Magento\Customer\Model\ResourceModel\Customer\Collection $collection
+ * @param FilterGroup $filterGroup
+ * @param Collection $collection
* @return void
- * @throws \Magento\Framework\Exception\InputException
*/
- protected function addFilterGroupToCollection(
- \Magento\Framework\Api\Search\FilterGroup $filterGroup,
- \Magento\Customer\Model\ResourceModel\Customer\Collection $collection
- ) {
+ protected function addFilterGroupToCollection(FilterGroup $filterGroup, Collection $collection)
+ {
$fields = [];
foreach ($filterGroup->getFilters() as $filter) {
$condition = $filter->getConditionType() ? $filter->getConditionType() : 'eq';
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/CustomerRepositoryTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/CustomerRepositoryTest.php
index e777313f13fe8..1ac785148c280 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/CustomerRepositoryTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Model/ResourceModel/CustomerRepositoryTest.php
@@ -8,8 +8,24 @@
use Magento\Customer\Api\AccountManagementInterface;
use Magento\Customer\Api\CustomerRepositoryInterface;
+use Magento\Customer\Api\Data\CustomerInterfaceFactory;
+use Magento\Customer\Api\Data\AddressInterfaceFactory;
+use Magento\Customer\Api\Data\RegionInterfaceFactory;
+use Magento\Framework\Api\ExtensibleDataObjectConverter;
+use Magento\Framework\Api\DataObjectHelper;
+use Magento\Framework\Encryption\EncryptorInterface;
+use Magento\Customer\Api\Data\CustomerInterface;
+use Magento\Customer\Model\CustomerRegistry;
use Magento\Framework\Api\SortOrder;
+use Magento\Framework\Config\CacheInterface;
+use Magento\Framework\ObjectManagerInterface;
use Magento\TestFramework\Helper\Bootstrap;
+use Magento\Customer\Api\Data\AddressInterface;
+use Magento\Framework\Api\SearchCriteriaBuilder;
+use Magento\Framework\Api\FilterBuilder;
+use Magento\Framework\Api\SortOrderBuilder;
+use Magento\Framework\Exception\NoSuchEntityException;
+use Magento\Customer\Model\Customer;
/**
* Checks Customer insert, update, search with repository
@@ -25,60 +41,65 @@ class CustomerRepositoryTest extends \PHPUnit\Framework\TestCase
/** @var CustomerRepositoryInterface */
private $customerRepository;
- /** @var \Magento\Framework\ObjectManagerInterface */
+ /** @var ObjectManagerInterface */
private $objectManager;
- /** @var \Magento\Customer\Api\Data\CustomerInterfaceFactory */
+ /** @var CustomerInterfaceFactory */
private $customerFactory;
- /** @var \Magento\Customer\Api\Data\AddressInterfaceFactory */
+ /** @var AddressInterfaceFactory */
private $addressFactory;
- /** @var \Magento\Customer\Api\Data\RegionInterfaceFactory */
+ /** @var RegionInterfaceFactory */
private $regionFactory;
- /** @var \Magento\Framework\Api\ExtensibleDataObjectConverter */
+ /** @var ExtensibleDataObjectConverter */
private $converter;
- /** @var \Magento\Framework\Api\DataObjectHelper */
+ /** @var DataObjectHelper */
protected $dataObjectHelper;
- /** @var \Magento\Framework\Encryption\EncryptorInterface */
+ /** @var EncryptorInterface */
protected $encryptor;
- /** @var \Magento\Customer\Model\CustomerRegistry */
+ /** @var CustomerRegistry */
protected $customerRegistry;
+ /**
+ * @inheritdoc
+ */
protected function setUp()
{
$this->objectManager = Bootstrap::getObjectManager();
- $this->customerRepository =
- $this->objectManager->create(\Magento\Customer\Api\CustomerRepositoryInterface::class);
- $this->customerFactory =
- $this->objectManager->create(\Magento\Customer\Api\Data\CustomerInterfaceFactory::class);
- $this->addressFactory = $this->objectManager->create(\Magento\Customer\Api\Data\AddressInterfaceFactory::class);
- $this->regionFactory = $this->objectManager->create(\Magento\Customer\Api\Data\RegionInterfaceFactory::class);
- $this->accountManagement =
- $this->objectManager->create(\Magento\Customer\Api\AccountManagementInterface::class);
- $this->converter = $this->objectManager->create(\Magento\Framework\Api\ExtensibleDataObjectConverter::class);
- $this->dataObjectHelper = $this->objectManager->create(\Magento\Framework\Api\DataObjectHelper::class);
- $this->encryptor = $this->objectManager->create(\Magento\Framework\Encryption\EncryptorInterface::class);
- $this->customerRegistry = $this->objectManager->create(\Magento\Customer\Model\CustomerRegistry::class);
-
- /** @var \Magento\Framework\Config\CacheInterface $cache */
- $cache = $this->objectManager->create(\Magento\Framework\Config\CacheInterface::class);
+ $this->customerRepository = $this->objectManager->create(CustomerRepositoryInterface::class);
+ $this->customerFactory = $this->objectManager->create(CustomerInterfaceFactory::class);
+ $this->addressFactory = $this->objectManager->create(AddressInterfaceFactory::class);
+ $this->regionFactory = $this->objectManager->create(RegionInterfaceFactory::class);
+ $this->accountManagement = $this->objectManager->create(AccountManagementInterface::class);
+ $this->converter = $this->objectManager->create(ExtensibleDataObjectConverter::class);
+ $this->dataObjectHelper = $this->objectManager->create(DataObjectHelper::class);
+ $this->encryptor = $this->objectManager->create(EncryptorInterface::class);
+ $this->customerRegistry = $this->objectManager->create(CustomerRegistry::class);
+
+ /** @var CacheInterface $cache */
+ $cache = $this->objectManager->create(CacheInterface::class);
$cache->remove('extension_attributes_config');
}
+ /**
+ * @inheritdoc
+ */
protected function tearDown()
{
- $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
+ $objectManager = Bootstrap::getObjectManager();
/** @var \Magento\Customer\Model\CustomerRegistry $customerRegistry */
- $customerRegistry = $objectManager->get(\Magento\Customer\Model\CustomerRegistry::class);
+ $customerRegistry = $objectManager->get(CustomerRegistry::class);
$customerRegistry->remove(1);
}
/**
+ * Check if first name update was successful
+ *
* @magentoDbIsolation enabled
*/
public function testCreateCustomerNewThenUpdateFirstName()
@@ -100,7 +121,7 @@ public function testCreateCustomerNewThenUpdateFirstName()
$newCustomerFirstname = 'New First Name';
$updatedCustomer = $this->customerFactory->create();
$this->dataObjectHelper->mergeDataObjects(
- \Magento\Customer\Api\Data\CustomerInterface::class,
+ CustomerInterface::class,
$updatedCustomer,
$customer
);
@@ -113,6 +134,8 @@ public function testCreateCustomerNewThenUpdateFirstName()
}
/**
+ * Test create new customer
+ *
* @magentoDbIsolation enabled
*/
public function testCreateNewCustomer()
@@ -140,6 +163,8 @@ public function testCreateNewCustomer()
}
/**
+ * Test update customer
+ *
* @dataProvider updateCustomerDataProvider
* @magentoAppArea frontend
* @magentoDataFixture Magento/Customer/_files/customer.php
@@ -169,7 +194,7 @@ public function testUpdateCustomer($defaultBilling, $defaultShipping)
$this->dataObjectHelper->populateWithArray(
$customerDetails,
$customerData,
- \Magento\Customer\Api\Data\CustomerInterface::class
+ CustomerInterface::class
);
$this->customerRepository->save($customerDetails, $newPasswordHash);
$customerAfter = $this->customerRepository->getById($existingCustomerId);
@@ -188,12 +213,12 @@ public function testUpdateCustomer($defaultBilling, $defaultShipping)
$attributesBefore = $this->converter->toFlatArray(
$customerBefore,
[],
- \Magento\Customer\Api\Data\CustomerInterface::class
+ CustomerInterface::class
);
$attributesAfter = $this->converter->toFlatArray(
$customerAfter,
[],
- \Magento\Customer\Api\Data\CustomerInterface::class
+ CustomerInterface::class
);
// ignore 'updated_at'
unset($attributesBefore['updated_at']);
@@ -216,6 +241,8 @@ public function testUpdateCustomer($defaultBilling, $defaultShipping)
}
/**
+ * Test update customer address
+ *
* @magentoAppArea frontend
* @magentoDataFixture Magento/Customer/_files/customer.php
* @magentoDataFixture Magento/Customer/_files/customer_two_addresses.php
@@ -234,14 +261,14 @@ public function testUpdateCustomerAddress()
$this->dataObjectHelper->populateWithArray(
$newAddressDataObject,
$newAddress,
- \Magento\Customer\Api\Data\AddressInterface::class
+ AddressInterface::class
);
$newAddressDataObject->setRegion($addresses[0]->getRegion());
$newCustomerEntity = $this->customerFactory->create();
$this->dataObjectHelper->populateWithArray(
$newCustomerEntity,
$customerDetails,
- \Magento\Customer\Api\Data\CustomerInterface::class
+ CustomerInterface::class
);
$newCustomerEntity->setId($customerId)
->setAddresses([$newAddressDataObject, $addresses[1]]);
@@ -257,6 +284,8 @@ public function testUpdateCustomerAddress()
}
/**
+ * Test preserve all addresses after customer update
+ *
* @magentoAppArea frontend
* @magentoDataFixture Magento/Customer/_files/customer.php
* @magentoDataFixture Magento/Customer/_files/customer_two_addresses.php
@@ -270,7 +299,7 @@ public function testUpdateCustomerPreserveAllAddresses()
$this->dataObjectHelper->populateWithArray(
$newCustomerEntity,
$customerDetails,
- \Magento\Customer\Api\Data\CustomerInterface::class
+ CustomerInterface::class
);
$newCustomerEntity->setId($customer->getId())
->setAddresses(null);
@@ -282,6 +311,8 @@ public function testUpdateCustomerPreserveAllAddresses()
}
/**
+ * Test update delete all addresses with empty arrays
+ *
* @magentoAppArea frontend
* @magentoDataFixture Magento/Customer/_files/customer.php
* @magentoDataFixture Magento/Customer/_files/customer_two_addresses.php
@@ -295,7 +326,7 @@ public function testUpdateCustomerDeleteAllAddressesWithEmptyArray()
$this->dataObjectHelper->populateWithArray(
$newCustomerEntity,
$customerDetails,
- \Magento\Customer\Api\Data\CustomerInterface::class
+ CustomerInterface::class
);
$newCustomerEntity->setId($customer->getId())
->setAddresses([]);
@@ -307,6 +338,51 @@ public function testUpdateCustomerDeleteAllAddressesWithEmptyArray()
}
/**
+ * Test customer update with new address
+ *
+ * @magentoAppArea frontend
+ * @magentoDataFixture Magento/Customer/_files/customer.php
+ * @magentoDataFixture Magento/Customer/_files/customer_two_addresses.php
+ */
+ public function testUpdateCustomerWithNewAddress()
+ {
+ $customerId = 1;
+ $customer = $this->customerRepository->getById($customerId);
+ $customerDetails = $customer->__toArray();
+ unset($customerDetails['default_billing']);
+ unset($customerDetails['default_shipping']);
+
+ $beforeSaveCustomer = $this->customerFactory->create();
+ $this->dataObjectHelper->populateWithArray(
+ $beforeSaveCustomer,
+ $customerDetails,
+ CustomerInterface::class
+ );
+
+ $addresses = $customer->getAddresses();
+ $beforeSaveAddress = $addresses[0]->__toArray();
+ unset($beforeSaveAddress['id']);
+ $newAddressDataObject = $this->addressFactory->create();
+ $this->dataObjectHelper->populateWithArray(
+ $newAddressDataObject,
+ $beforeSaveAddress,
+ AddressInterface::class
+ );
+
+ $beforeSaveCustomer->setAddresses([$newAddressDataObject]);
+ $this->customerRepository->save($beforeSaveCustomer);
+
+ $newCustomer = $this->customerRepository->getById($customerId);
+ $newCustomerAddresses = $newCustomer->getAddresses();
+ $addressId = $newCustomerAddresses[0]->getId();
+
+ $this->assertEquals($newCustomer->getDefaultBilling(), $addressId, "Default billing invalid value");
+ $this->assertEquals($newCustomer->getDefaultShipping(), $addressId, "Default shipping invalid value");
+ }
+
+ /**
+ * Test search customers
+ *
* @param \Magento\Framework\Api\Filter[] $filters
* @param \Magento\Framework\Api\Filter[] $filterGroup
* @param array $expectedResult array of expected results indexed by ID
@@ -318,9 +394,8 @@ public function testUpdateCustomerDeleteAllAddressesWithEmptyArray()
*/
public function testSearchCustomers($filters, $filterGroup, $expectedResult)
{
- /** @var \Magento\Framework\Api\SearchCriteriaBuilder $searchBuilder */
- $searchBuilder = Bootstrap::getObjectManager()
- ->create(\Magento\Framework\Api\SearchCriteriaBuilder::class);
+ /** @var SearchCriteriaBuilder $searchBuilder */
+ $searchBuilder = Bootstrap::getObjectManager()->create(SearchCriteriaBuilder::class);
foreach ($filters as $filter) {
$searchBuilder->addFilters([$filter]);
}
@@ -347,19 +422,19 @@ public function testSearchCustomers($filters, $filterGroup, $expectedResult)
*/
public function testSearchCustomersOrder()
{
- /** @var \Magento\Framework\Api\SearchCriteriaBuilder $searchBuilder */
+ /** @var SearchCriteriaBuilder $searchBuilder */
$objectManager = Bootstrap::getObjectManager();
- $searchBuilder = $objectManager->create(\Magento\Framework\Api\SearchCriteriaBuilder::class);
+ $searchBuilder = $objectManager->create(SearchCriteriaBuilder::class);
// Filter for 'firstname' like 'First'
- $filterBuilder = $objectManager->create(\Magento\Framework\Api\FilterBuilder::class);
+ $filterBuilder = $objectManager->create(FilterBuilder::class);
$firstnameFilter = $filterBuilder->setField('firstname')
->setConditionType('like')
->setValue('First%')
->create();
$searchBuilder->addFilters([$firstnameFilter]);
// Search ascending order
- $sortOrderBuilder = $objectManager->create(\Magento\Framework\Api\SortOrderBuilder::class);
+ $sortOrderBuilder = $objectManager->create(SortOrderBuilder::class);
$sortOrder = $sortOrderBuilder
->setField('lastname')
->setDirection(SortOrder::SORT_ASC)
@@ -384,6 +459,8 @@ public function testSearchCustomersOrder()
}
/**
+ * Test delete
+ *
* @magentoAppArea adminhtml
* @magentoDataFixture Magento/Customer/_files/customer.php
* @magentoAppIsolation enabled
@@ -395,13 +472,15 @@ public function testDelete()
$this->customerRepository->delete($customer);
/** Ensure that customer was deleted */
$this->expectException(
- \Magento\Framework\Exception\NoSuchEntityException::class,
+ NoSuchEntityException::class,
'No such entity with email = customer@example.com, websiteId = 1'
);
$this->customerRepository->get($fixtureCustomerEmail);
}
/**
+ * Test delete by id
+ *
* @magentoAppArea adminhtml
* @magentoDataFixture Magento/Customer/_files/customer.php
* @magentoAppIsolation enabled
@@ -413,7 +492,7 @@ public function testDeleteById()
$this->customerRepository->deleteById($fixtureCustomerId);
/** Ensure that customer was deleted */
$this->expectException(
- \Magento\Framework\Exception\NoSuchEntityException::class,
+ NoSuchEntityException::class,
'No such entity with email = customer@example.com, websiteId = 1'
);
$this->customerRepository->get($fixtureCustomerEmail);
@@ -438,9 +517,14 @@ public function updateCustomerDataProvider()
];
}
+ /**
+ * Search customer data provider
+ *
+ * @return array
+ */
public function searchCustomersDataProvider()
{
- $builder = Bootstrap::getObjectManager()->create(\Magento\Framework\Api\FilterBuilder::class);
+ $builder = Bootstrap::getObjectManager()->create(FilterBuilder::class);
return [
'Customer with specific email' => [
[$builder->setField('email')->setValue('customer@search.example.com')->create()],
@@ -490,9 +574,9 @@ protected function expectedDefaultShippingsInCustomerModelAttributes(
$defaultShipping
) {
/**
- * @var \Magento\Customer\Model\Customer $customer
+ * @var Customer $customer
*/
- $customer = $this->objectManager->create(\Magento\Customer\Model\Customer::class);
+ $customer = $this->objectManager->create(Customer::class);
/** @var \Magento\Customer\Model\Customer $customer */
$customer->load($customerId);
$this->assertEquals(
@@ -508,6 +592,8 @@ protected function expectedDefaultShippingsInCustomerModelAttributes(
}
/**
+ * Test update default shipping and default billing address
+ *
* @magentoDataFixture Magento/Customer/_files/customer.php
* @magentoDbIsolation enabled
*/
@@ -535,13 +621,13 @@ public function testUpdateDefaultShippingAndDefaultBillingTest()
$this->assertEquals(
$savedCustomer->getDefaultBilling(),
$oldDefaultBilling,
- 'Default billing shoud not be overridden'
+ 'Default billing should not be overridden'
);
$this->assertEquals(
$savedCustomer->getDefaultShipping(),
$oldDefaultShipping,
- 'Default shipping shoud not be overridden'
+ 'Default shipping should not be overridden'
);
}
}
From 512ad8896228bb7a7f26f2a49029a27314fcdd84 Mon Sep 17 00:00:00 2001
From: serhii balko
Date: Wed, 7 Nov 2018 15:56:11 +0200
Subject: [PATCH 66/75] MAGETWO-94860: Moving Category generate duplicate
url_rewrite when 4th level category exist and is translated
---
.../Magento/UrlRewrite/Test/TestCase/CategoryUrlRewriteTest.php | 1 +
1 file changed, 1 insertion(+)
diff --git a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/CategoryUrlRewriteTest.php b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/CategoryUrlRewriteTest.php
index 8147818135edc..a2767f76cfecb 100644
--- a/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/CategoryUrlRewriteTest.php
+++ b/dev/tests/functional/tests/app/Magento/UrlRewrite/Test/TestCase/CategoryUrlRewriteTest.php
@@ -85,6 +85,7 @@ public function test(Store $storeView, Category $childCategory, Category $parent
$this->catalogCategoryEdit->getFormPageActions()->selectStoreView($storeView->getName());
$this->catalogCategoryEdit->getEditForm()->fill($categoryUpdates);
$this->catalogCategoryEdit->getFormPageActions()->save();
+ $this->catalogCategoryEdit->getFormPageActions()->selectStoreView('All Store Views');
$this->catalogCategoryIndex->getTreeCategories()->assignCategory(
$parentCategory->getName(),
$childCategory->getName()
From 27dc8e82de328af66a82f1402cb5671f87d80115 Mon Sep 17 00:00:00 2001
From: Stanislav Idolov
Date: Wed, 7 Nov 2018 17:11:39 +0200
Subject: [PATCH 67/75] Fixed static failure
---
.../luma/Magento_Checkout/web/css/source/module/_cart.less | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_cart.less b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_cart.less
index be5863f726d33..1015bb584ff7b 100644
--- a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_cart.less
+++ b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/_cart.less
@@ -631,8 +631,8 @@
}
&-item-details {
- padding-bottom: 35px;
display: table-cell;
+ padding-bottom: 35px;
vertical-align: top;
white-space: normal;
width: 99%;
From 106fe00dc9e08ca53613bf6b8f8c0241932be095 Mon Sep 17 00:00:00 2001
From: Pavel Bystritsky
Date: Wed, 7 Nov 2018 17:22:48 +0200
Subject: [PATCH 68/75] ENGCOM-1429: Fix order history status.
---
app/code/Magento/Sales/Model/Order.php | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/app/code/Magento/Sales/Model/Order.php b/app/code/Magento/Sales/Model/Order.php
index b86b10315b765..a3589177a5909 100644
--- a/app/code/Magento/Sales/Model/Order.php
+++ b/app/code/Magento/Sales/Model/Order.php
@@ -1562,7 +1562,10 @@ public function getStatusHistoryById($statusId)
public function addStatusHistory(\Magento\Sales\Model\Order\Status\History $history)
{
$history->setOrder($this);
- $this->setStatus($history->getStatus());
+ $status = $history->getStatus();
+ if (null !== $status) {
+ $this->setStatus($status);
+ }
if (!$history->getId()) {
$this->setStatusHistories(array_merge($this->getStatusHistories(), [$history]));
$this->setDataChanges(true);
From 252a0ed8225d03ff36e0c4139e46d37db8ad7402 Mon Sep 17 00:00:00 2001
From: Oleksii Korshenko
Date: Wed, 7 Nov 2018 17:21:09 +0200
Subject: [PATCH 69/75] magento/magento2#18840: Invalid Unit Test Annotations.
- fixed invalid unit tests annotations that assert exception messages -
backport to 2.2.
---
.../Unit/Model/Product/Gallery/GalleryManagementTest.php | 2 +-
.../Catalog/Test/Unit/Model/Product/PriceModifierTest.php | 6 +++---
.../Test/Unit/Model/Product/TierPriceManagementTest.php | 2 +-
app/code/Magento/Checkout/Test/Unit/Model/SidebarTest.php | 2 +-
.../Downloadable/Test/Unit/Helper/DownloadTest.php | 2 +-
.../GiftMessage/Test/Unit/Model/Plugin/OrderSaveTest.php | 8 ++++----
.../GuestCartManagement/Plugin/AuthorizationTest.php | 2 +-
.../Quote/Test/Unit/Model/Quote/Item/UpdaterTest.php | 2 +-
.../Test/Unit/Model/ShippingAddressManagementTest.php | 2 +-
.../Search/Test/Unit/Model/SynonymGroupRepositoryTest.php | 4 ++--
.../Theme/Test/Unit/Model/Theme/Source/ThemeTest.php | 1 -
.../Ui/Test/Unit/Component/Filters/FilterModifierTest.php | 5 +++--
.../Magento/Framework/App/Test/Unit/ErrorHandlerTest.php | 4 ++--
.../App/Test/Unit/Response/Http/FileFactoryTest.php | 2 +-
lib/internal/Magento/Framework/App/Test/Unit/ViewTest.php | 2 +-
.../Profiler/Test/Unit/Driver/Standard/StatTest.php | 4 ++--
.../Setup/Test/Unit/Module/I18n/Parser/ParserTest.php | 2 +-
17 files changed, 26 insertions(+), 26 deletions(-)
diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/Gallery/GalleryManagementTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/Gallery/GalleryManagementTest.php
index d80cf3cb9bfa2..53ac1d4d9e4df 100644
--- a/app/code/Magento/Catalog/Test/Unit/Model/Product/Gallery/GalleryManagementTest.php
+++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/Gallery/GalleryManagementTest.php
@@ -268,7 +268,7 @@ public function testGetWithNonExistingProduct()
/**
* @expectedException \Magento\Framework\Exception\NoSuchEntityException
- * @expectedExceptionText Such image doesn't exist
+ * @expectedExceptionMessage Such image doesn't exist
*/
public function testGetWithNonExistingImage()
{
diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/PriceModifierTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/PriceModifierTest.php
index 75fbad0aab262..17711a18f7cfa 100644
--- a/app/code/Magento/Catalog/Test/Unit/Model/Product/PriceModifierTest.php
+++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/PriceModifierTest.php
@@ -56,7 +56,7 @@ protected function setUp()
/**
* @expectedException \Magento\Framework\Exception\NoSuchEntityException
- * @expectedMessage This product doesn't have tier price
+ * @expectedExceptionMessage Product hasn't group price with such data: customerGroupId = '1', website = 1, qty = 3
*/
public function testRemoveWhenTierPricesNotExists()
{
@@ -72,7 +72,7 @@ public function testRemoveWhenTierPricesNotExists()
/**
* @expectedException \Magento\Framework\Exception\NoSuchEntityException
- * @expectedMessage For current customerGroupId = '10' with 'qty' = 15 any tier price exist'.
+ * @expectedExceptionMessage Product hasn't group price with such data: customerGroupId = '10', website = 1, qty = 5
*/
public function testRemoveTierPriceForNonExistingCustomerGroup()
{
@@ -83,7 +83,7 @@ public function testRemoveTierPriceForNonExistingCustomerGroup()
->will($this->returnValue($this->prices));
$this->productMock->expects($this->never())->method('setData');
$this->productRepositoryMock->expects($this->never())->method('save');
- $this->priceModifier->removeTierPrice($this->productMock, 10, 15, 1);
+ $this->priceModifier->removeTierPrice($this->productMock, 10, 5, 1);
}
public function testSuccessfullyRemoveTierPriceSpecifiedForAllGroups()
diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/TierPriceManagementTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/TierPriceManagementTest.php
index 6d42a33d1fc73..15d99aee538b0 100644
--- a/app/code/Magento/Catalog/Test/Unit/Model/Product/TierPriceManagementTest.php
+++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/TierPriceManagementTest.php
@@ -188,7 +188,7 @@ public function testSuccessDeleteTierPrice()
/**
* @expectedException \Magento\Framework\Exception\NoSuchEntityException
- * @message Such product doesn't exist
+ * @expectedExceptionMessage No such entity.
*/
public function testDeleteTierPriceFromNonExistingProduct()
{
diff --git a/app/code/Magento/Checkout/Test/Unit/Model/SidebarTest.php b/app/code/Magento/Checkout/Test/Unit/Model/SidebarTest.php
index 29537e8ec0526..bcc9f1bc94bd7 100644
--- a/app/code/Magento/Checkout/Test/Unit/Model/SidebarTest.php
+++ b/app/code/Magento/Checkout/Test/Unit/Model/SidebarTest.php
@@ -94,7 +94,7 @@ public function testCheckQuoteItem()
/**
* @expectedException \Magento\Framework\Exception\LocalizedException
- * @exceptedExceptionMessage We can't find the quote item.
+ * @expectedExceptionMessage We can't find the quote item.
*/
public function testCheckQuoteItemWithException()
{
diff --git a/app/code/Magento/Downloadable/Test/Unit/Helper/DownloadTest.php b/app/code/Magento/Downloadable/Test/Unit/Helper/DownloadTest.php
index 3142900613296..4cd43ce12f49b 100644
--- a/app/code/Magento/Downloadable/Test/Unit/Helper/DownloadTest.php
+++ b/app/code/Magento/Downloadable/Test/Unit/Helper/DownloadTest.php
@@ -89,7 +89,7 @@ public function testSetResourceInvalidPath()
/**
* @expectedException \Magento\Framework\Exception\LocalizedException
- * @exectedExceptionMessage Please set resource file and link type.
+ * @expectedExceptionMessage Please set resource file and link type.
*/
public function testGetFileSizeNoResource()
{
diff --git a/app/code/Magento/GiftMessage/Test/Unit/Model/Plugin/OrderSaveTest.php b/app/code/Magento/GiftMessage/Test/Unit/Model/Plugin/OrderSaveTest.php
index ec8a8841f6477..608bef3ee091b 100644
--- a/app/code/Magento/GiftMessage/Test/Unit/Model/Plugin/OrderSaveTest.php
+++ b/app/code/Magento/GiftMessage/Test/Unit/Model/Plugin/OrderSaveTest.php
@@ -128,7 +128,7 @@ public function testAfterSaveGiftMessages()
/**
* @expectedException \Magento\Framework\Exception\CouldNotSaveException
- * @expectedMessage Could not add gift message to order:Test message
+ * @expectedExceptionMessage Could not add gift message to order: "Test message"
*/
public function testAfterSaveIfGiftMessagesNotExist()
{
@@ -146,7 +146,7 @@ public function testAfterSaveIfGiftMessagesNotExist()
$this->giftMessageOrderRepositoryMock
->expects($this->once())
->method('save')
- ->willThrowException(new \Exception('TestMessage'));
+ ->willThrowException(new \Exception('Test message'));
// save Gift Messages on item level
$this->orderMock->expects($this->never())->method('getItems');
@@ -155,7 +155,7 @@ public function testAfterSaveIfGiftMessagesNotExist()
/**
* @expectedException \Magento\Framework\Exception\CouldNotSaveException
- * @expectedMessage Could not add gift message to order:Test message
+ * @expectedExceptionMessage Could not add gift message to order's item: "Test message"
*/
public function testAfterSaveIfItemGiftMessagesNotExist()
{
@@ -185,7 +185,7 @@ public function testAfterSaveIfItemGiftMessagesNotExist()
$this->giftMessageOrderItemRepositoryMock
->expects($this->once())->method('save')
->with($orderId, $orderItemId, $this->giftMessageMock)
- ->willThrowException(new \Exception('TestMessage'));
+ ->willThrowException(new \Exception('Test message'));
$this->plugin->afterSave($this->orderRepositoryMock, $this->orderMock);
}
}
diff --git a/app/code/Magento/Quote/Test/Unit/Model/GuestCartManagement/Plugin/AuthorizationTest.php b/app/code/Magento/Quote/Test/Unit/Model/GuestCartManagement/Plugin/AuthorizationTest.php
index 9cde4bbc19184..d67ebdd5a0fc2 100644
--- a/app/code/Magento/Quote/Test/Unit/Model/GuestCartManagement/Plugin/AuthorizationTest.php
+++ b/app/code/Magento/Quote/Test/Unit/Model/GuestCartManagement/Plugin/AuthorizationTest.php
@@ -36,7 +36,7 @@ protected function setUp()
/**
* @expectedException \Magento\Framework\Exception\StateException
- * @expectedMessage Cannot assign customer to the given cart. You don't have permission for this operation.
+ * @expectedExceptionMessage Cannot assign customer to the given cart. You don't have permission for this operation.
*/
public function testBeforeAssignCustomer()
{
diff --git a/app/code/Magento/Quote/Test/Unit/Model/Quote/Item/UpdaterTest.php b/app/code/Magento/Quote/Test/Unit/Model/Quote/Item/UpdaterTest.php
index 03c3e32c20cb9..c83eec9eb51d2 100644
--- a/app/code/Magento/Quote/Test/Unit/Model/Quote/Item/UpdaterTest.php
+++ b/app/code/Magento/Quote/Test/Unit/Model/Quote/Item/UpdaterTest.php
@@ -92,7 +92,7 @@ protected function setUp()
/**
* @expectedException \InvalidArgumentException
- * @ExceptedExceptionMessage The qty value is required to update quote item.
+ * @expectedExceptionMessage The qty value is required to update quote item.
*/
public function testUpdateNoQty()
{
diff --git a/app/code/Magento/Quote/Test/Unit/Model/ShippingAddressManagementTest.php b/app/code/Magento/Quote/Test/Unit/Model/ShippingAddressManagementTest.php
index 1870fa9dc81ba..59445c3999899 100644
--- a/app/code/Magento/Quote/Test/Unit/Model/ShippingAddressManagementTest.php
+++ b/app/code/Magento/Quote/Test/Unit/Model/ShippingAddressManagementTest.php
@@ -100,7 +100,7 @@ protected function setUp()
/**
* @expectedException \Magento\Framework\Exception\NoSuchEntityException
- * @expected ExceptionMessage error345
+ * @expectedExceptionMessage error345
*/
public function testSetAddressValidationFailed()
{
diff --git a/app/code/Magento/Search/Test/Unit/Model/SynonymGroupRepositoryTest.php b/app/code/Magento/Search/Test/Unit/Model/SynonymGroupRepositoryTest.php
index f62c07b149c0e..4532479c482b5 100644
--- a/app/code/Magento/Search/Test/Unit/Model/SynonymGroupRepositoryTest.php
+++ b/app/code/Magento/Search/Test/Unit/Model/SynonymGroupRepositoryTest.php
@@ -53,7 +53,7 @@ public function testSaveCreate()
/**
* @expectedException \Magento\Search\Model\Synonym\MergeConflictException
- * @expecteExceptionMessage (c,d,e)
+ * @expectedExceptionMessage Merge conflict with existing synonym group(s): (a,b,c)
*/
public function testSaveCreateMergeConflict()
{
@@ -138,7 +138,7 @@ public function testSaveUpdate()
/**
* @expectedException \Magento\Search\Model\Synonym\MergeConflictException
- * @expecteExceptionMessage (d,h,i)
+ * @expectedExceptionMessage (d,h,i)
*/
public function testSaveUpdateMergeConflict()
{
diff --git a/app/code/Magento/Theme/Test/Unit/Model/Theme/Source/ThemeTest.php b/app/code/Magento/Theme/Test/Unit/Model/Theme/Source/ThemeTest.php
index 5cb265d3d628b..c06e2626034a7 100644
--- a/app/code/Magento/Theme/Test/Unit/Model/Theme/Source/ThemeTest.php
+++ b/app/code/Magento/Theme/Test/Unit/Model/Theme/Source/ThemeTest.php
@@ -10,7 +10,6 @@
class ThemeTest extends \PHPUnit\Framework\TestCase
{
/**
- * @true
* @return void
* @covers \Magento\Theme\Model\Theme\Source\Theme::__construct
* @covers \Magento\Theme\Model\Theme\Source\Theme::getAllOptions
diff --git a/app/code/Magento/Ui/Test/Unit/Component/Filters/FilterModifierTest.php b/app/code/Magento/Ui/Test/Unit/Component/Filters/FilterModifierTest.php
index f91401e43ea80..50d82b19d1045 100644
--- a/app/code/Magento/Ui/Test/Unit/Component/Filters/FilterModifierTest.php
+++ b/app/code/Magento/Ui/Test/Unit/Component/Filters/FilterModifierTest.php
@@ -66,7 +66,8 @@ public function testNotApplyFilterModifier()
/**
* @return void
- * @assertException \Magento\Framework\Exception\LocalizedException
+ * @expectedException \Magento\Framework\Exception\LocalizedException
+ * @expectedExceptionMessage Condition type "not_allowed" is not allowed
*/
public function testApplyFilterModifierWithNotAllowedCondition()
{
@@ -78,7 +79,7 @@ public function testApplyFilterModifierWithNotAllowedCondition()
]
]);
$this->dataProvider->expects($this->never())->method('addFilter');
- $this->unit->applyFilterModifier($this->dataProvider, 'test');
+ $this->unit->applyFilterModifier($this->dataProvider, 'filter');
}
/**
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/ErrorHandlerTest.php b/lib/internal/Magento/Framework/App/Test/Unit/ErrorHandlerTest.php
index daf3a4bdfab0c..fcab6b8e850c4 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/ErrorHandlerTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/ErrorHandlerTest.php
@@ -53,9 +53,9 @@ public function testHandlerException($errorNo, $errorPhrase)
$errorFile = 'test_file';
$errorLine = 'test_error_line';
- $exceptedExceptionMessage = sprintf('%s: %s in %s on line %s', $errorPhrase, $errorStr, $errorFile, $errorLine);
+ $expectedExceptionMessage = sprintf('%s: %s in %s on line %s', $errorPhrase, $errorStr, $errorFile, $errorLine);
$this->expectException('Exception');
- $this->expectExceptionMessage($exceptedExceptionMessage);
+ $this->expectExceptionMessage($expectedExceptionMessage);
$this->object->handler($errorNo, $errorStr, $errorFile, $errorLine);
}
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Response/Http/FileFactoryTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Response/Http/FileFactoryTest.php
index d6b8f677860cc..3b7aacc1afba1 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/Response/Http/FileFactoryTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/Response/Http/FileFactoryTest.php
@@ -67,7 +67,7 @@ public function testCreateIfContentDoesntHaveRequiredKeys()
/**
* @expectedException \Exception
- * @exceptedExceptionMessage File not found
+ * @expectedExceptionMessage File not found
*/
public function testCreateIfFileNotExist()
{
diff --git a/lib/internal/Magento/Framework/App/Test/Unit/ViewTest.php b/lib/internal/Magento/Framework/App/Test/Unit/ViewTest.php
index 807a70ecd7599..f39a91161c1f5 100644
--- a/lib/internal/Magento/Framework/App/Test/Unit/ViewTest.php
+++ b/lib/internal/Magento/Framework/App/Test/Unit/ViewTest.php
@@ -122,7 +122,7 @@ public function testGetLayout()
/**
* @expectedException \RuntimeException
- * @exceptedExceptionMessage 'Layout must be loaded only once.'
+ * @expectedExceptionMessage Layout must be loaded only once.
*/
public function testLoadLayoutWhenLayoutAlreadyLoaded()
{
diff --git a/lib/internal/Magento/Framework/Profiler/Test/Unit/Driver/Standard/StatTest.php b/lib/internal/Magento/Framework/Profiler/Test/Unit/Driver/Standard/StatTest.php
index d694697284f8e..df74eeec972ba 100644
--- a/lib/internal/Magento/Framework/Profiler/Test/Unit/Driver/Standard/StatTest.php
+++ b/lib/internal/Magento/Framework/Profiler/Test/Unit/Driver/Standard/StatTest.php
@@ -395,7 +395,7 @@ public function fetchDataProvider()
/**
* @expectedException \InvalidArgumentException
- * @expectedMessage Timer "foo" doesn't exist.
+ * @expectedExceptionMessage Timer "foo" doesn't exist.
*/
public function testFetchInvalidTimer()
{
@@ -404,7 +404,7 @@ public function testFetchInvalidTimer()
/**
* @expectedException \InvalidArgumentException
- * @expectedMessage Timer "foo" doesn't have value for "bar".
+ * @expectedExceptionMessage Timer "foo" doesn't have value for "bar".
*/
public function testFetchInvalidKey()
{
diff --git a/setup/src/Magento/Setup/Test/Unit/Module/I18n/Parser/ParserTest.php b/setup/src/Magento/Setup/Test/Unit/Module/I18n/Parser/ParserTest.php
index 36ce2e4ad7c45..e907c39bdd56e 100644
--- a/setup/src/Magento/Setup/Test/Unit/Module/I18n/Parser/ParserTest.php
+++ b/setup/src/Magento/Setup/Test/Unit/Module/I18n/Parser/ParserTest.php
@@ -41,7 +41,7 @@ protected function setUp()
* @param array $jsFiles
* @param array $phpMap
* @param array $jsMap
- * @paran array $phraseFactoryMap
+ * @param array $phraseFactoryMap
* @param array $expectedResult
* @dataProvider addPhraseDataProvider
*/
From 35c234560342f1ce5e259679a983d51cec0e2858 Mon Sep 17 00:00:00 2001
From: Yevhenii Dumskyi
Date: Mon, 5 Nov 2018 14:34:03 +0200
Subject: [PATCH 70/75] Add additional check if password hash is empty in auth
process
---
app/code/Magento/Customer/Model/Authentication.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/code/Magento/Customer/Model/Authentication.php b/app/code/Magento/Customer/Model/Authentication.php
index 0967f1a0189e3..b0729647d7eec 100644
--- a/app/code/Magento/Customer/Model/Authentication.php
+++ b/app/code/Magento/Customer/Model/Authentication.php
@@ -167,7 +167,7 @@ public function authenticate($customerId, $password)
{
$customerSecure = $this->customerRegistry->retrieveSecureData($customerId);
$hash = $customerSecure->getPasswordHash();
- if (!$this->encryptor->validateHash($password, $hash)) {
+ if (!$hash || !$this->encryptor->validateHash($password, $hash)) {
$this->processAuthenticationFailure($customerId);
if ($this->isLocked($customerId)) {
throw new UserLockedException(__('The account is locked.'));
From 740f9d2f9997f5cf235cffc919ce430b1bd8793f Mon Sep 17 00:00:00 2001
From: Arnoud Beekman
Date: Fri, 2 Nov 2018 22:34:49 +0100
Subject: [PATCH 71/75] Add/update newsletter messages in translation file
---
app/code/Magento/Newsletter/i18n/en_US.csv | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/app/code/Magento/Newsletter/i18n/en_US.csv b/app/code/Magento/Newsletter/i18n/en_US.csv
index c49fdc80da810..388b583f990b1 100644
--- a/app/code/Magento/Newsletter/i18n/en_US.csv
+++ b/app/code/Magento/Newsletter/i18n/en_US.csv
@@ -67,8 +67,8 @@ Subscribers,Subscribers
"Something went wrong while saving this template.","Something went wrong while saving this template."
"Newsletter Subscription","Newsletter Subscription"
"Something went wrong while saving your subscription.","Something went wrong while saving your subscription."
-"We saved the subscription.","We saved the subscription."
-"We removed the subscription.","We removed the subscription."
+"We have saved your subscription.","We have saved your subscription."
+"We have removed your newsletter subscription.","We have removed your newsletter subscription."
"Your subscription has been confirmed.","Your subscription has been confirmed."
"This is an invalid subscription confirmation code.","This is an invalid subscription confirmation code."
"This is an invalid subscription ID.","This is an invalid subscription ID."
@@ -76,7 +76,7 @@ Subscribers,Subscribers
"Sorry, but the administrator denied subscription for guests. Please register .","Sorry, but the administrator denied subscription for guests. Please register ."
"Please enter a valid email address.","Please enter a valid email address."
"This email address is already subscribed.","This email address is already subscribed."
-"The confirmation request has been sent.","The confirmation request has been sent."
+"A confirmation request has been sent.","A confirmation request has been sent."
"Thank you for your subscription.","Thank you for your subscription."
"There was a problem with the subscription: %1","There was a problem with the subscription: %1"
"Something went wrong with the subscription.","Something went wrong with the subscription."
@@ -151,3 +151,4 @@ Unconfirmed,Unconfirmed
Store,Store
"Store View","Store View"
"Newsletter Subscriptions","Newsletter Subscriptions"
+"We have updated your subscription.","We have updated your subscription."
From 51aa64f683042cb253172d1bf26aa360807d1bcd Mon Sep 17 00:00:00 2001
From: Kevin Kozan
Date: Fri, 9 Nov 2018 10:18:30 -0600
Subject: [PATCH 72/75] MQE-1339: Bump MFTF version in Magento
- pull origin lock file, update MFTF version only
---
composer.lock | 195 ++++++++++++++++++++++++--------------------------
1 file changed, 95 insertions(+), 100 deletions(-)
diff --git a/composer.lock b/composer.lock
index 1097aeaa010b2..1ffc2d5b50e10 100644
--- a/composer.lock
+++ b/composer.lock
@@ -204,16 +204,16 @@
},
{
"name": "composer/ca-bundle",
- "version": "1.1.3",
+ "version": "1.1.2",
"source": {
"type": "git",
"url": "https://github.com/composer/ca-bundle.git",
- "reference": "8afa52cd417f4ec417b4bfe86b68106538a87660"
+ "reference": "46afded9720f40b9dc63542af4e3e43a1177acb0"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/composer/ca-bundle/zipball/8afa52cd417f4ec417b4bfe86b68106538a87660",
- "reference": "8afa52cd417f4ec417b4bfe86b68106538a87660",
+ "url": "https://api.github.com/repos/composer/ca-bundle/zipball/46afded9720f40b9dc63542af4e3e43a1177acb0",
+ "reference": "46afded9720f40b9dc63542af4e3e43a1177acb0",
"shasum": ""
},
"require": {
@@ -256,7 +256,7 @@
"ssl",
"tls"
],
- "time": "2018-10-18T06:09:13+00:00"
+ "time": "2018-08-08T08:57:40+00:00"
},
{
"name": "composer/composer",
@@ -399,16 +399,16 @@
},
{
"name": "composer/spdx-licenses",
- "version": "1.5.0",
+ "version": "1.4.0",
"source": {
"type": "git",
"url": "https://github.com/composer/spdx-licenses.git",
- "reference": "7a9556b22bd9d4df7cad89876b00af58ef20d3a2"
+ "reference": "cb17687e9f936acd7e7245ad3890f953770dec1b"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/composer/spdx-licenses/zipball/7a9556b22bd9d4df7cad89876b00af58ef20d3a2",
- "reference": "7a9556b22bd9d4df7cad89876b00af58ef20d3a2",
+ "url": "https://api.github.com/repos/composer/spdx-licenses/zipball/cb17687e9f936acd7e7245ad3890f953770dec1b",
+ "reference": "cb17687e9f936acd7e7245ad3890f953770dec1b",
"shasum": ""
},
"require": {
@@ -456,7 +456,7 @@
"spdx",
"validator"
],
- "time": "2018-11-01T09:45:54+00:00"
+ "time": "2018-04-30T10:33:04+00:00"
},
{
"name": "container-interop/container-interop",
@@ -719,16 +719,16 @@
},
{
"name": "monolog/monolog",
- "version": "1.24.0",
+ "version": "1.23.0",
"source": {
"type": "git",
"url": "https://github.com/Seldaek/monolog.git",
- "reference": "bfc9ebb28f97e7a24c45bdc3f0ff482e47bb0266"
+ "reference": "fd8c787753b3a2ad11bc60c063cff1358a32a3b4"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/Seldaek/monolog/zipball/bfc9ebb28f97e7a24c45bdc3f0ff482e47bb0266",
- "reference": "bfc9ebb28f97e7a24c45bdc3f0ff482e47bb0266",
+ "url": "https://api.github.com/repos/Seldaek/monolog/zipball/fd8c787753b3a2ad11bc60c063cff1358a32a3b4",
+ "reference": "fd8c787753b3a2ad11bc60c063cff1358a32a3b4",
"shasum": ""
},
"require": {
@@ -793,7 +793,7 @@
"logging",
"psr-3"
],
- "time": "2018-11-05T09:00:11+00:00"
+ "time": "2017-06-19T01:22:40+00:00"
},
{
"name": "oyejorge/less.php",
@@ -977,16 +977,16 @@
},
{
"name": "phpseclib/phpseclib",
- "version": "2.0.12",
+ "version": "2.0.11",
"source": {
"type": "git",
"url": "https://github.com/phpseclib/phpseclib.git",
- "reference": "8814dc7841db159daed0b32c2b08fb7e03c6afe7"
+ "reference": "7053f06f91b3de78e143d430e55a8f7889efc08b"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/8814dc7841db159daed0b32c2b08fb7e03c6afe7",
- "reference": "8814dc7841db159daed0b32c2b08fb7e03c6afe7",
+ "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/7053f06f91b3de78e143d430e55a8f7889efc08b",
+ "reference": "7053f06f91b3de78e143d430e55a8f7889efc08b",
"shasum": ""
},
"require": {
@@ -1065,7 +1065,7 @@
"x.509",
"x509"
],
- "time": "2018-11-04T05:45:48+00:00"
+ "time": "2018-04-15T16:55:05+00:00"
},
{
"name": "psr/container",
@@ -1436,16 +1436,16 @@
},
{
"name": "symfony/console",
- "version": "v2.8.47",
+ "version": "v2.8.46",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
- "reference": "48ed63767c4add573fb3e9e127d3426db27f78e8"
+ "reference": "aca0dcc0c75496e17e2aa0303bb9c8e6d79ed789"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/console/zipball/48ed63767c4add573fb3e9e127d3426db27f78e8",
- "reference": "48ed63767c4add573fb3e9e127d3426db27f78e8",
+ "url": "https://api.github.com/repos/symfony/console/zipball/aca0dcc0c75496e17e2aa0303bb9c8e6d79ed789",
+ "reference": "aca0dcc0c75496e17e2aa0303bb9c8e6d79ed789",
"shasum": ""
},
"require": {
@@ -1493,7 +1493,7 @@
],
"description": "Symfony Console Component",
"homepage": "https://symfony.com",
- "time": "2018-10-30T14:26:34+00:00"
+ "time": "2018-09-30T03:33:07+00:00"
},
{
"name": "symfony/debug",
@@ -1554,16 +1554,16 @@
},
{
"name": "symfony/event-dispatcher",
- "version": "v2.8.47",
+ "version": "v2.8.46",
"source": {
"type": "git",
"url": "https://github.com/symfony/event-dispatcher.git",
- "reference": "76494bc38ff38d90d01913d23b5271acd4d78dd3"
+ "reference": "84ae343f39947aa084426ed1138bb96bf94d1f12"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/76494bc38ff38d90d01913d23b5271acd4d78dd3",
- "reference": "76494bc38ff38d90d01913d23b5271acd4d78dd3",
+ "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/84ae343f39947aa084426ed1138bb96bf94d1f12",
+ "reference": "84ae343f39947aa084426ed1138bb96bf94d1f12",
"shasum": ""
},
"require": {
@@ -1610,11 +1610,11 @@
],
"description": "Symfony EventDispatcher Component",
"homepage": "https://symfony.com",
- "time": "2018-10-20T23:16:31+00:00"
+ "time": "2018-07-26T09:03:18+00:00"
},
{
"name": "symfony/filesystem",
- "version": "v3.4.18",
+ "version": "v3.4.17",
"source": {
"type": "git",
"url": "https://github.com/symfony/filesystem.git",
@@ -1664,7 +1664,7 @@
},
{
"name": "symfony/finder",
- "version": "v3.4.18",
+ "version": "v3.4.17",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
@@ -1713,7 +1713,7 @@
},
{
"name": "symfony/polyfill-ctype",
- "version": "v1.10.0",
+ "version": "v1.9.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
@@ -1771,16 +1771,16 @@
},
{
"name": "symfony/polyfill-mbstring",
- "version": "v1.10.0",
+ "version": "v1.9.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
- "reference": "c79c051f5b3a46be09205c73b80b346e4153e494"
+ "reference": "d0cd638f4634c16d8df4508e847f14e9e43168b8"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/c79c051f5b3a46be09205c73b80b346e4153e494",
- "reference": "c79c051f5b3a46be09205c73b80b346e4153e494",
+ "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/d0cd638f4634c16d8df4508e847f14e9e43168b8",
+ "reference": "d0cd638f4634c16d8df4508e847f14e9e43168b8",
"shasum": ""
},
"require": {
@@ -1826,20 +1826,20 @@
"portable",
"shim"
],
- "time": "2018-09-21T13:07:52+00:00"
+ "time": "2018-08-06T14:22:27+00:00"
},
{
"name": "symfony/process",
- "version": "v2.8.47",
+ "version": "v2.8.46",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
- "reference": "a15cb61190c6fe37168600922e82295eb5e5449b"
+ "reference": "f09e21b7c5aba06c47bbfad9cbcf13ac7f0db0a6"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/process/zipball/a15cb61190c6fe37168600922e82295eb5e5449b",
- "reference": "a15cb61190c6fe37168600922e82295eb5e5449b",
+ "url": "https://api.github.com/repos/symfony/process/zipball/f09e21b7c5aba06c47bbfad9cbcf13ac7f0db0a6",
+ "reference": "f09e21b7c5aba06c47bbfad9cbcf13ac7f0db0a6",
"shasum": ""
},
"require": {
@@ -1875,7 +1875,7 @@
],
"description": "Symfony Process Component",
"homepage": "https://symfony.com",
- "time": "2018-10-05T07:35:28+00:00"
+ "time": "2018-09-06T17:11:15+00:00"
},
{
"name": "tedivm/jshrink",
@@ -4443,16 +4443,16 @@
},
{
"name": "consolidation/config",
- "version": "1.1.1",
+ "version": "1.1.0",
"source": {
"type": "git",
"url": "https://github.com/consolidation/config.git",
- "reference": "925231dfff32f05b787e1fddb265e789b939cf4c"
+ "reference": "c9fc25e9088a708637e18a256321addc0670e578"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/consolidation/config/zipball/925231dfff32f05b787e1fddb265e789b939cf4c",
- "reference": "925231dfff32f05b787e1fddb265e789b939cf4c",
+ "url": "https://api.github.com/repos/consolidation/config/zipball/c9fc25e9088a708637e18a256321addc0670e578",
+ "reference": "c9fc25e9088a708637e18a256321addc0670e578",
"shasum": ""
},
"require": {
@@ -4493,7 +4493,7 @@
}
],
"description": "Provide configuration services for a commandline tool.",
- "time": "2018-10-24T17:55:35+00:00"
+ "time": "2018-08-07T22:57:00+00:00"
},
{
"name": "consolidation/log",
@@ -4546,20 +4546,19 @@
},
{
"name": "consolidation/output-formatters",
- "version": "3.4.0",
+ "version": "3.2.1",
"source": {
"type": "git",
"url": "https://github.com/consolidation/output-formatters.git",
- "reference": "a942680232094c4a5b21c0b7e54c20cce623ae19"
+ "reference": "d78ef59aea19d3e2e5a23f90a055155ee78a0ad5"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/consolidation/output-formatters/zipball/a942680232094c4a5b21c0b7e54c20cce623ae19",
- "reference": "a942680232094c4a5b21c0b7e54c20cce623ae19",
+ "url": "https://api.github.com/repos/consolidation/output-formatters/zipball/d78ef59aea19d3e2e5a23f90a055155ee78a0ad5",
+ "reference": "d78ef59aea19d3e2e5a23f90a055155ee78a0ad5",
"shasum": ""
},
"require": {
- "dflydev/dot-access-data": "^1.1.0",
"php": ">=5.4.0",
"symfony/console": "^2.8|^3|^4",
"symfony/finder": "^2.5|^3|^4"
@@ -4598,7 +4597,7 @@
}
],
"description": "Format text by applying transformations provided by plug-in formatters.",
- "time": "2018-10-19T22:35:38+00:00"
+ "time": "2018-05-25T18:02:34+00:00"
},
{
"name": "consolidation/robo",
@@ -4683,16 +4682,16 @@
},
{
"name": "consolidation/self-update",
- "version": "1.1.5",
+ "version": "1.1.3",
"source": {
"type": "git",
"url": "https://github.com/consolidation/self-update.git",
- "reference": "a1c273b14ce334789825a09d06d4c87c0a02ad54"
+ "reference": "de33822f907e0beb0ffad24cf4b1b4fae5ada318"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/consolidation/self-update/zipball/a1c273b14ce334789825a09d06d4c87c0a02ad54",
- "reference": "a1c273b14ce334789825a09d06d4c87c0a02ad54",
+ "url": "https://api.github.com/repos/consolidation/self-update/zipball/de33822f907e0beb0ffad24cf4b1b4fae5ada318",
+ "reference": "de33822f907e0beb0ffad24cf4b1b4fae5ada318",
"shasum": ""
},
"require": {
@@ -4729,7 +4728,7 @@
}
],
"description": "Provides a self:update command for Symfony Console applications.",
- "time": "2018-10-28T01:52:03+00:00"
+ "time": "2018-08-24T17:01:46+00:00"
},
{
"name": "dflydev/dot-access-data",
@@ -5671,16 +5670,16 @@
},
{
"name": "jms/metadata",
- "version": "1.7.0",
+ "version": "1.6.0",
"source": {
"type": "git",
"url": "https://github.com/schmittjoh/metadata.git",
- "reference": "e5854ab1aa643623dc64adde718a8eec32b957a8"
+ "reference": "6a06970a10e0a532fb52d3959547123b84a3b3ab"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/schmittjoh/metadata/zipball/e5854ab1aa643623dc64adde718a8eec32b957a8",
- "reference": "e5854ab1aa643623dc64adde718a8eec32b957a8",
+ "url": "https://api.github.com/repos/schmittjoh/metadata/zipball/6a06970a10e0a532fb52d3959547123b84a3b3ab",
+ "reference": "6a06970a10e0a532fb52d3959547123b84a3b3ab",
"shasum": ""
},
"require": {
@@ -5703,13 +5702,9 @@
},
"notification-url": "https://packagist.org/downloads/",
"license": [
- "MIT"
+ "Apache-2.0"
],
"authors": [
- {
- "name": "Asmir Mustafic",
- "email": "goetas@gmail.com"
- },
{
"name": "Johannes M. Schmitt",
"email": "schmittjoh@gmail.com"
@@ -5722,7 +5717,7 @@
"xml",
"yaml"
],
- "time": "2018-10-26T12:40:10+00:00"
+ "time": "2016-12-05T10:18:33+00:00"
},
{
"name": "jms/parser-lib",
@@ -7801,7 +7796,7 @@
},
{
"name": "symfony/browser-kit",
- "version": "v3.4.18",
+ "version": "v3.4.17",
"source": {
"type": "git",
"url": "https://github.com/symfony/browser-kit.git",
@@ -7858,16 +7853,16 @@
},
{
"name": "symfony/config",
- "version": "v3.4.18",
+ "version": "v3.4.17",
"source": {
"type": "git",
"url": "https://github.com/symfony/config.git",
- "reference": "99b2fa8acc244e656cdf324ff419fbe6fd300a4d"
+ "reference": "e5389132dc6320682de3643091121c048ff796b3"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/config/zipball/99b2fa8acc244e656cdf324ff419fbe6fd300a4d",
- "reference": "99b2fa8acc244e656cdf324ff419fbe6fd300a4d",
+ "url": "https://api.github.com/repos/symfony/config/zipball/e5389132dc6320682de3643091121c048ff796b3",
+ "reference": "e5389132dc6320682de3643091121c048ff796b3",
"shasum": ""
},
"require": {
@@ -7918,11 +7913,11 @@
],
"description": "Symfony Config Component",
"homepage": "https://symfony.com",
- "time": "2018-10-31T09:06:03+00:00"
+ "time": "2018-09-08T13:15:14+00:00"
},
{
"name": "symfony/css-selector",
- "version": "v3.4.18",
+ "version": "v3.4.17",
"source": {
"type": "git",
"url": "https://github.com/symfony/css-selector.git",
@@ -8045,7 +8040,7 @@
},
{
"name": "symfony/dom-crawler",
- "version": "v3.4.18",
+ "version": "v3.4.17",
"source": {
"type": "git",
"url": "https://github.com/symfony/dom-crawler.git",
@@ -8102,16 +8097,16 @@
},
{
"name": "symfony/http-foundation",
- "version": "v3.4.18",
+ "version": "v3.4.17",
"source": {
"type": "git",
"url": "https://github.com/symfony/http-foundation.git",
- "reference": "5aea7a86ca3203dd7a257e765b4b9c9cfd01c6c0"
+ "reference": "3a4498236ade473c52b92d509303e5fd1b211ab1"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/http-foundation/zipball/5aea7a86ca3203dd7a257e765b4b9c9cfd01c6c0",
- "reference": "5aea7a86ca3203dd7a257e765b4b9c9cfd01c6c0",
+ "url": "https://api.github.com/repos/symfony/http-foundation/zipball/3a4498236ade473c52b92d509303e5fd1b211ab1",
+ "reference": "3a4498236ade473c52b92d509303e5fd1b211ab1",
"shasum": ""
},
"require": {
@@ -8152,11 +8147,11 @@
],
"description": "Symfony HttpFoundation Component",
"homepage": "https://symfony.com",
- "time": "2018-10-31T08:57:11+00:00"
+ "time": "2018-10-03T08:48:18+00:00"
},
{
"name": "symfony/options-resolver",
- "version": "v3.4.18",
+ "version": "v3.4.17",
"source": {
"type": "git",
"url": "https://github.com/symfony/options-resolver.git",
@@ -8210,7 +8205,7 @@
},
{
"name": "symfony/polyfill-php54",
- "version": "v1.10.0",
+ "version": "v1.9.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php54.git",
@@ -8268,16 +8263,16 @@
},
{
"name": "symfony/polyfill-php55",
- "version": "v1.10.0",
+ "version": "v1.9.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php55.git",
- "reference": "42a4c00a347625ac8853c3358c47eeadc7fd4e96"
+ "reference": "578b8528da843de0fc65ec395900fa3181f2ead7"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-php55/zipball/42a4c00a347625ac8853c3358c47eeadc7fd4e96",
- "reference": "42a4c00a347625ac8853c3358c47eeadc7fd4e96",
+ "url": "https://api.github.com/repos/symfony/polyfill-php55/zipball/578b8528da843de0fc65ec395900fa3181f2ead7",
+ "reference": "578b8528da843de0fc65ec395900fa3181f2ead7",
"shasum": ""
},
"require": {
@@ -8320,20 +8315,20 @@
"portable",
"shim"
],
- "time": "2018-10-31T12:13:01+00:00"
+ "time": "2018-08-06T14:22:27+00:00"
},
{
"name": "symfony/polyfill-php70",
- "version": "v1.10.0",
+ "version": "v1.9.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php70.git",
- "reference": "6b88000cdd431cd2e940caa2cb569201f3f84224"
+ "reference": "1e24b0c4a56d55aaf368763a06c6d1c7d3194934"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/6b88000cdd431cd2e940caa2cb569201f3f84224",
- "reference": "6b88000cdd431cd2e940caa2cb569201f3f84224",
+ "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/1e24b0c4a56d55aaf368763a06c6d1c7d3194934",
+ "reference": "1e24b0c4a56d55aaf368763a06c6d1c7d3194934",
"shasum": ""
},
"require": {
@@ -8379,20 +8374,20 @@
"portable",
"shim"
],
- "time": "2018-09-21T06:26:08+00:00"
+ "time": "2018-08-06T14:22:27+00:00"
},
{
"name": "symfony/polyfill-php72",
- "version": "v1.10.0",
+ "version": "v1.9.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php72.git",
- "reference": "9050816e2ca34a8e916c3a0ae8b9c2fccf68b631"
+ "reference": "95c50420b0baed23852452a7f0c7b527303ed5ae"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/9050816e2ca34a8e916c3a0ae8b9c2fccf68b631",
- "reference": "9050816e2ca34a8e916c3a0ae8b9c2fccf68b631",
+ "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/95c50420b0baed23852452a7f0c7b527303ed5ae",
+ "reference": "95c50420b0baed23852452a7f0c7b527303ed5ae",
"shasum": ""
},
"require": {
@@ -8434,11 +8429,11 @@
"portable",
"shim"
],
- "time": "2018-09-21T13:07:52+00:00"
+ "time": "2018-08-06T14:22:27+00:00"
},
{
"name": "symfony/stopwatch",
- "version": "v3.4.18",
+ "version": "v3.4.17",
"source": {
"type": "git",
"url": "https://github.com/symfony/stopwatch.git",
From e98a94fcfe23f7f00821fb2b343412e89badc92a Mon Sep 17 00:00:00 2001
From: Kevin Kozan
Date: Fri, 9 Nov 2018 14:06:52 -0600
Subject: [PATCH 73/75] MQE-1339: Bump MFTF version in Magento
- Fix flaky actionGroup
---
.../ChangeStatusProductUsingProductGridActionGroup.xml | 1 +
1 file changed, 1 insertion(+)
diff --git a/app/code/Magento/Quote/Test/Mftf/ActionGroup/ChangeStatusProductUsingProductGridActionGroup.xml b/app/code/Magento/Quote/Test/Mftf/ActionGroup/ChangeStatusProductUsingProductGridActionGroup.xml
index dba4a94f3db2a..7da3938863a15 100644
--- a/app/code/Magento/Quote/Test/Mftf/ActionGroup/ChangeStatusProductUsingProductGridActionGroup.xml
+++ b/app/code/Magento/Quote/Test/Mftf/ActionGroup/ChangeStatusProductUsingProductGridActionGroup.xml
@@ -28,6 +28,7 @@
+
From c5571edd6e1831e078751d52c47be100b0f9a055 Mon Sep 17 00:00:00 2001
From: serhii balko
Date: Mon, 12 Nov 2018 12:49:15 +0200
Subject: [PATCH 74/75] MAGETWO-94860: Moving Category generate duplicate
url_rewrite when 4th level category exist and is translated
---
...SortingByPriceForConfigurableWithCatalogRuleAppliedTest.xml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontSortingByPriceForConfigurableWithCatalogRuleAppliedTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontSortingByPriceForConfigurableWithCatalogRuleAppliedTest.xml
index c8ca2ced0d60f..d07ff3ec4d656 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontSortingByPriceForConfigurableWithCatalogRuleAppliedTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontSortingByPriceForConfigurableWithCatalogRuleAppliedTest.xml
@@ -16,6 +16,9 @@
+
+
+
From c864c30c5bdfdcce3616ea36e8f4b9ba896e4344 Mon Sep 17 00:00:00 2001
From: Kevin Kozan
Date: Tue, 13 Nov 2018 13:12:28 -0600
Subject: [PATCH 75/75] MQE-1339: Bump MFTF version in Magento
- MFTF version bump and lock file update
---
composer.json | 2 +-
composer.lock | 12 ++++++------
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/composer.json b/composer.json
index 9c1ad3672d231..891667b6ee942 100644
--- a/composer.json
+++ b/composer.json
@@ -74,7 +74,7 @@
"ramsey/uuid": "~3.7.3"
},
"require-dev": {
- "magento/magento2-functional-testing-framework": "2.3.10",
+ "magento/magento2-functional-testing-framework": "2.3.11",
"phpunit/phpunit": "~6.2.0",
"squizlabs/php_codesniffer": "3.2.2",
"phpmd/phpmd": "@stable",
diff --git a/composer.lock b/composer.lock
index 1ffc2d5b50e10..98c4846dc228a 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "ed7440f5db63647b663968c08869cf6d",
+ "content-hash": "d101565e8093f4857dc138911992d64b",
"packages": [
{
"name": "braintree/braintree_php",
@@ -5972,16 +5972,16 @@
},
{
"name": "magento/magento2-functional-testing-framework",
- "version": "2.3.10",
+ "version": "2.3.11",
"source": {
"type": "git",
"url": "https://github.com/magento/magento2-functional-testing-framework.git",
- "reference": "7cd80dbf1af405473f1a976c3b75097a0f27725d"
+ "reference": "3ca1bd74228a61bd05520bed1ef88b5a19764d92"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/magento/magento2-functional-testing-framework/zipball/7cd80dbf1af405473f1a976c3b75097a0f27725d",
- "reference": "7cd80dbf1af405473f1a976c3b75097a0f27725d",
+ "url": "https://api.github.com/repos/magento/magento2-functional-testing-framework/zipball/3ca1bd74228a61bd05520bed1ef88b5a19764d92",
+ "reference": "3ca1bd74228a61bd05520bed1ef88b5a19764d92",
"shasum": ""
},
"require": {
@@ -6039,7 +6039,7 @@
"magento",
"testing"
],
- "time": "2018-11-06T20:54:16+00:00"
+ "time": "2018-11-13T18:22:25+00:00"
},
{
"name": "moontoast/math",