From 82a635b3a4eb0fd0e2f030d82495ab717ee11db5 Mon Sep 17 00:00:00 2001
From: Graham Wharton
Date: Mon, 8 Oct 2018 16:44:56 +0100
Subject: [PATCH 001/315] Removed setFromByStore and replaced with default
parameter to setFrom
---
.../Sales/Model/Order/Email/SenderBuilder.php | 16 +----
.../Model/Order/Email/SenderBuilderTest.php | 25 +++----
.../Mail/Template/TransportBuilder.php | 5 +-
.../Mail/Template/TransportBuilderByStore.php | 55 ---------------
.../Template/TransportBuilderByStoreTest.php | 67 -------------------
.../Unit/Template/TransportBuilderTest.php | 5 +-
6 files changed, 21 insertions(+), 152 deletions(-)
delete mode 100644 lib/internal/Magento/Framework/Mail/Template/TransportBuilderByStore.php
delete mode 100644 lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderByStoreTest.php
diff --git a/app/code/Magento/Sales/Model/Order/Email/SenderBuilder.php b/app/code/Magento/Sales/Model/Order/Email/SenderBuilder.php
index 7ec089b882972..e5c9c4b4afddc 100644
--- a/app/code/Magento/Sales/Model/Order/Email/SenderBuilder.php
+++ b/app/code/Magento/Sales/Model/Order/Email/SenderBuilder.php
@@ -5,9 +5,7 @@
*/
namespace Magento\Sales\Model\Order\Email;
-use Magento\Framework\App\ObjectManager;
use Magento\Framework\Mail\Template\TransportBuilder;
-use Magento\Framework\Mail\Template\TransportBuilderByStore;
use Magento\Sales\Model\Order\Email\Container\IdentityInterface;
use Magento\Sales\Model\Order\Email\Container\Template;
@@ -28,29 +26,19 @@ class SenderBuilder
*/
protected $transportBuilder;
- /**
- * @var TransportBuilderByStore
- */
- private $transportBuilderByStore;
-
/**
* @param Template $templateContainer
* @param IdentityInterface $identityContainer
* @param TransportBuilder $transportBuilder
- * @param TransportBuilderByStore $transportBuilderByStore
*/
public function __construct(
Template $templateContainer,
IdentityInterface $identityContainer,
- TransportBuilder $transportBuilder,
- TransportBuilderByStore $transportBuilderByStore = null
+ TransportBuilder $transportBuilder
) {
$this->templateContainer = $templateContainer;
$this->identityContainer = $identityContainer;
$this->transportBuilder = $transportBuilder;
- $this->transportBuilderByStore = $transportBuilderByStore ?: ObjectManager::getInstance()->get(
- TransportBuilderByStore::class
- );
}
/**
@@ -110,7 +98,7 @@ protected function configureEmailTemplate()
$this->transportBuilder->setTemplateIdentifier($this->templateContainer->getTemplateId());
$this->transportBuilder->setTemplateOptions($this->templateContainer->getTemplateOptions());
$this->transportBuilder->setTemplateVars($this->templateContainer->getTemplateVars());
- $this->transportBuilderByStore->setFromByStore(
+ $this->transportBuilder->setFrom(
$this->identityContainer->getEmailIdentity(),
$this->identityContainer->getStore()->getId()
);
diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Email/SenderBuilderTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Email/SenderBuilderTest.php
index 38209bb22aef4..a3b7f6ef574dc 100644
--- a/app/code/Magento/Sales/Test/Unit/Model/Order/Email/SenderBuilderTest.php
+++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Email/SenderBuilderTest.php
@@ -6,7 +6,6 @@
namespace Magento\Sales\Test\Unit\Model\Order\Email;
-use Magento\Framework\Mail\Template\TransportBuilderByStore;
use Magento\Sales\Model\Order\Email\SenderBuilder;
class SenderBuilderTest extends \PHPUnit\Framework\TestCase
@@ -36,11 +35,6 @@ class SenderBuilderTest extends \PHPUnit\Framework\TestCase
*/
private $storeMock;
- /**
- * @var \PHPUnit_Framework_MockObject_MockObject
- */
- private $transportBuilderByStore;
-
protected function setUp()
{
$templateId = 'test_template_id';
@@ -82,11 +76,10 @@ protected function setUp()
'setTemplateIdentifier',
'setTemplateOptions',
'setTemplateVars',
+ 'setFrom',
]
);
- $this->transportBuilderByStore = $this->createMock(TransportBuilderByStore::class);
-
$this->templateContainerMock->expects($this->once())
->method('getTemplateId')
->will($this->returnValue($templateId));
@@ -109,8 +102,8 @@ protected function setUp()
$this->identityContainerMock->expects($this->once())
->method('getEmailIdentity')
->will($this->returnValue($emailIdentity));
- $this->transportBuilderByStore->expects($this->once())
- ->method('setFromByStore')
+ $this->transportBuilder->expects($this->once())
+ ->method('setFrom')
->with($this->equalTo($emailIdentity));
$this->identityContainerMock->expects($this->once())
@@ -120,8 +113,7 @@ protected function setUp()
$this->senderBuilder = new SenderBuilder(
$this->templateContainerMock,
$this->identityContainerMock,
- $this->transportBuilder,
- $this->transportBuilderByStore
+ $this->transportBuilder
);
}
@@ -129,6 +121,8 @@ public function testSend()
{
$customerName = 'test_name';
$customerEmail = 'test_email';
+ $identity = 'email_identity_test';
+
$transportMock = $this->createMock(
\Magento\Sales\Test\Unit\Model\Order\Email\Stub\TransportInterfaceMock::class
);
@@ -151,6 +145,9 @@ public function testSend()
$this->storeMock->expects($this->once())
->method('getId')
->willReturn(1);
+ $this->transportBuilder->expects($this->once())
+ ->method('setFrom')
+ ->with($identity, 1);
$this->transportBuilder->expects($this->once())
->method('addTo')
->with($this->equalTo($customerEmail), $this->equalTo($customerName));
@@ -164,6 +161,7 @@ public function testSend()
public function testSendCopyTo()
{
+ $identity = 'email_identity_test';
$transportMock = $this->createMock(
\Magento\Sales\Test\Unit\Model\Order\Email\Stub\TransportInterfaceMock::class
);
@@ -177,6 +175,9 @@ public function testSendCopyTo()
$this->transportBuilder->expects($this->once())
->method('addTo')
->with($this->equalTo('example@mail.com'));
+ $this->transportBuilder->expects($this->once())
+ ->method('setFrom')
+ ->with($identity, 1);
$this->identityContainerMock->expects($this->once())
->method('getStore')
->willReturn($this->storeMock);
diff --git a/lib/internal/Magento/Framework/Mail/Template/TransportBuilder.php b/lib/internal/Magento/Framework/Mail/Template/TransportBuilder.php
index a1c7333f41245..afe5477e84637 100644
--- a/lib/internal/Magento/Framework/Mail/Template/TransportBuilder.php
+++ b/lib/internal/Magento/Framework/Mail/Template/TransportBuilder.php
@@ -174,11 +174,12 @@ public function setReplyTo($email, $name = null)
* Set mail from address
*
* @param string|array $from
+ * @param string|int $store
* @return $this
*/
- public function setFrom($from)
+ public function setFrom($from, $store = null)
{
- $result = $this->_senderResolver->resolve($from);
+ $result = $this->_senderResolver->resolve($from, $store);
$this->message->setFrom($result['email'], $result['name']);
return $this;
}
diff --git a/lib/internal/Magento/Framework/Mail/Template/TransportBuilderByStore.php b/lib/internal/Magento/Framework/Mail/Template/TransportBuilderByStore.php
deleted file mode 100644
index 95f17fed1123c..0000000000000
--- a/lib/internal/Magento/Framework/Mail/Template/TransportBuilderByStore.php
+++ /dev/null
@@ -1,55 +0,0 @@
-message = $message;
- $this->senderResolver = $senderResolver;
- }
-
- /**
- * Set mail from address by store.
- *
- * @param string|array $from
- * @param string|int $store
- *
- * @return $this
- */
- public function setFromByStore($from, $store)
- {
- $result = $this->senderResolver->resolve($from, $store);
- $this->message->clearFrom();
- $this->message->setFrom($result['email'], $result['name']);
-
- return $this;
- }
-}
diff --git a/lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderByStoreTest.php b/lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderByStoreTest.php
deleted file mode 100644
index 58c9b045eed8c..0000000000000
--- a/lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderByStoreTest.php
+++ /dev/null
@@ -1,67 +0,0 @@
-messageMock = $this->createMock(\Magento\Framework\Mail\Message::class);
- $this->senderResolverMock = $this->createMock(\Magento\Framework\Mail\Template\SenderResolverInterface::class);
-
- $this->model = $objectManagerHelper->getObject(
- TransportBuilderByStore::class,
- [
- 'message' => $this->messageMock,
- 'senderResolver' => $this->senderResolverMock,
- ]
- );
- }
-
- /**
- * @return void
- */
- public function testSetFromByStore()
- {
- $sender = ['email' => 'from@example.com', 'name' => 'name'];
- $store = 1;
- $this->senderResolverMock->expects($this->once())
- ->method('resolve')
- ->with($sender, $store)
- ->willReturn($sender);
- $this->messageMock->expects($this->once())
- ->method('setFrom')
- ->with('from@example.com', 'name')
- ->willReturnSelf();
- $this->messageMock->expects($this->once())
- ->method('clearFrom')
- ->willReturnSelf();
-
- $this->model->setFromByStore($sender, $store);
- }
-}
diff --git a/lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderTest.php b/lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderTest.php
index c3759bc43f81f..8e9858116ffdb 100644
--- a/lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderTest.php
+++ b/lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderTest.php
@@ -167,16 +167,17 @@ public function getTransportDataProvider()
public function testSetFrom()
{
$sender = ['email' => 'from@example.com', 'name' => 'name'];
+ $store = 1;
$this->senderResolverMock->expects($this->once())
->method('resolve')
- ->with($sender)
+ ->with($sender, $store)
->willReturn($sender);
$this->messageMock->expects($this->once())
->method('setFrom')
->with('from@example.com', 'name')
->willReturnSelf();
- $this->builder->setFrom($sender);
+ $this->builder->setFrom($sender, $store);
}
/**
From 16afc0962463261e4464456b9bdaad4e8f3be924 Mon Sep 17 00:00:00 2001
From: Graham Wharton
Date: Tue, 16 Oct 2018 09:31:45 +0100
Subject: [PATCH 002/315] Added new setFromByStore function and deprecated old
function.
TODO : Rest of Magento codebase still uses deprecated setFrom
---
.../Sales/Model/Order/Email/SenderBuilder.php | 2 +-
.../Model/Order/Email/SenderBuilderTest.php | 10 +++++-----
.../Mail/Template/TransportBuilder.php | 17 ++++++++++++++++-
.../Test/Unit/Template/TransportBuilderTest.php | 4 ++--
4 files changed, 24 insertions(+), 9 deletions(-)
diff --git a/app/code/Magento/Sales/Model/Order/Email/SenderBuilder.php b/app/code/Magento/Sales/Model/Order/Email/SenderBuilder.php
index e5c9c4b4afddc..af3ace9090834 100644
--- a/app/code/Magento/Sales/Model/Order/Email/SenderBuilder.php
+++ b/app/code/Magento/Sales/Model/Order/Email/SenderBuilder.php
@@ -98,7 +98,7 @@ protected function configureEmailTemplate()
$this->transportBuilder->setTemplateIdentifier($this->templateContainer->getTemplateId());
$this->transportBuilder->setTemplateOptions($this->templateContainer->getTemplateOptions());
$this->transportBuilder->setTemplateVars($this->templateContainer->getTemplateVars());
- $this->transportBuilder->setFrom(
+ $this->transportBuilder->setFromByStore(
$this->identityContainer->getEmailIdentity(),
$this->identityContainer->getStore()->getId()
);
diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Email/SenderBuilderTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Email/SenderBuilderTest.php
index a3b7f6ef574dc..86d65cc476668 100644
--- a/app/code/Magento/Sales/Test/Unit/Model/Order/Email/SenderBuilderTest.php
+++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Email/SenderBuilderTest.php
@@ -76,7 +76,7 @@ protected function setUp()
'setTemplateIdentifier',
'setTemplateOptions',
'setTemplateVars',
- 'setFrom',
+ 'setFromByStore',
]
);
@@ -103,8 +103,8 @@ protected function setUp()
->method('getEmailIdentity')
->will($this->returnValue($emailIdentity));
$this->transportBuilder->expects($this->once())
- ->method('setFrom')
- ->with($this->equalTo($emailIdentity));
+ ->method('setFromByStore')
+ ->with($this->equalTo($emailIdentity), 1);
$this->identityContainerMock->expects($this->once())
->method('getEmailCopyTo')
@@ -146,7 +146,7 @@ public function testSend()
->method('getId')
->willReturn(1);
$this->transportBuilder->expects($this->once())
- ->method('setFrom')
+ ->method('setFromByStore')
->with($identity, 1);
$this->transportBuilder->expects($this->once())
->method('addTo')
@@ -176,7 +176,7 @@ public function testSendCopyTo()
->method('addTo')
->with($this->equalTo('example@mail.com'));
$this->transportBuilder->expects($this->once())
- ->method('setFrom')
+ ->method('setFromByStore')
->with($identity, 1);
$this->identityContainerMock->expects($this->once())
->method('getStore')
diff --git a/lib/internal/Magento/Framework/Mail/Template/TransportBuilder.php b/lib/internal/Magento/Framework/Mail/Template/TransportBuilder.php
index afe5477e84637..81edf165fdf75 100644
--- a/lib/internal/Magento/Framework/Mail/Template/TransportBuilder.php
+++ b/lib/internal/Magento/Framework/Mail/Template/TransportBuilder.php
@@ -172,12 +172,27 @@ public function setReplyTo($email, $name = null)
/**
* Set mail from address
+ *
+ * @deprecated Use setFromByStore
+ *
+ * @param string|array $from
+ * @return $this
+ */
+ public function setFrom($from)
+ {
+ $result = $this->_senderResolver->resolve($from);
+ $this->message->setFrom($result['email'], $result['name']);
+ return $this;
+ }
+
+ /**
+ * Set mail from address by store
*
* @param string|array $from
* @param string|int $store
* @return $this
*/
- public function setFrom($from, $store = null)
+ public function setFromByStore($from, $store = null)
{
$result = $this->_senderResolver->resolve($from, $store);
$this->message->setFrom($result['email'], $result['name']);
diff --git a/lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderTest.php b/lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderTest.php
index 8e9858116ffdb..a2539c1326a49 100644
--- a/lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderTest.php
+++ b/lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderTest.php
@@ -173,11 +173,11 @@ public function testSetFrom()
->with($sender, $store)
->willReturn($sender);
$this->messageMock->expects($this->once())
- ->method('setFrom')
+ ->method('setFromByStore')
->with('from@example.com', 'name')
->willReturnSelf();
- $this->builder->setFrom($sender, $store);
+ $this->builder->setFromByStore($sender, $store);
}
/**
From 47c5f72c9196dc77b50db3c36ec99719a69a18a0 Mon Sep 17 00:00:00 2001
From: Graham Wharton
Date: Tue, 16 Oct 2018 09:59:02 +0100
Subject: [PATCH 003/315] Addressed review comments
---
.../Sales/Model/Order/Email/SenderBuilder.php | 5 +-
.../Mail/Template/TransportBuilder.php | 9 +--
.../Mail/Template/TransportBuilderByStore.php | 62 +++++++++++++++++
.../Template/TransportBuilderByStoreTest.php | 67 +++++++++++++++++++
4 files changed, 138 insertions(+), 5 deletions(-)
create mode 100644 lib/internal/Magento/Framework/Mail/Template/TransportBuilderByStore.php
create mode 100644 lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderByStoreTest.php
diff --git a/app/code/Magento/Sales/Model/Order/Email/SenderBuilder.php b/app/code/Magento/Sales/Model/Order/Email/SenderBuilder.php
index af3ace9090834..cda3e3a343f4c 100644
--- a/app/code/Magento/Sales/Model/Order/Email/SenderBuilder.php
+++ b/app/code/Magento/Sales/Model/Order/Email/SenderBuilder.php
@@ -6,6 +6,7 @@
namespace Magento\Sales\Model\Order\Email;
use Magento\Framework\Mail\Template\TransportBuilder;
+use Magento\Framework\Mail\Template\TransportBuilderByStore;
use Magento\Sales\Model\Order\Email\Container\IdentityInterface;
use Magento\Sales\Model\Order\Email\Container\Template;
@@ -30,11 +31,13 @@ class SenderBuilder
* @param Template $templateContainer
* @param IdentityInterface $identityContainer
* @param TransportBuilder $transportBuilder
+ * @param TransportBuilderByStore $transportBuilderByStore
*/
public function __construct(
Template $templateContainer,
IdentityInterface $identityContainer,
- TransportBuilder $transportBuilder
+ TransportBuilder $transportBuilder,
+ TransportBuilderByStore $transportBuilderByStore = null
) {
$this->templateContainer = $templateContainer;
$this->identityContainer = $identityContainer;
diff --git a/lib/internal/Magento/Framework/Mail/Template/TransportBuilder.php b/lib/internal/Magento/Framework/Mail/Template/TransportBuilder.php
index 81edf165fdf75..12ab84eb61c11 100644
--- a/lib/internal/Magento/Framework/Mail/Template/TransportBuilder.php
+++ b/lib/internal/Magento/Framework/Mail/Template/TransportBuilder.php
@@ -173,16 +173,17 @@ public function setReplyTo($email, $name = null)
/**
* Set mail from address
*
- * @deprecated Use setFromByStore
+ * @deprecated This function sets the from address for the first store only.
+ * new function setFromByStore introduced to allow setting of from address
+ * based on store.
+ * @see setFromByStore()
*
* @param string|array $from
* @return $this
*/
public function setFrom($from)
{
- $result = $this->_senderResolver->resolve($from);
- $this->message->setFrom($result['email'], $result['name']);
- return $this;
+ return($this->setFromByStore($from));
}
/**
diff --git a/lib/internal/Magento/Framework/Mail/Template/TransportBuilderByStore.php b/lib/internal/Magento/Framework/Mail/Template/TransportBuilderByStore.php
new file mode 100644
index 0000000000000..88ad4f105f4b7
--- /dev/null
+++ b/lib/internal/Magento/Framework/Mail/Template/TransportBuilderByStore.php
@@ -0,0 +1,62 @@
+message = $message;
+ $this->senderResolver = $senderResolver;
+ }
+
+ /**
+ * Set mail from address by store.
+ *
+ * @param string|array $from
+ * @param string|int $store
+ *
+ * @return $this
+ */
+ public function setFromByStore($from, $store)
+ {
+ $result = $this->senderResolver->resolve($from, $store);
+ $this->message->clearFrom();
+ $this->message->setFrom($result['email'], $result['name']);
+
+ return $this;
+ }
+}
\ No newline at end of file
diff --git a/lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderByStoreTest.php b/lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderByStoreTest.php
new file mode 100644
index 0000000000000..d9f9a194165d6
--- /dev/null
+++ b/lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderByStoreTest.php
@@ -0,0 +1,67 @@
+messageMock = $this->createMock(\Magento\Framework\Mail\Message::class);
+ $this->senderResolverMock = $this->createMock(\Magento\Framework\Mail\Template\SenderResolverInterface::class);
+
+ $this->model = $objectManagerHelper->getObject(
+ TransportBuilderByStore::class,
+ [
+ 'message' => $this->messageMock,
+ 'senderResolver' => $this->senderResolverMock,
+ ]
+ );
+ }
+
+ /**
+ * @return void
+ */
+ public function testSetFromByStore()
+ {
+ $sender = ['email' => 'from@example.com', 'name' => 'name'];
+ $store = 1;
+ $this->senderResolverMock->expects($this->once())
+ ->method('resolve')
+ ->with($sender, $store)
+ ->willReturn($sender);
+ $this->messageMock->expects($this->once())
+ ->method('setFrom')
+ ->with('from@example.com', 'name')
+ ->willReturnSelf();
+ $this->messageMock->expects($this->once())
+ ->method('clearFrom')
+ ->willReturnSelf();
+
+ $this->model->setFromByStore($sender, $store);
+ }
+}
\ No newline at end of file
From 8d7a4513ddf4b759a6c6a0d2ace04aa714a396df Mon Sep 17 00:00:00 2001
From: Graham Wharton
Date: Tue, 16 Oct 2018 10:03:56 +0100
Subject: [PATCH 004/315] Corrected linefeeds
---
.../Mail/Template/TransportBuilderByStore.php | 122 ++++++++--------
.../Template/TransportBuilderByStoreTest.php | 132 +++++++++---------
2 files changed, 127 insertions(+), 127 deletions(-)
diff --git a/lib/internal/Magento/Framework/Mail/Template/TransportBuilderByStore.php b/lib/internal/Magento/Framework/Mail/Template/TransportBuilderByStore.php
index 88ad4f105f4b7..105a497a14bdb 100644
--- a/lib/internal/Magento/Framework/Mail/Template/TransportBuilderByStore.php
+++ b/lib/internal/Magento/Framework/Mail/Template/TransportBuilderByStore.php
@@ -1,62 +1,62 @@
-message = $message;
- $this->senderResolver = $senderResolver;
- }
-
- /**
- * Set mail from address by store.
- *
- * @param string|array $from
- * @param string|int $store
- *
- * @return $this
- */
- public function setFromByStore($from, $store)
- {
- $result = $this->senderResolver->resolve($from, $store);
- $this->message->clearFrom();
- $this->message->setFrom($result['email'], $result['name']);
-
- return $this;
- }
+message = $message;
+ $this->senderResolver = $senderResolver;
+ }
+
+ /**
+ * Set mail from address by store.
+ *
+ * @param string|array $from
+ * @param string|int $store
+ *
+ * @return $this
+ */
+ public function setFromByStore($from, $store)
+ {
+ $result = $this->senderResolver->resolve($from, $store);
+ $this->message->clearFrom();
+ $this->message->setFrom($result['email'], $result['name']);
+
+ return $this;
+ }
}
\ No newline at end of file
diff --git a/lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderByStoreTest.php b/lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderByStoreTest.php
index d9f9a194165d6..cebf2a8b15b7f 100644
--- a/lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderByStoreTest.php
+++ b/lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderByStoreTest.php
@@ -1,67 +1,67 @@
-messageMock = $this->createMock(\Magento\Framework\Mail\Message::class);
- $this->senderResolverMock = $this->createMock(\Magento\Framework\Mail\Template\SenderResolverInterface::class);
-
- $this->model = $objectManagerHelper->getObject(
- TransportBuilderByStore::class,
- [
- 'message' => $this->messageMock,
- 'senderResolver' => $this->senderResolverMock,
- ]
- );
- }
-
- /**
- * @return void
- */
- public function testSetFromByStore()
- {
- $sender = ['email' => 'from@example.com', 'name' => 'name'];
- $store = 1;
- $this->senderResolverMock->expects($this->once())
- ->method('resolve')
- ->with($sender, $store)
- ->willReturn($sender);
- $this->messageMock->expects($this->once())
- ->method('setFrom')
- ->with('from@example.com', 'name')
- ->willReturnSelf();
- $this->messageMock->expects($this->once())
- ->method('clearFrom')
- ->willReturnSelf();
-
- $this->model->setFromByStore($sender, $store);
- }
+messageMock = $this->createMock(\Magento\Framework\Mail\Message::class);
+ $this->senderResolverMock = $this->createMock(\Magento\Framework\Mail\Template\SenderResolverInterface::class);
+
+ $this->model = $objectManagerHelper->getObject(
+ TransportBuilderByStore::class,
+ [
+ 'message' => $this->messageMock,
+ 'senderResolver' => $this->senderResolverMock,
+ ]
+ );
+ }
+
+ /**
+ * @return void
+ */
+ public function testSetFromByStore()
+ {
+ $sender = ['email' => 'from@example.com', 'name' => 'name'];
+ $store = 1;
+ $this->senderResolverMock->expects($this->once())
+ ->method('resolve')
+ ->with($sender, $store)
+ ->willReturn($sender);
+ $this->messageMock->expects($this->once())
+ ->method('setFrom')
+ ->with('from@example.com', 'name')
+ ->willReturnSelf();
+ $this->messageMock->expects($this->once())
+ ->method('clearFrom')
+ ->willReturnSelf();
+
+ $this->model->setFromByStore($sender, $store);
+ }
}
\ No newline at end of file
From a7cd527a6896c3a2f204e2771b92496ef4089f4e Mon Sep 17 00:00:00 2001
From: Graham Wharton
Date: Tue, 16 Oct 2018 10:09:44 +0100
Subject: [PATCH 005/315] Corrected file encoding
---
.../Magento/Framework/Mail/Template/TransportBuilderByStore.php | 2 +-
.../Mail/Test/Unit/Template/TransportBuilderByStoreTest.php | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/internal/Magento/Framework/Mail/Template/TransportBuilderByStore.php b/lib/internal/Magento/Framework/Mail/Template/TransportBuilderByStore.php
index 105a497a14bdb..82a9c20d59a53 100644
--- a/lib/internal/Magento/Framework/Mail/Template/TransportBuilderByStore.php
+++ b/lib/internal/Magento/Framework/Mail/Template/TransportBuilderByStore.php
@@ -1,6 +1,6 @@
Date: Tue, 16 Oct 2018 10:11:22 +0100
Subject: [PATCH 006/315] Fixed whitespace issues
---
.../Magento/Framework/Mail/Template/TransportBuilderByStore.php | 2 +-
.../Mail/Test/Unit/Template/TransportBuilderByStoreTest.php | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/internal/Magento/Framework/Mail/Template/TransportBuilderByStore.php b/lib/internal/Magento/Framework/Mail/Template/TransportBuilderByStore.php
index 82a9c20d59a53..c898f92bbf282 100644
--- a/lib/internal/Magento/Framework/Mail/Template/TransportBuilderByStore.php
+++ b/lib/internal/Magento/Framework/Mail/Template/TransportBuilderByStore.php
@@ -59,4 +59,4 @@ public function setFromByStore($from, $store)
return $this;
}
-}
\ No newline at end of file
+}
diff --git a/lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderByStoreTest.php b/lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderByStoreTest.php
index 5ae4d8d4478bc..58c9b045eed8c 100644
--- a/lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderByStoreTest.php
+++ b/lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderByStoreTest.php
@@ -64,4 +64,4 @@ public function testSetFromByStore()
$this->model->setFromByStore($sender, $store);
}
-}
\ No newline at end of file
+}
From 490e5d22074224ec1965a391abfffc379c31d0ee Mon Sep 17 00:00:00 2001
From: Graham Wharton
Date: Tue, 16 Oct 2018 10:22:41 +0100
Subject: [PATCH 007/315] Fixed TransportBuilderTest
---
.../Mail/Test/Unit/Template/TransportBuilderTest.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderTest.php b/lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderTest.php
index a2539c1326a49..1af4dd87b087e 100644
--- a/lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderTest.php
+++ b/lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderTest.php
@@ -164,7 +164,7 @@ public function getTransportDataProvider()
/**
* @return void
*/
- public function testSetFrom()
+ public function testSetFromByStore()
{
$sender = ['email' => 'from@example.com', 'name' => 'name'];
$store = 1;
@@ -173,7 +173,7 @@ public function testSetFrom()
->with($sender, $store)
->willReturn($sender);
$this->messageMock->expects($this->once())
- ->method('setFromByStore')
+ ->method('setFrom')
->with('from@example.com', 'name')
->willReturnSelf();
From b19b3ed195b870f16a00c673e435b5b9b8184227 Mon Sep 17 00:00:00 2001
From: Graham Wharton
Date: Tue, 16 Oct 2018 10:24:30 +0100
Subject: [PATCH 008/315] Fixed whitespace violations
---
.../Magento/Framework/Mail/Template/TransportBuilder.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/internal/Magento/Framework/Mail/Template/TransportBuilder.php b/lib/internal/Magento/Framework/Mail/Template/TransportBuilder.php
index 12ab84eb61c11..087fdf8503a60 100644
--- a/lib/internal/Magento/Framework/Mail/Template/TransportBuilder.php
+++ b/lib/internal/Magento/Framework/Mail/Template/TransportBuilder.php
@@ -172,7 +172,7 @@ public function setReplyTo($email, $name = null)
/**
* Set mail from address
- *
+ *
* @deprecated This function sets the from address for the first store only.
* new function setFromByStore introduced to allow setting of from address
* based on store.
From 9f34fd631a55ded6d8a458d219edfc23c1bc5f9b Mon Sep 17 00:00:00 2001
From: Graham Wharton
Date: Tue, 16 Oct 2018 17:55:46 +0100
Subject: [PATCH 009/315] Ignore unused parameter in constructor. Left in for
backwards compatability purposes.
---
app/code/Magento/Sales/Model/Order/Email/SenderBuilder.php | 2 ++
1 file changed, 2 insertions(+)
diff --git a/app/code/Magento/Sales/Model/Order/Email/SenderBuilder.php b/app/code/Magento/Sales/Model/Order/Email/SenderBuilder.php
index cda3e3a343f4c..e4dc75ade7c79 100644
--- a/app/code/Magento/Sales/Model/Order/Email/SenderBuilder.php
+++ b/app/code/Magento/Sales/Model/Order/Email/SenderBuilder.php
@@ -28,6 +28,8 @@ class SenderBuilder
protected $transportBuilder;
/**
+ * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+ *
* @param Template $templateContainer
* @param IdentityInterface $identityContainer
* @param TransportBuilder $transportBuilder
From 66478ec59d6cbf77d538f2ea112f32997e491bf8 Mon Sep 17 00:00:00 2001
From: Ihor Sviziev
Date: Wed, 17 Oct 2018 08:11:32 +0300
Subject: [PATCH 010/315] magento/magento2#18471 Alternative fix for Multi
Store Emails issue
Fix small issue
---
.../Magento/Framework/Mail/Template/TransportBuilder.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/internal/Magento/Framework/Mail/Template/TransportBuilder.php b/lib/internal/Magento/Framework/Mail/Template/TransportBuilder.php
index 087fdf8503a60..35e1651c6a5df 100644
--- a/lib/internal/Magento/Framework/Mail/Template/TransportBuilder.php
+++ b/lib/internal/Magento/Framework/Mail/Template/TransportBuilder.php
@@ -183,7 +183,7 @@ public function setReplyTo($email, $name = null)
*/
public function setFrom($from)
{
- return($this->setFromByStore($from));
+ return $this->setFromByStore($from, null);
}
/**
From cc34f00113e1e644e92002f82d34c4bf36aa0e26 Mon Sep 17 00:00:00 2001
From: gwharton <30697781+gwharton@users.noreply.github.com>
Date: Sat, 20 Oct 2018 14:11:28 +0100
Subject: [PATCH 011/315] Fixed Whitespace issue
---
.../Sales/Test/Unit/Model/Order/Email/SenderBuilderTest.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Email/SenderBuilderTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Email/SenderBuilderTest.php
index 86d65cc476668..759d60d9e6613 100644
--- a/app/code/Magento/Sales/Test/Unit/Model/Order/Email/SenderBuilderTest.php
+++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Email/SenderBuilderTest.php
@@ -122,7 +122,7 @@ public function testSend()
$customerName = 'test_name';
$customerEmail = 'test_email';
$identity = 'email_identity_test';
-
+
$transportMock = $this->createMock(
\Magento\Sales\Test\Unit\Model\Order\Email\Stub\TransportInterfaceMock::class
);
From b271dd889363992514d1555ab9bd21ddfdb7b41d Mon Sep 17 00:00:00 2001
From: Rik Willems
Date: Wed, 21 Nov 2018 16:28:44 +0100
Subject: [PATCH 012/315] CLA force push commit
---
app/code/Magento/Sales/Setup/UpgradeData.php | 125 ++++++++++++-------
1 file changed, 81 insertions(+), 44 deletions(-)
diff --git a/app/code/Magento/Sales/Setup/UpgradeData.php b/app/code/Magento/Sales/Setup/UpgradeData.php
index 77b96791e8cea..83f239546960e 100644
--- a/app/code/Magento/Sales/Setup/UpgradeData.php
+++ b/app/code/Magento/Sales/Setup/UpgradeData.php
@@ -14,9 +14,7 @@
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Framework\Setup\UpgradeDataInterface;
-use Magento\Quote\Model\QuoteFactory;
-use Magento\Sales\Model\OrderFactory;
-use Magento\Sales\Model\ResourceModel\Order\Address\CollectionFactory as AddressCollectionFactory;
+use Magento\Sales\Model\Order\Address;
/**
* Data upgrade script
@@ -42,21 +40,6 @@ class UpgradeData implements UpgradeDataInterface
*/
private $aggregatedFieldConverter;
- /**
- * @var AddressCollectionFactory
- */
- private $addressCollectionFactory;
-
- /**
- * @var OrderFactory
- */
- private $orderFactory;
-
- /**
- * @var QuoteFactory
- */
- private $quoteFactory;
-
/**
* @var State
*/
@@ -66,26 +49,17 @@ class UpgradeData implements UpgradeDataInterface
* @param SalesSetupFactory $salesSetupFactory
* @param Config $eavConfig
* @param AggregatedFieldDataConverter $aggregatedFieldConverter
- * @param AddressCollectionFactory $addressCollFactory
- * @param OrderFactory $orderFactory
- * @param QuoteFactory $quoteFactory
* @param State $state
*/
public function __construct(
SalesSetupFactory $salesSetupFactory,
Config $eavConfig,
AggregatedFieldDataConverter $aggregatedFieldConverter,
- AddressCollectionFactory $addressCollFactory,
- OrderFactory $orderFactory,
- QuoteFactory $quoteFactory,
State $state
) {
$this->salesSetupFactory = $salesSetupFactory;
$this->eavConfig = $eavConfig;
$this->aggregatedFieldConverter = $aggregatedFieldConverter;
- $this->addressCollectionFactory = $addressCollFactory;
- $this->orderFactory = $orderFactory;
- $this->quoteFactory = $quoteFactory;
$this->state = $state;
}
@@ -125,6 +99,7 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface
* @param string $setupVersion
* @param SalesSetup $salesSetup
* @return void
+ * @throws \Magento\Framework\DB\FieldDataConversionException
*/
private function convertSerializedDataToJson($setupVersion, SalesSetup $salesSetup)
{
@@ -173,32 +148,94 @@ private function convertSerializedDataToJson($setupVersion, SalesSetup $salesSet
/**
* Fill quote_address_id in table sales_order_address if it is empty.
- *
* @param ModuleDataSetupInterface $setup
*/
public function fillQuoteAddressIdInSalesOrderAddress(ModuleDataSetupInterface $setup)
{
- $addressTable = $setup->getTable('sales_order_address');
- $updateOrderAddress = $setup->getConnection()
+ $this->fillQuoteAddressIdInSalesOrderAddressByType($setup, Address::TYPE_SHIPPING);
+ $this->fillQuoteAddressIdInSalesOrderAddressByType($setup, Address::TYPE_BILLING);
+ }
+
+ /**
+ * @param ModuleDataSetupInterface $setup
+ * @param string $addressType
+ */
+ public function fillQuoteAddressIdInSalesOrderAddressByType(ModuleDataSetupInterface $setup, $addressType)
+ {
+ $salesConnection = $setup->getConnection('sales');
+
+ $orderTable = $setup->getTable('sales_order', 'sales');
+ $orderAddressTable = $setup->getTable('sales_order_address', 'sales');
+
+ $query = $salesConnection
->select()
+ ->from(
+ ['sales_order_address' => $orderAddressTable],
+ ['entity_id', 'address_type']
+ )
->joinInner(
- ['sales_order' => $setup->getTable('sales_order')],
- $addressTable . '.parent_id = sales_order.entity_id',
- ['quote_address_id' => 'quote_address.address_id']
+ ['sales_order' => $orderTable],
+ 'sales_order_address.parent_id = sales_order.entity_id',
+ ['quote_id' => 'sales_order.quote_id']
+ )
+ ->where('sales_order_address.quote_address_id IS NULL')
+ ->where('sales_order_address.address_type = ?', $addressType)
+ ->order('sales_order_address.entity_id');
+
+ $batchSize = 5000;
+ $result = $salesConnection->query($query);
+ $count = $result->rowCount();
+ $batches = ceil($count / $batchSize);
+
+ for ($batch = $batches; $batch > 0; $batch--) {
+ $query->limitPage($batch, $batchSize);
+ $result = $salesConnection->fetchAssoc($query);
+
+ $this->fillQuoteAddressIdInSalesOrderAddressProcessBatch($setup, $result, $addressType);
+ }
+ }
+ /**
+ * @param ModuleDataSetupInterface $setup
+ * @param array $orderAddresses
+ * @param string $addressType
+ */
+ public function fillQuoteAddressIdInSalesOrderAddressProcessBatch(
+ ModuleDataSetupInterface $setup,
+ array $orderAddresses,
+ $addressType
+ ) {
+ $salesConnection = $setup->getConnection('sales');
+ $quoteConnection = $setup->getConnection('checkout');
+
+ $quoteAddressTable = $setup->getTable('quote_address', 'checkout');
+ $quoteTable = $setup->getTable('quote', 'checkout');
+ $salesOrderAddressTable = $setup->getTable('sales_order_address', 'sales');
+
+ $query = $quoteConnection
+ ->select()
+ ->from(
+ ['quote_address' => $quoteAddressTable],
+ ['quote_id', 'address_id']
)
->joinInner(
- ['quote_address' => $setup->getTable('quote_address')],
- 'sales_order.quote_id = quote_address.quote_id
- AND ' . $addressTable . '.address_type = quote_address.address_type',
+ ['quote' => $quoteTable],
+ 'quote_address.quote_id = quote.entity_id',
[]
)
- ->where(
- $addressTable . '.quote_address_id IS NULL'
- );
- $updateOrderAddress = $setup->getConnection()->updateFromSelect(
- $updateOrderAddress,
- $addressTable
- );
- $setup->getConnection()->query($updateOrderAddress);
+ ->where('quote.entity_id in (?)', array_column($orderAddresses, 'quote_id'))
+ ->where('address_type = ?', $addressType);
+
+ $quoteAddresses = $quoteConnection->fetchAssoc($query);
+
+ foreach ($orderAddresses as $orderAddress) {
+ $bind = [
+ 'quote_address_id' => $quoteAddresses[$orderAddress['quote_id']]['address_id'] ?? null,
+ ];
+ $where = [
+ 'orderAddressId' => $orderAddress['entity_id']
+ ];
+
+ $salesConnection->update($salesOrderAddressTable, $bind, $where);
+ }
}
}
From f0a92f2a2ad7e6a8f6c03b7bded7b2092561f07b Mon Sep 17 00:00:00 2001
From: Suneet
Date: Tue, 4 Dec 2018 22:52:34 +0530
Subject: [PATCH 013/315] Resolved upgrade issue if manufacturer attribute
missing
---
.../ConfigurableProduct/Setup/InstallData.php | 24 ++++++++++---------
.../ConfigurableProduct/Setup/UpgradeData.php | 23 +++++++++++-------
2 files changed, 27 insertions(+), 20 deletions(-)
diff --git a/app/code/Magento/ConfigurableProduct/Setup/InstallData.php b/app/code/Magento/ConfigurableProduct/Setup/InstallData.php
index 1c26f159405dd..f9c94cc684b0d 100644
--- a/app/code/Magento/ConfigurableProduct/Setup/InstallData.php
+++ b/app/code/Magento/ConfigurableProduct/Setup/InstallData.php
@@ -57,18 +57,20 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface
'color'
];
foreach ($attributes as $attributeCode) {
- $relatedProductTypes = explode(
- ',',
- $eavSetup->getAttribute(\Magento\Catalog\Model\Product::ENTITY, $attributeCode, 'apply_to')
- );
- if (!in_array(Configurable::TYPE_CODE, $relatedProductTypes)) {
- $relatedProductTypes[] = Configurable::TYPE_CODE;
- $eavSetup->updateAttribute(
- \Magento\Catalog\Model\Product::ENTITY,
- $attributeCode,
- 'apply_to',
- implode(',', $relatedProductTypes)
+ if ($attribute = $eavSetup->getAttribute(\Magento\Catalog\Model\Product::ENTITY, $attributeCode, 'apply_to')) {
+ $relatedProductTypes = explode(
+ ',',
+ $attribute
);
+ if (!in_array(Configurable::TYPE_CODE, $relatedProductTypes)) {
+ $relatedProductTypes[] = Configurable::TYPE_CODE;
+ $eavSetup->updateAttribute(
+ \Magento\Catalog\Model\Product::ENTITY,
+ $attributeCode,
+ 'apply_to',
+ implode(',', $relatedProductTypes)
+ );
+ }
}
}
}
diff --git a/app/code/Magento/ConfigurableProduct/Setup/UpgradeData.php b/app/code/Magento/ConfigurableProduct/Setup/UpgradeData.php
index 1ff78a632c3bb..c71bb95a584c5 100644
--- a/app/code/Magento/ConfigurableProduct/Setup/UpgradeData.php
+++ b/app/code/Magento/ConfigurableProduct/Setup/UpgradeData.php
@@ -47,16 +47,18 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface
if (version_compare($context->getVersion(), '2.2.0') < 0) {
$relatedProductTypes = $this->getRelatedProductTypes('tier_price', $eavSetup);
- $key = array_search(Configurable::TYPE_CODE, $relatedProductTypes);
- if ($key !== false) {
- unset($relatedProductTypes[$key]);
- $this->updateRelatedProductTypes('tier_price', $relatedProductTypes, $eavSetup);
+ if (!empty($relatedProductTypes)) {
+ $key = array_search(Configurable::TYPE_CODE, $relatedProductTypes);
+ if ($key !== false) {
+ unset($relatedProductTypes[$key]);
+ $this->updateRelatedProductTypes('tier_price', $relatedProductTypes, $eavSetup);
+ }
}
}
if (version_compare($context->getVersion(), '2.2.1') < 0) {
$relatedProductTypes = $this->getRelatedProductTypes('manufacturer', $eavSetup);
- if (!in_array(Configurable::TYPE_CODE, $relatedProductTypes)) {
+ if (!empty($relatedProductTypes) && !in_array(Configurable::TYPE_CODE, $relatedProductTypes)) {
$relatedProductTypes[] = Configurable::TYPE_CODE;
$this->updateRelatedProductTypes('manufacturer', $relatedProductTypes, $eavSetup);
}
@@ -78,10 +80,13 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface
*/
private function getRelatedProductTypes(string $attributeId, EavSetup $eavSetup)
{
- return explode(
- ',',
- $eavSetup->getAttribute(Product::ENTITY, $attributeId, 'apply_to')
- );
+ if($attribute = $eavSetup->getAttribute(Product::ENTITY, $attributeId, 'apply_to')) {
+ return explode(
+ ',',
+ $attribute
+ );
+ }
+ return [];
}
/**
From dbf5293d42f7f88eae47913b746278cf16045914 Mon Sep 17 00:00:00 2001
From: Suneet
Date: Tue, 4 Dec 2018 23:35:35 +0530
Subject: [PATCH 014/315] Fixed code style as per the review
---
app/code/Magento/ConfigurableProduct/Setup/InstallData.php | 5 ++++-
app/code/Magento/ConfigurableProduct/Setup/UpgradeData.php | 5 ++++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/app/code/Magento/ConfigurableProduct/Setup/InstallData.php b/app/code/Magento/ConfigurableProduct/Setup/InstallData.php
index f9c94cc684b0d..2d6f6579059bc 100644
--- a/app/code/Magento/ConfigurableProduct/Setup/InstallData.php
+++ b/app/code/Magento/ConfigurableProduct/Setup/InstallData.php
@@ -57,7 +57,10 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface
'color'
];
foreach ($attributes as $attributeCode) {
- if ($attribute = $eavSetup->getAttribute(\Magento\Catalog\Model\Product::ENTITY, $attributeCode, 'apply_to')) {
+ if ($attribute = $eavSetup->getAttribute(
+ \Magento\Catalog\Model\Product::ENTITY,
+ $attributeCode, 'apply_to'
+ )) {
$relatedProductTypes = explode(
',',
$attribute
diff --git a/app/code/Magento/ConfigurableProduct/Setup/UpgradeData.php b/app/code/Magento/ConfigurableProduct/Setup/UpgradeData.php
index c71bb95a584c5..8724e244a1fd0 100644
--- a/app/code/Magento/ConfigurableProduct/Setup/UpgradeData.php
+++ b/app/code/Magento/ConfigurableProduct/Setup/UpgradeData.php
@@ -80,7 +80,10 @@ public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface
*/
private function getRelatedProductTypes(string $attributeId, EavSetup $eavSetup)
{
- if($attribute = $eavSetup->getAttribute(Product::ENTITY, $attributeId, 'apply_to')) {
+ if ($attribute = $eavSetup->getAttribute(
+ Product::ENTITY,
+ $attributeId, 'apply_to'
+ )) {
return explode(
',',
$attribute
From 94a3402605fa3d8fc74b025095d292616002b33d Mon Sep 17 00:00:00 2001
From: Stjepan Udovicic
Date: Tue, 4 Dec 2018 19:24:45 +0100
Subject: [PATCH 015/315] Fix typo in SQL join
---
.../Model/ResourceModel/Product/Indexer/Price/DefaultPrice.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/DefaultPrice.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/DefaultPrice.php
index 7ea85cd3f6f10..8fdeaf00b804f 100644
--- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/DefaultPrice.php
+++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/DefaultPrice.php
@@ -604,7 +604,7 @@ protected function _applyCustomOption()
[]
)->joinLeft(
['otps' => $this->getTable('catalog_product_option_type_price')],
- 'otps.option_type_id = otpd.option_type_id AND otpd.store_id = cs.store_id',
+ 'otps.option_type_id = otpd.option_type_id AND otps.store_id = cs.store_id',
[]
)->group(
['i.entity_id', 'i.customer_group_id', 'i.website_id', 'o.option_id']
From 4567a1a95fdd8a4089c808cfd12895de4db1d0e5 Mon Sep 17 00:00:00 2001
From: Suneet
Date: Wed, 5 Dec 2018 10:01:14 +0530
Subject: [PATCH 016/315] Fixed code style
---
app/code/Magento/ConfigurableProduct/Setup/InstallData.php | 3 ++-
app/code/Magento/ConfigurableProduct/Setup/UpgradeData.php | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/app/code/Magento/ConfigurableProduct/Setup/InstallData.php b/app/code/Magento/ConfigurableProduct/Setup/InstallData.php
index 2d6f6579059bc..57cc287aa24aa 100644
--- a/app/code/Magento/ConfigurableProduct/Setup/InstallData.php
+++ b/app/code/Magento/ConfigurableProduct/Setup/InstallData.php
@@ -59,7 +59,8 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface
foreach ($attributes as $attributeCode) {
if ($attribute = $eavSetup->getAttribute(
\Magento\Catalog\Model\Product::ENTITY,
- $attributeCode, 'apply_to'
+ $attributeCode,
+ 'apply_to'
)) {
$relatedProductTypes = explode(
',',
diff --git a/app/code/Magento/ConfigurableProduct/Setup/UpgradeData.php b/app/code/Magento/ConfigurableProduct/Setup/UpgradeData.php
index 8724e244a1fd0..113839e57791d 100644
--- a/app/code/Magento/ConfigurableProduct/Setup/UpgradeData.php
+++ b/app/code/Magento/ConfigurableProduct/Setup/UpgradeData.php
@@ -82,7 +82,8 @@ private function getRelatedProductTypes(string $attributeId, EavSetup $eavSetup)
{
if ($attribute = $eavSetup->getAttribute(
Product::ENTITY,
- $attributeId, 'apply_to'
+ $attributeId,
+ 'apply_to'
)) {
return explode(
',',
From 0935782d1e27027299446103e819edbf76db5259 Mon Sep 17 00:00:00 2001
From: Stjepan Udovicic
Date: Sun, 16 Dec 2018 00:07:48 +0100
Subject: [PATCH 017/315] Fix typo in SQL for CustomOptionPriceModifier
---
.../Product/Indexer/Price/CustomOptionPriceModifier.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/CustomOptionPriceModifier.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/CustomOptionPriceModifier.php
index 646cd0d4c1a4c..0ca13855cf896 100644
--- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/CustomOptionPriceModifier.php
+++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/Price/CustomOptionPriceModifier.php
@@ -211,7 +211,7 @@ private function getSelectForOptionsWithMultipleValues(string $sourceTable): Sel
} else {
$select->joinLeft(
['otps' => $this->getTable('catalog_product_option_type_price')],
- 'otps.option_type_id = otpd.option_type_id AND otpd.store_id = cwd.default_store_id',
+ 'otps.option_type_id = otpd.option_type_id AND otps.store_id = cwd.default_store_id',
[]
);
From 59a4e57a0c36671ff84e8398f413253610a512ac Mon Sep 17 00:00:00 2001
From: Graham Wharton
Date: Thu, 10 Jan 2019 10:19:52 +0000
Subject: [PATCH 018/315] Reverted changes made in MAGETWO-96712
---
.../Mail/Template/TransportBuilder.php | 16 ----------
.../Unit/Template/TransportBuilderTest.php | 32 +++----------------
2 files changed, 4 insertions(+), 44 deletions(-)
diff --git a/lib/internal/Magento/Framework/Mail/Template/TransportBuilder.php b/lib/internal/Magento/Framework/Mail/Template/TransportBuilder.php
index 1580c0b5eef91..35e1651c6a5df 100644
--- a/lib/internal/Magento/Framework/Mail/Template/TransportBuilder.php
+++ b/lib/internal/Magento/Framework/Mail/Template/TransportBuilder.php
@@ -48,13 +48,6 @@ class TransportBuilder
*/
protected $templateOptions;
- /**
- * Mail from address
- *
- * @var string|array
- */
- private $from;
-
/**
* Mail Transport
*
@@ -280,7 +273,6 @@ protected function reset()
$this->templateIdentifier = null;
$this->templateVars = null;
$this->templateOptions = null;
- $this->from = null;
return $this;
}
@@ -314,14 +306,6 @@ protected function prepareMessage()
->setBody($body)
->setSubject(html_entity_decode($template->getSubject(), ENT_QUOTES));
- if ($this->from) {
- $from = $this->_senderResolver->resolve(
- $this->from,
- $template->getDesignConfig()->getStore()
- );
- $this->message->setFrom($from['email'], $from['name']);
- }
-
return $this;
}
}
diff --git a/lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderTest.php b/lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderTest.php
index b18f5d2753ee6..8b3cc7df9a013 100644
--- a/lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderTest.php
+++ b/lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderTest.php
@@ -7,7 +7,6 @@
namespace Magento\Framework\Mail\Test\Unit\Template;
use Magento\Framework\App\TemplateTypesInterface;
-use Magento\Framework\DataObject;
use Magento\Framework\Mail\MessageInterface;
/**
@@ -100,37 +99,17 @@ protected function setUp()
*/
public function testGetTransport($templateType, $messageType, $bodyText, $templateNamespace)
{
+ $this->builder->setTemplateModel($templateNamespace);
+
$vars = ['reason' => 'Reason', 'customer' => 'Customer'];
$options = ['area' => 'frontend', 'store' => 1];
- $from = 'email_from';
- $sender = ['email' => 'from@example.com', 'name' => 'name'];
-
- $this->builder->setTemplateModel($templateNamespace);
- $this->builder->setFrom($from);
- $template = $this->createPartialMock(
- \Magento\Framework\Mail\TemplateInterface::class,
- [
- 'setVars',
- 'isPlain',
- 'setOptions',
- 'getSubject',
- 'getType',
- 'processTemplate',
- 'getDesignConfig',
- ]
- );
+ $template = $this->createMock(\Magento\Framework\Mail\TemplateInterface::class);
$template->expects($this->once())->method('setVars')->with($this->equalTo($vars))->willReturnSelf();
$template->expects($this->once())->method('setOptions')->with($this->equalTo($options))->willReturnSelf();
$template->expects($this->once())->method('getSubject')->willReturn('Email Subject');
$template->expects($this->once())->method('getType')->willReturn($templateType);
$template->expects($this->once())->method('processTemplate')->willReturn($bodyText);
- $template->method('getDesignConfig')->willReturn(new DataObject($options));
-
- $this->senderResolverMock->expects($this->once())
- ->method('resolve')
- ->with($from, 1)
- ->willReturn($sender);
$this->templateFactoryMock->expects($this->once())
->method('get')
@@ -149,9 +128,6 @@ public function testGetTransport($templateType, $messageType, $bodyText, $templa
->method('setBody')
->with($this->equalTo($bodyText))
->willReturnSelf();
- $this->messageMock->method('setFrom')
- ->with($sender['email'], $sender['name'])
- ->willReturnSelf();
$transport = $this->createMock(\Magento\Framework\Mail\TransportInterface::class);
@@ -184,7 +160,7 @@ public function getTransportDataProvider()
]
];
}
-
+
/**
* @return void
*/
From a8bcb8bb8442a649bf1e62400ca6f147023e53c6 Mon Sep 17 00:00:00 2001
From: Graham Wharton
Date: Thu, 10 Jan 2019 10:31:49 +0000
Subject: [PATCH 019/315] Deprecated Magento\Framework\Mail\Message::setFrom
function, introduced new function setFromAddress
---
lib/internal/Magento/Framework/Mail/Message.php | 15 ++++++++++++++-
.../Framework/Mail/Template/TransportBuilder.php | 2 +-
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/lib/internal/Magento/Framework/Mail/Message.php b/lib/internal/Magento/Framework/Mail/Message.php
index c8f0e75c52800..96566ad82b8eb 100644
--- a/lib/internal/Magento/Framework/Mail/Message.php
+++ b/lib/internal/Magento/Framework/Mail/Message.php
@@ -89,10 +89,23 @@ public function getBody()
/**
* @inheritdoc
+ *
+ * @deprecated This function is missing the from name. The
+ * setFromAddress() function sets both from address and from name.
+ * @see setFromAddress()
*/
public function setFrom($fromAddress)
{
- $this->zendMessage->setFrom($fromAddress);
+ $this->setFromAddress($fromAddress, null);
+ return $this;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function setFromAddress($fromAddress, $fromName = null)
+ {
+ $this->zendMessage->setFrom($fromAddress, $fromName);
return $this;
}
diff --git a/lib/internal/Magento/Framework/Mail/Template/TransportBuilder.php b/lib/internal/Magento/Framework/Mail/Template/TransportBuilder.php
index 35e1651c6a5df..25cbaf73b8d76 100644
--- a/lib/internal/Magento/Framework/Mail/Template/TransportBuilder.php
+++ b/lib/internal/Magento/Framework/Mail/Template/TransportBuilder.php
@@ -196,7 +196,7 @@ public function setFrom($from)
public function setFromByStore($from, $store = null)
{
$result = $this->_senderResolver->resolve($from, $store);
- $this->message->setFrom($result['email'], $result['name']);
+ $this->message->setFromAddress($result['email'], $result['name']);
return $this;
}
From 573cf7a9fee7c2d8ca9c1c25fe909c93ccf06c49 Mon Sep 17 00:00:00 2001
From: Graham Wharton
Date: Thu, 10 Jan 2019 11:26:35 +0000
Subject: [PATCH 020/315] Fixed testSetFromByStore unit test
---
.../Framework/Mail/Test/Unit/Template/TransportBuilderTest.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderTest.php b/lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderTest.php
index 8b3cc7df9a013..77c41cceeb285 100644
--- a/lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderTest.php
+++ b/lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderTest.php
@@ -173,7 +173,7 @@ public function testSetFromByStore()
->with($sender, $store)
->willReturn($sender);
$this->messageMock->expects($this->once())
- ->method('setFrom')
+ ->method('setFromAddress')
->with('from@example.com', 'name')
->willReturnSelf();
From 49607ac12e9c2e2316e6adc6ee926b043cbae212 Mon Sep 17 00:00:00 2001
From: Nikita Fomin
Date: Fri, 11 Jan 2019 13:45:04 +0200
Subject: [PATCH 021/315] MAGETWO-93326: Automate with MFTF Move Update to
Another existing Update
---
.../Magento/Ui/Test/Mftf/Section/AdminDataGridTableSection.xml | 1 +
1 file changed, 1 insertion(+)
diff --git a/app/code/Magento/Ui/Test/Mftf/Section/AdminDataGridTableSection.xml b/app/code/Magento/Ui/Test/Mftf/Section/AdminDataGridTableSection.xml
index 28ee9efc9f0a2..cbe5d9e158bb3 100644
--- a/app/code/Magento/Ui/Test/Mftf/Section/AdminDataGridTableSection.xml
+++ b/app/code/Magento/Ui/Test/Mftf/Section/AdminDataGridTableSection.xml
@@ -21,5 +21,6 @@
+
From c874bf5176c292b13e403724cb91a7d7ebc40fc6 Mon Sep 17 00:00:00 2001
From: Dipti 2Jcommerce
Date: Thu, 17 Jan 2019 17:32:15 +0530
Subject: [PATCH 022/315] iPhone5-device-newsletter-subscription-#20167
---
.../web/css/source/_module.less | 21 +++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/app/design/frontend/Magento/luma/Magento_Newsletter/web/css/source/_module.less b/app/design/frontend/Magento/luma/Magento_Newsletter/web/css/source/_module.less
index 9ccd6c190ec0e..aab895392e6dd 100644
--- a/app/design/frontend/Magento/luma/Magento_Newsletter/web/css/source/_module.less
+++ b/app/design/frontend/Magento/luma/Magento_Newsletter/web/css/source/_module.less
@@ -81,3 +81,24 @@
width: 34%;
}
}
+
+//
+// Mobile
+// _____________________________________________
+
+.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__m) {
+ .block{
+ &.newsletter {
+ input {
+ font-size: 12px;
+ padding-left: 30px;
+ }
+
+ .field {
+ .control:before{
+ font-size: 13px;
+ }
+ }
+ }
+ }
+}
From 3b9ba7c6af3b74eb2dea568db860959516abbf71 Mon Sep 17 00:00:00 2001
From: Igor Ludgero Miura
Date: Fri, 18 Jan 2019 14:35:47 -0200
Subject: [PATCH 023/315] Remove sku from this condition
---
.../Magento/Rule/Model/Condition/Product/AbstractProduct.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/code/Magento/Rule/Model/Condition/Product/AbstractProduct.php b/app/code/Magento/Rule/Model/Condition/Product/AbstractProduct.php
index c02bbd64e7ca3..b7dd1d6c55f4e 100644
--- a/app/code/Magento/Rule/Model/Condition/Product/AbstractProduct.php
+++ b/app/code/Magento/Rule/Model/Condition/Product/AbstractProduct.php
@@ -713,7 +713,7 @@ protected function _getAttributeSetId($productId)
public function getOperatorForValidate()
{
$operator = $this->getOperator();
- if (in_array($this->getInputType(), ['category', 'sku'])) {
+ if (in_array($this->getInputType(), ['category'])) {
if ($operator == '==') {
$operator = '{}';
} elseif ($operator == '!=') {
From 0b0dcfb9c7a943045d7724ee1832da2cbd3e04ff Mon Sep 17 00:00:00 2001
From: Ihor Sviziev
Date: Tue, 22 Jan 2019 16:25:51 +0200
Subject: [PATCH 024/315] magento/magento2#19098 2.2.6 Use batches and direct
queries to fix sales address upgrade
Revert not needed changes
---
app/code/Magento/Sales/Setup/UpgradeData.php | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/app/code/Magento/Sales/Setup/UpgradeData.php b/app/code/Magento/Sales/Setup/UpgradeData.php
index 83f239546960e..b35632d6e12d2 100644
--- a/app/code/Magento/Sales/Setup/UpgradeData.php
+++ b/app/code/Magento/Sales/Setup/UpgradeData.php
@@ -14,7 +14,10 @@
use Magento\Framework\Setup\ModuleContextInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Framework\Setup\UpgradeDataInterface;
+use Magento\Quote\Model\QuoteFactory;
use Magento\Sales\Model\Order\Address;
+use Magento\Sales\Model\OrderFactory;
+use Magento\Sales\Model\ResourceModel\Order\Address\CollectionFactory as AddressCollectionFactory;
/**
* Data upgrade script
@@ -49,12 +52,18 @@ class UpgradeData implements UpgradeDataInterface
* @param SalesSetupFactory $salesSetupFactory
* @param Config $eavConfig
* @param AggregatedFieldDataConverter $aggregatedFieldConverter
+ * @param AddressCollectionFactory $addressCollFactory
+ * @param OrderFactory $orderFactory
+ * @param QuoteFactory $quoteFactory
* @param State $state
*/
public function __construct(
SalesSetupFactory $salesSetupFactory,
Config $eavConfig,
AggregatedFieldDataConverter $aggregatedFieldConverter,
+ AddressCollectionFactory $addressCollFactory,
+ OrderFactory $orderFactory,
+ QuoteFactory $quoteFactory,
State $state
) {
$this->salesSetupFactory = $salesSetupFactory;
From 867f47465bfee044b51b621392ca3228fb803a2c Mon Sep 17 00:00:00 2001
From: Arvinda kumar
Date: Tue, 15 Jan 2019 16:46:44 +0530
Subject: [PATCH 025/315] issue fixed #20299 Order item details label not
aligned in mobile view
issue fixed #20299 Order item details label not aligned in mobile view
---
.../Magento_Checkout/web/css/source/module/_cart.less | 11 +++++++++++
1 file changed, 11 insertions(+)
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 1015bb584ff7b..ce4ba47cc2337 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
@@ -501,6 +501,17 @@
}
}
}
+
+ .cart.table-wrapper,
+ .order-items.table-wrapper {
+ .col.price,
+ .col.qty,
+ .col.subtotal,
+ .col.msrp {
+ text-align: left;
+ }
+ }
+
}
//
From 362f81fada5975a193b1a41415725cf9bdad4ef7 Mon Sep 17 00:00:00 2001
From: nmalevanec
Date: Wed, 16 Jan 2019 11:52:32 +0200
Subject: [PATCH 026/315] Fix static tests.
---
.../luma/Magento_Checkout/web/css/source/module/_cart.less | 4 ++--
1 file changed, 2 insertions(+), 2 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 ce4ba47cc2337..fa41682cbd635 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
@@ -501,7 +501,7 @@
}
}
}
-
+
.cart.table-wrapper,
.order-items.table-wrapper {
.col.price,
@@ -511,7 +511,7 @@
text-align: left;
}
}
-
+
}
//
From ef635bf6b8ecf67c729deb38df05c81b9e5b5359 Mon Sep 17 00:00:00 2001
From: Graham Wharton
Date: Fri, 25 Jan 2019 13:21:24 +0000
Subject: [PATCH 027/315] Changed references to "Store" to "Scope" in framework
components.
---
.../Sales/Model/Order/Email/SenderBuilder.php | 2 +-
.../Model/Order/Email/SenderBuilderTest.php | 8 ++++----
.../Mail/Template/TransportBuilder.php | 17 ++++++++---------
.../Test/Unit/Template/TransportBuilderTest.php | 8 ++++----
4 files changed, 17 insertions(+), 18 deletions(-)
diff --git a/app/code/Magento/Sales/Model/Order/Email/SenderBuilder.php b/app/code/Magento/Sales/Model/Order/Email/SenderBuilder.php
index e4dc75ade7c79..5fb89b7855056 100644
--- a/app/code/Magento/Sales/Model/Order/Email/SenderBuilder.php
+++ b/app/code/Magento/Sales/Model/Order/Email/SenderBuilder.php
@@ -103,7 +103,7 @@ protected function configureEmailTemplate()
$this->transportBuilder->setTemplateIdentifier($this->templateContainer->getTemplateId());
$this->transportBuilder->setTemplateOptions($this->templateContainer->getTemplateOptions());
$this->transportBuilder->setTemplateVars($this->templateContainer->getTemplateVars());
- $this->transportBuilder->setFromByStore(
+ $this->transportBuilder->setFromByScope(
$this->identityContainer->getEmailIdentity(),
$this->identityContainer->getStore()->getId()
);
diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Email/SenderBuilderTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Email/SenderBuilderTest.php
index 759d60d9e6613..24cd54e3a46b3 100644
--- a/app/code/Magento/Sales/Test/Unit/Model/Order/Email/SenderBuilderTest.php
+++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Email/SenderBuilderTest.php
@@ -76,7 +76,7 @@ protected function setUp()
'setTemplateIdentifier',
'setTemplateOptions',
'setTemplateVars',
- 'setFromByStore',
+ 'setFromByScope',
]
);
@@ -103,7 +103,7 @@ protected function setUp()
->method('getEmailIdentity')
->will($this->returnValue($emailIdentity));
$this->transportBuilder->expects($this->once())
- ->method('setFromByStore')
+ ->method('setFromByScope')
->with($this->equalTo($emailIdentity), 1);
$this->identityContainerMock->expects($this->once())
@@ -146,7 +146,7 @@ public function testSend()
->method('getId')
->willReturn(1);
$this->transportBuilder->expects($this->once())
- ->method('setFromByStore')
+ ->method('setFromByScope')
->with($identity, 1);
$this->transportBuilder->expects($this->once())
->method('addTo')
@@ -176,7 +176,7 @@ public function testSendCopyTo()
->method('addTo')
->with($this->equalTo('example@mail.com'));
$this->transportBuilder->expects($this->once())
- ->method('setFromByStore')
+ ->method('setFromByScope')
->with($identity, 1);
$this->identityContainerMock->expects($this->once())
->method('getStore')
diff --git a/lib/internal/Magento/Framework/Mail/Template/TransportBuilder.php b/lib/internal/Magento/Framework/Mail/Template/TransportBuilder.php
index 25cbaf73b8d76..b5be1cbf52cfd 100644
--- a/lib/internal/Magento/Framework/Mail/Template/TransportBuilder.php
+++ b/lib/internal/Magento/Framework/Mail/Template/TransportBuilder.php
@@ -173,29 +173,28 @@ public function setReplyTo($email, $name = null)
/**
* Set mail from address
*
- * @deprecated This function sets the from address for the first store only.
- * new function setFromByStore introduced to allow setting of from address
- * based on store.
- * @see setFromByStore()
+ * @deprecated This function sets the from address but does not provide
+ * a way of setting the correct from addresses based on the scope.
+ * @see setFromByScope()
*
* @param string|array $from
* @return $this
*/
public function setFrom($from)
{
- return $this->setFromByStore($from, null);
+ return $this->setFromByScope($from, null);
}
/**
- * Set mail from address by store
+ * Set mail from address by Scope
*
* @param string|array $from
- * @param string|int $store
+ * @param string|int $scopeId
* @return $this
*/
- public function setFromByStore($from, $store = null)
+ public function setFromByScope($from, $scopeId = null)
{
- $result = $this->_senderResolver->resolve($from, $store);
+ $result = $this->_senderResolver->resolve($from, $scopeId);
$this->message->setFromAddress($result['email'], $result['name']);
return $this;
}
diff --git a/lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderTest.php b/lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderTest.php
index 77c41cceeb285..6c5c48fba1b9b 100644
--- a/lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderTest.php
+++ b/lib/internal/Magento/Framework/Mail/Test/Unit/Template/TransportBuilderTest.php
@@ -164,20 +164,20 @@ public function getTransportDataProvider()
/**
* @return void
*/
- public function testSetFromByStore()
+ public function testSetFromByScope()
{
$sender = ['email' => 'from@example.com', 'name' => 'name'];
- $store = 1;
+ $scopeId = 1;
$this->senderResolverMock->expects($this->once())
->method('resolve')
- ->with($sender, $store)
+ ->with($sender, $scopeId)
->willReturn($sender);
$this->messageMock->expects($this->once())
->method('setFromAddress')
->with('from@example.com', 'name')
->willReturnSelf();
- $this->builder->setFromByStore($sender, $store);
+ $this->builder->setFromByScope($sender, $scopeId);
}
/**
From f0032eef4ddebeec30caafac764c1c5262ee4ec3 Mon Sep 17 00:00:00 2001
From: Parag Chavare
Date: Wed, 23 Jan 2019 17:55:52 +0530
Subject: [PATCH 028/315] bundle-product-radio-button-misalign
---
.../Magento/luma/Magento_Bundle/web/css/source/_module.less | 1 +
1 file changed, 1 insertion(+)
diff --git a/app/design/frontend/Magento/luma/Magento_Bundle/web/css/source/_module.less b/app/design/frontend/Magento/luma/Magento_Bundle/web/css/source/_module.less
index 43ae23bab7895..99c8aa1ad2bae 100644
--- a/app/design/frontend/Magento/luma/Magento_Bundle/web/css/source/_module.less
+++ b/app/design/frontend/Magento/luma/Magento_Bundle/web/css/source/_module.less
@@ -58,6 +58,7 @@
.field.choice {
input {
float: left;
+ margin-top: 4px;
}
.label {
From 7383946a868dbe8c36ffeb1605097addfb08a2f5 Mon Sep 17 00:00:00 2001
From: amol 2jcommerce
Date: Wed, 30 Jan 2019 10:22:33 +0530
Subject: [PATCH 029/315] cms-page-top-spacing-issue-2.2
---
.../Magento/luma/Magento_Theme/web/css/source/_module.less | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/design/frontend/Magento/luma/Magento_Theme/web/css/source/_module.less b/app/design/frontend/Magento/luma/Magento_Theme/web/css/source/_module.less
index 68938ed206038..9d17ee7256ee4 100644
--- a/app/design/frontend/Magento/luma/Magento_Theme/web/css/source/_module.less
+++ b/app/design/frontend/Magento/luma/Magento_Theme/web/css/source/_module.less
@@ -441,7 +441,7 @@
.media-width(@extremum, @break) when (@extremum = 'max') and (@break = @screen__m) {
.cms-page-view .page-main {
- padding-top: 41px;
+ padding-top: 0;
position: relative;
}
}
From 4a9a98a9b6548cecb4c479e7cfb567faa51825d7 Mon Sep 17 00:00:00 2001
From: Ihor Sviziev
Date: Wed, 30 Jan 2019 08:30:56 +0200
Subject: [PATCH 030/315] magento/magento2#19098 2.2.6 Use batches and direct
queries to fix sales address upgrade
Fix static test failures
---
app/code/Magento/Sales/Setup/UpgradeData.php | 2 ++
1 file changed, 2 insertions(+)
diff --git a/app/code/Magento/Sales/Setup/UpgradeData.php b/app/code/Magento/Sales/Setup/UpgradeData.php
index b35632d6e12d2..0b69458b7656c 100644
--- a/app/code/Magento/Sales/Setup/UpgradeData.php
+++ b/app/code/Magento/Sales/Setup/UpgradeData.php
@@ -49,6 +49,8 @@ class UpgradeData implements UpgradeDataInterface
private $state;
/**
+ * @SuppressWarnings(PHPMD.UnusedFormalParameter)
+ *
* @param SalesSetupFactory $salesSetupFactory
* @param Config $eavConfig
* @param AggregatedFieldDataConverter $aggregatedFieldConverter
From 7c6026e2f62e5edd35b0f75877b556b07801e598 Mon Sep 17 00:00:00 2001
From: Ihor Sviziev
Date: Wed, 30 Jan 2019 09:13:37 +0200
Subject: [PATCH 031/315] magento/magento2#19098 2.2.6 Use batches and direct
queries to fix sales address upgrade
Fix statis test failures
---
app/code/Magento/Sales/Setup/UpgradeData.php | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/app/code/Magento/Sales/Setup/UpgradeData.php b/app/code/Magento/Sales/Setup/UpgradeData.php
index 0b69458b7656c..56cbf31c3d695 100644
--- a/app/code/Magento/Sales/Setup/UpgradeData.php
+++ b/app/code/Magento/Sales/Setup/UpgradeData.php
@@ -171,7 +171,7 @@ public function fillQuoteAddressIdInSalesOrderAddress(ModuleDataSetupInterface $
* @param ModuleDataSetupInterface $setup
* @param string $addressType
*/
- public function fillQuoteAddressIdInSalesOrderAddressByType(ModuleDataSetupInterface $setup, $addressType)
+ private function fillQuoteAddressIdInSalesOrderAddressByType(ModuleDataSetupInterface $setup, $addressType)
{
$salesConnection = $setup->getConnection('sales');
@@ -205,12 +205,13 @@ public function fillQuoteAddressIdInSalesOrderAddressByType(ModuleDataSetupInter
$this->fillQuoteAddressIdInSalesOrderAddressProcessBatch($setup, $result, $addressType);
}
}
+
/**
* @param ModuleDataSetupInterface $setup
* @param array $orderAddresses
* @param string $addressType
*/
- public function fillQuoteAddressIdInSalesOrderAddressProcessBatch(
+ private function fillQuoteAddressIdInSalesOrderAddressProcessBatch(
ModuleDataSetupInterface $setup,
array $orderAddresses,
$addressType
From 756cefa0b7ff6bc687866809b3f3e25c12943d92 Mon Sep 17 00:00:00 2001
From: "rostyslav.hymon"
Date: Wed, 30 Jan 2019 12:11:31 +0000
Subject: [PATCH 032/315] MAGETWO-97630: [Magento Cloud] news_from_date and
news_to_date dates incorrect in database with scheduled updates
Due to unstable work of intl parsing on different platforms
---
app/code/Magento/Cron/Model/Schedule.php | 30 ++--
.../Cron/Test/Unit/Model/ScheduleTest.php | 140 ++++++++++++++----
2 files changed, 136 insertions(+), 34 deletions(-)
diff --git a/app/code/Magento/Cron/Model/Schedule.php b/app/code/Magento/Cron/Model/Schedule.php
index 39a58ef360cb3..a9ae04cb0c5d1 100644
--- a/app/code/Magento/Cron/Model/Schedule.php
+++ b/app/code/Magento/Cron/Model/Schedule.php
@@ -9,6 +9,7 @@
use Magento\Framework\Exception\CronException;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\Stdlib\DateTime\TimezoneInterface;
+use Magento\Framework\Intl\DateTimeFactory;
/**
* Crontab schedule model
@@ -50,13 +51,19 @@ class Schedule extends \Magento\Framework\Model\AbstractModel
*/
private $timezoneConverter;
+ /**
+ * @var DateTimeFactory
+ */
+ private $dateTimeFactory;
+
/**
* @param \Magento\Framework\Model\Context $context
* @param \Magento\Framework\Registry $registry
* @param \Magento\Framework\Model\ResourceModel\AbstractResource $resource
* @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection
* @param array $data
- * @param TimezoneInterface $timezoneConverter
+ * @param TimezoneInterface|null $timezoneConverter
+ * @param DateTimeFactory|null $dateTimeFactory
*/
public function __construct(
\Magento\Framework\Model\Context $context,
@@ -64,10 +71,12 @@ public function __construct(
\Magento\Framework\Model\ResourceModel\AbstractResource $resource = null,
\Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null,
array $data = [],
- TimezoneInterface $timezoneConverter = null
+ TimezoneInterface $timezoneConverter = null,
+ DateTimeFactory $dateTimeFactory = null
) {
parent::__construct($context, $registry, $resource, $resourceCollection, $data);
$this->timezoneConverter = $timezoneConverter ?: ObjectManager::getInstance()->get(TimezoneInterface::class);
+ $this->dateTimeFactory = $dateTimeFactory ?: ObjectManager::getInstance()->get(DateTimeFactory::class);
}
/**
@@ -109,17 +118,20 @@ public function trySchedule()
if (!$e || !$time) {
return false;
}
+ $configTimeZone = $this->timezoneConverter->getConfigTimezone();
+ $storeDateTime = $this->dateTimeFactory->create(null, new \DateTimeZone($configTimeZone));
if (!is_numeric($time)) {
//convert time from UTC to admin store timezone
//we assume that all schedules in configuration (crontab.xml and DB tables) are in admin store timezone
- $time = $this->timezoneConverter->date($time)->format('Y-m-d H:i');
- $time = strtotime($time);
+ $dateTimeUtc = $this->dateTimeFactory->create($time);
+ $time = $dateTimeUtc->getTimestamp();
}
- $match = $this->matchCronExpression($e[0], strftime('%M', $time))
- && $this->matchCronExpression($e[1], strftime('%H', $time))
- && $this->matchCronExpression($e[2], strftime('%d', $time))
- && $this->matchCronExpression($e[3], strftime('%m', $time))
- && $this->matchCronExpression($e[4], strftime('%w', $time));
+ $time = $storeDateTime->setTimestamp($time);
+ $match = $this->matchCronExpression($e[0], $time->format('i'))
+ && $this->matchCronExpression($e[1], $time->format('H'))
+ && $this->matchCronExpression($e[2], $time->format('d'))
+ && $this->matchCronExpression($e[3], $time->format('m'))
+ && $this->matchCronExpression($e[4], $time->format('w'));
return $match;
}
diff --git a/app/code/Magento/Cron/Test/Unit/Model/ScheduleTest.php b/app/code/Magento/Cron/Test/Unit/Model/ScheduleTest.php
index e9f4c61c7f551..76e9627ad7098 100644
--- a/app/code/Magento/Cron/Test/Unit/Model/ScheduleTest.php
+++ b/app/code/Magento/Cron/Test/Unit/Model/ScheduleTest.php
@@ -6,6 +6,9 @@
namespace Magento\Cron\Test\Unit\Model;
use Magento\Cron\Model\Schedule;
+use Magento\Framework\Intl\DateTimeFactory;
+use Magento\Framework\Stdlib\DateTime\TimezoneInterface;
+use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
/**
* Class \Magento\Cron\Test\Unit\Model\ObserverTest
@@ -18,11 +21,27 @@ class ScheduleTest extends \PHPUnit\Framework\TestCase
*/
protected $helper;
+ /**
+ * @var \Magento\Cron\Model\ResourceModel\Schedule
+ */
protected $resourceJobMock;
+ /**
+ * @var TimezoneInterface|\PHPUnit_Framework_MockObject_MockObject
+ */
+ private $timezoneConverter;
+
+ /**
+ * @var DateTimeFactory|\PHPUnit_Framework_MockObject_MockObject
+ */
+ private $dateTimeFactory;
+
+ /**
+ * @inheritdoc
+ */
protected function setUp()
{
- $this->helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
+ $this->helper = new ObjectManager($this);
$this->resourceJobMock = $this->getMockBuilder(\Magento\Cron\Model\ResourceModel\Schedule::class)
->disableOriginalConstructor()
@@ -32,18 +51,30 @@ protected function setUp()
$this->resourceJobMock->expects($this->any())
->method('getIdFieldName')
->will($this->returnValue('id'));
+
+ $this->timezoneConverter = $this->getMockBuilder(TimezoneInterface::class)
+ ->setMethods(['date'])
+ ->getMockForAbstractClass();
+
+ $this->dateTimeFactory = $this->getMockBuilder(DateTimeFactory::class)
+ ->setMethods(['create'])
+ ->getMock();
}
/**
+ * Test for SetCronExpr
+ *
* @param string $cronExpression
* @param array $expected
+ *
+ * @return void
* @dataProvider setCronExprDataProvider
*/
public function testSetCronExpr($cronExpression, $expected)
{
// 1. Create mocks
- /** @var \Magento\Cron\Model\Schedule $model */
- $model = $this->helper->getObject(\Magento\Cron\Model\Schedule::class);
+ /** @var Schedule $model */
+ $model = $this->helper->getObject(Schedule::class);
// 2. Run tested method
$model->setCronExpr($cronExpression);
@@ -61,7 +92,7 @@ public function testSetCronExpr($cronExpression, $expected)
*
* @return array
*/
- public function setCronExprDataProvider()
+ public function setCronExprDataProvider(): array
{
return [
['1 2 3 4 5', [1, 2, 3, 4, 5]],
@@ -121,27 +152,33 @@ public function setCronExprDataProvider()
}
/**
+ * Test for SetCronExprException
+ *
* @param string $cronExpression
+ *
+ * @return void
* @expectedException \Magento\Framework\Exception\CronException
* @dataProvider setCronExprExceptionDataProvider
*/
public function testSetCronExprException($cronExpression)
{
// 1. Create mocks
- /** @var \Magento\Cron\Model\Schedule $model */
- $model = $this->helper->getObject(\Magento\Cron\Model\Schedule::class);
+ /** @var Schedule $model */
+ $model = $this->helper->getObject(Schedule::class);
// 2. Run tested method
$model->setCronExpr($cronExpression);
}
/**
+ * Data provider
+ *
* Here is a list of allowed characters and values for Cron expression
* http://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm
*
* @return array
*/
- public function setCronExprExceptionDataProvider()
+ public function setCronExprExceptionDataProvider(): array
{
return [
[''],
@@ -153,17 +190,31 @@ public function setCronExprExceptionDataProvider()
}
/**
+ * Test for trySchedule
+ *
* @param int $scheduledAt
* @param array $cronExprArr
* @param $expected
+ *
+ * @return void
* @dataProvider tryScheduleDataProvider
*/
public function testTrySchedule($scheduledAt, $cronExprArr, $expected)
{
// 1. Create mocks
+ $this->timezoneConverter->method('getConfigTimezone')
+ ->willReturn('UTC');
+
+ $this->dateTimeFactory->method('create')
+ ->willReturn(new \DateTime());
+
/** @var \Magento\Cron\Model\Schedule $model */
$model = $this->helper->getObject(
- \Magento\Cron\Model\Schedule::class
+ \Magento\Cron\Model\Schedule::class,
+ [
+ 'timezoneConverter' => $this->timezoneConverter,
+ 'dateTimeFactory' => $this->dateTimeFactory,
+ ]
);
// 2. Set fixtures
@@ -177,22 +228,29 @@ public function testTrySchedule($scheduledAt, $cronExprArr, $expected)
$this->assertEquals($expected, $result);
}
+ /**
+ * Test for tryScheduleWithConversionToAdminStoreTime
+ *
+ * @return void
+ */
public function testTryScheduleWithConversionToAdminStoreTime()
{
$scheduledAt = '2011-12-13 14:15:16';
$cronExprArr = ['*', '*', '*', '*', '*'];
- // 1. Create mocks
- $timezoneConverter = $this->createMock(\Magento\Framework\Stdlib\DateTime\TimezoneInterface::class);
- $timezoneConverter->expects($this->once())
- ->method('date')
- ->with($scheduledAt)
- ->willReturn(new \DateTime($scheduledAt));
+ $this->timezoneConverter->method('getConfigTimezone')
+ ->willReturn('UTC');
+
+ $this->dateTimeFactory->method('create')
+ ->willReturn(new \DateTime());
/** @var \Magento\Cron\Model\Schedule $model */
$model = $this->helper->getObject(
\Magento\Cron\Model\Schedule::class,
- ['timezoneConverter' => $timezoneConverter]
+ [
+ 'timezoneConverter' => $this->timezoneConverter,
+ 'dateTimeFactory' => $this->dateTimeFactory,
+ ]
);
// 2. Set fixtures
@@ -207,11 +265,15 @@ public function testTryScheduleWithConversionToAdminStoreTime()
}
/**
+ * Data provider
+ *
* @return array
*/
- public function tryScheduleDataProvider()
+ public function tryScheduleDataProvider(): array
{
$date = '2011-12-13 14:15:16';
+ $timestamp = (new \DateTime($date))->getTimestamp();
+ $day = 'Monday';
return [
[$date, [], false],
[$date, null, false],
@@ -219,19 +281,23 @@ public function tryScheduleDataProvider()
[$date, [], false],
[$date, null, false],
[$date, false, false],
- [strtotime($date), ['*', '*', '*', '*', '*'], true],
- [strtotime($date), ['15', '*', '*', '*', '*'], true],
- [strtotime($date), ['*', '14', '*', '*', '*'], true],
- [strtotime($date), ['*', '*', '13', '*', '*'], true],
- [strtotime($date), ['*', '*', '*', '12', '*'], true],
- [strtotime('Monday'), ['*', '*', '*', '*', '1'], true],
+ [$timestamp, ['*', '*', '*', '*', '*'], true],
+ [$timestamp, ['15', '*', '*', '*', '*'], true],
+ [$timestamp, ['*', '14', '*', '*', '*'], true],
+ [$timestamp, ['*', '*', '13', '*', '*'], true],
+ [$timestamp, ['*', '*', '*', '12', '*'], true],
+ [(new \DateTime($day))->getTimestamp(), ['*', '*', '*', '*', '1'], true],
];
}
/**
+ * Test for matchCronExpression
+ *
* @param string $cronExpressionPart
* @param int $dateTimePart
* @param bool $expectedResult
+ *
+ * @return void
* @dataProvider matchCronExpressionDataProvider
*/
public function testMatchCronExpression($cronExpressionPart, $dateTimePart, $expectedResult)
@@ -248,9 +314,11 @@ public function testMatchCronExpression($cronExpressionPart, $dateTimePart, $exp
}
/**
+ * Data provider
+ *
* @return array
*/
- public function matchCronExpressionDataProvider()
+ public function matchCronExpressionDataProvider(): array
{
return [
['*', 0, true],
@@ -287,7 +355,11 @@ public function matchCronExpressionDataProvider()
}
/**
+ * Test for matchCronExpressionException
+ *
* @param string $cronExpressionPart
+ *
+ * @return void
* @expectedException \Magento\Framework\Exception\CronException
* @dataProvider matchCronExpressionExceptionDataProvider
*/
@@ -304,9 +376,11 @@ public function testMatchCronExpressionException($cronExpressionPart)
}
/**
+ * Data provider
+ *
* @return array
*/
- public function matchCronExpressionExceptionDataProvider()
+ public function matchCronExpressionExceptionDataProvider(): array
{
return [
['1/2/3'], //Invalid cron expression, expecting 'match/modulus': 1/2/3
@@ -317,8 +391,12 @@ public function matchCronExpressionExceptionDataProvider()
}
/**
+ * Test for GetNumeric
+ *
* @param mixed $param
* @param int $expectedResult
+ *
+ * @return void
* @dataProvider getNumericDataProvider
*/
public function testGetNumeric($param, $expectedResult)
@@ -335,9 +413,11 @@ public function testGetNumeric($param, $expectedResult)
}
/**
+ * Data provider
+ *
* @return array
*/
- public function getNumericDataProvider()
+ public function getNumericDataProvider(): array
{
return [
[null, false],
@@ -362,6 +442,11 @@ public function getNumericDataProvider()
];
}
+ /**
+ * Test for tryLockJobSuccess
+ *
+ * @return void
+ */
public function testTryLockJobSuccess()
{
$scheduleId = 1;
@@ -386,6 +471,11 @@ public function testTryLockJobSuccess()
$this->assertEquals(Schedule::STATUS_RUNNING, $model->getStatus());
}
+ /**
+ * Test for tryLockJobFailure
+ *
+ * @return void
+ */
public function testTryLockJobFailure()
{
$scheduleId = 1;
From c495f31900cc2250bb63bcd57242d518aa894d92 Mon Sep 17 00:00:00 2001
From: Mahesh Singh
Date: Fri, 1 Feb 2019 00:44:04 +0530
Subject: [PATCH 033/315] issue #20380 fixed for 2.2
---
app/code/Magento/Sales/Model/Order.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/code/Magento/Sales/Model/Order.php b/app/code/Magento/Sales/Model/Order.php
index 1972aa71080c8..8b58f7abb6a27 100644
--- a/app/code/Magento/Sales/Model/Order.php
+++ b/app/code/Magento/Sales/Model/Order.php
@@ -1298,12 +1298,12 @@ public function getTrackingNumbers()
* Retrieve shipping method
*
* @param bool $asObject return carrier code and shipping method data as object
- * @return string|\Magento\Framework\DataObject
+ * @return string|null|\Magento\Framework\DataObject
*/
public function getShippingMethod($asObject = false)
{
$shippingMethod = parent::getShippingMethod();
- if (!$asObject) {
+ if (!$asObject || !$shippingMethod) {
return $shippingMethod;
} else {
list($carrierCode, $method) = explode('_', $shippingMethod, 2);
From c60d395347569dd4feb3be07dab5b8a5738b6e85 Mon Sep 17 00:00:00 2001
From: Ihor Sviziev
Date: Fri, 1 Feb 2019 09:22:04 +0200
Subject: [PATCH 034/315] magento/magento2#19098 2.2.6 Use batches and direct
queries to fix sales address upgrade
Fix static test failure
---
app/code/Magento/Sales/Setup/UpgradeData.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/code/Magento/Sales/Setup/UpgradeData.php b/app/code/Magento/Sales/Setup/UpgradeData.php
index 56cbf31c3d695..0f9833ed8f7f2 100644
--- a/app/code/Magento/Sales/Setup/UpgradeData.php
+++ b/app/code/Magento/Sales/Setup/UpgradeData.php
@@ -50,7 +50,7 @@ class UpgradeData implements UpgradeDataInterface
/**
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
- *
+ *
* @param SalesSetupFactory $salesSetupFactory
* @param Config $eavConfig
* @param AggregatedFieldDataConverter $aggregatedFieldConverter
From bef07b690a96fbc6bbe7b53d59b746a10c7cb949 Mon Sep 17 00:00:00 2001
From: DmytroPaidych
Date: Fri, 1 Feb 2019 09:50:55 +0200
Subject: [PATCH 035/315] MAGETWO-97236: Delete Product Staging Update when the
Product is used
---
.../Catalog/Test/Mftf/Data/ProductData.xml | 5 +-
.../Test/Mftf/Data/ProductLinkData.xml | 19 +++
.../Test/Mftf/Data/ProductLinksData.xml | 14 +++
.../Catalog/Test/Mftf/Data/WidgetsData.xml | 15 +++
.../Test/Mftf/Metadata/product-meta.xml | 3 +
.../Test/Mftf/Page/AdminNewWidgetPage.xml | 14 +++
.../Test/Mftf/Page/StorefrontProductPage.xml | 3 +-
.../Mftf/Section/AdminNewWidgetSection.xml | 14 +++
...dminNewWidgetSelectProductPopupSection.xml | 15 +++
...StorefrontProducRelatedProductsSection.xml | 14 +++
.../Mftf/Page/AdminUrlRewriteEditPage.xml | 14 +++
.../Section/AdminUrlRewriteEditSection.xml | 14 +++
.../AdminCreateWidgetActionGroup.xml | 108 +++++++++---------
.../Test/Mftf/Page/AdminNewWidgetPage.xml | 4 +-
.../Mftf/Section/AdminNewWidgetSection.xml | 3 +-
15 files changed, 203 insertions(+), 56 deletions(-)
create mode 100644 app/code/Magento/Catalog/Test/Mftf/Data/ProductLinkData.xml
create mode 100644 app/code/Magento/Catalog/Test/Mftf/Data/ProductLinksData.xml
create mode 100644 app/code/Magento/Catalog/Test/Mftf/Data/WidgetsData.xml
create mode 100644 app/code/Magento/Catalog/Test/Mftf/Page/AdminNewWidgetPage.xml
create mode 100644 app/code/Magento/Catalog/Test/Mftf/Section/AdminNewWidgetSection.xml
create mode 100644 app/code/Magento/Catalog/Test/Mftf/Section/AdminNewWidgetSelectProductPopupSection.xml
create mode 100644 app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProducRelatedProductsSection.xml
create mode 100644 app/code/Magento/UrlRewrite/Test/Mftf/Page/AdminUrlRewriteEditPage.xml
create mode 100644 app/code/Magento/UrlRewrite/Test/Mftf/Section/AdminUrlRewriteEditSection.xml
diff --git a/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml b/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml
index 39f4f0f2d997d..86bdb1a102172 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml
@@ -7,7 +7,7 @@
-->
+ xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
testSku
simple
@@ -282,4 +282,7 @@
1
EavStock1
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Data/ProductLinkData.xml b/app/code/Magento/Catalog/Test/Mftf/Data/ProductLinkData.xml
new file mode 100644
index 0000000000000..000bb2095002c
--- /dev/null
+++ b/app/code/Magento/Catalog/Test/Mftf/Data/ProductLinkData.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+ related
+ simple
+ 1
+ Qty1000
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Data/ProductLinksData.xml b/app/code/Magento/Catalog/Test/Mftf/Data/ProductLinksData.xml
new file mode 100644
index 0000000000000..bd4f807880ab8
--- /dev/null
+++ b/app/code/Magento/Catalog/Test/Mftf/Data/ProductLinksData.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+ RelatedProductLink
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Data/WidgetsData.xml b/app/code/Magento/Catalog/Test/Mftf/Data/WidgetsData.xml
new file mode 100644
index 0000000000000..83f0a56c21545
--- /dev/null
+++ b/app/code/Magento/Catalog/Test/Mftf/Data/WidgetsData.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+ Catalog Product Link
+ Product Link Block Template
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Metadata/product-meta.xml b/app/code/Magento/Catalog/Test/Mftf/Metadata/product-meta.xml
index 1bf7d0b0d988f..23be8408d4a1e 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Metadata/product-meta.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Metadata/product-meta.xml
@@ -121,4 +121,7 @@
application/json
+
+ application/json
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Page/AdminNewWidgetPage.xml b/app/code/Magento/Catalog/Test/Mftf/Page/AdminNewWidgetPage.xml
new file mode 100644
index 0000000000000..e23a503266e33
--- /dev/null
+++ b/app/code/Magento/Catalog/Test/Mftf/Page/AdminNewWidgetPage.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Page/StorefrontProductPage.xml b/app/code/Magento/Catalog/Test/Mftf/Page/StorefrontProductPage.xml
index 9fcbcc199176b..fdfee62f6dc0b 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Page/StorefrontProductPage.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Page/StorefrontProductPage.xml
@@ -7,11 +7,12 @@
-->
+ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminNewWidgetSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminNewWidgetSection.xml
new file mode 100644
index 0000000000000..5329ad48c8f43
--- /dev/null
+++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminNewWidgetSection.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminNewWidgetSelectProductPopupSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminNewWidgetSelectProductPopupSection.xml
new file mode 100644
index 0000000000000..0da67849f85c6
--- /dev/null
+++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminNewWidgetSelectProductPopupSection.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProducRelatedProductsSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProducRelatedProductsSection.xml
new file mode 100644
index 0000000000000..a7b72bbaa78aa
--- /dev/null
+++ b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProducRelatedProductsSection.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Page/AdminUrlRewriteEditPage.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Page/AdminUrlRewriteEditPage.xml
new file mode 100644
index 0000000000000..b43e0e05ad55d
--- /dev/null
+++ b/app/code/Magento/UrlRewrite/Test/Mftf/Page/AdminUrlRewriteEditPage.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Section/AdminUrlRewriteEditSection.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Section/AdminUrlRewriteEditSection.xml
new file mode 100644
index 0000000000000..7095214e72c43
--- /dev/null
+++ b/app/code/Magento/UrlRewrite/Test/Mftf/Section/AdminUrlRewriteEditSection.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
diff --git a/app/code/Magento/Widget/Test/Mftf/ActionGroup/AdminCreateWidgetActionGroup.xml b/app/code/Magento/Widget/Test/Mftf/ActionGroup/AdminCreateWidgetActionGroup.xml
index b6dfc00c0ff9e..f146e793db882 100644
--- a/app/code/Magento/Widget/Test/Mftf/ActionGroup/AdminCreateWidgetActionGroup.xml
+++ b/app/code/Magento/Widget/Test/Mftf/ActionGroup/AdminCreateWidgetActionGroup.xml
@@ -7,58 +7,64 @@
-->
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Widget/Test/Mftf/Page/AdminNewWidgetPage.xml b/app/code/Magento/Widget/Test/Mftf/Page/AdminNewWidgetPage.xml
index 8eb0a5f65318e..5946bb81d9485 100644
--- a/app/code/Magento/Widget/Test/Mftf/Page/AdminNewWidgetPage.xml
+++ b/app/code/Magento/Widget/Test/Mftf/Page/AdminNewWidgetPage.xml
@@ -7,8 +7,8 @@
-->
-
+ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/PageObject.xsd">
+
diff --git a/app/code/Magento/Widget/Test/Mftf/Section/AdminNewWidgetSection.xml b/app/code/Magento/Widget/Test/Mftf/Section/AdminNewWidgetSection.xml
index adf234baede72..57f07d9795b68 100644
--- a/app/code/Magento/Widget/Test/Mftf/Section/AdminNewWidgetSection.xml
+++ b/app/code/Magento/Widget/Test/Mftf/Section/AdminNewWidgetSection.xml
@@ -7,7 +7,7 @@
-->
+ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
@@ -17,6 +17,7 @@
+
From 9b6ef590ed0fc95c5da7e5ebfacf5b2452dead5e Mon Sep 17 00:00:00 2001
From: Serhiy Zhovnir
Date: Sun, 3 Feb 2019 19:19:10 +0200
Subject: [PATCH 036/315] #18698 Fixed order email sending via order async
email sending when order was created with disabled email sending
---
app/code/Magento/Sales/Model/Order/Email/Sender/OrderSender.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/code/Magento/Sales/Model/Order/Email/Sender/OrderSender.php b/app/code/Magento/Sales/Model/Order/Email/Sender/OrderSender.php
index f06da0de0fd00..7ac11ca073d26 100644
--- a/app/code/Magento/Sales/Model/Order/Email/Sender/OrderSender.php
+++ b/app/code/Magento/Sales/Model/Order/Email/Sender/OrderSender.php
@@ -97,7 +97,7 @@ public function __construct(
*/
public function send(Order $order, $forceSyncMode = false)
{
- $order->setSendEmail(true);
+ $order->setSendEmail($this->identityContainer->isEnabled());
if (!$this->globalConfig->getValue('sales_email/general/async_sending') || $forceSyncMode) {
if ($this->checkAndSend($order)) {
From f4bec9aec5a22af59021b937fc09555823d3598e Mon Sep 17 00:00:00 2001
From: amol 2jcommerce
Date: Mon, 4 Feb 2019 20:20:11 +0530
Subject: [PATCH 037/315] admin-store-view-label-not-alignment-2
---
.../web/css/source/module/main/actions-bar/_store-switcher.less | 1 +
1 file changed, 1 insertion(+)
diff --git a/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/main/actions-bar/_store-switcher.less b/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/main/actions-bar/_store-switcher.less
index 80bebb22a9043..8daa7d5808d06 100644
--- a/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/main/actions-bar/_store-switcher.less
+++ b/app/design/adminhtml/Magento/backend/Magento_Backend/web/css/source/module/main/actions-bar/_store-switcher.less
@@ -235,6 +235,7 @@
.store-view {
&:not(.store-switcher) {
float: left;
+ margin-top: 13px;
}
.store-switcher-label {
From d7fb21ae94273dc5c5e0fd445cc9a3049883ded1 Mon Sep 17 00:00:00 2001
From: DmytroPaidych
Date: Tue, 5 Feb 2019 13:03:11 +0200
Subject: [PATCH 038/315] MAGETWO-97236: Delete Product Staging Update when the
Product is used
---
.../UrlRewrite/Test/Mftf/Page/AdminUrlRewriteEditPage.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Page/AdminUrlRewriteEditPage.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Page/AdminUrlRewriteEditPage.xml
index b43e0e05ad55d..f51b9321e6911 100644
--- a/app/code/Magento/UrlRewrite/Test/Mftf/Page/AdminUrlRewriteEditPage.xml
+++ b/app/code/Magento/UrlRewrite/Test/Mftf/Page/AdminUrlRewriteEditPage.xml
@@ -8,7 +8,7 @@
-
+
From 7ef7fdeb39623fb5e9da437724993396817609df Mon Sep 17 00:00:00 2001
From: Serhiy Yelahin
Date: Tue, 5 Feb 2019 13:22:39 +0200
Subject: [PATCH 039/315] MAGETWO-97950: Minicart isn't updated for disabled
products
---
.../frontend/templates/cart/noItems.phtml | 7 ++++
.../view/frontend/web/js/empty-cart.js | 12 ++++++
...efrontGuestCheckoutDisabledProductTest.xml | 41 ++++++++++++++++---
3 files changed, 54 insertions(+), 6 deletions(-)
create mode 100644 app/code/Magento/Checkout/view/frontend/web/js/empty-cart.js
diff --git a/app/code/Magento/Checkout/view/frontend/templates/cart/noItems.phtml b/app/code/Magento/Checkout/view/frontend/templates/cart/noItems.phtml
index 1c0c221a550cd..67ac4a9335565 100644
--- a/app/code/Magento/Checkout/view/frontend/templates/cart/noItems.phtml
+++ b/app/code/Magento/Checkout/view/frontend/templates/cart/noItems.phtml
@@ -13,3 +13,10 @@
$block->escapeUrl($block->getContinueShoppingUrl())) ?>
= $block->getChildHtml('shopping.cart.table.after') ?>
+
\ No newline at end of file
diff --git a/app/code/Magento/Checkout/view/frontend/web/js/empty-cart.js b/app/code/Magento/Checkout/view/frontend/web/js/empty-cart.js
new file mode 100644
index 0000000000000..27d38697afe39
--- /dev/null
+++ b/app/code/Magento/Checkout/view/frontend/web/js/empty-cart.js
@@ -0,0 +1,12 @@
+/**
+ * Copyright © Magento, Inc. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+define([
+ 'Magento_Customer/js/customer-data'
+], function (customerData) {
+ 'use strict';
+
+ customerData.reload(['cart'], false);
+});
diff --git a/app/code/Magento/Quote/Test/Mftf/Test/StorefrontGuestCheckoutDisabledProductTest.xml b/app/code/Magento/Quote/Test/Mftf/Test/StorefrontGuestCheckoutDisabledProductTest.xml
index a2f08353a4f3b..034c2bc6f051b 100644
--- a/app/code/Magento/Quote/Test/Mftf/Test/StorefrontGuestCheckoutDisabledProductTest.xml
+++ b/app/code/Magento/Quote/Test/Mftf/Test/StorefrontGuestCheckoutDisabledProductTest.xml
@@ -22,6 +22,9 @@
+
+
+
@@ -70,7 +73,10 @@
+
+
+
@@ -79,13 +85,11 @@
-
-
@@ -94,8 +98,6 @@
-
-
@@ -113,10 +115,37 @@
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
From 078830a669c090b763e6e844b9116ba3ff19d141 Mon Sep 17 00:00:00 2001
From: Serhii Voloshkov
Date: Tue, 5 Feb 2019 15:26:49 +0200
Subject: [PATCH 040/315] MAGETWO-94450: Rewards points earned from coupon code
are not applied to guests that create accounts after checking out
---
.../AdminCustomerMainActionsSection.xml | 3 +-
.../Test/Mftf/Data/SalesRuleData.xml | 41 ++++++++++++++++++-
.../Data/SalesRuleExtensionAttributeData.xml | 13 ++++++
.../sales-rule-extension-attribute-meta.xml | 12 ++++++
.../Test/Mftf/Metadata/sales_rule-meta.xml | 6 +--
5 files changed, 68 insertions(+), 7 deletions(-)
create mode 100644 app/code/Magento/SalesRule/Test/Mftf/Data/SalesRuleExtensionAttributeData.xml
create mode 100644 app/code/Magento/SalesRule/Test/Mftf/Metadata/sales-rule-extension-attribute-meta.xml
diff --git a/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerMainActionsSection.xml b/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerMainActionsSection.xml
index 0a77890033295..9553752539757 100644
--- a/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerMainActionsSection.xml
+++ b/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerMainActionsSection.xml
@@ -7,8 +7,9 @@
-->
+ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
diff --git a/app/code/Magento/SalesRule/Test/Mftf/Data/SalesRuleData.xml b/app/code/Magento/SalesRule/Test/Mftf/Data/SalesRuleData.xml
index 595aedc2b604f..25aaa6dd5a23d 100644
--- a/app/code/Magento/SalesRule/Test/Mftf/Data/SalesRuleData.xml
+++ b/app/code/Magento/SalesRule/Test/Mftf/Data/SalesRuleData.xml
@@ -7,7 +7,7 @@
-->
+ xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataProfileSchema.xsd">
salesRule
Sales Rule Descritpion
@@ -141,7 +141,6 @@
0
0
-
SimpleSalesRule
Sales Rule Description
@@ -168,6 +167,44 @@
10
1
+
+ SalesRuleReward
+ Sales Rule with Reward Point
+
+ - 1
+
+
+ - 0
+ - 1
+ - 2
+ - 3
+
+ 10
+ true
+ true
+ true
+ 0
+ by_percent
+ 0
+ 0
+ 0
+ false
+ 0
+ true
+ NO_COUPON
+ false
+ 10
+ 0
+ SalesRuleExtensionAttribute
+
+
+
+ SalesRule
+ Main Website
+ 'NOT LOGGED IN', 'General', 'Wholesale', 'Retailer'
+ Fixed amount discount for whole cart
+ 0
+
SalesRule
diff --git a/app/code/Magento/SalesRule/Test/Mftf/Data/SalesRuleExtensionAttributeData.xml b/app/code/Magento/SalesRule/Test/Mftf/Data/SalesRuleExtensionAttributeData.xml
new file mode 100644
index 0000000000000..43ff4d897c143
--- /dev/null
+++ b/app/code/Magento/SalesRule/Test/Mftf/Data/SalesRuleExtensionAttributeData.xml
@@ -0,0 +1,13 @@
+
+
+
+
+ 200
+
+
diff --git a/app/code/Magento/SalesRule/Test/Mftf/Metadata/sales-rule-extension-attribute-meta.xml b/app/code/Magento/SalesRule/Test/Mftf/Metadata/sales-rule-extension-attribute-meta.xml
new file mode 100644
index 0000000000000..51c4ac24a7426
--- /dev/null
+++ b/app/code/Magento/SalesRule/Test/Mftf/Metadata/sales-rule-extension-attribute-meta.xml
@@ -0,0 +1,12 @@
+
+
+
+ integer
+
+
diff --git a/app/code/Magento/SalesRule/Test/Mftf/Metadata/sales_rule-meta.xml b/app/code/Magento/SalesRule/Test/Mftf/Metadata/sales_rule-meta.xml
index 0d4c4356a20a7..38009c510d2be 100644
--- a/app/code/Magento/SalesRule/Test/Mftf/Metadata/sales_rule-meta.xml
+++ b/app/code/Magento/SalesRule/Test/Mftf/Metadata/sales_rule-meta.xml
@@ -6,7 +6,7 @@
*/
-->
+ xsi:noNamespaceSchemaLocation="urn:magento:mftf:DataGenerator/etc/dataOperation.xsd">
application/json
-
From 532ca5d9cc11685ceed4fa1923662fa0e037e4b3 Mon Sep 17 00:00:00 2001
From: Serhiy Yelahin
Date: Tue, 5 Feb 2019 16:14:00 +0200
Subject: [PATCH 041/315] MAGETWO-97950: Minicart isn't updated for disabled
products
---
.../Mftf/Test/StorefrontGuestCheckoutDisabledProductTest.xml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/code/Magento/Quote/Test/Mftf/Test/StorefrontGuestCheckoutDisabledProductTest.xml b/app/code/Magento/Quote/Test/Mftf/Test/StorefrontGuestCheckoutDisabledProductTest.xml
index 034c2bc6f051b..e5e7c3834bf7d 100644
--- a/app/code/Magento/Quote/Test/Mftf/Test/StorefrontGuestCheckoutDisabledProductTest.xml
+++ b/app/code/Magento/Quote/Test/Mftf/Test/StorefrontGuestCheckoutDisabledProductTest.xml
@@ -74,7 +74,7 @@
-
+
@@ -123,7 +123,7 @@
-
+
From d70186b5835f4839413c283a5f319618998b762e Mon Sep 17 00:00:00 2001
From: Serhiy Zhovnir
Date: Tue, 5 Feb 2019 21:14:09 +0200
Subject: [PATCH 042/315] #18698 Fix PHPUnit test
---
.../Unit/Model/Order/Email/Sender/OrderSenderTest.php | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/OrderSenderTest.php b/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/OrderSenderTest.php
index 46c44c03b1514..88053ea684ce8 100644
--- a/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/OrderSenderTest.php
+++ b/app/code/Magento/Sales/Test/Unit/Model/Order/Email/Sender/OrderSenderTest.php
@@ -64,7 +64,7 @@ public function testSend($configValue, $forceSyncMode, $emailSendingResult, $sen
$this->orderMock->expects($this->once())
->method('setSendEmail')
- ->with(true);
+ ->with($emailSendingResult);
$this->globalConfig->expects($this->once())
->method('getValue')
@@ -72,7 +72,7 @@ public function testSend($configValue, $forceSyncMode, $emailSendingResult, $sen
->willReturn($configValue);
if (!$configValue || $forceSyncMode) {
- $this->identityContainerMock->expects($this->once())
+ $this->identityContainerMock->expects($this->exactly(2))
->method('isEnabled')
->willReturn($emailSendingResult);
@@ -118,7 +118,7 @@ public function testSend($configValue, $forceSyncMode, $emailSendingResult, $sen
$this->orderMock->expects($this->once())
->method('setEmailSent')
- ->with(true);
+ ->with($emailSendingResult);
$this->orderResourceMock->expects($this->once())
->method('saveAttribute')
@@ -210,7 +210,7 @@ public function testSendVirtualOrder($isVirtualOrder, $formatCallCount, $expecte
->with('sales_email/general/async_sending')
->willReturn(false);
- $this->identityContainerMock->expects($this->once())
+ $this->identityContainerMock->expects($this->exactly(2))
->method('isEnabled')
->willReturn(true);
From 03f4af3ec92c1487f1564f3967e729edf137518c Mon Sep 17 00:00:00 2001
From: DianaRusin
Date: Wed, 6 Feb 2019 14:05:59 +0200
Subject: [PATCH 043/315] MAGETWO-95182: Order placed by new customer before
they registered is displayed in the admin under the name Guest
---
...ontCheckCustomerInfoCreatedByGuestTest.xml | 61 +++++++++++++++++++
.../AssignOrderToCustomerObserver.php | 11 ++++
.../AssignOrderToCustomerObserverTest.php | 33 ++++++++--
3 files changed, 99 insertions(+), 6 deletions(-)
create mode 100644 app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckCustomerInfoCreatedByGuestTest.xml
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckCustomerInfoCreatedByGuestTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckCustomerInfoCreatedByGuestTest.xml
new file mode 100644
index 0000000000000..adc308b490c33
--- /dev/null
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckCustomerInfoCreatedByGuestTest.xml
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Sales/Observer/AssignOrderToCustomerObserver.php b/app/code/Magento/Sales/Observer/AssignOrderToCustomerObserver.php
index 9857fa39fa51a..80e909941c5ce 100644
--- a/app/code/Magento/Sales/Observer/AssignOrderToCustomerObserver.php
+++ b/app/code/Magento/Sales/Observer/AssignOrderToCustomerObserver.php
@@ -57,6 +57,17 @@ public function execute(Observer $observer)
$orderId = $delegateData['__sales_assign_order_id'];
$order = $this->orderRepository->get($orderId);
if (!$order->getCustomerId() && $customer->getId()) {
+ // Assign customer info to order after customer creation.
+ $order->setCustomerId($customer->getId())
+ ->setCustomerIsGuest(0)
+ ->setCustomerEmail($customer->getEmail())
+ ->setCustomerFirstname($customer->getFirstname())
+ ->setCustomerLastname($customer->getLastname())
+ ->setCustomerMiddlename($customer->getMiddlename())
+ ->setCustomerPrefix($customer->getPrefix())
+ ->setCustomerSuffix($customer->getSuffix())
+ ->setCustomerGroupId($customer->getGroupId());
+
$this->assignmentService->execute($order, $customer);
}
}
diff --git a/app/code/Magento/Sales/Test/Unit/Observer/AssignOrderToCustomerObserverTest.php b/app/code/Magento/Sales/Test/Unit/Observer/AssignOrderToCustomerObserverTest.php
index 18371274049e3..8890f01130c82 100644
--- a/app/code/Magento/Sales/Test/Unit/Observer/AssignOrderToCustomerObserverTest.php
+++ b/app/code/Magento/Sales/Test/Unit/Observer/AssignOrderToCustomerObserverTest.php
@@ -52,9 +52,10 @@ protected function setUp()
*
* @dataProvider getCustomerIds
* @param null|int $customerId
+ * @param null|int $customerOrderId
* @return void
*/
- public function testAssignOrderToCustomerAfterGuestOrder($customerId)
+ public function testAssignOrderToCustomerAfterGuestOrder($customerId, $customerOrderId)
{
$orderId = 1;
/** @var Observer|PHPUnit_Framework_MockObject_MockObject $observerMock */
@@ -64,7 +65,12 @@ public function testAssignOrderToCustomerAfterGuestOrder($customerId)
->setMethods(['getData'])
->getMock();
/** @var CustomerInterface|PHPUnit_Framework_MockObject_MockObject $customerMock */
- $customerMock = $this->createMock(CustomerInterface::class);
+ $customerMock = $this->getMockBuilder(CustomerInterface::class)
+ ->disableOriginalConstructor()
+ ->getMockForAbstractClass();
+ $customerMock->expects($this->any())
+ ->method('getId')
+ ->willReturn($customerId);
/** @var OrderInterface|PHPUnit_Framework_MockObject_MockObject $orderMock */
$orderMock = $this->getMockBuilder(OrderInterface::class)
->disableOriginalConstructor()
@@ -75,13 +81,24 @@ public function testAssignOrderToCustomerAfterGuestOrder($customerId)
['delegate_data', null, ['__sales_assign_order_id' => $orderId]],
['customer_data_object', null, $customerMock]
]);
- $orderMock->expects($this->once())->method('getCustomerId')->willReturn($customerId);
+ $orderMock->expects($this->any())->method('getCustomerId')->willReturn($customerOrderId);
$this->orderRepositoryMock->expects($this->once())->method('get')->with($orderId)
->willReturn($orderMock);
- if ($customerId) {
+ if (!$customerOrderId && $customerId) {
+ $orderMock->expects($this->once())->method('setCustomerId')->willReturn($orderMock);
+ $orderMock->expects($this->once())->method('setCustomerIsGuest')->willReturn($orderMock);
+ $orderMock->expects($this->once())->method('setCustomerEmail')->willReturn($orderMock);
+ $orderMock->expects($this->once())->method('setCustomerFirstname')->willReturn($orderMock);
+ $orderMock->expects($this->once())->method('setCustomerLastname')->willReturn($orderMock);
+ $orderMock->expects($this->once())->method('setCustomerMiddlename')->willReturn($orderMock);
+ $orderMock->expects($this->once())->method('setCustomerPrefix')->willReturn($orderMock);
+ $orderMock->expects($this->once())->method('setCustomerSuffix')->willReturn($orderMock);
+ $orderMock->expects($this->once())->method('setCustomerGroupId')->willReturn($orderMock);
+
$this->assignmentMock->expects($this->once())->method('execute')->with($orderMock, $customerMock);
$this->sut->execute($observerMock);
+
return;
}
@@ -94,8 +111,12 @@ public function testAssignOrderToCustomerAfterGuestOrder($customerId)
*
* @return array
*/
- public function getCustomerIds()
+ public function getCustomerIds(): array
{
- return [[null, 1]];
+ return [
+ [null, null],
+ [1, null],
+ [1, 1],
+ ];
}
}
From 004de84450feaa72f125145c7c46cc730008fa80 Mon Sep 17 00:00:00 2001
From: Viktor Sevch
Date: Thu, 7 Feb 2019 11:35:26 +0200
Subject: [PATCH 044/315] MAGETWO-95463: Order Sales Report includes canceled
orders
---
.../Block/Adminhtml/Sales/Sales/Grid.php | 68 ++++++++++++-
.../GenerateOrderReportActionGroup.xml | 22 +++++
.../Test/Mftf/Page/OrdersReportPage.xml | 14 +++
.../Section/AdminOrderReportFilterSection.xml | 16 ++++
.../AdminOrderReportMainActionsSection.xml | 15 +++
.../Section/AdminOrderReportTableSection.xml | 15 +++
.../CancelOrdersInOrderSalesReportTest.xml | 95 +++++++++++++++++++
7 files changed, 242 insertions(+), 3 deletions(-)
create mode 100644 app/code/Magento/Reports/Test/Mftf/ActionGroup/GenerateOrderReportActionGroup.xml
create mode 100644 app/code/Magento/Reports/Test/Mftf/Page/OrdersReportPage.xml
create mode 100644 app/code/Magento/Reports/Test/Mftf/Section/AdminOrderReportFilterSection.xml
create mode 100644 app/code/Magento/Reports/Test/Mftf/Section/AdminOrderReportMainActionsSection.xml
create mode 100644 app/code/Magento/Reports/Test/Mftf/Section/AdminOrderReportTableSection.xml
create mode 100644 app/code/Magento/Reports/Test/Mftf/Test/CancelOrdersInOrderSalesReportTest.xml
diff --git a/app/code/Magento/Reports/Block/Adminhtml/Sales/Sales/Grid.php b/app/code/Magento/Reports/Block/Adminhtml/Sales/Sales/Grid.php
index 1f90309721c23..9c80f6aa423b8 100644
--- a/app/code/Magento/Reports/Block/Adminhtml/Sales/Sales/Grid.php
+++ b/app/code/Magento/Reports/Block/Adminhtml/Sales/Sales/Grid.php
@@ -6,23 +6,58 @@
namespace Magento\Reports\Block\Adminhtml\Sales\Sales;
+use Magento\Framework\DataObject;
use Magento\Reports\Block\Adminhtml\Grid\Column\Renderer\Currency;
+use Magento\Framework\App\ObjectManager;
+use Magento\Sales\Model\Order\ConfigFactory;
+use Magento\Sales\Model\Order;
/**
* Adminhtml sales report grid block
*
- * @author Magento Core Team
* @SuppressWarnings(PHPMD.DepthOfInheritance)
*/
class Grid extends \Magento\Reports\Block\Adminhtml\Grid\AbstractGrid
{
/**
- * GROUP BY criteria
- *
* @var string
*/
protected $_columnGroupBy = 'period';
+ /**
+ * @var ConfigFactory
+ */
+ private $configFactory;
+
+ /**
+ * @param \Magento\Backend\Block\Template\Context $context
+ * @param \Magento\Backend\Helper\Data $backendHelper
+ * @param \Magento\Reports\Model\ResourceModel\Report\Collection\Factory $resourceFactory
+ * @param \Magento\Reports\Model\Grouped\CollectionFactory $collectionFactory
+ * @param \Magento\Reports\Helper\Data $reportsData
+ * @param array $data
+ * @param ConfigFactory|null $configFactory
+ */
+ public function __construct(
+ \Magento\Backend\Block\Template\Context $context,
+ \Magento\Backend\Helper\Data $backendHelper,
+ \Magento\Reports\Model\ResourceModel\Report\Collection\Factory $resourceFactory,
+ \Magento\Reports\Model\Grouped\CollectionFactory $collectionFactory,
+ \Magento\Reports\Helper\Data $reportsData,
+ array $data = [],
+ ConfigFactory $configFactory = null
+ ) {
+ parent::__construct(
+ $context,
+ $backendHelper,
+ $resourceFactory,
+ $collectionFactory,
+ $reportsData,
+ $data
+ );
+ $this->configFactory = $configFactory ?: ObjectManager::getInstance()->get(ConfigFactory::class);
+ }
+
/**
* {@inheritdoc}
* @codeCoverageIgnore
@@ -328,4 +363,31 @@ protected function _prepareColumns()
return parent::_prepareColumns();
}
+
+ /**
+ * @inheritdoc
+ *
+ * Filter canceled statuses for orders.
+ *
+ * @return Grid
+ */
+ protected function _prepareCollection()
+ {
+ /** @var DataObject $filterData */
+ $filterData = $this->getData('filter_data');
+ if (!$filterData->hasData('order_statuses')) {
+ $orderConfig = $this->configFactory->create();
+ $statusValues = [];
+ $canceledStatuses = $orderConfig->getStateStatuses(Order::STATE_CANCELED);
+ $statusCodes = array_keys($orderConfig->getStatuses());
+ foreach ($statusCodes as $code) {
+ if (!isset($canceledStatuses[$code])) {
+ $statusValues[] = $code;
+ }
+ }
+ $filterData->setData('order_statuses', $statusValues);
+ }
+
+ return parent::_prepareCollection();
+ }
}
diff --git a/app/code/Magento/Reports/Test/Mftf/ActionGroup/GenerateOrderReportActionGroup.xml b/app/code/Magento/Reports/Test/Mftf/ActionGroup/GenerateOrderReportActionGroup.xml
new file mode 100644
index 0000000000000..79b9c21b0db6a
--- /dev/null
+++ b/app/code/Magento/Reports/Test/Mftf/ActionGroup/GenerateOrderReportActionGroup.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Reports/Test/Mftf/Page/OrdersReportPage.xml b/app/code/Magento/Reports/Test/Mftf/Page/OrdersReportPage.xml
new file mode 100644
index 0000000000000..46509089b97ba
--- /dev/null
+++ b/app/code/Magento/Reports/Test/Mftf/Page/OrdersReportPage.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Reports/Test/Mftf/Section/AdminOrderReportFilterSection.xml b/app/code/Magento/Reports/Test/Mftf/Section/AdminOrderReportFilterSection.xml
new file mode 100644
index 0000000000000..33527e1262020
--- /dev/null
+++ b/app/code/Magento/Reports/Test/Mftf/Section/AdminOrderReportFilterSection.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
diff --git a/app/code/Magento/Reports/Test/Mftf/Section/AdminOrderReportMainActionsSection.xml b/app/code/Magento/Reports/Test/Mftf/Section/AdminOrderReportMainActionsSection.xml
new file mode 100644
index 0000000000000..e9a56f538fd9c
--- /dev/null
+++ b/app/code/Magento/Reports/Test/Mftf/Section/AdminOrderReportMainActionsSection.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
diff --git a/app/code/Magento/Reports/Test/Mftf/Section/AdminOrderReportTableSection.xml b/app/code/Magento/Reports/Test/Mftf/Section/AdminOrderReportTableSection.xml
new file mode 100644
index 0000000000000..e920d28bcf386
--- /dev/null
+++ b/app/code/Magento/Reports/Test/Mftf/Section/AdminOrderReportTableSection.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
diff --git a/app/code/Magento/Reports/Test/Mftf/Test/CancelOrdersInOrderSalesReportTest.xml b/app/code/Magento/Reports/Test/Mftf/Test/CancelOrdersInOrderSalesReportTest.xml
new file mode 100644
index 0000000000000..c229fb1cf0271
--- /dev/null
+++ b/app/code/Magento/Reports/Test/Mftf/Test/CancelOrdersInOrderSalesReportTest.xml
@@ -0,0 +1,95 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
From 3803660262f766bc71e54e593b94584d91418bd0 Mon Sep 17 00:00:00 2001
From: Cristiano Casciotti
Date: Thu, 7 Feb 2019 11:37:13 +0100
Subject: [PATCH 045/315] Added RewriteBase directive template in .htaccess
file into pub/media folder
---
pub/media/.htaccess | 3 +++
1 file changed, 3 insertions(+)
diff --git a/pub/media/.htaccess b/pub/media/.htaccess
index 28e65b490fbb8..d8793a891430a 100644
--- a/pub/media/.htaccess
+++ b/pub/media/.htaccess
@@ -23,6 +23,9 @@ SetHandler default-handler
Options +FollowSymLinks
RewriteEngine on
+ ## you can put here your pub/media folder path relative to web root
+ #RewriteBase /magento/pub/media/
+
############################################
## never rewrite for existing files
RewriteCond %{REQUEST_FILENAME} !-f
From 402d83d2225aba6fe2c719d853d550a53e4848ca Mon Sep 17 00:00:00 2001
From: OlgaVasyltsun
Date: Thu, 7 Feb 2019 14:13:50 +0200
Subject: [PATCH 046/315] MAGETWO-73432: Change EAV model
---
.../AdminAddCustomerAddressActionGroup.xml | 26 +++++++++++++++++++
.../Test/Mftf/Page/AdminEditCustomerPage.xml | 1 +
.../AdminCustomerAccountNewAddressSection.xml | 19 ++++++++++++++
app/code/Magento/Eav/Model/Entity/Type.php | 7 ++---
4 files changed, 48 insertions(+), 5 deletions(-)
create mode 100644 app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAddCustomerAddressActionGroup.xml
create mode 100644 app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAccountNewAddressSection.xml
diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAddCustomerAddressActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAddCustomerAddressActionGroup.xml
new file mode 100644
index 0000000000000..f042c272cbfce
--- /dev/null
+++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminAddCustomerAddressActionGroup.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Customer/Test/Mftf/Page/AdminEditCustomerPage.xml b/app/code/Magento/Customer/Test/Mftf/Page/AdminEditCustomerPage.xml
index 72d5d90bdc05f..b5a87009315b3 100644
--- a/app/code/Magento/Customer/Test/Mftf/Page/AdminEditCustomerPage.xml
+++ b/app/code/Magento/Customer/Test/Mftf/Page/AdminEditCustomerPage.xml
@@ -12,5 +12,6 @@
+
diff --git a/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAccountNewAddressSection.xml b/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAccountNewAddressSection.xml
new file mode 100644
index 0000000000000..4f1bf69c6e687
--- /dev/null
+++ b/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAccountNewAddressSection.xml
@@ -0,0 +1,19 @@
+
+
+
+
diff --git a/app/code/Magento/Eav/Model/Entity/Type.php b/app/code/Magento/Eav/Model/Entity/Type.php
index aa298d7d547bf..5ee15287e8899 100644
--- a/app/code/Magento/Eav/Model/Entity/Type.php
+++ b/app/code/Magento/Eav/Model/Entity/Type.php
@@ -167,11 +167,8 @@ public function getAttributeCollection($setId = null)
*/
protected function _getAttributeCollection()
{
- $collection = $this->_attributeFactory->create()->getCollection();
- $objectsModel = $this->getAttributeModel();
- if ($objectsModel) {
- $collection->setModel($objectsModel);
- }
+ $collection = $this->_universalFactory->create($this->getEntityAttributeCollection());
+ $collection->setItemObjectClass($this->getAttributeModel());
return $collection;
}
From 69b16da0598cf159040915723bcb1c26f5aa697e Mon Sep 17 00:00:00 2001
From: OlgaVasyltsun
Date: Thu, 7 Feb 2019 16:34:04 +0200
Subject: [PATCH 047/315] MAGETWO-73432: Change EAV model
---
.../Magento/Customer/Test/Mftf/Page/AdminEditCustomerPage.xml | 2 +-
.../Test/Mftf/Section/AdminCustomerAccountAddressSection.xml | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/code/Magento/Customer/Test/Mftf/Page/AdminEditCustomerPage.xml b/app/code/Magento/Customer/Test/Mftf/Page/AdminEditCustomerPage.xml
index b5a87009315b3..7cd36c12c80bd 100644
--- a/app/code/Magento/Customer/Test/Mftf/Page/AdminEditCustomerPage.xml
+++ b/app/code/Magento/Customer/Test/Mftf/Page/AdminEditCustomerPage.xml
@@ -12,6 +12,6 @@
-
+
diff --git a/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAccountAddressSection.xml b/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAccountAddressSection.xml
index db9619dde671f..334a5d81901ea 100644
--- a/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAccountAddressSection.xml
+++ b/app/code/Magento/Customer/Test/Mftf/Section/AdminCustomerAccountAddressSection.xml
@@ -7,7 +7,7 @@
From fe02088e52243c48b0a11c86c53862be8bfc573e Mon Sep 17 00:00:00 2001
From: Jason Woods
Date: Thu, 7 Feb 2019 20:16:21 +0000
Subject: [PATCH 048/315] Fix admin quote address being lost when removing all
items, causing broken quote process until address is updated
---
app/code/Magento/Checkout/etc/di.xml | 3 ---
app/code/Magento/Checkout/etc/frontend/di.xml | 3 +++
.../Checkout/Plugin/Model/Quote/ResetQuoteAddressesTest.php | 1 +
3 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/app/code/Magento/Checkout/etc/di.xml b/app/code/Magento/Checkout/etc/di.xml
index 71dfd12bb4779..4ebd594a28562 100644
--- a/app/code/Magento/Checkout/etc/di.xml
+++ b/app/code/Magento/Checkout/etc/di.xml
@@ -49,7 +49,4 @@
-
-
-
diff --git a/app/code/Magento/Checkout/etc/frontend/di.xml b/app/code/Magento/Checkout/etc/frontend/di.xml
index d80f88786c87b..e203fe5077d26 100644
--- a/app/code/Magento/Checkout/etc/frontend/di.xml
+++ b/app/code/Magento/Checkout/etc/frontend/di.xml
@@ -95,4 +95,7 @@
+
+
+
diff --git a/dev/tests/integration/testsuite/Magento/Checkout/Plugin/Model/Quote/ResetQuoteAddressesTest.php b/dev/tests/integration/testsuite/Magento/Checkout/Plugin/Model/Quote/ResetQuoteAddressesTest.php
index 43108dbca1f5e..85dede0d84c2d 100644
--- a/dev/tests/integration/testsuite/Magento/Checkout/Plugin/Model/Quote/ResetQuoteAddressesTest.php
+++ b/dev/tests/integration/testsuite/Magento/Checkout/Plugin/Model/Quote/ResetQuoteAddressesTest.php
@@ -21,6 +21,7 @@ class ResetQuoteAddressesTest extends \PHPUnit\Framework\TestCase
{
/**
* @magentoDataFixture Magento/Checkout/_files/quote_with_virtual_product_and_address.php
+ * @magentoAppArea frontend
*
* @return void
*/
From c412fc8ba3e7a96d7b2787220f7370c940740772 Mon Sep 17 00:00:00 2001
From: Viktor Sevch
Date: Fri, 8 Feb 2019 10:10:11 +0200
Subject: [PATCH 049/315] MAGETWO-95463: Order Sales Report includes canceled
orders
---
.../Mftf/ActionGroup/GenerateOrderReportActionGroup.xml | 6 +++---
.../{OrdersReportPage.xml => AdminOrdersReportPage.xml} | 8 ++++----
.../Mftf/Section/AdminOrderReportMainActionsSection.xml | 4 ++--
.../Test/Mftf/Test/CancelOrdersInOrderSalesReportTest.xml | 4 ++--
4 files changed, 11 insertions(+), 11 deletions(-)
rename app/code/Magento/Reports/Test/Mftf/Page/{OrdersReportPage.xml => AdminOrdersReportPage.xml} (52%)
diff --git a/app/code/Magento/Reports/Test/Mftf/ActionGroup/GenerateOrderReportActionGroup.xml b/app/code/Magento/Reports/Test/Mftf/ActionGroup/GenerateOrderReportActionGroup.xml
index 79b9c21b0db6a..8ddfd4092645f 100644
--- a/app/code/Magento/Reports/Test/Mftf/ActionGroup/GenerateOrderReportActionGroup.xml
+++ b/app/code/Magento/Reports/Test/Mftf/ActionGroup/GenerateOrderReportActionGroup.xml
@@ -13,10 +13,10 @@
-
+
-
-
+
+
diff --git a/app/code/Magento/Reports/Test/Mftf/Page/OrdersReportPage.xml b/app/code/Magento/Reports/Test/Mftf/Page/AdminOrdersReportPage.xml
similarity index 52%
rename from app/code/Magento/Reports/Test/Mftf/Page/OrdersReportPage.xml
rename to app/code/Magento/Reports/Test/Mftf/Page/AdminOrdersReportPage.xml
index 46509089b97ba..f0b51f6e39357 100644
--- a/app/code/Magento/Reports/Test/Mftf/Page/OrdersReportPage.xml
+++ b/app/code/Magento/Reports/Test/Mftf/Page/AdminOrdersReportPage.xml
@@ -6,9 +6,9 @@
*/
-->
-
-
-
-
+
+
+
+
diff --git a/app/code/Magento/Reports/Test/Mftf/Section/AdminOrderReportMainActionsSection.xml b/app/code/Magento/Reports/Test/Mftf/Section/AdminOrderReportMainActionsSection.xml
index e9a56f538fd9c..c4a96537740ee 100644
--- a/app/code/Magento/Reports/Test/Mftf/Section/AdminOrderReportMainActionsSection.xml
+++ b/app/code/Magento/Reports/Test/Mftf/Section/AdminOrderReportMainActionsSection.xml
@@ -9,7 +9,7 @@
diff --git a/app/code/Magento/Reports/Test/Mftf/Test/CancelOrdersInOrderSalesReportTest.xml b/app/code/Magento/Reports/Test/Mftf/Test/CancelOrdersInOrderSalesReportTest.xml
index c229fb1cf0271..009e4b8e5f6f1 100644
--- a/app/code/Magento/Reports/Test/Mftf/Test/CancelOrdersInOrderSalesReportTest.xml
+++ b/app/code/Magento/Reports/Test/Mftf/Test/CancelOrdersInOrderSalesReportTest.xml
@@ -55,7 +55,7 @@
-
+
@@ -81,7 +81,7 @@
-
+
From acad817a34f70172f56d5c2601d094e274c12492 Mon Sep 17 00:00:00 2001
From: serhii balko
Date: Fri, 8 Feb 2019 13:49:17 +0200
Subject: [PATCH 050/315] MAGETWO-97528: Custom Customer Attribute is not
updating on one website
---
.../Controller/Adminhtml/Index/Save.php | 38 ++++++++--
.../Controller/Adminhtml/Index/SaveTest.php | 75 +++++++++++--------
.../Controller/Adminhtml/IndexTest.php | 36 +++++++++
3 files changed, 112 insertions(+), 37 deletions(-)
diff --git a/app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php b/app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php
index 3a03e9064a0a3..ffff916053dbd 100644
--- a/app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php
+++ b/app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php
@@ -283,11 +283,9 @@ protected function _extractCustomerAddressData(array & $extractedCustomerData)
public function execute()
{
$returnToEdit = false;
- $originalRequestData = $this->getRequest()->getPostValue();
-
$customerId = $this->getCurrentCustomerId();
- if ($originalRequestData) {
+ if ($this->getRequest()->getPostValue()) {
try {
// optional fields might be set in request for future processing by observers in other modules
$customerData = $this->_extractCustomerData();
@@ -375,7 +373,7 @@ public function execute()
$messages = $exception->getMessage();
}
$this->_addSessionErrorMessages($messages);
- $this->_getSession()->setCustomerFormData($originalRequestData);
+ $this->_getSession()->setCustomerFormData($this->retrieveFormattedFormData());
$returnToEdit = true;
} catch (\Magento\Framework\Exception\AbstractAggregateException $exception) {
$errors = $exception->getErrors();
@@ -384,18 +382,19 @@ public function execute()
$messages[] = $error->getMessage();
}
$this->_addSessionErrorMessages($messages);
- $this->_getSession()->setCustomerFormData($originalRequestData);
+ $this->_getSession()->setCustomerFormData($this->retrieveFormattedFormData());
$returnToEdit = true;
} catch (LocalizedException $exception) {
$this->_addSessionErrorMessages($exception->getMessage());
- $this->_getSession()->setCustomerFormData($originalRequestData);
+ $this->_getSession()->setCustomerFormData($this->retrieveFormattedFormData());
$returnToEdit = true;
} catch (\Exception $exception) {
$this->messageManager->addException($exception, __('Something went wrong while saving the customer.'));
- $this->_getSession()->setCustomerFormData($originalRequestData);
+ $this->_getSession()->setCustomerFormData($this->retrieveFormattedFormData());
$returnToEdit = true;
}
}
+
$resultRedirect = $this->resultRedirectFactory->create();
if ($returnToEdit) {
if ($customerId) {
@@ -501,4 +500,29 @@ private function disableAddressValidation(CustomerInterface $customer)
$addressModel->setShouldIgnoreValidation(true);
}
}
+
+ /**
+ * Retrieve formatted form data
+ *
+ * @return array
+ */
+ private function retrieveFormattedFormData(): array
+ {
+ $originalRequestData = $originalRequestData = $this->getRequest()->getPostValue();
+
+ /* Customer data filtration */
+ if (isset($originalRequestData['customer'])) {
+ $customerData = $this->_extractData(
+ 'adminhtml_customer',
+ CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER,
+ [],
+ 'customer'
+ );
+
+ $customerData = array_intersect_key($customerData, $originalRequestData['customer']);
+ $originalRequestData['customer'] = array_merge($originalRequestData['customer'], $customerData);
+ }
+
+ return $originalRequestData;
+ }
}
diff --git a/app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Index/SaveTest.php b/app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Index/SaveTest.php
index e703e7499d731..09082a0a9de53 100644
--- a/app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Index/SaveTest.php
+++ b/app/code/Magento/Customer/Test/Unit/Controller/Adminhtml/Index/SaveTest.php
@@ -886,22 +886,24 @@ public function testExecuteWithNewCustomerAndValidationException()
'customer' => [
'coolness' => false,
'disable_auto_group_change' => 'false',
+ 'dob' => '3/12/1996',
],
'subscription' => $subscription,
];
$extractedData = [
'coolness' => false,
'disable_auto_group_change' => 'false',
+ 'dob' => '1996-03-12',
];
/** @var AttributeMetadataInterface|\PHPUnit_Framework_MockObject_MockObject $customerFormMock */
$attributeMock = $this->getMockBuilder(
\Magento\Customer\Api\Data\AttributeMetadataInterface::class
)->disableOriginalConstructor()->getMock();
- $attributeMock->expects($this->once())
+ $attributeMock->expects($this->exactly(2))
->method('getAttributeCode')
->willReturn('coolness');
- $attributeMock->expects($this->once())
+ $attributeMock->expects($this->exactly(2))
->method('getFrontendInput')
->willReturn('int');
$attributes = [$attributeMock];
@@ -912,7 +914,7 @@ public function testExecuteWithNewCustomerAndValidationException()
[null, null, $postValue],
[CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER, null, $postValue['customer']],
]);
- $this->requestMock->expects($this->exactly(2))
+ $this->requestMock->expects($this->any())
->method('getPost')
->willReturnMap(
[
@@ -925,12 +927,12 @@ public function testExecuteWithNewCustomerAndValidationException()
$objectMock = $this->getMockBuilder(\Magento\Framework\DataObject::class)
->disableOriginalConstructor()
->getMock();
- $objectMock->expects($this->once())
+ $objectMock->expects($this->exactly(2))
->method('getData')
->with('customer')
->willReturn($postValue['customer']);
- $this->objectFactoryMock->expects($this->once())
+ $this->objectFactoryMock->expects($this->exactly(2))
->method('create')
->with(['data' => $postValue])
->willReturn($objectMock);
@@ -938,19 +940,19 @@ public function testExecuteWithNewCustomerAndValidationException()
$customerFormMock = $this->getMockBuilder(
\Magento\Customer\Model\Metadata\Form::class
)->disableOriginalConstructor()->getMock();
- $customerFormMock->expects($this->once())
+ $customerFormMock->expects($this->exactly(2))
->method('extractData')
->with($this->requestMock, 'customer')
->willReturn($extractedData);
- $customerFormMock->expects($this->once())
+ $customerFormMock->expects($this->exactly(2))
->method('compactData')
->with($extractedData)
->willReturn($extractedData);
- $customerFormMock->expects($this->once())
+ $customerFormMock->expects($this->exactly(2))
->method('getAttributes')
->willReturn($attributes);
- $this->formFactoryMock->expects($this->once())
+ $this->formFactoryMock->expects($this->exactly(2))
->method('create')
->with(
CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER,
@@ -998,7 +1000,10 @@ public function testExecuteWithNewCustomerAndValidationException()
$this->sessionMock->expects($this->once())
->method('setCustomerFormData')
- ->with($postValue);
+ ->with([
+ 'customer' => $extractedData,
+ 'subscription' => $subscription,
+ ]);
/** @var Redirect|\PHPUnit_Framework_MockObject_MockObject $redirectMock */
$redirectMock = $this->getMockBuilder(\Magento\Framework\Controller\Result\Redirect::class)
@@ -1029,22 +1034,24 @@ public function testExecuteWithNewCustomerAndLocalizedException()
'customer' => [
'coolness' => false,
'disable_auto_group_change' => 'false',
+ 'dob' => '3/12/1996',
],
'subscription' => $subscription,
];
$extractedData = [
'coolness' => false,
'disable_auto_group_change' => 'false',
+ 'dob' => '1996-03-12',
];
/** @var AttributeMetadataInterface|\PHPUnit_Framework_MockObject_MockObject $customerFormMock */
$attributeMock = $this->getMockBuilder(
\Magento\Customer\Api\Data\AttributeMetadataInterface::class
)->disableOriginalConstructor()->getMock();
- $attributeMock->expects($this->once())
+ $attributeMock->expects($this->exactly(2))
->method('getAttributeCode')
->willReturn('coolness');
- $attributeMock->expects($this->once())
+ $attributeMock->expects($this->exactly(2))
->method('getFrontendInput')
->willReturn('int');
$attributes = [$attributeMock];
@@ -1055,7 +1062,7 @@ public function testExecuteWithNewCustomerAndLocalizedException()
[null, null, $postValue],
[CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER, null, $postValue['customer']],
]);
- $this->requestMock->expects($this->exactly(2))
+ $this->requestMock->expects($this->any())
->method('getPost')
->willReturnMap(
[
@@ -1068,12 +1075,12 @@ public function testExecuteWithNewCustomerAndLocalizedException()
$objectMock = $this->getMockBuilder(\Magento\Framework\DataObject::class)
->disableOriginalConstructor()
->getMock();
- $objectMock->expects($this->once())
+ $objectMock->expects($this->exactly(2))
->method('getData')
->with('customer')
->willReturn($postValue['customer']);
- $this->objectFactoryMock->expects($this->once())
+ $this->objectFactoryMock->expects($this->exactly(2))
->method('create')
->with(['data' => $postValue])
->willReturn($objectMock);
@@ -1082,19 +1089,19 @@ public function testExecuteWithNewCustomerAndLocalizedException()
$customerFormMock = $this->getMockBuilder(
\Magento\Customer\Model\Metadata\Form::class
)->disableOriginalConstructor()->getMock();
- $customerFormMock->expects($this->once())
+ $customerFormMock->expects($this->exactly(2))
->method('extractData')
->with($this->requestMock, 'customer')
->willReturn($extractedData);
- $customerFormMock->expects($this->once())
+ $customerFormMock->expects($this->exactly(2))
->method('compactData')
->with($extractedData)
->willReturn($extractedData);
- $customerFormMock->expects($this->once())
+ $customerFormMock->expects($this->exactly(2))
->method('getAttributes')
->willReturn($attributes);
- $this->formFactoryMock->expects($this->once())
+ $this->formFactoryMock->expects($this->exactly(2))
->method('create')
->with(
CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER,
@@ -1141,7 +1148,10 @@ public function testExecuteWithNewCustomerAndLocalizedException()
$this->sessionMock->expects($this->once())
->method('setCustomerFormData')
- ->with($postValue);
+ ->with([
+ 'customer' => $extractedData,
+ 'subscription' => $subscription,
+ ]);
/** @var Redirect|\PHPUnit_Framework_MockObject_MockObject $redirectMock */
$redirectMock = $this->getMockBuilder(\Magento\Framework\Controller\Result\Redirect::class)
@@ -1172,22 +1182,24 @@ public function testExecuteWithNewCustomerAndException()
'customer' => [
'coolness' => false,
'disable_auto_group_change' => 'false',
+ 'dob' => '3/12/1996',
],
'subscription' => $subscription,
];
$extractedData = [
'coolness' => false,
'disable_auto_group_change' => 'false',
+ 'dob' => '1996-03-12',
];
/** @var AttributeMetadataInterface|\PHPUnit_Framework_MockObject_MockObject $customerFormMock */
$attributeMock = $this->getMockBuilder(
\Magento\Customer\Api\Data\AttributeMetadataInterface::class
)->disableOriginalConstructor()->getMock();
- $attributeMock->expects($this->once())
+ $attributeMock->expects($this->exactly(2))
->method('getAttributeCode')
->willReturn('coolness');
- $attributeMock->expects($this->once())
+ $attributeMock->expects($this->exactly(2))
->method('getFrontendInput')
->willReturn('int');
$attributes = [$attributeMock];
@@ -1198,7 +1210,7 @@ public function testExecuteWithNewCustomerAndException()
[null, null, $postValue],
[CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER, null, $postValue['customer']],
]);
- $this->requestMock->expects($this->exactly(2))
+ $this->requestMock->expects($this->any())
->method('getPost')
->willReturnMap(
[
@@ -1211,12 +1223,12 @@ public function testExecuteWithNewCustomerAndException()
$objectMock = $this->getMockBuilder(\Magento\Framework\DataObject::class)
->disableOriginalConstructor()
->getMock();
- $objectMock->expects($this->once())
+ $objectMock->expects($this->exactly(2))
->method('getData')
->with('customer')
->willReturn($postValue['customer']);
- $this->objectFactoryMock->expects($this->once())
+ $this->objectFactoryMock->expects($this->exactly(2))
->method('create')
->with(['data' => $postValue])
->willReturn($objectMock);
@@ -1224,19 +1236,19 @@ public function testExecuteWithNewCustomerAndException()
$customerFormMock = $this->getMockBuilder(
\Magento\Customer\Model\Metadata\Form::class
)->disableOriginalConstructor()->getMock();
- $customerFormMock->expects($this->once())
+ $customerFormMock->expects($this->exactly(2))
->method('extractData')
->with($this->requestMock, 'customer')
->willReturn($extractedData);
- $customerFormMock->expects($this->once())
+ $customerFormMock->expects($this->exactly(2))
->method('compactData')
->with($extractedData)
->willReturn($extractedData);
- $customerFormMock->expects($this->once())
+ $customerFormMock->expects($this->exactly(2))
->method('getAttributes')
->willReturn($attributes);
- $this->formFactoryMock->expects($this->once())
+ $this->formFactoryMock->expects($this->exactly(2))
->method('create')
->with(
CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER,
@@ -1285,7 +1297,10 @@ public function testExecuteWithNewCustomerAndException()
$this->sessionMock->expects($this->once())
->method('setCustomerFormData')
- ->with($postValue);
+ ->with([
+ 'customer' => $extractedData,
+ 'subscription' => $subscription,
+ ]);
/** @var Redirect|\PHPUnit_Framework_MockObject_MockObject $redirectMock */
$redirectMock = $this->getMockBuilder(\Magento\Framework\Controller\Result\Redirect::class)
diff --git a/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php
index 36df9cbf851bd..ccf9c45da8660 100644
--- a/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php
+++ b/dev/tests/integration/testsuite/Magento/Customer/Controller/Adminhtml/IndexTest.php
@@ -509,6 +509,42 @@ public function testSaveActionCoreException()
$this->assertRedirect($this->stringStartsWith($this->_baseControllerUrl . 'new/key/'));
}
+ /**
+ * @magentoDataFixture Magento/Customer/_files/customer_sample.php
+ */
+ public function testSaveActionCoreExceptionFormatFormData()
+ {
+ $post = [
+ 'customer' => [
+ 'website_id' => 1,
+ 'email' => 'customer@example.com',
+ 'dob' => '12/3/1996',
+ ],
+ ];
+ $postFormatted = [
+ 'customer' => [
+ 'website_id' => 1,
+ 'email' => 'customer@example.com',
+ 'dob' => '1996-12-03',
+ ],
+ ];
+ $this->getRequest()->setPostValue($post);
+ $this->dispatch('backend/customer/index/save');
+ /*
+ * Check that error message is set
+ */
+ $this->assertSessionMessages(
+ $this->equalTo(['A customer with the same email already exists in an associated website.']),
+ \Magento\Framework\Message\MessageInterface::TYPE_ERROR
+ );
+ $this->assertEquals(
+ $postFormatted,
+ Bootstrap::getObjectManager()->get(\Magento\Backend\Model\Session::class)->getCustomerFormData(),
+ 'Customer form data should be formatted'
+ );
+ $this->assertRedirect($this->stringStartsWith($this->_baseControllerUrl . 'new/key/'));
+ }
+
/**
* @magentoDataFixture Magento/Customer/_files/customer_sample.php
*/
From 6e515402393b02e954841ecdb3dabc09e1907432 Mon Sep 17 00:00:00 2001
From: serhii balko
Date: Fri, 8 Feb 2019 15:32:26 +0200
Subject: [PATCH 051/315] MAGETWO-97528: Custom Customer Attribute is not
updating on one website
---
app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php b/app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php
index ffff916053dbd..5b61c0aaf5e2f 100644
--- a/app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php
+++ b/app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php
@@ -520,7 +520,7 @@ private function retrieveFormattedFormData(): array
);
$customerData = array_intersect_key($customerData, $originalRequestData['customer']);
- $originalRequestData['customer'] = array_merge($originalRequestData['customer'], $customerData);
+ $originalRequestData['customer'] = array_merge($originalRequestData['customer'], $customerData);
}
return $originalRequestData;
From 42a7099e70eb1e369cc120654e79e8620d7db687 Mon Sep 17 00:00:00 2001
From: Stas Kozar
Date: Fri, 8 Feb 2019 15:33:54 +0200
Subject: [PATCH 052/315] MAGETWO-86215: Static blocks with same ID appear in
place of correct block
---
.../Magento/Cms/Model/ResourceModel/Block.php | 23 ++++---
.../AdminCreateNewCMSBlockActionGroup.xml | 21 +++++++
.../AdminDeleteCMSBlockActionGroup.xml | 21 +++++++
.../Section/AdminCmsBlockContentSection.xml | 3 +
...teStaticBlockOnDuplicateIdentifierTest.xml | 61 +++++++++++++++++++
5 files changed, 122 insertions(+), 7 deletions(-)
create mode 100644 app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminCreateNewCMSBlockActionGroup.xml
create mode 100644 app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminDeleteCMSBlockActionGroup.xml
create mode 100644 app/code/Magento/Cms/Test/Mftf/Test/CheckCreateStaticBlockOnDuplicateIdentifierTest.xml
diff --git a/app/code/Magento/Cms/Model/ResourceModel/Block.php b/app/code/Magento/Cms/Model/ResourceModel/Block.php
index 9aab54b02bc14..30e817713755c 100644
--- a/app/code/Magento/Cms/Model/ResourceModel/Block.php
+++ b/app/code/Magento/Cms/Model/ResourceModel/Block.php
@@ -95,9 +95,11 @@ protected function _beforeSave(AbstractModel $object)
}
/**
+ * Get block id.
+ *
* @param AbstractModel $object
* @param mixed $value
- * @param null $field
+ * @param string $field
* @return bool|int|string
* @throws LocalizedException
* @throws \Exception
@@ -183,10 +185,12 @@ public function getIsUniqueBlockToStores(AbstractModel $object)
$entityMetadata = $this->metadataPool->getMetadata(BlockInterface::class);
$linkField = $entityMetadata->getLinkField();
- if ($this->_storeManager->isSingleStoreMode()) {
- $stores = [Store::DEFAULT_STORE_ID];
- } else {
- $stores = (array)$object->getData('store_id');
+ $stores = (array)$object->getData('store_id');
+ $isDefaultStore = $this->_storeManager->isSingleStoreMode()
+ || array_search(Store::DEFAULT_STORE_ID, $stores) !== false;
+
+ if (!$isDefaultStore) {
+ $stores[] = Store::DEFAULT_STORE_ID;
}
$select = $this->getConnection()->select()
@@ -196,8 +200,11 @@ public function getIsUniqueBlockToStores(AbstractModel $object)
'cb.' . $linkField . ' = cbs.' . $linkField,
[]
)
- ->where('cb.identifier = ?', $object->getData('identifier'))
- ->where('cbs.store_id IN (?)', $stores);
+ ->where('cb.identifier = ? ', $object->getData('identifier'));
+
+ if (!$isDefaultStore) {
+ $select->where('cbs.store_id IN (?)', $stores);
+ }
if ($object->getId()) {
$select->where('cb.' . $entityMetadata->getIdentifierField() . ' <> ?', $object->getId());
@@ -236,6 +243,8 @@ public function lookupStoreIds($id)
}
/**
+ * Save an object.
+ *
* @param AbstractModel $object
* @return $this
* @throws \Exception
diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminCreateNewCMSBlockActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminCreateNewCMSBlockActionGroup.xml
new file mode 100644
index 0000000000000..ce240f9f47e99
--- /dev/null
+++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminCreateNewCMSBlockActionGroup.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminDeleteCMSBlockActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminDeleteCMSBlockActionGroup.xml
new file mode 100644
index 0000000000000..b5ff9c3639c8b
--- /dev/null
+++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminDeleteCMSBlockActionGroup.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Cms/Test/Mftf/Section/AdminCmsBlockContentSection.xml b/app/code/Magento/Cms/Test/Mftf/Section/AdminCmsBlockContentSection.xml
index 9614f13f9e3d3..20e55c49ec235 100644
--- a/app/code/Magento/Cms/Test/Mftf/Section/AdminCmsBlockContentSection.xml
+++ b/app/code/Magento/Cms/Test/Mftf/Section/AdminCmsBlockContentSection.xml
@@ -11,5 +11,8 @@
diff --git a/app/code/Magento/Cms/Test/Mftf/Test/CheckCreateStaticBlockOnDuplicateIdentifierTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/CheckCreateStaticBlockOnDuplicateIdentifierTest.xml
new file mode 100644
index 0000000000000..371e6529590e7
--- /dev/null
+++ b/app/code/Magento/Cms/Test/Mftf/Test/CheckCreateStaticBlockOnDuplicateIdentifierTest.xml
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
From 9d858b3b8c9e30b7414d7c85fa271dc310feed0b Mon Sep 17 00:00:00 2001
From: NazarKlovanych
Date: Fri, 8 Feb 2019 16:26:29 +0200
Subject: [PATCH 053/315] fix-issue21073
---
.../Edit/Action/Attribute/Tab/Inventory.php | 29 +++++++++++++++++--
.../product/edit/action/inventory.phtml | 2 +-
2 files changed, 28 insertions(+), 3 deletions(-)
diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Inventory.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Inventory.php
index 4aebd521fe60d..d11a6d632657f 100644
--- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Inventory.php
+++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Action/Attribute/Tab/Inventory.php
@@ -5,6 +5,8 @@
*/
namespace Magento\Catalog\Block\Adminhtml\Product\Edit\Action\Attribute\Tab;
+use Magento\Customer\Api\Data\GroupInterface;
+
/**
* Products mass update inventory tab
*
@@ -29,6 +31,11 @@ class Inventory extends \Magento\Backend\Block\Widget implements \Magento\Backen
*/
protected $disabledFields = [];
+ /**
+ * @var \Magento\Framework\Serialize\SerializerInterface
+ */
+ private $serializer;
+
/**
* @param \Magento\Backend\Block\Template\Context $context
* @param \Magento\CatalogInventory\Model\Source\Backorders $backorders
@@ -39,10 +46,13 @@ public function __construct(
\Magento\Backend\Block\Template\Context $context,
\Magento\CatalogInventory\Model\Source\Backorders $backorders,
\Magento\CatalogInventory\Api\StockConfigurationInterface $stockConfiguration,
- array $data = []
+ array $data = [],
+ \Magento\Framework\Serialize\SerializerInterface $serializer = null
) {
$this->_backorders = $backorders;
$this->stockConfiguration = $stockConfiguration;
+ $this->serializer = $serializer ?? \Magento\Framework\App\ObjectManager::getInstance()
+ ->get(\Magento\Framework\Serialize\SerializerInterface::class);
parent::__construct($context, $data);
}
@@ -74,7 +84,7 @@ public function getFieldSuffix()
public function getStoreId()
{
$storeId = $this->getRequest()->getParam('store');
- return (int)$storeId;
+ return (int) $storeId;
}
/**
@@ -88,6 +98,21 @@ public function getDefaultConfigValue($field)
return $this->stockConfiguration->getDefaultConfigValue($field);
}
+ /**
+ * Returns min_sale_qty configuration for the ALL Customer Group
+ * @return int
+ */
+ public function getDefaultMinSaleQty()
+ {
+ $default = $this->stockConfiguration->getDefaultConfigValue('min_sale_qty');
+ if (!is_numeric($default)) {
+ $default = $this->serializer->unserialize($default);
+ $default = isset($default[GroupInterface::CUST_GROUP_ALL]) ? $default[GroupInterface::CUST_GROUP_ALL] : 1;
+ }
+
+ return (int) $default;
+ }
+
/**
* Tab settings
*
diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/action/inventory.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/action/inventory.phtml
index efc06d675c369..96e07ceb4d305 100644
--- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/action/inventory.phtml
+++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/edit/action/inventory.phtml
@@ -132,7 +132,7 @@
From 9d0f7691131080b51b8da3ef06fff015ff37e023 Mon Sep 17 00:00:00 2001
From: Myroslav Dobra
Date: Fri, 8 Feb 2019 17:27:51 +0200
Subject: [PATCH 054/315] MAGETWO-73534: [GITHUB] Url rewrite for product is
broken after using massaction #8227
---
.../Page/AdminProductUpdateAttributesPage.xml | 14 ++++
.../Section/AdminProductFiltersSection.xml | 3 +-
.../Mftf/Section/AdminProductSEOSection.xml | 1 +
.../Section/AdminUpdateAttributesSection.xml | 17 +++++
.../ProductToWebsiteChangeObserver.php | 17 +++--
...minUrlForProductRewrittenCorrectlyTest.xml | 72 +++++++++++++++++++
6 files changed, 117 insertions(+), 7 deletions(-)
create mode 100644 app/code/Magento/Catalog/Test/Mftf/Page/AdminProductUpdateAttributesPage.xml
create mode 100644 app/code/Magento/Catalog/Test/Mftf/Section/AdminUpdateAttributesSection.xml
create mode 100644 app/code/Magento/CatalogUrlRewrite/Test/Mftf/Test/AdminUrlForProductRewrittenCorrectlyTest.xml
diff --git a/app/code/Magento/Catalog/Test/Mftf/Page/AdminProductUpdateAttributesPage.xml b/app/code/Magento/Catalog/Test/Mftf/Page/AdminProductUpdateAttributesPage.xml
new file mode 100644
index 0000000000000..84996a3814571
--- /dev/null
+++ b/app/code/Magento/Catalog/Test/Mftf/Page/AdminProductUpdateAttributesPage.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFiltersSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFiltersSection.xml
index 6844006e4e399..8e13f9c38f805 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFiltersSection.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFiltersSection.xml
@@ -7,12 +7,13 @@
-->
+ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductSEOSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductSEOSection.xml
index 1d49d05363612..90c3856933be9 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductSEOSection.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductSEOSection.xml
@@ -11,5 +11,6 @@
diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminUpdateAttributesSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminUpdateAttributesSection.xml
new file mode 100644
index 0000000000000..051fda092d151
--- /dev/null
+++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminUpdateAttributesSection.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
diff --git a/app/code/Magento/CatalogUrlRewrite/Observer/ProductToWebsiteChangeObserver.php b/app/code/Magento/CatalogUrlRewrite/Observer/ProductToWebsiteChangeObserver.php
index fc2056e83ec70..94798753ca63f 100644
--- a/app/code/Magento/CatalogUrlRewrite/Observer/ProductToWebsiteChangeObserver.php
+++ b/app/code/Magento/CatalogUrlRewrite/Observer/ProductToWebsiteChangeObserver.php
@@ -14,6 +14,9 @@
use Magento\UrlRewrite\Model\UrlPersistInterface;
use Magento\UrlRewrite\Service\V1\Data\UrlRewrite;
+/**
+ * Observer to assign the products to website.
+ */
class ProductToWebsiteChangeObserver implements ObserverInterface
{
/**
@@ -69,12 +72,14 @@ public function execute(\Magento\Framework\Event\Observer $observer)
$this->request->getParam('store_id', Store::DEFAULT_STORE_ID)
);
- $this->urlPersist->deleteByData([
- UrlRewrite::ENTITY_ID => $product->getId(),
- UrlRewrite::ENTITY_TYPE => ProductUrlRewriteGenerator::ENTITY_TYPE,
- ]);
- if ($product->getVisibility() != Visibility::VISIBILITY_NOT_VISIBLE) {
- $this->urlPersist->replace($this->productUrlRewriteGenerator->generate($product));
+ if (!empty($this->productUrlRewriteGenerator->generate($product))) {
+ $this->urlPersist->deleteByData([
+ UrlRewrite::ENTITY_ID => $product->getId(),
+ UrlRewrite::ENTITY_TYPE => ProductUrlRewriteGenerator::ENTITY_TYPE,
+ ]);
+ if ($product->getVisibility() != Visibility::VISIBILITY_NOT_VISIBLE) {
+ $this->urlPersist->replace($this->productUrlRewriteGenerator->generate($product));
+ }
}
}
}
diff --git a/app/code/Magento/CatalogUrlRewrite/Test/Mftf/Test/AdminUrlForProductRewrittenCorrectlyTest.xml b/app/code/Magento/CatalogUrlRewrite/Test/Mftf/Test/AdminUrlForProductRewrittenCorrectlyTest.xml
new file mode 100644
index 0000000000000..558e19885e112
--- /dev/null
+++ b/app/code/Magento/CatalogUrlRewrite/Test/Mftf/Test/AdminUrlForProductRewrittenCorrectlyTest.xml
@@ -0,0 +1,72 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
From 786b2fa832fcc75d5343a2f6f5bffb6aee8f4a79 Mon Sep 17 00:00:00 2001
From: Mastiuhin Olexandr
Date: Fri, 8 Feb 2019 21:52:18 +0200
Subject: [PATCH 055/315] MAGETWO-97425: Country of Manufacture displays empty
under More Information tab
---
.../Catalog/Block/Product/View/Attributes.php | 8 +++++++-
.../Unit/Block/Product/View/AttributesTest.php | 16 ++++++++++++++++
2 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/app/code/Magento/Catalog/Block/Product/View/Attributes.php b/app/code/Magento/Catalog/Block/Product/View/Attributes.php
index b353e477a056c..8494b690bad9f 100644
--- a/app/code/Magento/Catalog/Block/Product/View/Attributes.php
+++ b/app/code/Magento/Catalog/Block/Product/View/Attributes.php
@@ -16,6 +16,8 @@
use Magento\Framework\Pricing\PriceCurrencyInterface;
/**
+ * Attributes attributes block
+ *
* @api
* @since 100.0.2
*/
@@ -56,6 +58,8 @@ public function __construct(
}
/**
+ * Returns a Product.
+ *
* @return Product
*/
public function getProduct()
@@ -67,6 +71,8 @@ public function getProduct()
}
/**
+ * Additional data.
+ *
* $excludeAttr is optional array of attribute codes to
* exclude them from additional data array
*
@@ -89,7 +95,7 @@ public function getAdditionalData(array $excludeAttr = [])
$value = $this->priceCurrency->convertAndFormat($value);
}
- if (is_string($value) && strlen($value)) {
+ if (is_string($value) && strlen(trim($value))) {
$data[$attribute->getAttributeCode()] = [
'label' => __($attribute->getStoreLabel()),
'value' => $value,
diff --git a/app/code/Magento/Catalog/Test/Unit/Block/Product/View/AttributesTest.php b/app/code/Magento/Catalog/Test/Unit/Block/Product/View/AttributesTest.php
index 4602a0d99f6f1..a42b167bb432a 100644
--- a/app/code/Magento/Catalog/Test/Unit/Block/Product/View/AttributesTest.php
+++ b/app/code/Magento/Catalog/Test/Unit/Block/Product/View/AttributesTest.php
@@ -138,6 +138,22 @@ public function testGetAttributeNoValue()
$this->assertTrue(empty($attributes['phrase']));
}
+ /**
+ * Test getAttribute whitespaces.
+ *
+ * @return void
+ */
+ public function testGetAttributeWhitespacesValue()
+ {
+ $this->phrase = ' ';
+ $this->frontendAttribute
+ ->expects($this->any())
+ ->method('getValue')
+ ->willReturn($this->phrase);
+ $attributes = $this->attributesBlock->getAdditionalData();
+ $this->assertTrue(empty($attributes['phrase']));
+ }
+
/**
* @return void
*/
From 35b532f379d47eef2343ddbd2a96bfd1a18339fc Mon Sep 17 00:00:00 2001
From: serhii balko
Date: Mon, 11 Feb 2019 08:18:51 +0200
Subject: [PATCH 056/315] MAGETWO-97528: Custom Customer Attribute is not
updating on one website
---
app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php b/app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php
index 5b61c0aaf5e2f..561039990f705 100644
--- a/app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php
+++ b/app/code/Magento/Customer/Controller/Adminhtml/Index/Save.php
@@ -508,7 +508,7 @@ private function disableAddressValidation(CustomerInterface $customer)
*/
private function retrieveFormattedFormData(): array
{
- $originalRequestData = $originalRequestData = $this->getRequest()->getPostValue();
+ $originalRequestData = $this->getRequest()->getPostValue();
/* Customer data filtration */
if (isset($originalRequestData['customer'])) {
From d234115d69b0d9bb1eaf72eef4f99d9c12d01c3b Mon Sep 17 00:00:00 2001
From: Serhii Voloshkov
Date: Mon, 11 Feb 2019 10:12:55 +0200
Subject: [PATCH 057/315] MAGETWO-94450: Rewards points earned from coupon code
are not applied to guests that create accounts after checking out
---
.../Magento/SalesRule/Test/Mftf/Data/SalesRuleData.xml | 8 --------
1 file changed, 8 deletions(-)
diff --git a/app/code/Magento/SalesRule/Test/Mftf/Data/SalesRuleData.xml b/app/code/Magento/SalesRule/Test/Mftf/Data/SalesRuleData.xml
index 2200f1eb45d7d..e85eea62d473e 100644
--- a/app/code/Magento/SalesRule/Test/Mftf/Data/SalesRuleData.xml
+++ b/app/code/Magento/SalesRule/Test/Mftf/Data/SalesRuleData.xml
@@ -206,14 +206,6 @@
0
-
- SalesRule
- Main Website
- 'NOT LOGGED IN', 'General', 'Wholesale', 'Retailer'
- Fixed amount discount for whole cart
- 0
-
-
by_fixed
From 8b4759fe28a1c2a8afc75f1ebde4010a4b2ec6ac Mon Sep 17 00:00:00 2001
From: DianaRusin
Date: Mon, 11 Feb 2019 11:27:34 +0200
Subject: [PATCH 058/315] MAGETWO-95182: Order placed by new customer before
they registered is displayed in the admin under the name Guest
---
.../StorefrontCheckCustomerInfoCreatedByGuestTest.xml | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckCustomerInfoCreatedByGuestTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckCustomerInfoCreatedByGuestTest.xml
index adc308b490c33..32cc254543bca 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckCustomerInfoCreatedByGuestTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckCustomerInfoCreatedByGuestTest.xml
@@ -11,14 +11,15 @@
-
-
+
+
-
+
+
@@ -29,10 +30,10 @@
-
+
@@ -44,6 +45,7 @@
+
From 16f7465bef4cc8129e2fe4fa7ec8d686c9965243 Mon Sep 17 00:00:00 2001
From: Mastiuhin Olexandr
Date: Mon, 11 Feb 2019 12:12:16 +0200
Subject: [PATCH 059/315] MAGETWO-97425: Country of Manufacture displays empty
under More Information tab
---
.../Block/Product/View/AttributesTest.php | 29 ++++++++-----------
1 file changed, 12 insertions(+), 17 deletions(-)
diff --git a/app/code/Magento/Catalog/Test/Unit/Block/Product/View/AttributesTest.php b/app/code/Magento/Catalog/Test/Unit/Block/Product/View/AttributesTest.php
index a42b167bb432a..66a62b444b4af 100644
--- a/app/code/Magento/Catalog/Test/Unit/Block/Product/View/AttributesTest.php
+++ b/app/code/Magento/Catalog/Test/Unit/Block/Product/View/AttributesTest.php
@@ -125,33 +125,28 @@ protected function setUp()
}
/**
+ * Get attribute with no value phrase
+ *
+ * @param string $phrase
* @return void
+ * @dataProvider noValue
*/
- public function testGetAttributeNoValue()
+ public function testGetAttributeNoValue(string $phrase)
{
- $this->phrase = '';
- $this->frontendAttribute
- ->expects($this->any())
- ->method('getValue')
- ->willReturn($this->phrase);
+ $this->frontendAttribute->method('getValue')
+ ->willReturn($phrase);
$attributes = $this->attributesBlock->getAdditionalData();
- $this->assertTrue(empty($attributes['phrase']));
+ $this->assertArrayNotHasKey('phrase', $attributes);
}
/**
- * Test getAttribute whitespaces.
+ * No value data provider
*
- * @return void
+ * @return array
*/
- public function testGetAttributeWhitespacesValue()
+ public function noValue()
{
- $this->phrase = ' ';
- $this->frontendAttribute
- ->expects($this->any())
- ->method('getValue')
- ->willReturn($this->phrase);
- $attributes = $this->attributesBlock->getAdditionalData();
- $this->assertTrue(empty($attributes['phrase']));
+ return [[' '], ['']];
}
/**
From 572693882f7a39768bfe31fbaa206fc696072ada Mon Sep 17 00:00:00 2001
From: Mastiuhin Olexandr
Date: Mon, 11 Feb 2019 12:38:06 +0200
Subject: [PATCH 060/315] MAGETWO-97425: Country of Manufacture displays empty
under More Information tab
---
.../Catalog/Test/Unit/Block/Product/View/AttributesTest.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/code/Magento/Catalog/Test/Unit/Block/Product/View/AttributesTest.php b/app/code/Magento/Catalog/Test/Unit/Block/Product/View/AttributesTest.php
index 66a62b444b4af..69133c1429be5 100644
--- a/app/code/Magento/Catalog/Test/Unit/Block/Product/View/AttributesTest.php
+++ b/app/code/Magento/Catalog/Test/Unit/Block/Product/View/AttributesTest.php
@@ -144,7 +144,7 @@ public function testGetAttributeNoValue(string $phrase)
*
* @return array
*/
- public function noValue()
+ public function noValue(): array
{
return [[' '], ['']];
}
From d56f551f500e98e8b17d72e726378e9300904add Mon Sep 17 00:00:00 2001
From: Myroslav Dobra
Date: Mon, 11 Feb 2019 13:01:11 +0200
Subject: [PATCH 061/315] MAGETWO-98182: [FT] [MFTF]
StorefrontPurchaseProductCustomOptionsDifferentStoreViewsTest fails because
of bad design
---
...ctCustomOptionsDifferentStoreViewsTest.xml | 93 ++++++++++---------
.../Mftf/ActionGroup/CheckoutActionGroup.xml | 2 +-
.../AdminCreateStoreViewActionGroup.xml | 4 +-
.../StorefrontSwitchStoreViewActionGroup.xml | 2 +-
4 files changed, 53 insertions(+), 48 deletions(-)
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontPurchaseProductCustomOptionsDifferentStoreViewsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontPurchaseProductCustomOptionsDifferentStoreViewsTest.xml
index 68dbe628e9817..5a3ac4ddd8495 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontPurchaseProductCustomOptionsDifferentStoreViewsTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontPurchaseProductCustomOptionsDifferentStoreViewsTest.xml
@@ -7,7 +7,7 @@
-->
+ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
@@ -16,9 +16,6 @@
-
-
-
@@ -65,18 +62,24 @@
+
+
+
+
+
+
+
-
-
-
-
+
+
+
@@ -100,15 +103,12 @@
-
-
-
-
-
+
+
+
-
@@ -128,16 +128,13 @@
-
-
-
-
-
+
+
+
-
@@ -156,10 +153,7 @@
-
-
-
-
+
@@ -177,20 +171,28 @@
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -205,14 +207,12 @@
-
-
-
-
-
+
+
+
+
-
@@ -232,9 +232,7 @@
-
-
-
+
@@ -252,18 +250,26 @@
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
@@ -297,7 +303,6 @@
-
diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckoutActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckoutActionGroup.xml
index f79d59028c468..e3dbb3870896d 100644
--- a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckoutActionGroup.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckoutActionGroup.xml
@@ -37,7 +37,7 @@
-
+
diff --git a/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminCreateStoreViewActionGroup.xml b/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminCreateStoreViewActionGroup.xml
index f1c6f4d87e0d6..2f541feacd9c2 100644
--- a/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminCreateStoreViewActionGroup.xml
+++ b/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminCreateStoreViewActionGroup.xml
@@ -24,8 +24,8 @@
-
-
+
+
diff --git a/app/code/Magento/Store/Test/Mftf/ActionGroup/StorefrontSwitchStoreViewActionGroup.xml b/app/code/Magento/Store/Test/Mftf/ActionGroup/StorefrontSwitchStoreViewActionGroup.xml
index e6ebd229e4683..c62ed55c7df49 100644
--- a/app/code/Magento/Store/Test/Mftf/ActionGroup/StorefrontSwitchStoreViewActionGroup.xml
+++ b/app/code/Magento/Store/Test/Mftf/ActionGroup/StorefrontSwitchStoreViewActionGroup.xml
@@ -13,7 +13,7 @@
-
+
From adc050d34fd58ea809d963d3aa0dfc49ce9bcb01 Mon Sep 17 00:00:00 2001
From: OlgaVasyltsun
Date: Mon, 11 Feb 2019 13:36:57 +0200
Subject: [PATCH 062/315] MAGETWO-96489: Anchor categories are not showing
products after enabling subcategories
---
app/code/Magento/Catalog/Model/Category.php | 20 +++++--
.../StorefrontCategoryActionGroup.xml | 6 +++
.../Section/StorefrontCategoryMainSection.xml | 1 +
...vailableAfterEnablingSubCategoriesTest.xml | 54 +++++++++++++++++++
.../Catalog/Test/Unit/Model/CategoryTest.php | 24 ++++++---
5 files changed, 92 insertions(+), 13 deletions(-)
create mode 100644 app/code/Magento/Catalog/Test/Mftf/Test/StorefrontProductAvailableAfterEnablingSubCategoriesTest.xml
diff --git a/app/code/Magento/Catalog/Model/Category.php b/app/code/Magento/Catalog/Model/Category.php
index 00b093b2918f1..0bf4ac49acf1d 100644
--- a/app/code/Magento/Catalog/Model/Category.php
+++ b/app/code/Magento/Catalog/Model/Category.php
@@ -1130,10 +1130,15 @@ public function reindex()
}
}
$productIndexer = $this->indexerRegistry->get(Indexer\Category\Product::INDEXER_ID);
- if (!$productIndexer->isScheduled()
- && (!empty($this->getAffectedProductIds()) || $this->dataHasChangedFor('is_anchor'))
- ) {
- $productIndexer->reindexList($this->getPathIds());
+
+ if (!empty($this->getAffectedProductIds())
+ || $this->dataHasChangedFor('is_anchor')
+ || $this->dataHasChangedFor('is_active')) {
+ if (!$productIndexer->isScheduled()) {
+ $productIndexer->reindexList($this->getPathIds());
+ } else {
+ $productIndexer->invalidate();
+ }
}
}
@@ -1167,6 +1172,11 @@ public function getIdentities()
if ($this->hasDataChanges() || $this->isDeleted() || $this->dataHasChangedFor(self::KEY_INCLUDE_IN_MENU)) {
$identities[] = Product::CACHE_PRODUCT_CATEGORY_TAG . '_' . $this->getId();
+ if ($this->dataHasChangedFor('is_anchor') || $this->dataHasChangedFor('is_active')) {
+ foreach ($this->getPathIds() as $id) {
+ $identities[] = Product::CACHE_PRODUCT_CATEGORY_TAG . '_' . $id;
+ }
+ }
}
if ($this->isObjectNew()) {
@@ -1174,7 +1184,7 @@ public function getIdentities()
}
}
- return $identities;
+ return array_unique($identities);
}
/**
diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCategoryActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCategoryActionGroup.xml
index 2551bd61580ed..e46bfc7ee8b02 100644
--- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCategoryActionGroup.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontCategoryActionGroup.xml
@@ -19,6 +19,12 @@
+
+
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategoryMainSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategoryMainSection.xml
index 1f1a4ce9133e7..3c769f9dbc0ce 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategoryMainSection.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategoryMainSection.xml
@@ -22,5 +22,6 @@
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontProductAvailableAfterEnablingSubCategoriesTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontProductAvailableAfterEnablingSubCategoriesTest.xml
new file mode 100644
index 0000000000000..fe7858313c848
--- /dev/null
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontProductAvailableAfterEnablingSubCategoriesTest.xml
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Unit/Model/CategoryTest.php b/app/code/Magento/Catalog/Test/Unit/Model/CategoryTest.php
index a53b87dcf1567..c84753ad4adcb 100644
--- a/app/code/Magento/Catalog/Test/Unit/Model/CategoryTest.php
+++ b/app/code/Magento/Catalog/Test/Unit/Model/CategoryTest.php
@@ -348,13 +348,15 @@ public function testReindexFlatEnabled($flatScheduled, $productScheduled, $expec
public function reindexFlatDisabledTestDataProvider()
{
return [
- [false, null, null, null, 0],
- [true, null, null, null, 0],
- [false, [], null, null, 0],
- [false, ["1", "2"], null, null, 1],
- [false, null, 1, null, 1],
- [false, ["1", "2"], 0, 1, 1],
- [false, null, 1, 1, 0],
+ [false, null, null, null, null, null, 0],
+ [true, null, null, null, null, null, 0],
+ [false, [], null, null, null, null, 0],
+ [false, ["1", "2"], null, null, null, null, 1],
+ [false, null, 1, null, null, null, 1],
+ [false, ["1", "2"], 0, 1, null, null, 1],
+ [false, null, 1, 1, null, null, 0],
+ [false, ["1", "2"], null, null, 0, 1, 1],
+ [false, ["1", "2"], null, null, 1, 0, 1],
];
}
@@ -363,6 +365,8 @@ public function reindexFlatDisabledTestDataProvider()
* @param array $affectedIds
* @param int|string $isAnchorOrig
* @param int|string $isAnchor
+ * @param mixed $isActiveOrig
+ * @param mixed $isActive,
* @param int $expectedProductReindexCall
*
* @dataProvider reindexFlatDisabledTestDataProvider
@@ -372,12 +376,16 @@ public function testReindexFlatDisabled(
$affectedIds,
$isAnchorOrig,
$isAnchor,
+ $isActiveOrig,
+ $isActive,
$expectedProductReindexCall
) {
$this->category->setAffectedProductIds($affectedIds);
$this->category->setData('is_anchor', $isAnchor);
$this->category->setOrigData('is_anchor', $isAnchorOrig);
$this->category->setAffectedProductIds($affectedIds);
+ $this->category->setData('is_active', $isActive);
+ $this->category->setOrigData('is_active', $isActiveOrig);
$pathIds = ['path/1/2', 'path/2/3'];
$this->category->setData('path_ids', $pathIds);
@@ -387,7 +395,7 @@ public function testReindexFlatDisabled(
->method('isFlatEnabled')
->will($this->returnValue(false));
- $this->productIndexer->expects($this->exactly(1))
+ $this->productIndexer->expects($this->any())
->method('isScheduled')
->willReturn($productScheduled);
$this->productIndexer->expects($this->exactly($expectedProductReindexCall))
From ba2ad3863e53d4f05bbc6f669b61f82715268a81 Mon Sep 17 00:00:00 2001
From: OlgaVasyltsun
Date: Mon, 11 Feb 2019 15:16:46 +0200
Subject: [PATCH 063/315] MAGETWO-96489: Anchor categories are not showing
products after enabling subcategories
---
app/code/Magento/Catalog/Model/Category.php | 31 +++++++++++++++------
1 file changed, 22 insertions(+), 9 deletions(-)
diff --git a/app/code/Magento/Catalog/Model/Category.php b/app/code/Magento/Catalog/Model/Category.php
index 0bf4ac49acf1d..aa99918753e81 100644
--- a/app/code/Magento/Catalog/Model/Category.php
+++ b/app/code/Magento/Catalog/Model/Category.php
@@ -1170,15 +1170,8 @@ public function getIdentities()
$identities[] = self::CACHE_TAG . '_' . $this->getId();
}
- if ($this->hasDataChanges() || $this->isDeleted() || $this->dataHasChangedFor(self::KEY_INCLUDE_IN_MENU)) {
- $identities[] = Product::CACHE_PRODUCT_CATEGORY_TAG . '_' . $this->getId();
- if ($this->dataHasChangedFor('is_anchor') || $this->dataHasChangedFor('is_active')) {
- foreach ($this->getPathIds() as $id) {
- $identities[] = Product::CACHE_PRODUCT_CATEGORY_TAG . '_' . $id;
- }
- }
- }
-
+ $identities = $this->getCategoryRelationIdentities($identities);
+
if ($this->isObjectNew()) {
$identities[] = self::CACHE_TAG;
}
@@ -1470,5 +1463,25 @@ public function setExtensionAttributes(\Magento\Catalog\Api\Data\CategoryExtensi
return $this->_setExtensionAttributes($extensionAttributes);
}
+ /**
+ * Return category relation identities.
+ *
+ * @param array $identities
+ * @return array
+ */
+ private function getCategoryRelationIdentities(array $identities): array
+ {
+ if ($this->hasDataChanges() || $this->isDeleted() || $this->dataHasChangedFor(self::KEY_INCLUDE_IN_MENU)) {
+ $identities[] = Product::CACHE_PRODUCT_CATEGORY_TAG . '_' . $this->getId();
+ if ($this->dataHasChangedFor('is_anchor') || $this->dataHasChangedFor('is_active')) {
+ foreach ($this->getPathIds() as $id) {
+ $identities[] = Product::CACHE_PRODUCT_CATEGORY_TAG . '_' . $id;
+ }
+ }
+ }
+
+ return $identities;
+ }
+
//@codeCoverageIgnoreEnd
}
From f461c3dcbd63f8cdf0fe18ab4de7c89ece0dde71 Mon Sep 17 00:00:00 2001
From: Mastiuhin Olexandr
Date: Mon, 11 Feb 2019 15:29:41 +0200
Subject: [PATCH 064/315] MAGETWO-97425: Country of Manufacture displays empty
under More Information tab
---
.../Catalog/Test/Unit/Block/Product/View/AttributesTest.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/code/Magento/Catalog/Test/Unit/Block/Product/View/AttributesTest.php b/app/code/Magento/Catalog/Test/Unit/Block/Product/View/AttributesTest.php
index 69133c1429be5..2310b1f8b871c 100644
--- a/app/code/Magento/Catalog/Test/Unit/Block/Product/View/AttributesTest.php
+++ b/app/code/Magento/Catalog/Test/Unit/Block/Product/View/AttributesTest.php
@@ -129,7 +129,7 @@ protected function setUp()
*
* @param string $phrase
* @return void
- * @dataProvider noValue
+ * @dataProvider noValueProvider
*/
public function testGetAttributeNoValue(string $phrase)
{
@@ -144,7 +144,7 @@ public function testGetAttributeNoValue(string $phrase)
*
* @return array
*/
- public function noValue(): array
+ public function noValueProvider(): array
{
return [[' '], ['']];
}
From b4f47f947d6e6b50518553dd9c22e4e722fb86b9 Mon Sep 17 00:00:00 2001
From: Pavel Bystritsky
Date: Mon, 11 Feb 2019 17:22:36 +0200
Subject: [PATCH 065/315] ENGCOM-4000: Integration test fix.
---
.../Magento/Rule/Model/Condition/Product/AbstractProduct.php | 2 +-
.../Magento/CatalogWidget/Block/Product/ProductListTest.php | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/code/Magento/Rule/Model/Condition/Product/AbstractProduct.php b/app/code/Magento/Rule/Model/Condition/Product/AbstractProduct.php
index b7dd1d6c55f4e..bedac8c1108e5 100644
--- a/app/code/Magento/Rule/Model/Condition/Product/AbstractProduct.php
+++ b/app/code/Magento/Rule/Model/Condition/Product/AbstractProduct.php
@@ -713,7 +713,7 @@ protected function _getAttributeSetId($productId)
public function getOperatorForValidate()
{
$operator = $this->getOperator();
- if (in_array($this->getInputType(), ['category'])) {
+ if ('category' === $this->getInputType()) {
if ($operator == '==') {
$operator = '{}';
} elseif ($operator == '!=') {
diff --git a/dev/tests/integration/testsuite/Magento/CatalogWidget/Block/Product/ProductListTest.php b/dev/tests/integration/testsuite/Magento/CatalogWidget/Block/Product/ProductListTest.php
index 08e9ebbd1f9f0..4251e01f4299a 100644
--- a/dev/tests/integration/testsuite/Magento/CatalogWidget/Block/Product/ProductListTest.php
+++ b/dev/tests/integration/testsuite/Magento/CatalogWidget/Block/Product/ProductListTest.php
@@ -83,7 +83,7 @@ public function testCreateCollectionWithMultipleSkuCondition()
{
$encodedConditions = '^[`1`:^[`type`:`Magento||CatalogWidget||Model||Rule||Condition||Combine`,' .
'`aggregator`:`all`,`value`:`1`,`new_child`:``^],`1--1`:^[`type`:`Magento||CatalogWidget||Model||Rule|' .
- '|Condition||Product`,`attribute`:`sku`,`operator`:`==`,`value`:`simple1, simple2`^]^]';
+ '|Condition||Product`,`attribute`:`sku`,`operator`:`()`,`value`:`simple1, simple2`^]^]';
$this->block->setData('conditions_encoded', $encodedConditions);
$this->performAssertions(2);
}
From bbabad9c2ecb7fb7bf0152e601a95f282adaea91 Mon Sep 17 00:00:00 2001
From: Myroslav Dobra
Date: Tue, 12 Feb 2019 10:45:43 +0200
Subject: [PATCH 066/315] MAGETWO-98182: [FT] [MFTF]
StorefrontPurchaseProductCustomOptionsDifferentStoreViewsTest fails because
of bad design
---
...roductCustomOptionsDifferentStoreViewsTest.xml | 15 ++++++---------
.../Test/Mftf/ActionGroup/CheckoutActionGroup.xml | 2 +-
2 files changed, 7 insertions(+), 10 deletions(-)
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontPurchaseProductCustomOptionsDifferentStoreViewsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontPurchaseProductCustomOptionsDifferentStoreViewsTest.xml
index 5a3ac4ddd8495..e7054839ef4d0 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontPurchaseProductCustomOptionsDifferentStoreViewsTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontPurchaseProductCustomOptionsDifferentStoreViewsTest.xml
@@ -64,8 +64,7 @@
-
-
+
@@ -191,11 +190,9 @@
-
-
-
-
-
+
+
+
@@ -212,7 +209,7 @@
-
+
@@ -302,7 +299,7 @@
-
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckoutActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckoutActionGroup.xml
index e3dbb3870896d..d20616b4384d1 100644
--- a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckoutActionGroup.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/CheckoutActionGroup.xml
@@ -7,7 +7,7 @@
-->
+ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
From c1afe36da67f59029dcb566431214509a544b3f7 Mon Sep 17 00:00:00 2001
From: Stas Kozar
Date: Tue, 12 Feb 2019 12:33:49 +0200
Subject: [PATCH 067/315] MAGETWO-86215: Static blocks with same ID appear in
place of correct block
---
.../Magento/Cms/Model/ResourceModel/Block.php | 2 +-
.../ActionGroup/AdminCmsBlockActionGroup.xml | 46 +++++++++++++++++++
.../AdminCreateNewCMSBlockActionGroup.xml | 21 ---------
.../AdminDeleteCMSBlockActionGroup.xml | 21 ---------
.../Test/Mftf/Page/AdminCmsBlockNewPage.xml | 14 ++++++
...teStaticBlockOnDuplicateIdentifierTest.xml | 33 ++++++-------
6 files changed, 74 insertions(+), 63 deletions(-)
create mode 100644 app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminCmsBlockActionGroup.xml
delete mode 100644 app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminCreateNewCMSBlockActionGroup.xml
delete mode 100644 app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminDeleteCMSBlockActionGroup.xml
create mode 100644 app/code/Magento/Cms/Test/Mftf/Page/AdminCmsBlockNewPage.xml
diff --git a/app/code/Magento/Cms/Model/ResourceModel/Block.php b/app/code/Magento/Cms/Model/ResourceModel/Block.php
index 30e817713755c..6eae76f9790c9 100644
--- a/app/code/Magento/Cms/Model/ResourceModel/Block.php
+++ b/app/code/Magento/Cms/Model/ResourceModel/Block.php
@@ -200,7 +200,7 @@ public function getIsUniqueBlockToStores(AbstractModel $object)
'cb.' . $linkField . ' = cbs.' . $linkField,
[]
)
- ->where('cb.identifier = ? ', $object->getData('identifier'));
+ ->where('cb.identifier = ? ', $object->getData('identifier'));
if (!$isDefaultStore) {
$select->where('cbs.store_id IN (?)', $stores);
diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminCmsBlockActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminCmsBlockActionGroup.xml
new file mode 100644
index 0000000000000..0ee5b3280a7c3
--- /dev/null
+++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminCmsBlockActionGroup.xml
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminCreateNewCMSBlockActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminCreateNewCMSBlockActionGroup.xml
deleted file mode 100644
index ce240f9f47e99..0000000000000
--- a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminCreateNewCMSBlockActionGroup.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminDeleteCMSBlockActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminDeleteCMSBlockActionGroup.xml
deleted file mode 100644
index b5ff9c3639c8b..0000000000000
--- a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminDeleteCMSBlockActionGroup.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/code/Magento/Cms/Test/Mftf/Page/AdminCmsBlockNewPage.xml b/app/code/Magento/Cms/Test/Mftf/Page/AdminCmsBlockNewPage.xml
new file mode 100644
index 0000000000000..2868d832ad762
--- /dev/null
+++ b/app/code/Magento/Cms/Test/Mftf/Page/AdminCmsBlockNewPage.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Cms/Test/Mftf/Test/CheckCreateStaticBlockOnDuplicateIdentifierTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/CheckCreateStaticBlockOnDuplicateIdentifierTest.xml
index 371e6529590e7..f7ed9776c066c 100644
--- a/app/code/Magento/Cms/Test/Mftf/Test/CheckCreateStaticBlockOnDuplicateIdentifierTest.xml
+++ b/app/code/Magento/Cms/Test/Mftf/Test/CheckCreateStaticBlockOnDuplicateIdentifierTest.xml
@@ -11,12 +11,13 @@
-
+
-
+
+
@@ -35,27 +36,19 @@
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
From 73c4bca05b737f3962687dcb3c9a888d1a3110e5 Mon Sep 17 00:00:00 2001
From: OlgaVasyltsun
Date: Tue, 12 Feb 2019 14:33:24 +0200
Subject: [PATCH 068/315] MAGETWO-90192: Prefix in checkout not starting with
blank value
---
.../Block/Checkout/LayoutProcessor.php | 38 ++++++++-----------
.../Mftf/Section/CheckoutShippingSection.xml | 3 ++
.../Magento/Customer/Block/Widget/Name.php | 7 +++-
.../CustomerNameAddressOptionsConfigData.xml | 38 +++++++++++++++++++
...tomer_name_address_options_config-meta.xml | 25 ++++++++++++
5 files changed, 88 insertions(+), 23 deletions(-)
create mode 100644 app/code/Magento/Customer/Test/Mftf/Data/CustomerNameAddressOptionsConfigData.xml
create mode 100644 app/code/Magento/Customer/Test/Mftf/Metadata/customer_name_address_options_config-meta.xml
diff --git a/app/code/Magento/Checkout/Block/Checkout/LayoutProcessor.php b/app/code/Magento/Checkout/Block/Checkout/LayoutProcessor.php
index f47e514948d69..c5d4d68b06225 100644
--- a/app/code/Magento/Checkout/Block/Checkout/LayoutProcessor.php
+++ b/app/code/Magento/Checkout/Block/Checkout/LayoutProcessor.php
@@ -6,8 +6,11 @@
namespace Magento\Checkout\Block\Checkout;
use Magento\Checkout\Helper\Data;
+use Magento\Customer\Model\AttributeMetadataDataProvider;
+use Magento\Customer\Model\Options;
use Magento\Framework\App\ObjectManager;
use Magento\Store\Api\StoreResolverInterface;
+use Magento\Ui\Component\Form\AttributeMapper;
/**
* Class LayoutProcessor
@@ -15,12 +18,12 @@
class LayoutProcessor implements \Magento\Checkout\Block\Checkout\LayoutProcessorInterface
{
/**
- * @var \Magento\Customer\Model\AttributeMetadataDataProvider
+ * @var AttributeMetadataDataProvider
*/
private $attributeMetadataDataProvider;
/**
- * @var \Magento\Ui\Component\Form\AttributeMapper
+ * @var AttributeMapper
*/
protected $attributeMapper;
@@ -30,7 +33,7 @@ class LayoutProcessor implements \Magento\Checkout\Block\Checkout\LayoutProcesso
protected $merger;
/**
- * @var \Magento\Customer\Model\Options
+ * @var Options
*/
private $options;
@@ -50,30 +53,21 @@ class LayoutProcessor implements \Magento\Checkout\Block\Checkout\LayoutProcesso
private $shippingConfig;
/**
- * @param \Magento\Customer\Model\AttributeMetadataDataProvider $attributeMetadataDataProvider
- * @param \Magento\Ui\Component\Form\AttributeMapper $attributeMapper
+ * @param AttributeMetadataDataProvider $attributeMetadataDataProvider
+ * @param AttributeMapper $attributeMapper
* @param AttributeMerger $merger
+ * @param Options|null $options
*/
public function __construct(
- \Magento\Customer\Model\AttributeMetadataDataProvider $attributeMetadataDataProvider,
- \Magento\Ui\Component\Form\AttributeMapper $attributeMapper,
- AttributeMerger $merger
+ AttributeMetadataDataProvider $attributeMetadataDataProvider,
+ AttributeMapper $attributeMapper,
+ AttributeMerger $merger,
+ Options $options = null
) {
$this->attributeMetadataDataProvider = $attributeMetadataDataProvider;
$this->attributeMapper = $attributeMapper;
$this->merger = $merger;
- }
-
- /**
- * @deprecated 100.0.11
- * @return \Magento\Customer\Model\Options
- */
- private function getOptions()
- {
- if (!is_object($this->options)) {
- $this->options = ObjectManager::getInstance()->get(\Magento\Customer\Model\Options::class);
- }
- return $this->options;
+ $this->options = $options ?? ObjectManager::getInstance()->get(Options::class);
}
/**
@@ -143,8 +137,8 @@ private function convertElementsToSelect($elements, $attributesToConvert)
public function process($jsLayout)
{
$attributesToConvert = [
- 'prefix' => [$this->getOptions(), 'getNamePrefixOptions'],
- 'suffix' => [$this->getOptions(), 'getNameSuffixOptions'],
+ 'prefix' => [$this->options, 'getNamePrefixOptions'],
+ 'suffix' => [$this->options, 'getNameSuffixOptions'],
];
$elements = $this->getAddressAttributes();
diff --git a/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutShippingSection.xml b/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutShippingSection.xml
index 76c9e9f674e6a..66cd480051905 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutShippingSection.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutShippingSection.xml
@@ -33,5 +33,8 @@
+
+
+
diff --git a/app/code/Magento/Customer/Block/Widget/Name.php b/app/code/Magento/Customer/Block/Widget/Name.php
index 35f3bbefb8f00..4411f40fe41f3 100644
--- a/app/code/Magento/Customer/Block/Widget/Name.php
+++ b/app/code/Magento/Customer/Block/Widget/Name.php
@@ -245,10 +245,13 @@ public function getStoreLabel($attributeCode)
*/
public function getAttributeValidationClass($attributeCode)
{
- return $this->_addressHelper->getAttributeValidationClass($attributeCode);
+ $attributeMetadata = $this->_getAttribute($attributeCode);
+ return $attributeMetadata ? $attributeMetadata->getFrontendClass() : '';
}
/**
+ * Check if attribute is required
+ *
* @param string $attributeCode
* @return bool
*/
@@ -259,6 +262,8 @@ private function _isAttributeRequired($attributeCode)
}
/**
+ * Check if attribute is visible
+ *
* @param string $attributeCode
* @return bool
*/
diff --git a/app/code/Magento/Customer/Test/Mftf/Data/CustomerNameAddressOptionsConfigData.xml b/app/code/Magento/Customer/Test/Mftf/Data/CustomerNameAddressOptionsConfigData.xml
new file mode 100644
index 0000000000000..1331f288286e5
--- /dev/null
+++ b/app/code/Magento/Customer/Test/Mftf/Data/CustomerNameAddressOptionsConfigData.xml
@@ -0,0 +1,38 @@
+
+
+
+
+
+ PrefixOptions
+
+
+ Mr;Mrs;Ms;Dr
+
+
+
+ DefaultPrefixOptions
+
+
+
+
+
+
+ SuffixOptions
+
+
+ Jr;Sr
+
+
+
+ DefaultSuffixOptions
+
+
+
+
+
diff --git a/app/code/Magento/Customer/Test/Mftf/Metadata/customer_name_address_options_config-meta.xml b/app/code/Magento/Customer/Test/Mftf/Metadata/customer_name_address_options_config-meta.xml
new file mode 100644
index 0000000000000..07175a09fe3e1
--- /dev/null
+++ b/app/code/Magento/Customer/Test/Mftf/Metadata/customer_name_address_options_config-meta.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
From 08142ff4aa1efb22ce10056fd7afc08ff2d63c18 Mon Sep 17 00:00:00 2001
From: Viktor Sevch
Date: Tue, 12 Feb 2019 15:27:19 +0200
Subject: [PATCH 069/315] MAGETWO-97242: Stabilize
AdminAbleToShipPartiallyInvoicedItemsTest
---
...inAbleToShipPartiallyInvoicedItemsTest.xml | 3 -
.../order/creditmemo/create/items.phtml | 67 +++++++++++--------
.../order/invoice/create/items.phtml | 53 ++++++++-------
3 files changed, 67 insertions(+), 56 deletions(-)
diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminAbleToShipPartiallyInvoicedItemsTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminAbleToShipPartiallyInvoicedItemsTest.xml
index cb761dc358abb..d196783744c46 100644
--- a/app/code/Magento/Sales/Test/Mftf/Test/AdminAbleToShipPartiallyInvoicedItemsTest.xml
+++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminAbleToShipPartiallyInvoicedItemsTest.xml
@@ -14,9 +14,6 @@
-
-
-
diff --git a/app/code/Magento/Sales/view/adminhtml/templates/order/creditmemo/create/items.phtml b/app/code/Magento/Sales/view/adminhtml/templates/order/creditmemo/create/items.phtml
index a73740c249b67..dc7d8fbebd46a 100644
--- a/app/code/Magento/Sales/view/adminhtml/templates/order/creditmemo/create/items.phtml
+++ b/app/code/Magento/Sales/view/adminhtml/templates/order/creditmemo/create/items.phtml
@@ -140,67 +140,76 @@
+getDefaultConfigValue('min_sale_qty');
+if (!is_numeric($defaultMinSaleQty)) {
+ $defaultMinSaleQty = json_decode($defaultMinSaleQty, true);
+ $defaultMinSaleQty = (float) $defaultMinSaleQty[\Magento\Customer\Api\Data\GroupInterface::CUST_GROUP_ALL] ?? 1;
+}
+?>