diff --git a/.htaccess b/.htaccess
index 71a5cf708dbc5..e07a564bc0ab6 100644
--- a/.htaccess
+++ b/.htaccess
@@ -37,29 +37,6 @@
DirectoryIndex index.php
-
-############################################
-## adjust memory limit
-
- php_value memory_limit 756M
- php_value max_execution_time 18000
-
-############################################
-## disable automatic session start
-## before autoload was initialized
-
- php_flag session.auto_start off
-
-############################################
-## enable resulting html compression
-
- #php_flag zlib.output_compression on
-
-###########################################
-## disable user agent verification to not break multiple image upload
-
- php_flag suhosin.session.cryptua off
-
############################################
## adjust memory limit
diff --git a/README.md b/README.md
index 91f2ed19fb453..ba194266f691a 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,20 @@
-[![Open Source Helpers](https://www.codetriage.com/magento/magento2/badges/users.svg)](https://www.codetriage.com/magento/magento2)
-[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/magento/magento2?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
-[![Crowdin](https://d322cqt584bo4o.cloudfront.net/magento-2/localized.svg)](https://crowdin.com/project/magento-2)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
## Welcome
Welcome to Magento 2 installation! We're glad you chose to install Magento 2, a cutting-edge, feature-rich eCommerce solution that gets results.
diff --git a/app/code/Magento/AdminAnalytics/Test/Mftf/ActionGroup/LoginAsAdminActionGroup.xml b/app/code/Magento/AdminAnalytics/Test/Mftf/ActionGroup/AdminLoginActionGroup.xml
similarity index 92%
rename from app/code/Magento/AdminAnalytics/Test/Mftf/ActionGroup/LoginAsAdminActionGroup.xml
rename to app/code/Magento/AdminAnalytics/Test/Mftf/ActionGroup/AdminLoginActionGroup.xml
index 5cf7be8a6fe11..89896d05bbe42 100644
--- a/app/code/Magento/AdminAnalytics/Test/Mftf/ActionGroup/LoginAsAdminActionGroup.xml
+++ b/app/code/Magento/AdminAnalytics/Test/Mftf/ActionGroup/AdminLoginActionGroup.xml
@@ -8,7 +8,7 @@
-
+
diff --git a/app/code/Magento/AdminAnalytics/Test/Mftf/ActionGroup/LoginAdminWithCredentialsActionGroup.xml b/app/code/Magento/AdminAnalytics/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml
similarity index 56%
rename from app/code/Magento/AdminAnalytics/Test/Mftf/ActionGroup/LoginAdminWithCredentialsActionGroup.xml
rename to app/code/Magento/AdminAnalytics/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml
index d9f5e5dbcb106..fc66f9fb0ef74 100644
--- a/app/code/Magento/AdminAnalytics/Test/Mftf/ActionGroup/LoginAdminWithCredentialsActionGroup.xml
+++ b/app/code/Magento/AdminAnalytics/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml
@@ -8,7 +8,10 @@
-
+
+
+
+
diff --git a/app/code/Magento/AdminNotification/Test/Mftf/Test/AdminSystemNotificationNavigateMenuTest.xml b/app/code/Magento/AdminNotification/Test/Mftf/Test/AdminSystemNotificationNavigateMenuTest.xml
index 75dceb4028622..81ad2858d5901 100644
--- a/app/code/Magento/AdminNotification/Test/Mftf/Test/AdminSystemNotificationNavigateMenuTest.xml
+++ b/app/code/Magento/AdminNotification/Test/Mftf/Test/AdminSystemNotificationNavigateMenuTest.xml
@@ -23,7 +23,7 @@
-
+
diff --git a/app/code/Magento/Analytics/ReportXml/QueryFactory.php b/app/code/Magento/Analytics/ReportXml/QueryFactory.php
index 5da7adf794215..285ddb1f99e29 100644
--- a/app/code/Magento/Analytics/ReportXml/QueryFactory.php
+++ b/app/code/Magento/Analytics/ReportXml/QueryFactory.php
@@ -3,14 +3,18 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
+
namespace Magento\Analytics\ReportXml;
use Magento\Analytics\ReportXml\DB\SelectBuilderFactory;
use Magento\Framework\App\CacheInterface;
+use Magento\Framework\DB\Select;
use Magento\Framework\ObjectManagerInterface;
+use Magento\Framework\Serialize\Serializer\Json;
/**
* Creates Query object according to configuration
+ *
* Factory for @see \Magento\Analytics\ReportXml\Query
*/
class QueryFactory
@@ -45,6 +49,11 @@ class QueryFactory
*/
private $selectHydrator;
+ /**
+ * @var Json
+ */
+ private $jsonSerializer;
+
/**
* QueryFactory constructor.
*
@@ -54,6 +63,7 @@ class QueryFactory
* @param SelectBuilderFactory $selectBuilderFactory
* @param Config $config
* @param array $assemblers
+ * @param Json $jsonSerializer
*/
public function __construct(
CacheInterface $queryCache,
@@ -61,7 +71,8 @@ public function __construct(
ObjectManagerInterface $objectManager,
SelectBuilderFactory $selectBuilderFactory,
Config $config,
- array $assemblers
+ array $assemblers,
+ Json $jsonSerializer
) {
$this->config = $config;
$this->selectBuilderFactory = $selectBuilderFactory;
@@ -69,6 +80,7 @@ public function __construct(
$this->queryCache = $queryCache;
$this->objectManager = $objectManager;
$this->selectHydrator = $selectHydrator;
+ $this->jsonSerializer = $jsonSerializer;
}
/**
@@ -101,14 +113,10 @@ private function constructQuery($queryName)
$selectBuilder = $assembler->assemble($selectBuilder, $queryConfig);
}
$select = $selectBuilder->create();
- return $this->objectManager->create(
- Query::class,
- [
- 'select' => $select,
- 'selectHydrator' => $this->selectHydrator,
- 'connectionName' => $selectBuilder->getConnectionName(),
- 'config' => $queryConfig
- ]
+ return $this->createQueryObject(
+ $select,
+ $selectBuilder->getConnectionName(),
+ $queryConfig
);
}
@@ -122,19 +130,42 @@ public function create($queryName)
{
$cached = $this->queryCache->load($queryName);
if ($cached) {
- $queryData = json_decode($cached, true);
- return $this->objectManager->create(
- Query::class,
- [
- 'select' => $this->selectHydrator->recreate($queryData['select_parts']),
- 'selectHydrator' => $this->selectHydrator,
- 'connectionName' => $queryData['connectionName'],
- 'config' => $queryData['config']
- ]
+ $queryData = $this->jsonSerializer->unserialize($cached);
+ return $this->createQueryObject(
+ $this->selectHydrator->recreate($queryData['select_parts']),
+ $queryData['connectionName'],
+ $queryData['config']
);
}
$query = $this->constructQuery($queryName);
- $this->queryCache->save(json_encode($query), $queryName);
+ $this->queryCache->save(
+ $this->jsonSerializer->serialize($query),
+ $queryName
+ );
return $query;
}
+
+ /**
+ * Create query class using objectmanger
+ *
+ * @param Select $select
+ * @param string $connection
+ * @param array $queryConfig
+ * @return Query
+ */
+ private function createQueryObject(
+ Select $select,
+ string $connection,
+ array $queryConfig
+ ) {
+ return $this->objectManager->create(
+ Query::class,
+ [
+ 'select' => $select,
+ 'selectHydrator' => $this->selectHydrator,
+ 'connectionName' => $connection,
+ 'config' => $queryConfig
+ ]
+ );
+ }
}
diff --git a/app/code/Magento/Analytics/Test/Mftf/Test/AdminAdvancedReportingButtonTest.xml b/app/code/Magento/Analytics/Test/Mftf/Test/AdminAdvancedReportingButtonTest.xml
index e660a2eb8d428..5da7ccd3c9823 100644
--- a/app/code/Magento/Analytics/Test/Mftf/Test/AdminAdvancedReportingButtonTest.xml
+++ b/app/code/Magento/Analytics/Test/Mftf/Test/AdminAdvancedReportingButtonTest.xml
@@ -25,7 +25,7 @@
-
+
@@ -35,4 +35,4 @@
-
\ No newline at end of file
+
diff --git a/app/code/Magento/Analytics/Test/Mftf/Test/AdminAdvancedReportingNavigateMenuTest.xml b/app/code/Magento/Analytics/Test/Mftf/Test/AdminAdvancedReportingNavigateMenuTest.xml
index d400bcf5f22fc..c742248b32cc3 100644
--- a/app/code/Magento/Analytics/Test/Mftf/Test/AdminAdvancedReportingNavigateMenuTest.xml
+++ b/app/code/Magento/Analytics/Test/Mftf/Test/AdminAdvancedReportingNavigateMenuTest.xml
@@ -23,7 +23,7 @@
-
+
diff --git a/app/code/Magento/Analytics/Test/Mftf/Test/AdminConfigurationBlankIndustryTest.xml b/app/code/Magento/Analytics/Test/Mftf/Test/AdminConfigurationBlankIndustryTest.xml
index 914cb59b64e4e..17d463030d91c 100644
--- a/app/code/Magento/Analytics/Test/Mftf/Test/AdminConfigurationBlankIndustryTest.xml
+++ b/app/code/Magento/Analytics/Test/Mftf/Test/AdminConfigurationBlankIndustryTest.xml
@@ -18,9 +18,9 @@
-
+
-
+
diff --git a/app/code/Magento/Analytics/Test/Mftf/Test/AdminConfigurationEnableDisableAnalyticsTest.xml b/app/code/Magento/Analytics/Test/Mftf/Test/AdminConfigurationEnableDisableAnalyticsTest.xml
index 1c1a3b27b06af..b03488c240604 100644
--- a/app/code/Magento/Analytics/Test/Mftf/Test/AdminConfigurationEnableDisableAnalyticsTest.xml
+++ b/app/code/Magento/Analytics/Test/Mftf/Test/AdminConfigurationEnableDisableAnalyticsTest.xml
@@ -18,9 +18,9 @@
-
+
-
+
diff --git a/app/code/Magento/Analytics/Test/Mftf/Test/AdminConfigurationIndustryTest.xml b/app/code/Magento/Analytics/Test/Mftf/Test/AdminConfigurationIndustryTest.xml
index bb682c4468012..c19fddc6aa0ce 100644
--- a/app/code/Magento/Analytics/Test/Mftf/Test/AdminConfigurationIndustryTest.xml
+++ b/app/code/Magento/Analytics/Test/Mftf/Test/AdminConfigurationIndustryTest.xml
@@ -19,7 +19,7 @@
-
+
diff --git a/app/code/Magento/Analytics/Test/Mftf/Test/AdminConfigurationPermissionTest.xml b/app/code/Magento/Analytics/Test/Mftf/Test/AdminConfigurationPermissionTest.xml
index 58e809ec45c4a..93ee464a17efa 100644
--- a/app/code/Magento/Analytics/Test/Mftf/Test/AdminConfigurationPermissionTest.xml
+++ b/app/code/Magento/Analytics/Test/Mftf/Test/AdminConfigurationPermissionTest.xml
@@ -21,10 +21,10 @@
-
+
-
+
@@ -51,7 +51,7 @@
-
+
diff --git a/app/code/Magento/Analytics/Test/Mftf/Test/AdminConfigurationTimeToSendDataTest.xml b/app/code/Magento/Analytics/Test/Mftf/Test/AdminConfigurationTimeToSendDataTest.xml
index 8ebd8cb594bee..6231b17c17b02 100644
--- a/app/code/Magento/Analytics/Test/Mftf/Test/AdminConfigurationTimeToSendDataTest.xml
+++ b/app/code/Magento/Analytics/Test/Mftf/Test/AdminConfigurationTimeToSendDataTest.xml
@@ -19,9 +19,9 @@
-
+
-
+
diff --git a/app/code/Magento/Analytics/Test/Unit/ReportXml/QueryFactoryTest.php b/app/code/Magento/Analytics/Test/Unit/ReportXml/QueryFactoryTest.php
index 9a3805a50f167..032ef1e107825 100644
--- a/app/code/Magento/Analytics/Test/Unit/ReportXml/QueryFactoryTest.php
+++ b/app/code/Magento/Analytics/Test/Unit/ReportXml/QueryFactoryTest.php
@@ -3,161 +3,171 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
+
+declare(strict_types=1);
+
namespace Magento\Analytics\Test\Unit\ReportXml;
+use Magento\Analytics\ReportXml\QueryFactory;
+use Magento\Analytics\ReportXml\Query;
+use Magento\Analytics\ReportXml\Config;
+use Magento\Framework\DB\Select;
+use Magento\Analytics\ReportXml\DB\Assembler\AssemblerInterface;
+use Magento\Framework\App\CacheInterface;
+use Magento\Framework\ObjectManagerInterface;
+use Magento\Analytics\ReportXml\SelectHydrator;
+use Magento\Analytics\ReportXml\DB\SelectBuilder;
+use Magento\Analytics\ReportXml\DB\SelectBuilderFactory;
+use Magento\Framework\Serialize\Serializer\Json;
+use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
+use PHPUnit\Framework\MockObject\MockObject;
+use PHPUnit\Framework\TestCase;
+
/**
* A unit test for testing of the query factory.
+ *
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class QueryFactoryTest extends \PHPUnit\Framework\TestCase
+class QueryFactoryTest extends TestCase
{
+ const STUB_QUERY_NAME = 'test_query';
+ const STUB_CONNECTION = 'default';
+
/**
- * @var \Magento\Analytics\ReportXml\QueryFactory
+ * @var QueryFactory
*/
private $subject;
/**
- * @var \Magento\Analytics\ReportXml\Query|\PHPUnit_Framework_MockObject_MockObject
+ * @var Query|MockObject
*/
private $queryMock;
/**
- * @var \Magento\Analytics\ReportXml\Config|\PHPUnit_Framework_MockObject_MockObject
+ * @var Config|MockObject
*/
private $configMock;
/**
- * @var \Magento\Framework\DB\Select|\PHPUnit_Framework_MockObject_MockObject
+ * @var Select|MockObject
*/
private $selectMock;
/**
- * @var \Magento\Analytics\ReportXml\DB\Assembler\AssemblerInterface|\PHPUnit_Framework_MockObject_MockObject
+ * @var AssemblerInterface|MockObject
*/
private $assemblerMock;
/**
- * @var \Magento\Framework\App\CacheInterface|\PHPUnit_Framework_MockObject_MockObject
+ * @var CacheInterface|MockObject
*/
private $queryCacheMock;
/**
- * @var \Magento\Framework\ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject
+ * @var ObjectManagerInterface|MockObject
*/
private $objectManagerMock;
/**
- * @var \Magento\Analytics\ReportXml\SelectHydrator|\PHPUnit_Framework_MockObject_MockObject
+ * @var SelectHydrator|MockObject
*/
private $selectHydratorMock;
/**
- * @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager
+ * @var ObjectManagerHelper
*/
private $objectManagerHelper;
/**
- * @var \Magento\Analytics\ReportXml\DB\SelectBuilderFactory|\PHPUnit_Framework_MockObject_MockObject
+ * @var SelectBuilderFactory|MockObject
*/
private $selectBuilderFactoryMock;
+ /**
+ * @var Json|MockObject
+ */
+ private $jsonSerializerMock;
+
/**
* @return void
*/
- protected function setUp()
+ protected function setUp(): void
{
- $this->queryMock = $this->getMockBuilder(
- \Magento\Analytics\ReportXml\Query::class
- )
- ->disableOriginalConstructor()
- ->getMock();
-
- $this->configMock = $this->getMockBuilder(
- \Magento\Analytics\ReportXml\Config::class
- )
- ->disableOriginalConstructor()
- ->getMock();
-
- $this->selectMock = $this->getMockBuilder(
- \Magento\Framework\DB\Select::class
- )
- ->disableOriginalConstructor()
- ->getMock();
-
- $this->assemblerMock = $this->getMockBuilder(
- \Magento\Analytics\ReportXml\DB\Assembler\AssemblerInterface::class
- )
- ->disableOriginalConstructor()
- ->getMock();
-
- $this->queryCacheMock = $this->getMockBuilder(
- \Magento\Framework\App\CacheInterface::class
- )
- ->disableOriginalConstructor()
- ->getMock();
-
- $this->objectManagerMock = $this->getMockBuilder(
- \Magento\Framework\ObjectManagerInterface::class
- )
- ->disableOriginalConstructor()
- ->getMock();
-
- $this->selectHydratorMock = $this->getMockBuilder(
- \Magento\Analytics\ReportXml\SelectHydrator::class
- )
- ->disableOriginalConstructor()
- ->getMock();
-
- $this->selectBuilderFactoryMock = $this->getMockBuilder(
- \Magento\Analytics\ReportXml\DB\SelectBuilderFactory::class
- )
- ->disableOriginalConstructor()
- ->getMock();
-
- $this->objectManagerHelper =
- new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
+ $this->queryMock = $this->getMockBuilder(Query::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $this->configMock = $this->getMockBuilder(Config::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->selectMock = $this->getMockBuilder(Select::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $this->assemblerMock = $this->getMockBuilder(AssemblerInterface::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $this->queryCacheMock = $this->getMockBuilder(CacheInterface::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $this->objectManagerMock = $this->getMockBuilder(ObjectManagerInterface::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $this->selectHydratorMock = $this->getMockBuilder(SelectHydrator::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $this->selectBuilderFactoryMock = $this->getMockBuilder(SelectBuilderFactory::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $this->jsonSerializerMock = $this->createMock(Json::class);
+
+ $this->objectManagerHelper = new ObjectManagerHelper($this);
$this->subject = $this->objectManagerHelper->getObject(
- \Magento\Analytics\ReportXml\QueryFactory::class,
+ QueryFactory::class,
[
- 'config' => $this->configMock,
- 'selectBuilderFactory' => $this->selectBuilderFactoryMock,
- 'assemblers' => [$this->assemblerMock],
'queryCache' => $this->queryCacheMock,
+ 'selectHydrator' => $this->selectHydratorMock,
'objectManager' => $this->objectManagerMock,
- 'selectHydrator' => $this->selectHydratorMock
+ 'selectBuilderFactory' => $this->selectBuilderFactoryMock,
+ 'config' => $this->configMock,
+ 'assemblers' => [$this->assemblerMock],
+ 'jsonSerializer' => $this->jsonSerializerMock
]
);
}
/**
+ * Test create() if query cached
+ *
* @return void
+ * @dataProvider queryDataProvider
*/
- public function testCreateCached()
+ public function testCreateIfQueryCached(array $queryDataMock, string $jsonEncodeData): void
{
- $queryName = 'test_query';
+ $queryConfigMock = $queryDataMock['config'];
+ $queryName = $queryConfigMock['name'];
$this->queryCacheMock->expects($this->any())
->method('load')
->with($queryName)
- ->willReturn('{"connectionName":"sales","config":{},"select_parts":{}}');
+ ->willReturn($jsonEncodeData);
+
+ $this->jsonSerializerMock->expects($this->once())
+ ->method('unserialize')
+ ->willReturn($queryDataMock);
$this->selectHydratorMock->expects($this->any())
->method('recreate')
->with([])
->willReturn($this->selectMock);
- $this->objectManagerMock->expects($this->once())
- ->method('create')
- ->with(
- \Magento\Analytics\ReportXml\Query::class,
- [
- 'select' => $this->selectMock,
- 'selectHydrator' => $this->selectHydratorMock,
- 'connectionName' => 'sales',
- 'config' => []
- ]
- )
- ->willReturn($this->queryMock);
+ $this->createQueryObjectMock($queryDataMock);
$this->queryCacheMock->expects($this->never())
->method('save');
@@ -169,22 +179,19 @@ public function testCreateCached()
}
/**
+ * Test create() if query not cached
+ *
* @return void
+ * @dataProvider queryDataProvider
*/
- public function testCreateNotCached()
+ public function testCreateIfQueryNotCached(array $queryDataMock, string $jsonEncodeData): void
{
- $queryName = 'test_query';
-
- $queryConfigMock = [
- 'name' => 'test_query',
- 'connection' => 'sales'
- ];
+ $queryConfigMock = $queryDataMock['config'];
+ $queryName = $queryConfigMock['name'];
- $selectBuilderMock = $this->getMockBuilder(
- \Magento\Analytics\ReportXml\DB\SelectBuilder::class
- )
- ->disableOriginalConstructor()
- ->getMock();
+ $selectBuilderMock = $this->getMockBuilder(SelectBuilder::class)
+ ->disableOriginalConstructor()
+ ->getMock();
$selectBuilderMock->expects($this->once())
->method('setConnectionName')
->with($queryConfigMock['connection']);
@@ -214,26 +221,65 @@ public function testCreateNotCached()
->with($selectBuilderMock, $queryConfigMock)
->willReturn($selectBuilderMock);
+ $this->createQueryObjectMock($queryDataMock);
+
+ $this->jsonSerializerMock->expects($this->once())
+ ->method('serialize')
+ ->willReturn($jsonEncodeData);
+
+ $this->queryCacheMock->expects($this->once())
+ ->method('save')
+ ->with($jsonEncodeData, $queryName);
+
+ $this->assertEquals(
+ $this->queryMock,
+ $this->subject->create($queryName)
+ );
+ }
+
+ /**
+ * Get Query Data Provider
+ *
+ * @return array
+ */
+ public function queryDataProvider(): array
+ {
+ return [
+ [
+ 'getQueryDataMock' => [
+ 'connectionName' => self::STUB_CONNECTION,
+ 'config' => [
+ 'name' => self::STUB_QUERY_NAME,
+ 'connection' => self::STUB_CONNECTION
+ ],
+ 'select_parts' => []
+ ],
+ 'getQueryDataJsonEncodeMock' => '{"connectionName":"default",'.
+ '"config":{"name":"test_query",'.
+ '"connection":"default"},"select_parts":[]}'
+ ]
+ ];
+ }
+
+ /**
+ * ObjectManager Mock with Query class
+ *
+ * @param array $queryDataMock
+ * @return void
+ */
+ private function createQueryObjectMock($queryDataMock): void
+ {
$this->objectManagerMock->expects($this->once())
->method('create')
->with(
- \Magento\Analytics\ReportXml\Query::class,
+ Query::class,
[
'select' => $this->selectMock,
'selectHydrator' => $this->selectHydratorMock,
- 'connectionName' => $queryConfigMock['connection'],
- 'config' => $queryConfigMock
+ 'connectionName' => $queryDataMock['connectionName'],
+ 'config' => $queryDataMock['config']
]
)
->willReturn($this->queryMock);
-
- $this->queryCacheMock->expects($this->once())
- ->method('save')
- ->with(json_encode($this->queryMock), $queryName);
-
- $this->assertEquals(
- $this->queryMock,
- $this->subject->create($queryName)
- );
}
}
diff --git a/app/code/Magento/Authorization/Model/Acl/Loader/Role.php b/app/code/Magento/Authorization/Model/Acl/Loader/Role.php
index a5f8fbd6eefec..e4b1103491230 100644
--- a/app/code/Magento/Authorization/Model/Acl/Loader/Role.php
+++ b/app/code/Magento/Authorization/Model/Acl/Loader/Role.php
@@ -3,14 +3,23 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
+declare(strict_types=1);
+
namespace Magento\Authorization\Model\Acl\Loader;
use Magento\Authorization\Model\Acl\Role\Group as RoleGroup;
+use Magento\Authorization\Model\Acl\Role\GroupFactory;
use Magento\Authorization\Model\Acl\Role\User as RoleUser;
-use Magento\Framework\App\ObjectManager;
+use Magento\Authorization\Model\Acl\Role\UserFactory;
+use Magento\Framework\Acl\Data\CacheInterface;
+use Magento\Framework\Acl\LoaderInterface;
+use Magento\Framework\App\ResourceConnection;
use Magento\Framework\Serialize\Serializer\Json;
-class Role implements \Magento\Framework\Acl\LoaderInterface
+/**
+ * Acl Role Loader
+ */
+class Role implements LoaderInterface
{
/**
* Cache key for ACL roles cache
@@ -18,22 +27,22 @@ class Role implements \Magento\Framework\Acl\LoaderInterface
const ACL_ROLES_CACHE_KEY = 'authorization_role_cached_data';
/**
- * @var \Magento\Framework\App\ResourceConnection
+ * @var ResourceConnection
*/
protected $_resource;
/**
- * @var \Magento\Authorization\Model\Acl\Role\GroupFactory
+ * @var GroupFactory
*/
protected $_groupFactory;
/**
- * @var \Magento\Authorization\Model\Acl\Role\UserFactory
+ * @var UserFactory
*/
protected $_roleFactory;
/**
- * @var \Magento\Framework\Acl\Data\CacheInterface
+ * @var CacheInterface
*/
private $aclDataCache;
@@ -48,28 +57,26 @@ class Role implements \Magento\Framework\Acl\LoaderInterface
private $cacheKey;
/**
- * @param \Magento\Authorization\Model\Acl\Role\GroupFactory $groupFactory
- * @param \Magento\Authorization\Model\Acl\Role\UserFactory $roleFactory
- * @param \Magento\Framework\App\ResourceConnection $resource
- * @param \Magento\Framework\Acl\Data\CacheInterface $aclDataCache
+ * @param GroupFactory $groupFactory
+ * @param UserFactory $roleFactory
+ * @param ResourceConnection $resource
+ * @param CacheInterface $aclDataCache
* @param Json $serializer
* @param string $cacheKey
*/
public function __construct(
- \Magento\Authorization\Model\Acl\Role\GroupFactory $groupFactory,
- \Magento\Authorization\Model\Acl\Role\UserFactory $roleFactory,
- \Magento\Framework\App\ResourceConnection $resource,
- \Magento\Framework\Acl\Data\CacheInterface $aclDataCache = null,
- Json $serializer = null,
+ GroupFactory $groupFactory,
+ UserFactory $roleFactory,
+ ResourceConnection $resource,
+ CacheInterface $aclDataCache,
+ Json $serializer,
$cacheKey = self::ACL_ROLES_CACHE_KEY
) {
- $this->_resource = $resource;
$this->_groupFactory = $groupFactory;
$this->_roleFactory = $roleFactory;
- $this->aclDataCache = $aclDataCache ?: ObjectManager::getInstance()->get(
- \Magento\Framework\Acl\Data\CacheInterface::class
- );
- $this->serializer = $serializer ?: ObjectManager::getInstance()->get(Json::class);
+ $this->_resource = $resource;
+ $this->aclDataCache = $aclDataCache;
+ $this->serializer = $serializer;
$this->cacheKey = $cacheKey;
}
diff --git a/app/code/Magento/Authorization/Model/Acl/Loader/Rule.php b/app/code/Magento/Authorization/Model/Acl/Loader/Rule.php
index 57bdcdbb3d9b8..b8fd974c5da6c 100644
--- a/app/code/Magento/Authorization/Model/Acl/Loader/Rule.php
+++ b/app/code/Magento/Authorization/Model/Acl/Loader/Rule.php
@@ -3,12 +3,20 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
+declare(strict_types=1);
+
namespace Magento\Authorization\Model\Acl\Loader;
-use Magento\Framework\App\ObjectManager;
+use Magento\Framework\Acl\Data\CacheInterface;
+use Magento\Framework\Acl\LoaderInterface;
+use Magento\Framework\Acl\RootResource;
+use Magento\Framework\App\ResourceConnection;
use Magento\Framework\Serialize\Serializer\Json;
-class Rule implements \Magento\Framework\Acl\LoaderInterface
+/**
+ * Acl Rule Loader
+ */
+class Rule implements LoaderInterface
{
/**
* Rules array cache key
@@ -16,17 +24,17 @@ class Rule implements \Magento\Framework\Acl\LoaderInterface
const ACL_RULE_CACHE_KEY = 'authorization_rule_cached_data';
/**
- * @var \Magento\Framework\App\ResourceConnection
+ * @var ResourceConnection
*/
protected $_resource;
/**
- * @var \Magento\Framework\Acl\RootResource
+ * @var RootResource
*/
private $_rootResource;
/**
- * @var \Magento\Framework\Acl\Data\CacheInterface
+ * @var CacheInterface
*/
private $aclDataCache;
@@ -41,28 +49,26 @@ class Rule implements \Magento\Framework\Acl\LoaderInterface
private $cacheKey;
/**
- * @param \Magento\Framework\Acl\RootResource $rootResource
- * @param \Magento\Framework\App\ResourceConnection $resource
- * @param array $data
- * @param \Magento\Framework\Acl\Data\CacheInterface $aclDataCache
+ * @param RootResource $rootResource
+ * @param ResourceConnection $resource
+ * @param CacheInterface $aclDataCache
* @param Json $serializer
+ * @param array $data
* @param string $cacheKey
* @SuppressWarnings(PHPMD.UnusedFormalParameter):
*/
public function __construct(
- \Magento\Framework\Acl\RootResource $rootResource,
- \Magento\Framework\App\ResourceConnection $resource,
+ RootResource $rootResource,
+ ResourceConnection $resource,
+ CacheInterface $aclDataCache,
+ Json $serializer,
array $data = [],
- \Magento\Framework\Acl\Data\CacheInterface $aclDataCache = null,
- Json $serializer = null,
$cacheKey = self::ACL_RULE_CACHE_KEY
) {
- $this->_resource = $resource;
$this->_rootResource = $rootResource;
- $this->aclDataCache = $aclDataCache ?: ObjectManager::getInstance()->get(
- \Magento\Framework\Acl\Data\CacheInterface::class
- );
- $this->serializer = $serializer ?: ObjectManager::getInstance()->get(Json::class);
+ $this->_resource = $resource;
+ $this->aclDataCache = $aclDataCache;
+ $this->serializer = $serializer;
$this->cacheKey = $cacheKey;
}
@@ -104,7 +110,7 @@ private function getRulesArray()
return $this->serializer->unserialize($rulesCachedData);
}
- $ruleTable = $this->_resource->getTableName("authorization_rule");
+ $ruleTable = $this->_resource->getTableName('authorization_rule');
$connection = $this->_resource->getConnection();
$select = $connection->select()
->from(['r' => $ruleTable]);
diff --git a/app/code/Magento/Authorization/Model/ResourceModel/Rules.php b/app/code/Magento/Authorization/Model/ResourceModel/Rules.php
index 5e4ae77731a0f..46470d885650b 100644
--- a/app/code/Magento/Authorization/Model/ResourceModel/Rules.php
+++ b/app/code/Magento/Authorization/Model/ResourceModel/Rules.php
@@ -6,58 +6,63 @@
namespace Magento\Authorization\Model\ResourceModel;
-use Magento\Framework\App\ObjectManager;
+use Magento\Backend\App\AbstractAction;
+use Magento\Framework\Acl\Builder;
+use Magento\Framework\Acl\Data\CacheInterface;
+use Magento\Framework\Acl\RootResource;
+use Magento\Framework\Exception\LocalizedException;
+use Magento\Framework\Model\ResourceModel\Db\AbstractDb;
+use Magento\Framework\Model\ResourceModel\Db\Context;
+use Psr\Log\LoggerInterface;
/**
* Admin rule resource model
*/
-class Rules extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
+class Rules extends AbstractDb
{
/**
* Root ACL resource
*
- * @var \Magento\Framework\Acl\RootResource
+ * @var RootResource
*/
protected $_rootResource;
/**
- * @var \Magento\Framework\Acl\Builder
+ * @var Builder
*/
protected $_aclBuilder;
/**
- * @var \Psr\Log\LoggerInterface
+ * @var LoggerInterface
*/
protected $_logger;
/**
- * @var \Magento\Framework\Acl\Data\CacheInterface
+ * @var CacheInterface
*/
private $aclDataCache;
/**
- * @param \Magento\Framework\Model\ResourceModel\Db\Context $context
- * @param \Magento\Framework\Acl\Builder $aclBuilder
- * @param \Psr\Log\LoggerInterface $logger
- * @param \Magento\Framework\Acl\RootResource $rootResource
+ * @param Context $context
+ * @param Builder $aclBuilder
+ * @param LoggerInterface $logger
+ * @param RootResource $rootResource
+ * @param CacheInterface $aclDataCache
* @param string $connectionName
- * @param \Magento\Framework\Acl\Data\CacheInterface $aclDataCache
*/
public function __construct(
- \Magento\Framework\Model\ResourceModel\Db\Context $context,
- \Magento\Framework\Acl\Builder $aclBuilder,
- \Psr\Log\LoggerInterface $logger,
- \Magento\Framework\Acl\RootResource $rootResource,
- $connectionName = null,
- \Magento\Framework\Acl\Data\CacheInterface $aclDataCache = null
+ Context $context,
+ Builder $aclBuilder,
+ LoggerInterface $logger,
+ RootResource $rootResource,
+ CacheInterface $aclDataCache,
+ $connectionName = null
) {
$this->_aclBuilder = $aclBuilder;
parent::__construct($context, $connectionName);
$this->_rootResource = $rootResource;
$this->_logger = $logger;
- $this->aclDataCache = $aclDataCache ?: ObjectManager::getInstance()->get(
- \Magento\Framework\Acl\Data\CacheInterface::class
- );
+ $this->aclDataCache = $aclDataCache;
}
/**
@@ -75,7 +80,7 @@ protected function _construct()
*
* @param \Magento\Authorization\Model\Rules $rule
* @return void
- * @throws \Magento\Framework\Exception\LocalizedException
+ * @throws LocalizedException
*/
public function saveRel(\Magento\Authorization\Model\Rules $rule)
{
@@ -107,7 +112,7 @@ public function saveRel(\Magento\Authorization\Model\Rules $rule)
$connection->insert($this->getMainTable(), $insertData);
} else {
/** Give basic admin permissions to any admin */
- $postedResources[] = \Magento\Backend\App\AbstractAction::ADMIN_RESOURCE;
+ $postedResources[] = AbstractAction::ADMIN_RESOURCE;
$acl = $this->_aclBuilder->getAcl();
/** @var $resource \Magento\Framework\Acl\AclResource */
foreach ($acl->getResources() as $resourceId) {
@@ -125,7 +130,7 @@ public function saveRel(\Magento\Authorization\Model\Rules $rule)
$connection->commit();
$this->aclDataCache->clean();
- } catch (\Magento\Framework\Exception\LocalizedException $e) {
+ } catch (LocalizedException $e) {
$connection->rollBack();
throw $e;
} catch (\Exception $e) {
diff --git a/app/code/Magento/Authorization/Test/Unit/Model/Acl/Loader/RoleTest.php b/app/code/Magento/Authorization/Test/Unit/Model/Acl/Loader/RoleTest.php
index a5ae7f8e86a6e..e1841b895dd07 100644
--- a/app/code/Magento/Authorization/Test/Unit/Model/Acl/Loader/RoleTest.php
+++ b/app/code/Magento/Authorization/Test/Unit/Model/Acl/Loader/RoleTest.php
@@ -3,199 +3,221 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
+declare(strict_types=1);
+
namespace Magento\Authorization\Test\Unit\Model\Acl\Loader;
-class RoleTest extends \PHPUnit\Framework\TestCase
-{
- /**
- * @var \Magento\Authorization\Model\Acl\Loader\Role
- */
- protected $_model;
+use Magento\Authorization\Model\Acl\Loader\Role;
+use Magento\Authorization\Model\Acl\Role\GroupFactory;
+use Magento\Authorization\Model\Acl\Role\UserFactory;
+use Magento\Framework\Acl;
+use Magento\Framework\Acl\Data\CacheInterface;
+use Magento\Framework\App\ResourceConnection;
+use Magento\Framework\DB\Adapter\Pdo\Mysql;
+use Magento\Framework\DB\Select;
+use Magento\Framework\Serialize\Serializer\Json;
+use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
+use PHPUnit\Framework\MockObject\MockObject;
+use PHPUnit\Framework\TestCase;
+/**
+ * Test class for \Magento\Authorization\Model\Acl\Loader\Role
+ */
+class RoleTest extends TestCase
+{
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var Role
*/
- protected $_resourceMock;
+ private $model;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var GroupFactory|MockObject
*/
- protected $_adapterMock;
+ private $groupFactoryMock;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var UserFactory|MockObject
*/
- protected $_roleFactoryMock;
+ private $roleFactoryMock;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var ResourceConnection|MockObject
*/
- protected $_groupFactoryMock;
+ private $resourceMock;
/**
- * @var \Magento\Framework\Acl\Data\CacheInterface|\PHPUnit_Framework_MockObject_MockObject
+ * @var CacheInterface|MockObject
*/
private $aclDataCacheMock;
/**
- * @var \Magento\Framework\Serialize\Serializer\Json|\PHPUnit_Framework_MockObject_MockObject
+ * @var Json|MockObject
*/
private $serializerMock;
/**
- * @var \Magento\Framework\DB\Select|\PHPUnit_Framework_MockObject_MockObject
+ * @var Select|MockObject
*/
private $selectMock;
+ /**
+ * @var Mysql|MockObject
+ */
+ private $adapterMock;
+
+ /**
+ * @inheritDoc
+ */
protected function setUp()
{
- $this->_resourceMock = $this->createMock(\Magento\Framework\App\ResourceConnection::class);
- $this->_groupFactoryMock = $this->getMockBuilder(\Magento\Authorization\Model\Acl\Role\GroupFactory::class)
+ $this->groupFactoryMock = $this->getMockBuilder(GroupFactory::class)
->setMethods(['create', 'getModelInstance'])
->disableOriginalConstructor()
->getMock();
- $this->_roleFactoryMock = $this->getMockBuilder(\Magento\Authorization\Model\Acl\Role\UserFactory::class)
+ $this->roleFactoryMock = $this->getMockBuilder(UserFactory::class)
->setMethods(['create', 'getModelInstance'])
->disableOriginalConstructor()
->getMock();
-
- $this->selectMock = $this->createMock(\Magento\Framework\DB\Select::class);
- $this->selectMock->expects($this->any())
- ->method('from')
- ->will($this->returnValue($this->selectMock));
-
- $this->_adapterMock = $this->createMock(\Magento\Framework\DB\Adapter\Pdo\Mysql::class);
-
+ $this->resourceMock = $this->createMock(ResourceConnection::class);
+ $this->aclDataCacheMock = $this->createMock(CacheInterface::class);
$this->serializerMock = $this->createPartialMock(
- \Magento\Framework\Serialize\Serializer\Json::class,
+ Json::class,
['serialize', 'unserialize']
);
- $this->serializerMock->expects($this->any())
- ->method('serialize')
- ->will(
- $this->returnCallback(
- function ($value) {
- return json_encode($value);
- }
- )
- );
- $this->serializerMock->expects($this->any())
- ->method('unserialize')
- ->will(
- $this->returnCallback(
- function ($value) {
- return json_decode($value, true);
- }
- )
+ $this->serializerMock->method('serialize')
+ ->willReturnCallback(
+ static function ($value) {
+ return json_encode($value);
+ }
);
- $this->aclDataCacheMock = $this->createMock(\Magento\Framework\Acl\Data\CacheInterface::class);
+ $this->serializerMock->method('unserialize')
+ ->willReturnCallback(
+ static function ($value) {
+ return json_decode($value, true);
+ }
+ );
- $this->_model = new \Magento\Authorization\Model\Acl\Loader\Role(
- $this->_groupFactoryMock,
- $this->_roleFactoryMock,
- $this->_resourceMock,
- $this->aclDataCacheMock,
- $this->serializerMock
+ $this->selectMock = $this->createMock(Select::class);
+ $this->selectMock->method('from')
+ ->willReturn($this->selectMock);
+
+ $this->adapterMock = $this->createMock(Mysql::class);
+
+ $objectManager = new ObjectManager($this);
+ $this->model = $objectManager->getObject(
+ Role::class,
+ [
+ 'groupFactory' => $this->groupFactoryMock,
+ 'roleFactory' => $this->roleFactoryMock,
+ 'resource' => $this->resourceMock,
+ 'aclDataCache' => $this->aclDataCacheMock,
+ 'serializer' => $this->serializerMock
+ ]
);
}
+ /**
+ * Test populating acl roles with children
+ */
public function testPopulateAclAddsRolesAndTheirChildren()
{
- $this->_resourceMock->expects($this->once())
+ $this->resourceMock->expects($this->once())
->method('getTableName')
->with($this->equalTo('authorization_role'))
- ->will($this->returnArgument(1));
+ ->willReturnArgument(1);
- $this->_adapterMock->expects($this->once())
+ $this->adapterMock->expects($this->once())
->method('select')
- ->will($this->returnValue($this->selectMock));
+ ->willReturn($this->selectMock);
- $this->_resourceMock->expects($this->once())
+ $this->resourceMock->expects($this->once())
->method('getConnection')
- ->will($this->returnValue($this->_adapterMock));
+ ->willReturn($this->adapterMock);
- $this->_adapterMock->expects($this->once())
+ $this->adapterMock->expects($this->once())
->method('fetchAll')
- ->will(
- $this->returnValue(
- [
- ['role_id' => 1, 'role_type' => 'G', 'parent_id' => null],
- ['role_id' => 2, 'role_type' => 'U', 'parent_id' => 1, 'user_id' => 1],
- ]
- )
+ ->willReturn(
+ [
+ ['role_id' => 1, 'role_type' => 'G', 'parent_id' => null],
+ ['role_id' => 2, 'role_type' => 'U', 'parent_id' => 1, 'user_id' => 1],
+ ]
);
- $this->_groupFactoryMock->expects($this->once())->method('create')->with(['roleId' => '1']);
- $this->_roleFactoryMock->expects($this->once())->method('create')->with(['roleId' => '2']);
+ $this->groupFactoryMock->expects($this->once())->method('create')->with(['roleId' => '1']);
+ $this->roleFactoryMock->expects($this->once())->method('create')->with(['roleId' => '2']);
- $aclMock = $this->createMock(\Magento\Framework\Acl::class);
+ $aclMock = $this->createMock(Acl::class);
$aclMock->expects($this->at(0))->method('addRole')->with($this->anything(), null);
$aclMock->expects($this->at(2))->method('addRole')->with($this->anything(), '1');
- $this->_model->populateAcl($aclMock);
+ $this->model->populateAcl($aclMock);
}
+ /**
+ * Test populating acl role with multiple parents
+ */
public function testPopulateAclAddsMultipleParents()
{
- $this->_resourceMock->expects($this->once())
+ $this->resourceMock->expects($this->once())
->method('getTableName')
->with($this->equalTo('authorization_role'))
- ->will($this->returnArgument(1));
+ ->willReturnArgument(1);
- $this->_adapterMock->expects($this->once())
+ $this->adapterMock->expects($this->once())
->method('select')
- ->will($this->returnValue($this->selectMock));
+ ->willReturn($this->selectMock);
- $this->_resourceMock->expects($this->once())
+ $this->resourceMock->expects($this->once())
->method('getConnection')
- ->will($this->returnValue($this->_adapterMock));
+ ->willReturn($this->adapterMock);
- $this->_adapterMock->expects($this->once())
+ $this->adapterMock->expects($this->once())
->method('fetchAll')
- ->will($this->returnValue([['role_id' => 1, 'role_type' => 'U', 'parent_id' => 2, 'user_id' => 3]]));
+ ->willReturn([['role_id' => 1, 'role_type' => 'U', 'parent_id' => 2, 'user_id' => 3]]);
- $this->_roleFactoryMock->expects($this->never())->method('getModelInstance');
- $this->_groupFactoryMock->expects($this->never())->method('getModelInstance');
+ $this->roleFactoryMock->expects($this->never())->method('getModelInstance');
+ $this->groupFactoryMock->expects($this->never())->method('getModelInstance');
- $aclMock = $this->createMock(\Magento\Framework\Acl::class);
- $aclMock->expects($this->at(0))->method('hasRole')->with('1')->will($this->returnValue(true));
+ $aclMock = $this->createMock(Acl::class);
+ $aclMock->expects($this->at(0))->method('hasRole')->with('1')->willReturn(true);
$aclMock->expects($this->at(1))->method('addRoleParent')->with('1', '2');
- $this->_model->populateAcl($aclMock);
+ $this->model->populateAcl($aclMock);
}
+ /**
+ * Test populating acl role from cache
+ */
public function testPopulateAclFromCache()
{
- $this->_resourceMock->expects($this->never())->method('getConnection');
- $this->_resourceMock->expects($this->never())->method('getTableName');
- $this->_adapterMock->expects($this->never())->method('fetchAll');
+ $this->resourceMock->expects($this->never())->method('getConnection');
+ $this->resourceMock->expects($this->never())->method('getTableName');
+ $this->adapterMock->expects($this->never())->method('fetchAll');
$this->aclDataCacheMock->expects($this->once())
->method('load')
- ->with(\Magento\Authorization\Model\Acl\Loader\Role::ACL_ROLES_CACHE_KEY)
- ->will(
- $this->returnValue(
- json_encode(
+ ->with(Role::ACL_ROLES_CACHE_KEY)
+ ->willReturn(
+ json_encode(
+ [
[
- [
- 'role_id' => 1,
- 'role_type' => 'U',
- 'parent_id' => 2,
- 'user_id' => 3
- ]
+ 'role_id' => 1,
+ 'role_type' => 'U',
+ 'parent_id' => 2,
+ 'user_id' => 3
]
- )
+ ]
)
);
- $this->_roleFactoryMock->expects($this->never())->method('getModelInstance');
- $this->_groupFactoryMock->expects($this->never())->method('getModelInstance');
+ $this->roleFactoryMock->expects($this->never())->method('getModelInstance');
+ $this->groupFactoryMock->expects($this->never())->method('getModelInstance');
- $aclMock = $this->createMock(\Magento\Framework\Acl::class);
- $aclMock->expects($this->at(0))->method('hasRole')->with('1')->will($this->returnValue(true));
+ $aclMock = $this->createMock(Acl::class);
+ $aclMock->expects($this->at(0))->method('hasRole')->with('1')->willReturn(true);
$aclMock->expects($this->at(1))->method('addRoleParent')->with('1', '2');
- $this->_model->populateAcl($aclMock);
+ $this->model->populateAcl($aclMock);
}
}
diff --git a/app/code/Magento/Authorization/Test/Unit/Model/Acl/Loader/RuleTest.php b/app/code/Magento/Authorization/Test/Unit/Model/Acl/Loader/RuleTest.php
index 51801e1842eff..c7a9b80c6597c 100644
--- a/app/code/Magento/Authorization/Test/Unit/Model/Acl/Loader/RuleTest.php
+++ b/app/code/Magento/Authorization/Test/Unit/Model/Acl/Loader/RuleTest.php
@@ -3,105 +3,121 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
+declare(strict_types=1);
+
namespace Magento\Authorization\Test\Unit\Model\Acl\Loader;
-class RuleTest extends \PHPUnit\Framework\TestCase
+use Magento\Authorization\Model\Acl\Loader\Rule;
+use Magento\Framework\Acl;
+use Magento\Framework\Acl\Data\CacheInterface;
+use Magento\Framework\Acl\RootResource;
+use Magento\Framework\App\ResourceConnection;
+use Magento\Framework\Serialize\Serializer\Json;
+use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
+use PHPUnit\Framework\MockObject\MockObject;
+use PHPUnit\Framework\TestCase;
+
+/**
+ * Test class for \Magento\Authorization\Model\Acl\Loader\Rule
+ */
+class RuleTest extends TestCase
{
/**
- * @var \Magento\Authorization\Model\Acl\Loader\Rule
+ * @var Rule
*/
- protected $_model;
+ private $model;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var RootResource
*/
- protected $_resourceMock;
+ private $rootResource;
/**
- * @var \Magento\Framework\Acl\RootResource
+ * @var ResourceConnection|MockObject
*/
- protected $_rootResourceMock;
+ private $resourceMock;
/**
- * @var \Magento\Framework\Acl\Data\CacheInterface|\PHPUnit_Framework_MockObject_MockObject
+ * @var CacheInterface|MockObject
*/
private $aclDataCacheMock;
/**
- * @var \Magento\Framework\Serialize\Serializer\Json|\PHPUnit_Framework_MockObject_MockObject
+ * @var Json|MockObject
*/
private $serializerMock;
+ /**
+ * @inheritDoc
+ */
protected function setUp()
{
- $this->_resourceMock = $this->createPartialMock(
- \Magento\Framework\App\ResourceConnection::class,
+ $this->rootResource = new RootResource('Magento_Backend::all');
+ $this->resourceMock = $this->createPartialMock(
+ ResourceConnection::class,
['getTable', 'getConnection']
);
+ $this->aclDataCacheMock = $this->createMock(CacheInterface::class);
$this->serializerMock = $this->createPartialMock(
- \Magento\Framework\Serialize\Serializer\Json::class,
+ Json::class,
['serialize', 'unserialize']
);
- $this->serializerMock->expects($this->any())
- ->method('serialize')
- ->will(
- $this->returnCallback(
- function ($value) {
- return json_encode($value);
- }
- )
- );
- $this->serializerMock->expects($this->any())
- ->method('unserialize')
- ->will(
- $this->returnCallback(
- function ($value) {
- return json_decode($value, true);
- }
- )
+ $this->serializerMock->method('serialize')
+ ->willReturnCallback(
+ static function ($value) {
+ return json_encode($value);
+ }
);
- $this->aclDataCacheMock = $this->createMock(\Magento\Framework\Acl\Data\CacheInterface::class);
+ $this->serializerMock->method('unserialize')
+ ->willReturnCallback(
+ static function ($value) {
+ return json_decode($value, true);
+ }
+ );
- $this->_rootResourceMock = new \Magento\Framework\Acl\RootResource('Magento_Backend::all');
- $this->_model = new \Magento\Authorization\Model\Acl\Loader\Rule(
- $this->_rootResourceMock,
- $this->_resourceMock,
- [],
- $this->aclDataCacheMock,
- $this->serializerMock
+ $objectManager = new ObjectManager($this);
+ $this->model = $objectManager->getObject(
+ Rule::class,
+ [
+ 'rootResource' => $this->rootResource,
+ 'resource' => $this->resourceMock,
+ 'aclDataCache' => $this->aclDataCacheMock,
+ 'serializer' => $this->serializerMock
+ ]
);
}
+ /**
+ * Test populating acl rule from cache
+ */
public function testPopulateAclFromCache()
{
- $this->_resourceMock->expects($this->never())->method('getTable');
- $this->_resourceMock->expects($this->never())
+ $this->resourceMock->expects($this->never())->method('getTable');
+ $this->resourceMock->expects($this->never())
->method('getConnection');
$this->aclDataCacheMock->expects($this->once())
->method('load')
- ->with(\Magento\Authorization\Model\Acl\Loader\Rule::ACL_RULE_CACHE_KEY)
- ->will(
- $this->returnValue(
- json_encode(
- [
- ['role_id' => 1, 'resource_id' => 'Magento_Backend::all', 'permission' => 'allow'],
- ['role_id' => 2, 'resource_id' => 1, 'permission' => 'allow'],
- ['role_id' => 3, 'resource_id' => 1, 'permission' => 'deny'],
- ]
- )
+ ->with(Rule::ACL_RULE_CACHE_KEY)
+ ->willReturn(
+ json_encode(
+ [
+ ['role_id' => 1, 'resource_id' => 'Magento_Backend::all', 'permission' => 'allow'],
+ ['role_id' => 2, 'resource_id' => 1, 'permission' => 'allow'],
+ ['role_id' => 3, 'resource_id' => 1, 'permission' => 'deny'],
+ ]
)
);
- $aclMock = $this->createMock(\Magento\Framework\Acl::class);
- $aclMock->expects($this->any())->method('has')->will($this->returnValue(true));
+ $aclMock = $this->createMock(Acl::class);
+ $aclMock->method('has')->willReturn(true);
$aclMock->expects($this->at(1))->method('allow')->with('1', null, null);
$aclMock->expects($this->at(2))->method('allow')->with('1', 'Magento_Backend::all', null);
$aclMock->expects($this->at(4))->method('allow')->with('2', 1, null);
$aclMock->expects($this->at(6))->method('deny')->with('3', 1, null);
- $this->_model->populateAcl($aclMock);
+ $this->model->populateAcl($aclMock);
}
}
diff --git a/app/code/Magento/Authorization/Test/Unit/Model/ResourceModel/RulesTest.php b/app/code/Magento/Authorization/Test/Unit/Model/ResourceModel/RulesTest.php
index 260691608537e..36cd789042f43 100644
--- a/app/code/Magento/Authorization/Test/Unit/Model/ResourceModel/RulesTest.php
+++ b/app/code/Magento/Authorization/Test/Unit/Model/ResourceModel/RulesTest.php
@@ -3,9 +3,23 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
+declare(strict_types=1);
namespace Magento\Authorization\Test\Unit\Model\ResourceModel;
+use Magento\Authorization\Model\ResourceModel\Rules;
+use Magento\Framework\Acl\Builder;
+use Magento\Framework\Acl\Data\CacheInterface;
+use Magento\Framework\Acl\RootResource;
+use Magento\Framework\App\ResourceConnection;
+use Magento\Framework\DB\Adapter\AdapterInterface;
+use Magento\Framework\Model\ResourceModel\Db\Context;
+use Magento\Framework\Phrase;
+use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
+use PHPUnit\Framework\MockObject\MockObject;
+use PHPUnit\Framework\TestCase;
+use Psr\Log\LoggerInterface;
+
/**
* Unit test for Rules resource model.
*
@@ -14,7 +28,7 @@
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class RulesTest extends \PHPUnit\Framework\TestCase
+class RulesTest extends TestCase
{
/**
* Test constants
@@ -22,121 +36,125 @@ class RulesTest extends \PHPUnit\Framework\TestCase
const TEST_ROLE_ID = 13;
/**
- * @var \Magento\Authorization\Model\ResourceModel\Rules
+ * @var Rules
*/
private $model;
/**
- * @var \Magento\Framework\Model\ResourceModel\Db\Context|\PHPUnit_Framework_MockObject_MockObject
+ * @var Context|MockObject
*/
private $contextMock;
/**
- * @var \Magento\Framework\Acl\Builder|\PHPUnit_Framework_MockObject_MockObject
+ * @var Builder|MockObject
*/
private $aclBuilderMock;
/**
- * @var \Psr\Log\LoggerInterface|\PHPUnit_Framework_MockObject_MockObject
+ * @var LoggerInterface|MockObject
*/
private $loggerMock;
/**
- * @var \Magento\Framework\Acl\RootResource|\PHPUnit_Framework_MockObject_MockObject
+ * @var RootResource|MockObject
*/
private $rootResourceMock;
/**
- * @var \Magento\Framework\Acl\Data\CacheInterface|\PHPUnit_Framework_MockObject_MockObject
+ * @var CacheInterface|MockObject
*/
private $aclDataCacheMock;
/**
- * @var \Magento\Framework\App\ResourceConnection|\PHPUnit_Framework_MockObject_MockObject
+ * @var ResourceConnection|MockObject
*/
private $resourceConnectionMock;
/**
- * @var \Magento\Framework\DB\Adapter\AdapterInterface|\PHPUnit_Framework_MockObject_MockObject
+ * @var AdapterInterface|MockObject
*/
private $connectionMock;
/**
- * @var \Magento\Authorization\Model\Rules|\PHPUnit_Framework_MockObject_MockObject
+ * @var \Magento\Authorization\Model\Rules|MockObject
*/
private $ruleMock;
+ /**
+ * @inheritDoc
+ */
protected function setUp()
{
- $this->contextMock = $this->getMockBuilder(\Magento\Framework\Model\ResourceModel\Db\Context::class)
+ $this->contextMock = $this->getMockBuilder(Context::class)
->disableOriginalConstructor()
->setMethods(['getResources'])
->getMock();
- $this->resourceConnectionMock = $this->getMockBuilder(\Magento\Framework\App\ResourceConnection::class)
+ $this->resourceConnectionMock = $this->getMockBuilder(ResourceConnection::class)
->disableOriginalConstructor()
->setMethods(['getConnection', 'getTableName'])
->getMock();
$this->contextMock->expects($this->once())
->method('getResources')
- ->will($this->returnValue($this->resourceConnectionMock));
+ ->willReturn($this->resourceConnectionMock);
- $this->connectionMock = $this->getMockBuilder(\Magento\Framework\DB\Adapter\AdapterInterface::class)
+ $this->connectionMock = $this->getMockBuilder(AdapterInterface::class)
->disableOriginalConstructor()
->setMethods([])
->getMock();
$this->resourceConnectionMock->expects($this->once())
->method('getConnection')
- ->with('connection')
- ->will($this->returnValue($this->connectionMock));
+ ->with('default')
+ ->willReturn($this->connectionMock);
- $this->resourceConnectionMock->expects($this->any())
- ->method('getTableName')
- ->with('authorization_rule', 'connection')
+ $this->resourceConnectionMock->method('getTableName')
+ ->with('authorization_rule', 'default')
->will($this->returnArgument(0));
- $this->aclBuilderMock = $this->getMockBuilder(\Magento\Framework\Acl\Builder::class)
+ $this->aclBuilderMock = $this->getMockBuilder(Builder::class)
->disableOriginalConstructor()
->setMethods(['getConfigCache'])
->getMock();
- $this->loggerMock = $this->getMockBuilder(\Psr\Log\LoggerInterface::class)
+ $this->loggerMock = $this->getMockBuilder(LoggerInterface::class)
->disableOriginalConstructor()
->setMethods([])
->getMock();
- $this->rootResourceMock = $this->getMockBuilder(\Magento\Framework\Acl\RootResource::class)
+ $this->rootResourceMock = $this->getMockBuilder(RootResource::class)
->disableOriginalConstructor()
->setMethods([])
->getMock();
- $this->aclDataCacheMock = $this->getMockBuilder(\Magento\Framework\Acl\Data\CacheInterface::class)
+ $this->aclDataCacheMock = $this->getMockBuilder(CacheInterface::class)
->disableOriginalConstructor()
->setMethods([])
->getMock();
- $this->aclBuilderMock->expects($this->any())
- ->method('getConfigCache')
- ->will($this->returnValue($this->aclDataCacheMock));
+ $this->aclBuilderMock->method('getConfigCache')
+ ->willReturn($this->aclDataCacheMock);
$this->ruleMock = $this->getMockBuilder(\Magento\Authorization\Model\Rules::class)
->disableOriginalConstructor()
->setMethods(['getRoleId'])
->getMock();
- $this->ruleMock->expects($this->any())
- ->method('getRoleId')
- ->will($this->returnValue(self::TEST_ROLE_ID));
-
- $this->model = new \Magento\Authorization\Model\ResourceModel\Rules(
- $this->contextMock,
- $this->aclBuilderMock,
- $this->loggerMock,
- $this->rootResourceMock,
- 'connection',
- $this->aclDataCacheMock
+ $this->ruleMock->method('getRoleId')
+ ->willReturn(self::TEST_ROLE_ID);
+
+ $objectManager = new ObjectManager($this);
+ $this->model = $objectManager->getObject(
+ Rules::class,
+ [
+ 'context' => $this->contextMock,
+ 'aclBuilder' => $this->aclBuilderMock,
+ 'logger' => $this->loggerMock,
+ 'rootResource' => $this->rootResourceMock,
+ 'aclDataCache' => $this->aclDataCacheMock,
+ 'default'
+ ]
);
}
@@ -167,12 +185,12 @@ public function testSaveRelNoResources()
*/
public function testLocalizedExceptionOccurance()
{
- $exceptionPhrase = $this->getMockBuilder(\Magento\Framework\Phrase::class)
+ $exceptionPhrase = $this->getMockBuilder(Phrase::class)
->disableOriginalConstructor()
->setMethods(['render'])
->getMock();
- $exceptionPhrase->expects($this->any())->method('render')->will($this->returnValue('TestException'));
+ $exceptionPhrase->method('render')->willReturn('TestException');
$exception = new \Magento\Framework\Exception\LocalizedException($exceptionPhrase);
diff --git a/app/code/Magento/Backend/Block/Dashboard/Graph.php b/app/code/Magento/Backend/Block/Dashboard/Graph.php
index b76421e4e6f67..527bb2136b4c5 100644
--- a/app/code/Magento/Backend/Block/Dashboard/Graph.php
+++ b/app/code/Magento/Backend/Block/Dashboard/Graph.php
@@ -14,9 +14,6 @@
*/
class Graph extends \Magento\Backend\Block\Dashboard\AbstractDashboard
{
- /**
- * Api URL
- */
const API_URL = 'https://image-charts.com/chart';
/**
@@ -190,8 +187,8 @@ public function getChartUrl($directUrl = true)
$params = [
'cht' => 'lc',
'chls' => '7',
- 'chf' => 'bg,s,f4f4f4|c,lg,90,ffffff,0.1,ededed,0',
- 'chm' => 'B,f4d4b2,0,0,0',
+ 'chf' => 'bg,s,f4f4f4|c,lg,90,ffffff,0.1,ededed,0',
+ 'chm' => 'B,f4d4b2,0,0,0',
'chco' => 'db4814',
'chxs' => '0,0,11|1,0,11',
'chma' => '15,15,15,15'
@@ -237,7 +234,7 @@ public function getChartUrl($directUrl = true)
case '1y':
case '2y':
$d = $dateStart->format('Y-m');
- $dateStart->modify('+1 month');
+ $dateStart->modify('first day of next month');
break;
default:
$d = $dateStart->format('Y-m-d H:00');
@@ -300,20 +297,23 @@ public function getChartUrl($directUrl = true)
$minvalue = min($localminvalue);
// default values
- $yLabels = [];
$miny = 0;
$maxy = 0;
$yorigin = 0;
+ $xAxis = 'x';
+ $xAxisIndex = 0;
+ $yAxisIndex = 1;
if ($minvalue >= 0 && $maxvalue >= 0) {
if ($maxvalue > 10) {
- $p = pow(10, $this->_getPow((int) $maxvalue));
+ $p = pow(10, $this->_getPow((int)$maxvalue));
$maxy = ceil($maxvalue / $p) * $p;
- $yLabels = range($miny, $maxy, $p);
+ $yRange = "$yAxisIndex,$miny,$maxy,$p";
} else {
$maxy = ceil($maxvalue + 1);
- $yLabels = range($miny, $maxy, 1);
+ $yRange = "$yAxisIndex,$miny,$maxy,1";
}
+ $params['chxr'] = $yRange;
$yorigin = 0;
}
@@ -341,22 +341,11 @@ public function getChartUrl($directUrl = true)
$params['chd'] .= $buffer;
- $valueBuffer = [];
-
if (count($this->_axisLabels) > 0) {
$params['chxt'] = implode(',', array_keys($this->_axisLabels));
- $indexid = 0;
- foreach ($this->_axisLabels as $idx => $labels) {
- if ($idx == 'x') {
- $this->formatAxisLabelDate((string) $idx, (string) $timezoneLocal);
- $tmpstring = implode('|', $this->_axisLabels[$idx]);
- $valueBuffer[] = $indexid . ":|" . $tmpstring;
- } elseif ($idx == 'y') {
- $valueBuffer[] = $indexid . ":|" . implode('|', $yLabels);
- }
- $indexid++;
- }
- $params['chxl'] = implode('|', $valueBuffer);
+ $this->formatAxisLabelDate($xAxis, (string)$timezoneLocal);
+ $customAxisLabels = $xAxisIndex . ":|" . implode('|', $this->_axisLabels[$xAxis]);
+ $params['chxl'] = $customAxisLabels . $dataSetdelimiter;
}
// chart size
@@ -368,7 +357,7 @@ public function getChartUrl($directUrl = true)
foreach ($params as $name => $value) {
$p[] = $name . '=' . urlencode($value);
}
- return (string) self::API_URL . '?' . implode('&', $p);
+ return (string)self::API_URL . '?' . implode('&', $p);
}
$gaData = urlencode(base64_encode(json_encode($params)));
$gaHash = $this->_dashboardData->getChartDataHash($gaData);
@@ -392,7 +381,7 @@ private function formatAxisLabelDate($idx, $timezoneLocal)
switch ($this->getDataHelper()->getParam('period')) {
case '24h':
$this->_axisLabels[$idx][$_index] = $this->_localeDate->formatDateTime(
- $period->setTime((int) $period->format('H'), 0, 0),
+ $period->setTime((int)$period->format('H'), 0, 0),
\IntlDateFormatter::NONE,
\IntlDateFormatter::SHORT
);
diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/AbstractRenderer.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/AbstractRenderer.php
index 623a75015eb2f..415ce7c4c21fc 100644
--- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/AbstractRenderer.php
+++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Renderer/AbstractRenderer.php
@@ -9,6 +9,9 @@
use Magento\Framework\DataObject;
/**
+ * Produce html output using the given data source.
+ *
+ * phpcs:disable Magento2.Classes.AbstractApi
* Backend grid item abstract renderer
* @api
* @SuppressWarnings(PHPMD.NumberOfChildren)
@@ -53,7 +56,7 @@ public function getColumn()
* Renders grid column
*
* @param DataObject $row
- * @return string
+ * @return string
*/
public function render(DataObject $row)
{
@@ -62,7 +65,7 @@ public function render(DataObject $row)
$result .= $this->getColumn()->getEditOnly() ? ''
: '' . $this->_getValue($row) . '';
- return $result . $this->_getInputValueElement($row) . '' ;
+ return $result . $this->_getInputValueElement($row) . '';
}
return $this->_getValue($row);
}
@@ -90,6 +93,7 @@ protected function _getValue(DataObject $row)
if (is_string($getter)) {
return $row->{$getter}();
} elseif (is_callable($getter)) {
+ //phpcs:ignore Magento2.Functions.DiscouragedFunction
return call_user_func($getter, $row);
}
return '';
diff --git a/app/code/Magento/Backend/Test/Mftf/ActionGroup/LoginAsAdminActionGroup.xml b/app/code/Magento/Backend/Test/Mftf/ActionGroup/AdminLoginActionGroup.xml
similarity index 72%
rename from app/code/Magento/Backend/Test/Mftf/ActionGroup/LoginAsAdminActionGroup.xml
rename to app/code/Magento/Backend/Test/Mftf/ActionGroup/AdminLoginActionGroup.xml
index 7e1dfe4cf381b..0320862b99e63 100644
--- a/app/code/Magento/Backend/Test/Mftf/ActionGroup/LoginAsAdminActionGroup.xml
+++ b/app/code/Magento/Backend/Test/Mftf/ActionGroup/AdminLoginActionGroup.xml
@@ -8,18 +8,20 @@
-
+
Login to Backend Admin using provided User Data. PLEASE NOTE: This Action Group does NOT validate that you are Logged In.
-
+
+
-
-
+
+
+
diff --git a/app/code/Magento/Backend/Test/Mftf/ActionGroup/AdminSetStoreInformationConfigurationActionGroup.xml b/app/code/Magento/Backend/Test/Mftf/ActionGroup/AdminSetStoreInformationConfigurationActionGroup.xml
new file mode 100644
index 0000000000000..9de4b684f6f5c
--- /dev/null
+++ b/app/code/Magento/Backend/Test/Mftf/ActionGroup/AdminSetStoreInformationConfigurationActionGroup.xml
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+ Set Store Information configurations
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Backend/Test/Mftf/ActionGroup/LoginActionGroup.xml b/app/code/Magento/Backend/Test/Mftf/ActionGroup/LoginActionGroup.xml
deleted file mode 100644
index 7068478bb4790..0000000000000
--- a/app/code/Magento/Backend/Test/Mftf/ActionGroup/LoginActionGroup.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
-
- Login to Backend Admin using ENV Admin credentials. PLEASE NOTE: This Action Group does NOT validate that you are Logged In.
-
-
-
-
-
-
-
-
diff --git a/app/code/Magento/Backend/Test/Mftf/ActionGroup/LoginAdminWithCredentialsActionGroup.xml b/app/code/Magento/Backend/Test/Mftf/ActionGroup/LoginAdminWithCredentialsActionGroup.xml
deleted file mode 100644
index 995a5e7130e0a..0000000000000
--- a/app/code/Magento/Backend/Test/Mftf/ActionGroup/LoginAdminWithCredentialsActionGroup.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
-
-
-
- Login to Backend Admin using provided Admin credentials. PLEASE NOTE: This Action Group does NOT validate that you are Logged In.
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/code/Magento/Backend/Test/Mftf/ActionGroup/LogoutActionGroup.xml b/app/code/Magento/Backend/Test/Mftf/ActionGroup/LogoutActionGroup.xml
deleted file mode 100644
index 4c265d08dd041..0000000000000
--- a/app/code/Magento/Backend/Test/Mftf/ActionGroup/LogoutActionGroup.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
- Logout of the Backend Admin. PLEASE NOTE: This Action Group does NOT validate that you are Logged Out.
-
-
-
-
-
diff --git a/app/code/Magento/Backend/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml b/app/code/Magento/Backend/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml
new file mode 100644
index 0000000000000..d2f4496c8cd4e
--- /dev/null
+++ b/app/code/Magento/Backend/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml
@@ -0,0 +1,56 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Login to Backend Admin using provided User Data. PLEASE NOTE: This Action Group does NOT validate that you are Logged In.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Login to Backend Admin using provided Admin credentials. PLEASE NOTE: This Action Group does NOT validate that you are Logged In.
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Backend/Test/Mftf/Data/AdminGeneralStoreInfomationConfigData.xml b/app/code/Magento/Backend/Test/Mftf/Data/AdminGeneralStoreInfomationConfigData.xml
index a8db2f94d69ab..2c50bc0fc75f4 100644
--- a/app/code/Magento/Backend/Test/Mftf/Data/AdminGeneralStoreInfomationConfigData.xml
+++ b/app/code/Magento/Backend/Test/Mftf/Data/AdminGeneralStoreInfomationConfigData.xml
@@ -30,4 +30,11 @@
general/store_information/street_line2
+
+ general/store_information/region_id
+
+
+ general/store_information/hours
+ 8AM-8PM
+
diff --git a/app/code/Magento/Backend/Test/Mftf/Test/AdminAttributeTextSwatchesCanBeFiledTest.xml b/app/code/Magento/Backend/Test/Mftf/Test/AdminAttributeTextSwatchesCanBeFiledTest.xml
index 2c061e54f5509..32201e03f92ec 100644
--- a/app/code/Magento/Backend/Test/Mftf/Test/AdminAttributeTextSwatchesCanBeFiledTest.xml
+++ b/app/code/Magento/Backend/Test/Mftf/Test/AdminAttributeTextSwatchesCanBeFiledTest.xml
@@ -58,7 +58,7 @@
-
+
diff --git a/app/code/Magento/Backend/Test/Mftf/Test/AdminContentScheduleNavigateMenuTest.xml b/app/code/Magento/Backend/Test/Mftf/Test/AdminContentScheduleNavigateMenuTest.xml
index bead59653eee8..091e441559d78 100644
--- a/app/code/Magento/Backend/Test/Mftf/Test/AdminContentScheduleNavigateMenuTest.xml
+++ b/app/code/Magento/Backend/Test/Mftf/Test/AdminContentScheduleNavigateMenuTest.xml
@@ -23,7 +23,7 @@
-
+
diff --git a/app/code/Magento/Backend/Test/Mftf/Test/AdminDashboardNavigateMenuTest.xml b/app/code/Magento/Backend/Test/Mftf/Test/AdminDashboardNavigateMenuTest.xml
index 6434d74b28754..60118202dbef2 100644
--- a/app/code/Magento/Backend/Test/Mftf/Test/AdminDashboardNavigateMenuTest.xml
+++ b/app/code/Magento/Backend/Test/Mftf/Test/AdminDashboardNavigateMenuTest.xml
@@ -23,7 +23,7 @@
-
+
diff --git a/app/code/Magento/Backend/Test/Mftf/Test/AdminDashboardWithChartsChart.xml b/app/code/Magento/Backend/Test/Mftf/Test/AdminDashboardWithChartsChart.xml
index 3ba965f746722..e82d54280d4e1 100644
--- a/app/code/Magento/Backend/Test/Mftf/Test/AdminDashboardWithChartsChart.xml
+++ b/app/code/Magento/Backend/Test/Mftf/Test/AdminDashboardWithChartsChart.xml
@@ -37,7 +37,7 @@
-
+
diff --git a/app/code/Magento/Backend/Test/Mftf/Test/AdminExpireCustomerSessionTest.xml b/app/code/Magento/Backend/Test/Mftf/Test/AdminExpireCustomerSessionTest.xml
index 88646401e3a99..d932da6ec0fad 100644
--- a/app/code/Magento/Backend/Test/Mftf/Test/AdminExpireCustomerSessionTest.xml
+++ b/app/code/Magento/Backend/Test/Mftf/Test/AdminExpireCustomerSessionTest.xml
@@ -24,7 +24,7 @@
-
+
diff --git a/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginAfterChangeCookieDomainTest.xml b/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginAfterChangeCookieDomainTest.xml
index 93d411c8827ed..f75f3b2e3f15e 100644
--- a/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginAfterChangeCookieDomainTest.xml
+++ b/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginAfterChangeCookieDomainTest.xml
@@ -29,6 +29,6 @@
-
+
diff --git a/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml b/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml
index 5550e3b317b0d..0aa31bb21b6f7 100644
--- a/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml
+++ b/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginAfterJSMinificationTest.xml
@@ -26,7 +26,7 @@
-
+
diff --git a/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginTest.xml b/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginTest.xml
index 960e77db7194f..566328e075600 100644
--- a/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginTest.xml
+++ b/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginTest.xml
@@ -22,6 +22,6 @@
-
+
diff --git a/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginWithRestrictPermissionTest.xml b/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginWithRestrictPermissionTest.xml
index e664a4a5f3e2f..a9706d902ff34 100644
--- a/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginWithRestrictPermissionTest.xml
+++ b/app/code/Magento/Backend/Test/Mftf/Test/AdminLoginWithRestrictPermissionTest.xml
@@ -39,7 +39,7 @@
-
+
@@ -52,7 +52,7 @@
-
+
diff --git a/app/code/Magento/Backend/Test/Mftf/Test/AdminMenuNavigationWithSecretKeysTest.xml b/app/code/Magento/Backend/Test/Mftf/Test/AdminMenuNavigationWithSecretKeysTest.xml
index c9a3b8089cc1d..db81a7829160d 100644
--- a/app/code/Magento/Backend/Test/Mftf/Test/AdminMenuNavigationWithSecretKeysTest.xml
+++ b/app/code/Magento/Backend/Test/Mftf/Test/AdminMenuNavigationWithSecretKeysTest.xml
@@ -26,7 +26,7 @@
-
+
diff --git a/app/code/Magento/Backend/Test/Mftf/Test/AdminStoresAllStoresNavigateMenuTest.xml b/app/code/Magento/Backend/Test/Mftf/Test/AdminStoresAllStoresNavigateMenuTest.xml
index 7758b387e393b..0ff1e817ac0ea 100644
--- a/app/code/Magento/Backend/Test/Mftf/Test/AdminStoresAllStoresNavigateMenuTest.xml
+++ b/app/code/Magento/Backend/Test/Mftf/Test/AdminStoresAllStoresNavigateMenuTest.xml
@@ -23,7 +23,7 @@
-
+
diff --git a/app/code/Magento/Backend/Test/Mftf/Test/AdminStoresConfigurationNavigateMenuTest.xml b/app/code/Magento/Backend/Test/Mftf/Test/AdminStoresConfigurationNavigateMenuTest.xml
index a54269b186ba0..94bf5c6b8993a 100644
--- a/app/code/Magento/Backend/Test/Mftf/Test/AdminStoresConfigurationNavigateMenuTest.xml
+++ b/app/code/Magento/Backend/Test/Mftf/Test/AdminStoresConfigurationNavigateMenuTest.xml
@@ -23,7 +23,7 @@
-
+
diff --git a/app/code/Magento/Backend/Test/Mftf/Test/AdminSystemCacheManagementNavigateMenuTest.xml b/app/code/Magento/Backend/Test/Mftf/Test/AdminSystemCacheManagementNavigateMenuTest.xml
index 516631c1bd166..3aae643ccc36b 100644
--- a/app/code/Magento/Backend/Test/Mftf/Test/AdminSystemCacheManagementNavigateMenuTest.xml
+++ b/app/code/Magento/Backend/Test/Mftf/Test/AdminSystemCacheManagementNavigateMenuTest.xml
@@ -23,7 +23,7 @@
-
+
diff --git a/app/code/Magento/Backend/etc/adminhtml/system.xml b/app/code/Magento/Backend/etc/adminhtml/system.xml
index 3a2b3554cc4a0..1e8ec226d6b88 100644
--- a/app/code/Magento/Backend/etc/adminhtml/system.xml
+++ b/app/code/Magento/Backend/etc/adminhtml/system.xml
@@ -115,7 +115,7 @@
Magento\Config\Model\Config\Source\Yesno
-
+
1
@@ -123,7 +123,7 @@
Magento\Config\Model\Config\Source\Yesno
Use URL parameter to enable template path hints for Storefront
-
+
1
diff --git a/app/code/Magento/Backend/i18n/en_US.csv b/app/code/Magento/Backend/i18n/en_US.csv
index 51fe8bfe542a2..53f7fe90cbbe5 100644
--- a/app/code/Magento/Backend/i18n/en_US.csv
+++ b/app/code/Magento/Backend/i18n/en_US.csv
@@ -461,3 +461,5 @@ Pagination,Pagination
"Alternative text for the next pages link in the pagination menu. If empty, default arrow image is used.","Alternative text for the next pages link in the pagination menu. If empty, default arrow image is used."
"Anchor Text for Next","Anchor Text for Next"
"Theme Name","Theme Name"
+"Use URL parameter to enable template path hints for Storefront","Use URL parameter to enable template path hints for Storefront"
+"Add the following parameter to the URL to show template hints ?templatehints=[parameter_value]","Add the following parameter to the URL to show template hints ?templatehints=[parameter_value]"
diff --git a/app/code/Magento/Backup/Test/Mftf/Test/AdminCreateAndDeleteBackupsTest.xml b/app/code/Magento/Backup/Test/Mftf/Test/AdminCreateAndDeleteBackupsTest.xml
index 778c6d5112b6a..383c1122ee07f 100644
--- a/app/code/Magento/Backup/Test/Mftf/Test/AdminCreateAndDeleteBackupsTest.xml
+++ b/app/code/Magento/Backup/Test/Mftf/Test/AdminCreateAndDeleteBackupsTest.xml
@@ -23,7 +23,7 @@
-
+
diff --git a/app/code/Magento/Braintree/Gateway/Command/CaptureStrategyCommand.php b/app/code/Magento/Braintree/Gateway/Command/CaptureStrategyCommand.php
index de439aad2defd..d35906c929b2a 100644
--- a/app/code/Magento/Braintree/Gateway/Command/CaptureStrategyCommand.php
+++ b/app/code/Magento/Braintree/Gateway/Command/CaptureStrategyCommand.php
@@ -21,7 +21,8 @@
use Magento\Payment\Gateway\Data\PaymentDataObjectInterface;
/**
- * Class CaptureStrategyCommand
+ * Braintree capture implementation.
+ *
* @SuppressWarnings(PHPMD)
*/
class CaptureStrategyCommand implements CommandInterface
@@ -84,7 +85,7 @@ class CaptureStrategyCommand implements CommandInterface
* @param FilterBuilder $filterBuilder
* @param SearchCriteriaBuilder $searchCriteriaBuilder
* @param SubjectReader $subjectReader
- * @param BraintreeAdapterFactory $braintreeAdapterFactory,
+ * @param BraintreeAdapterFactory $braintreeAdapterFactory
* @param BraintreeSearchAdapter $braintreeSearchAdapter
*/
public function __construct(
@@ -112,9 +113,9 @@ public function execute(array $commandSubject)
{
/** @var \Magento\Payment\Gateway\Data\PaymentDataObjectInterface $paymentDO */
$paymentDO = $this->subjectReader->readPayment($commandSubject);
-
$command = $this->getCommand($paymentDO);
- $this->commandPool->get($command)->execute($commandSubject);
+
+ return $this->commandPool->get($command)->execute($commandSubject);
}
/**
@@ -128,11 +129,8 @@ private function getCommand(PaymentDataObjectInterface $paymentDO)
$payment = $paymentDO->getPayment();
ContextHelper::assertOrderPayment($payment);
- // if auth transaction does not exist then execute authorize&capture command
+ // if capture transaction does not exist then execute capture command
$existsCapture = $this->isExistsCaptureTransaction($payment);
- if (!$payment->getAuthorizationTransaction() && !$existsCapture) {
- return self::SALE;
- }
// do capture for authorization transaction
if (!$existsCapture && !$this->isExpiredAuthorization($payment, $paymentDO->getOrder())) {
diff --git a/app/code/Magento/Braintree/Test/Mftf/Test/CreateAnAdminOrderUsingBraintreePaymentTest1.xml b/app/code/Magento/Braintree/Test/Mftf/Test/CreateAnAdminOrderUsingBraintreePaymentTest1.xml
index 16c8c93e94cbe..c45a8aece5ffc 100644
--- a/app/code/Magento/Braintree/Test/Mftf/Test/CreateAnAdminOrderUsingBraintreePaymentTest1.xml
+++ b/app/code/Magento/Braintree/Test/Mftf/Test/CreateAnAdminOrderUsingBraintreePaymentTest1.xml
@@ -53,7 +53,7 @@
-
+
diff --git a/app/code/Magento/Braintree/Test/Mftf/Test/CretateAdminOrderWithOnlinePaymentIncludingTaxAndDiscount.xml b/app/code/Magento/Braintree/Test/Mftf/Test/CretateAdminOrderWithOnlinePaymentIncludingTaxAndDiscount.xml
index 371b59418e4a9..d2b0479f2bba6 100644
--- a/app/code/Magento/Braintree/Test/Mftf/Test/CretateAdminOrderWithOnlinePaymentIncludingTaxAndDiscount.xml
+++ b/app/code/Magento/Braintree/Test/Mftf/Test/CretateAdminOrderWithOnlinePaymentIncludingTaxAndDiscount.xml
@@ -70,7 +70,7 @@
-
+
diff --git a/app/code/Magento/Braintree/Test/Unit/Gateway/Command/CaptureStrategyCommandTest.php b/app/code/Magento/Braintree/Test/Unit/Gateway/Command/CaptureStrategyCommandTest.php
index 845a02930d709..969894a20f9de 100644
--- a/app/code/Magento/Braintree/Test/Unit/Gateway/Command/CaptureStrategyCommandTest.php
+++ b/app/code/Magento/Braintree/Test/Unit/Gateway/Command/CaptureStrategyCommandTest.php
@@ -24,8 +24,6 @@
use PHPUnit_Framework_MockObject_MockObject as MockObject;
/**
- * Tests \Magento\Braintree\Gateway\Command\CaptureStrategyCommand.
- *
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class CaptureStrategyCommandTest extends \PHPUnit\Framework\TestCase
@@ -38,42 +36,42 @@ class CaptureStrategyCommandTest extends \PHPUnit\Framework\TestCase
/**
* @var CommandPoolInterface|MockObject
*/
- private $commandPoolMock;
+ private $commandPool;
/**
* @var TransactionRepositoryInterface|MockObject
*/
- private $transactionRepositoryMock;
+ private $transactionRepository;
/**
* @var FilterBuilder|MockObject
*/
- private $filterBuilderMock;
+ private $filterBuilder;
/**
* @var SearchCriteriaBuilder|MockObject
*/
- private $searchCriteriaBuilderMock;
+ private $searchCriteriaBuilder;
/**
* @var Payment|MockObject
*/
- private $paymentMock;
+ private $payment;
/**
* @var GatewayCommand|MockObject
*/
- private $commandMock;
+ private $command;
/**
* @var SubjectReader|MockObject
*/
- private $subjectReaderMock;
+ private $subjectReader;
/**
* @var BraintreeAdapter|MockObject
*/
- private $braintreeAdapterMock;
+ private $braintreeAdapter;
/**
* @var BraintreeSearchAdapter
@@ -82,12 +80,12 @@ class CaptureStrategyCommandTest extends \PHPUnit\Framework\TestCase
protected function setUp()
{
- $this->commandPoolMock = $this->getMockBuilder(CommandPoolInterface::class)
+ $this->commandPool = $this->getMockBuilder(CommandPoolInterface::class)
->disableOriginalConstructor()
->setMethods(['get', '__wakeup'])
->getMock();
- $this->subjectReaderMock = $this->getMockBuilder(SubjectReader::class)
+ $this->subjectReader = $this->getMockBuilder(SubjectReader::class)
->disableOriginalConstructor()
->getMock();
@@ -96,106 +94,60 @@ protected function setUp()
$this->initFilterBuilderMock();
$this->initSearchCriteriaBuilderMock();
- $this->braintreeAdapterMock = $this->getMockBuilder(BraintreeAdapter::class)
+ $this->braintreeAdapter = $this->getMockBuilder(BraintreeAdapter::class)
->disableOriginalConstructor()
->getMock();
- /** @var BraintreeAdapterFactory|MockObject $adapterFactoryMock */
- $adapterFactoryMock = $this->getMockBuilder(BraintreeAdapterFactory::class)
+ /** @var BraintreeAdapterFactory|MockObject $adapterFactory */
+ $adapterFactory = $this->getMockBuilder(BraintreeAdapterFactory::class)
->disableOriginalConstructor()
->getMock();
- $adapterFactoryMock->expects(self::any())
- ->method('create')
- ->willReturn($this->braintreeAdapterMock);
+ $adapterFactory->method('create')
+ ->willReturn($this->braintreeAdapter);
$this->braintreeSearchAdapter = new BraintreeSearchAdapter();
$this->strategyCommand = new CaptureStrategyCommand(
- $this->commandPoolMock,
- $this->transactionRepositoryMock,
- $this->filterBuilderMock,
- $this->searchCriteriaBuilderMock,
- $this->subjectReaderMock,
- $adapterFactoryMock,
+ $this->commandPool,
+ $this->transactionRepository,
+ $this->filterBuilder,
+ $this->searchCriteriaBuilder,
+ $this->subjectReader,
+ $adapterFactory,
$this->braintreeSearchAdapter
);
}
- /**
- * @covers \Magento\Braintree\Gateway\Command\CaptureStrategyCommand::execute
- */
- public function testSaleExecute()
- {
- $paymentData = $this->getPaymentDataObjectMock();
- $subject['payment'] = $paymentData;
-
- $this->subjectReaderMock->expects(self::once())
- ->method('readPayment')
- ->with($subject)
- ->willReturn($paymentData);
-
- $this->paymentMock->expects(static::once())
- ->method('getAuthorizationTransaction')
- ->willReturn(false);
-
- $this->paymentMock->expects(static::once())
- ->method('getId')
- ->willReturn(1);
-
- $this->buildSearchCriteria();
-
- $this->transactionRepositoryMock->expects(static::once())
- ->method('getTotalCount')
- ->willReturn(0);
-
- $this->commandPoolMock->expects(static::once())
- ->method('get')
- ->with(CaptureStrategyCommand::SALE)
- ->willReturn($this->commandMock);
-
- $this->strategyCommand->execute($subject);
- }
-
- /**
- * @covers \Magento\Braintree\Gateway\Command\CaptureStrategyCommand::execute
- */
public function testCaptureExecute()
{
$paymentData = $this->getPaymentDataObjectMock();
$subject['payment'] = $paymentData;
$lastTransId = 'txnds';
- $this->subjectReaderMock->expects(self::once())
- ->method('readPayment')
+ $this->subjectReader->method('readPayment')
->with($subject)
->willReturn($paymentData);
- $this->paymentMock->expects(static::once())
- ->method('getAuthorizationTransaction')
+ $this->payment->method('getAuthorizationTransaction')
->willReturn(true);
- $this->paymentMock->expects(static::once())
- ->method('getLastTransId')
+ $this->payment->method('getLastTransId')
->willReturn($lastTransId);
- $this->paymentMock->expects(static::once())
- ->method('getId')
+ $this->payment->method('getId')
->willReturn(1);
$this->buildSearchCriteria();
- $this->transactionRepositoryMock->expects(static::once())
- ->method('getTotalCount')
+ $this->transactionRepository->method('getTotalCount')
->willReturn(0);
// authorization transaction was not expired
$collection = $this->getNotExpiredExpectedCollection($lastTransId);
- $collection->expects(static::once())
- ->method('maximumCount')
+ $collection->method('maximumCount')
->willReturn(0);
- $this->commandPoolMock->expects(static::once())
- ->method('get')
+ $this->commandPool->method('get')
->with(CaptureStrategyCommand::CAPTURE)
- ->willReturn($this->commandMock);
+ ->willReturn($this->command);
$this->strategyCommand->execute($subject);
}
@@ -215,10 +167,9 @@ private function getNotExpiredExpectedCollection($lastTransactionId)
->disableOriginalConstructor()
->getMock();
- $this->braintreeAdapterMock->expects(static::once())
- ->method('search')
+ $this->braintreeAdapter->method('search')
->with(
- static::callback(
+ self::callback(
function (array $filters) use ($isExpectations) {
foreach ($filters as $filter) {
/** @var IsNode $filter */
@@ -240,82 +191,64 @@ function (array $filters) use ($isExpectations) {
return $collection;
}
- /**
- * @covers \Magento\Braintree\Gateway\Command\CaptureStrategyCommand::execute
- */
public function testExpiredAuthorizationPerformVaultCaptureExecute()
{
$paymentData = $this->getPaymentDataObjectMock();
$subject['payment'] = $paymentData;
$lastTransId = 'txnds';
- $this->subjectReaderMock->expects(self::once())
- ->method('readPayment')
+ $this->subjectReader->method('readPayment')
->with($subject)
->willReturn($paymentData);
- $this->paymentMock->expects(static::once())
- ->method('getAuthorizationTransaction')
+ $this->payment->method('getAuthorizationTransaction')
->willReturn(true);
- $this->paymentMock->expects(static::once())
- ->method('getLastTransId')
+ $this->payment->method('getLastTransId')
->willReturn($lastTransId);
- $this->paymentMock->expects(static::once())
- ->method('getId')
+ $this->payment->method('getId')
->willReturn(1);
$this->buildSearchCriteria();
- $this->transactionRepositoryMock->expects(static::once())
- ->method('getTotalCount')
+ $this->transactionRepository->method('getTotalCount')
->willReturn(0);
// authorization transaction was expired
$collection = $this->getNotExpiredExpectedCollection($lastTransId);
- $collection->expects(static::once())
- ->method('maximumCount')
+ $collection->method('maximumCount')
->willReturn(1);
- $this->commandPoolMock->expects(static::once())
- ->method('get')
+ $this->commandPool->method('get')
->with(CaptureStrategyCommand::VAULT_CAPTURE)
- ->willReturn($this->commandMock);
+ ->willReturn($this->command);
$this->strategyCommand->execute($subject);
}
- /**
- * @covers \Magento\Braintree\Gateway\Command\CaptureStrategyCommand::execute
- */
public function testVaultCaptureExecute()
{
$paymentData = $this->getPaymentDataObjectMock();
$subject['payment'] = $paymentData;
- $this->subjectReaderMock->expects(self::once())
- ->method('readPayment')
+ $this->subjectReader->method('readPayment')
->with($subject)
->willReturn($paymentData);
- $this->paymentMock->expects(static::once())
- ->method('getAuthorizationTransaction')
+ $this->payment->method('getAuthorizationTransaction')
->willReturn(true);
- $this->paymentMock->expects(static::once())
- ->method('getId')
+ $this->payment->method('getId')
->willReturn(1);
$this->buildSearchCriteria();
- $this->transactionRepositoryMock->expects(static::once())
- ->method('getTotalCount')
+ $this->transactionRepository->method('getTotalCount')
->willReturn(1);
- $this->commandPoolMock->expects(static::once())
- ->method('get')
+ $this->commandPool->method('get')
->with(CaptureStrategyCommand::VAULT_CAPTURE)
- ->willReturn($this->commandMock);
+ ->willReturn($this->command);
$this->strategyCommand->execute($subject);
}
@@ -326,7 +259,7 @@ public function testVaultCaptureExecute()
*/
private function getPaymentDataObjectMock()
{
- $this->paymentMock = $this->getMockBuilder(Payment::class)
+ $this->payment = $this->getMockBuilder(Payment::class)
->disableOriginalConstructor()
->getMock();
@@ -335,16 +268,15 @@ private function getPaymentDataObjectMock()
->disableOriginalConstructor()
->getMock();
- $mock->expects(static::once())
- ->method('getPayment')
- ->willReturn($this->paymentMock);
+ $mock->method('getPayment')
+ ->willReturn($this->payment);
- $orderMock = $this->getMockBuilder(OrderAdapterInterface::class)
+ $order = $this->getMockBuilder(OrderAdapterInterface::class)
->disableOriginalConstructor()
->getMock();
$mock->method('getOrder')
- ->willReturn($orderMock);
+ ->willReturn($order);
return $mock;
}
@@ -354,13 +286,12 @@ private function getPaymentDataObjectMock()
*/
private function initCommandMock()
{
- $this->commandMock = $this->getMockBuilder(GatewayCommand::class)
+ $this->command = $this->getMockBuilder(GatewayCommand::class)
->disableOriginalConstructor()
->setMethods(['execute'])
->getMock();
- $this->commandMock->expects(static::once())
- ->method('execute')
+ $this->command->method('execute')
->willReturn([]);
}
@@ -369,7 +300,7 @@ private function initCommandMock()
*/
private function initFilterBuilderMock()
{
- $this->filterBuilderMock = $this->getMockBuilder(FilterBuilder::class)
+ $this->filterBuilder = $this->getMockBuilder(FilterBuilder::class)
->disableOriginalConstructor()
->setMethods(['setField', 'setValue', 'create', '__wakeup'])
->getMock();
@@ -380,23 +311,21 @@ private function initFilterBuilderMock()
*/
private function buildSearchCriteria()
{
- $this->filterBuilderMock->expects(static::exactly(2))
+ $this->filterBuilder->expects(self::exactly(2))
->method('setField')
->willReturnSelf();
- $this->filterBuilderMock->expects(static::exactly(2))
+ $this->filterBuilder->expects(self::exactly(2))
->method('setValue')
->willReturnSelf();
$searchCriteria = new SearchCriteria();
- $this->searchCriteriaBuilderMock->expects(static::exactly(2))
+ $this->searchCriteriaBuilder->expects(self::exactly(2))
->method('addFilters')
->willReturnSelf();
- $this->searchCriteriaBuilderMock->expects(static::once())
- ->method('create')
+ $this->searchCriteriaBuilder->method('create')
->willReturn($searchCriteria);
- $this->transactionRepositoryMock->expects(static::once())
- ->method('getList')
+ $this->transactionRepository->method('getList')
->with($searchCriteria)
->willReturnSelf();
}
@@ -406,7 +335,7 @@ private function buildSearchCriteria()
*/
private function initSearchCriteriaBuilderMock()
{
- $this->searchCriteriaBuilderMock = $this->getMockBuilder(SearchCriteriaBuilder::class)
+ $this->searchCriteriaBuilder = $this->getMockBuilder(SearchCriteriaBuilder::class)
->disableOriginalConstructor()
->setMethods(['addFilters', 'create', '__wakeup'])
->getMock();
@@ -417,7 +346,7 @@ private function initSearchCriteriaBuilderMock()
*/
private function initTransactionRepositoryMock()
{
- $this->transactionRepositoryMock = $this->getMockBuilder(TransactionRepositoryInterface::class)
+ $this->transactionRepository = $this->getMockBuilder(TransactionRepositoryInterface::class)
->disableOriginalConstructor()
->setMethods(['getList', 'getTotalCount', 'delete', 'get', 'save', 'create', '__wakeup'])
->getMock();
diff --git a/app/code/Magento/Braintree/etc/config.xml b/app/code/Magento/Braintree/etc/config.xml
index 522d32302168e..b681100dc4dd0 100644
--- a/app/code/Magento/Braintree/etc/config.xml
+++ b/app/code/Magento/Braintree/etc/config.xml
@@ -15,6 +15,7 @@
0
1
1
+ 1
1
1
1
diff --git a/app/code/Magento/Braintree/view/frontend/web/js/view/payment/3d-secure.js b/app/code/Magento/Braintree/view/frontend/web/js/view/payment/3d-secure.js
index 43aec27508ce9..b66725c063414 100644
--- a/app/code/Magento/Braintree/view/frontend/web/js/view/payment/3d-secure.js
+++ b/app/code/Magento/Braintree/view/frontend/web/js/view/payment/3d-secure.js
@@ -117,7 +117,7 @@ define([
options.bin = context.paymentPayload.details.bin;
}
- if (shippingAddress) {
+ if (shippingAddress && this.isValidShippingAddress(shippingAddress)) {
options.additionalInformation = {
shippingGivenName: shippingAddress.firstname,
shippingSurname: shippingAddress.lastname,
@@ -206,6 +206,25 @@ define([
}
return false;
+ },
+
+ /**
+ * Validate shipping address
+ *
+ * @param {Object} shippingAddress
+ * @return {Boolean}
+ */
+ isValidShippingAddress: function (shippingAddress) {
+ var isValid = false;
+
+ // check that required fields are not empty
+ if (shippingAddress.firstname && shippingAddress.lastname && shippingAddress.telephone &&
+ shippingAddress.street && shippingAddress.city && shippingAddress.regionCode &&
+ shippingAddress.postcode && shippingAddress.countryId) {
+ isValid = true;
+ }
+
+ return isValid;
}
};
});
diff --git a/app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/cc-form.js b/app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/cc-form.js
index afe22475981ec..21809f186d252 100644
--- a/app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/cc-form.js
+++ b/app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/cc-form.js
@@ -91,7 +91,7 @@ define(
})
.then(function (hostedFieldsInstance) {
self.hostedFieldsInstance = hostedFieldsInstance;
- self.isPlaceOrderActionAllowed(true);
+ self.isPlaceOrderActionAllowed(false);
self.initFormValidationEvents(hostedFieldsInstance);
return self.hostedFieldsInstance;
diff --git a/app/code/Magento/Bundle/Helper/Data.php b/app/code/Magento/Bundle/Helper/Data.php
index dbd4a6a039c27..944876cbdad72 100644
--- a/app/code/Magento/Bundle/Helper/Data.php
+++ b/app/code/Magento/Bundle/Helper/Data.php
@@ -38,6 +38,6 @@ public function getAllowedSelectionTypes()
{
$configData = $this->config->getType(\Magento\Catalog\Model\Product\Type::TYPE_BUNDLE);
- return isset($configData['allowed_selection_types']) ? $configData['allowed_selection_types'] : [];
+ return $configData['allowed_selection_types'] ?? [];
}
}
diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/AdminAddBundleItemsTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/AdminAddBundleItemsTest.xml
index bf428440a24eb..2b6b139520f97 100644
--- a/app/code/Magento/Bundle/Test/Mftf/Test/AdminAddBundleItemsTest.xml
+++ b/app/code/Magento/Bundle/Test/Mftf/Test/AdminAddBundleItemsTest.xml
@@ -36,7 +36,7 @@
-
+
diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/AdminAddBundleProductToCartFromWishListPageTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/AdminAddBundleProductToCartFromWishListPageTest.xml
index b2d3c376d9b5a..1498e52850fd5 100644
--- a/app/code/Magento/Bundle/Test/Mftf/Test/AdminAddBundleProductToCartFromWishListPageTest.xml
+++ b/app/code/Magento/Bundle/Test/Mftf/Test/AdminAddBundleProductToCartFromWishListPageTest.xml
@@ -60,7 +60,7 @@
-
+
diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/AdminAssociateBundleProductToWebsitesTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/AdminAssociateBundleProductToWebsitesTest.xml
index b58637cf2e81d..823ad303c5455 100644
--- a/app/code/Magento/Bundle/Test/Mftf/Test/AdminAssociateBundleProductToWebsitesTest.xml
+++ b/app/code/Magento/Bundle/Test/Mftf/Test/AdminAssociateBundleProductToWebsitesTest.xml
@@ -82,7 +82,7 @@
-
+
diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/AdminCreateAndEditBundleProductSettingsTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/AdminCreateAndEditBundleProductSettingsTest.xml
index a80d5f040f825..b143bd63280ea 100644
--- a/app/code/Magento/Bundle/Test/Mftf/Test/AdminCreateAndEditBundleProductSettingsTest.xml
+++ b/app/code/Magento/Bundle/Test/Mftf/Test/AdminCreateAndEditBundleProductSettingsTest.xml
@@ -38,7 +38,7 @@
-
+
@@ -180,7 +180,7 @@
-
+
diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/AdminDeleteBundleDynamicProductTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/AdminDeleteBundleDynamicProductTest.xml
index 51821b136ba26..a3e9a8af40a34 100644
--- a/app/code/Magento/Bundle/Test/Mftf/Test/AdminDeleteBundleDynamicProductTest.xml
+++ b/app/code/Magento/Bundle/Test/Mftf/Test/AdminDeleteBundleDynamicProductTest.xml
@@ -29,7 +29,7 @@
-
+
diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/AdminDeleteBundleFixedProductTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/AdminDeleteBundleFixedProductTest.xml
index dcd53fff6f6dd..0c26fb1775bff 100644
--- a/app/code/Magento/Bundle/Test/Mftf/Test/AdminDeleteBundleFixedProductTest.xml
+++ b/app/code/Magento/Bundle/Test/Mftf/Test/AdminDeleteBundleFixedProductTest.xml
@@ -26,7 +26,7 @@
-
+
diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/AdminEditRelatedBundleProductTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/AdminEditRelatedBundleProductTest.xml
index 632ba194cf8de..fbb9dda50f0d9 100644
--- a/app/code/Magento/Bundle/Test/Mftf/Test/AdminEditRelatedBundleProductTest.xml
+++ b/app/code/Magento/Bundle/Test/Mftf/Test/AdminEditRelatedBundleProductTest.xml
@@ -70,6 +70,8 @@
+
+
diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/AdminProductBundleCreationTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/AdminProductBundleCreationTest.xml
index 78bc85da6f69b..7d82c6e5b43ad 100644
--- a/app/code/Magento/Bundle/Test/Mftf/Test/AdminProductBundleCreationTest.xml
+++ b/app/code/Magento/Bundle/Test/Mftf/Test/AdminProductBundleCreationTest.xml
@@ -33,7 +33,7 @@
-
+
diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/AdminShouldBeAbleToMassUpdateAttributesForBundleProductsTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/AdminShouldBeAbleToMassUpdateAttributesForBundleProductsTest.xml
index 994a10ae02692..173319affe53b 100644
--- a/app/code/Magento/Bundle/Test/Mftf/Test/AdminShouldBeAbleToMassUpdateAttributesForBundleProductsTest.xml
+++ b/app/code/Magento/Bundle/Test/Mftf/Test/AdminShouldBeAbleToMassUpdateAttributesForBundleProductsTest.xml
@@ -43,7 +43,7 @@
-
+
diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/BundleProductFixedPricingTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/BundleProductFixedPricingTest.xml
index 2b36458caa182..80920c2e6d851 100644
--- a/app/code/Magento/Bundle/Test/Mftf/Test/BundleProductFixedPricingTest.xml
+++ b/app/code/Magento/Bundle/Test/Mftf/Test/BundleProductFixedPricingTest.xml
@@ -35,7 +35,7 @@
-
+
diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/EnableDisableBundleProductStatusTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/EnableDisableBundleProductStatusTest.xml
index f73818a86a025..f1124e5446b58 100644
--- a/app/code/Magento/Bundle/Test/Mftf/Test/EnableDisableBundleProductStatusTest.xml
+++ b/app/code/Magento/Bundle/Test/Mftf/Test/EnableDisableBundleProductStatusTest.xml
@@ -31,7 +31,7 @@
-
+
diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontAddBundleOptionsToCartTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontAddBundleOptionsToCartTest.xml
index 7ad97a8991349..38926ccfbb7d6 100644
--- a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontAddBundleOptionsToCartTest.xml
+++ b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontAddBundleOptionsToCartTest.xml
@@ -48,7 +48,7 @@
-
+
diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontAddBundleProductWithZeroPriceToShoppingCartTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontAddBundleProductWithZeroPriceToShoppingCartTest.xml
index 64b786ac4ed7c..7ff88c49f0bc7 100644
--- a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontAddBundleProductWithZeroPriceToShoppingCartTest.xml
+++ b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontAddBundleProductWithZeroPriceToShoppingCartTest.xml
@@ -48,7 +48,7 @@
-
+
diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontBundleProductDetailsTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontBundleProductDetailsTest.xml
index cc0064e87c3c1..b174ee2ee3c70 100644
--- a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontBundleProductDetailsTest.xml
+++ b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontBundleProductDetailsTest.xml
@@ -34,7 +34,7 @@
-
+
diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontCheckBundleProductOptionTierPrices.xml b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontCheckBundleProductOptionTierPrices.xml
index 0487668c10094..4bb54436e8729 100644
--- a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontCheckBundleProductOptionTierPrices.xml
+++ b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontCheckBundleProductOptionTierPrices.xml
@@ -42,10 +42,9 @@
-
+
-
-
+
diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontCustomerSelectAndSetBundleOptionsTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontCustomerSelectAndSetBundleOptionsTest.xml
index dc8cb24246567..613187a4c3856 100644
--- a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontCustomerSelectAndSetBundleOptionsTest.xml
+++ b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontCustomerSelectAndSetBundleOptionsTest.xml
@@ -22,6 +22,8 @@
+
+
@@ -89,6 +91,10 @@
+
+
+
+
diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontEditBundleProductTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontEditBundleProductTest.xml
index 9dbd6e26bddc4..3a40a1b7eeb71 100644
--- a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontEditBundleProductTest.xml
+++ b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontEditBundleProductTest.xml
@@ -65,6 +65,8 @@
+
+
diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontSortBundleProductsByPriceTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontSortBundleProductsByPriceTest.xml
index 8bf0de7530e64..eaaa9c4356617 100644
--- a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontSortBundleProductsByPriceTest.xml
+++ b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontSortBundleProductsByPriceTest.xml
@@ -109,6 +109,9 @@
+
+
+
diff --git a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontVerifyDynamicBundleProductPricesForCombinationOfOptionsTest.xml b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontVerifyDynamicBundleProductPricesForCombinationOfOptionsTest.xml
index c78796d2fd8b4..896c4f8f25fec 100644
--- a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontVerifyDynamicBundleProductPricesForCombinationOfOptionsTest.xml
+++ b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontVerifyDynamicBundleProductPricesForCombinationOfOptionsTest.xml
@@ -192,7 +192,7 @@
-
+
diff --git a/app/code/Magento/BundleGraphQl/Model/Resolver/Options/Collection.php b/app/code/Magento/BundleGraphQl/Model/Resolver/Options/Collection.php
index 7608d6e9e4d97..c8e2384fcb99c 100644
--- a/app/code/Magento/BundleGraphQl/Model/Resolver/Options/Collection.php
+++ b/app/code/Magento/BundleGraphQl/Model/Resolver/Options/Collection.php
@@ -78,11 +78,7 @@ public function addParentFilterData(int $parentId, int $parentEntityId, string $
public function getOptionsByParentId(int $parentId) : array
{
$options = $this->fetch();
- if (!isset($options[$parentId])) {
- return [];
- }
-
- return $options[$parentId];
+ return $options[$parentId] ?? [];
}
/**
@@ -115,7 +111,7 @@ private function fetch() : array
$this->extensionAttributesJoinProcessor->process($optionsCollection);
if (empty($optionsCollection->getData())) {
- return null;
+ return [];
}
/** @var \Magento\Bundle\Model\Option $option */
diff --git a/app/code/Magento/Captcha/Observer/CheckContactUsFormObserver.php b/app/code/Magento/Captcha/Observer/CheckContactUsFormObserver.php
index 8c1da0e1ef104..2d0a6479bbcd6 100644
--- a/app/code/Magento/Captcha/Observer/CheckContactUsFormObserver.php
+++ b/app/code/Magento/Captcha/Observer/CheckContactUsFormObserver.php
@@ -3,34 +3,41 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
+declare(strict_types=1);
+
namespace Magento\Captcha\Observer;
+use Magento\Captcha\Helper\Data;
+use Magento\Framework\App\Action\Action;
+use Magento\Framework\App\ActionFlag;
+use Magento\Framework\App\Response\RedirectInterface;
+use Magento\Framework\Event\Observer;
use Magento\Framework\Event\ObserverInterface;
use Magento\Framework\App\Request\DataPersistorInterface;
-use Magento\Framework\App\ObjectManager;
+use Magento\Framework\Message\ManagerInterface;
/**
- * Class CheckContactUsFormObserver
+ * Check captcha on contact us form submit observer.
*/
class CheckContactUsFormObserver implements ObserverInterface
{
/**
- * @var \Magento\Captcha\Helper\Data
+ * @var Data
*/
protected $_helper;
/**
- * @var \Magento\Framework\App\ActionFlag
+ * @var ActionFlag
*/
protected $_actionFlag;
/**
- * @var \Magento\Framework\Message\ManagerInterface
+ * @var ManagerInterface
*/
protected $messageManager;
/**
- * @var \Magento\Framework\App\Response\RedirectInterface
+ * @var RedirectInterface
*/
protected $redirect;
@@ -45,60 +52,48 @@ class CheckContactUsFormObserver implements ObserverInterface
private $dataPersistor;
/**
- * @param \Magento\Captcha\Helper\Data $helper
- * @param \Magento\Framework\App\ActionFlag $actionFlag
- * @param \Magento\Framework\Message\ManagerInterface $messageManager
- * @param \Magento\Framework\App\Response\RedirectInterface $redirect
+ * @param Data $helper
+ * @param ActionFlag $actionFlag
+ * @param ManagerInterface $messageManager
+ * @param RedirectInterface $redirect
* @param CaptchaStringResolver $captchaStringResolver
+ * @param DataPersistorInterface $dataPersistor
*/
public function __construct(
- \Magento\Captcha\Helper\Data $helper,
- \Magento\Framework\App\ActionFlag $actionFlag,
- \Magento\Framework\Message\ManagerInterface $messageManager,
- \Magento\Framework\App\Response\RedirectInterface $redirect,
- CaptchaStringResolver $captchaStringResolver
+ Data $helper,
+ ActionFlag $actionFlag,
+ ManagerInterface $messageManager,
+ RedirectInterface $redirect,
+ CaptchaStringResolver $captchaStringResolver,
+ DataPersistorInterface $dataPersistor
) {
$this->_helper = $helper;
$this->_actionFlag = $actionFlag;
$this->messageManager = $messageManager;
$this->redirect = $redirect;
$this->captchaStringResolver = $captchaStringResolver;
+ $this->dataPersistor = $dataPersistor;
}
/**
* Check CAPTCHA on Contact Us page
*
- * @param \Magento\Framework\Event\Observer $observer
+ * @param Observer $observer
* @return void
*/
- public function execute(\Magento\Framework\Event\Observer $observer)
+ public function execute(Observer $observer)
{
$formId = 'contact_us';
$captcha = $this->_helper->getCaptcha($formId);
if ($captcha->isRequired()) {
- /** @var \Magento\Framework\App\Action\Action $controller */
+ /** @var Action $controller */
$controller = $observer->getControllerAction();
if (!$captcha->isCorrect($this->captchaStringResolver->resolve($controller->getRequest(), $formId))) {
$this->messageManager->addErrorMessage(__('Incorrect CAPTCHA.'));
- $this->getDataPersistor()->set($formId, $controller->getRequest()->getPostValue());
- $this->_actionFlag->set('', \Magento\Framework\App\Action\Action::FLAG_NO_DISPATCH, true);
+ $this->dataPersistor->set($formId, $controller->getRequest()->getPostValue());
+ $this->_actionFlag->set('', Action::FLAG_NO_DISPATCH, true);
$this->redirect->redirect($controller->getResponse(), 'contact/index/index');
}
}
}
-
- /**
- * Get Data Persistor
- *
- * @return DataPersistorInterface
- */
- private function getDataPersistor()
- {
- if ($this->dataPersistor === null) {
- $this->dataPersistor = ObjectManager::getInstance()
- ->get(DataPersistorInterface::class);
- }
-
- return $this->dataPersistor;
- }
}
diff --git a/app/code/Magento/Captcha/Observer/ResetAttemptForBackendObserver.php b/app/code/Magento/Captcha/Observer/ResetAttemptForBackendObserver.php
index 376bffbd9a6a5..165aef3d7f587 100644
--- a/app/code/Magento/Captcha/Observer/ResetAttemptForBackendObserver.php
+++ b/app/code/Magento/Captcha/Observer/ResetAttemptForBackendObserver.php
@@ -5,20 +5,27 @@
*/
namespace Magento\Captcha\Observer;
+use Magento\Captcha\Model\ResourceModel\Log;
+use Magento\Captcha\Model\ResourceModel\LogFactory;
+use Magento\Framework\Event\Observer;
use Magento\Framework\Event\ObserverInterface;
+use Magento\Framework\Exception\LocalizedException;
+/**
+ * Reset captcha attempts for Backend
+ */
class ResetAttemptForBackendObserver implements ObserverInterface
{
/**
- * @var \Magento\Captcha\Model\ResourceModel\LogFactory
+ * @var LogFactory
*/
public $resLogFactory;
/**
- * @param \Magento\Captcha\Model\ResourceModel\LogFactory $resLogFactory
+ * @param LogFactory $resLogFactory
*/
public function __construct(
- \Magento\Captcha\Model\ResourceModel\LogFactory $resLogFactory
+ LogFactory $resLogFactory
) {
$this->resLogFactory = $resLogFactory;
}
@@ -26,10 +33,11 @@ public function __construct(
/**
* Reset Attempts For Backend
*
- * @param \Magento\Framework\Event\Observer $observer
- * @return \Magento\Captcha\Observer\ResetAttemptForBackendObserver
+ * @param Observer $observer
+ * @return Log
+ * @throws LocalizedException
*/
- public function execute(\Magento\Framework\Event\Observer $observer)
+ public function execute(Observer $observer)
{
return $this->resLogFactory->create()->deleteUserAttempts($observer->getUser()->getUsername());
}
diff --git a/app/code/Magento/Captcha/Observer/ResetAttemptForFrontendObserver.php b/app/code/Magento/Captcha/Observer/ResetAttemptForFrontendObserver.php
index dedb57ad52581..e65793cd3508e 100644
--- a/app/code/Magento/Captcha/Observer/ResetAttemptForFrontendObserver.php
+++ b/app/code/Magento/Captcha/Observer/ResetAttemptForFrontendObserver.php
@@ -5,20 +5,28 @@
*/
namespace Magento\Captcha\Observer;
+use Magento\Captcha\Model\ResourceModel\Log;
+use Magento\Captcha\Model\ResourceModel\LogFactory;
+use Magento\Customer\Model\Customer;
+use Magento\Framework\Event\Observer;
use Magento\Framework\Event\ObserverInterface;
+use Magento\Framework\Exception\LocalizedException;
+/**
+ * Reset captcha attempts for Frontend
+ */
class ResetAttemptForFrontendObserver implements ObserverInterface
{
/**
- * @var \Magento\Captcha\Model\ResourceModel\LogFactory
+ * @var LogFactory
*/
public $resLogFactory;
/**
- * @param \Magento\Captcha\Model\ResourceModel\LogFactory $resLogFactory
+ * @param LogFactory $resLogFactory
*/
public function __construct(
- \Magento\Captcha\Model\ResourceModel\LogFactory $resLogFactory
+ LogFactory $resLogFactory
) {
$this->resLogFactory = $resLogFactory;
}
@@ -26,12 +34,13 @@ public function __construct(
/**
* Reset Attempts For Frontend
*
- * @param \Magento\Framework\Event\Observer $observer
- * @return \Magento\Captcha\Observer\ResetAttemptForFrontendObserver
+ * @param Observer $observer
+ * @return Log
+ * @throws LocalizedException
*/
- public function execute(\Magento\Framework\Event\Observer $observer)
+ public function execute(Observer $observer)
{
- /** @var \Magento\Customer\Model\Customer $model */
+ /** @var Customer $model */
$model = $observer->getModel();
return $this->resLogFactory->create()->deleteUserAttempts($model->getEmail());
diff --git a/app/code/Magento/Captcha/Test/Unit/Observer/CheckContactUsFormObserverTest.php b/app/code/Magento/Captcha/Test/Unit/Observer/CheckContactUsFormObserverTest.php
index 83bfb2910f9f8..6bb21e9432d70 100644
--- a/app/code/Magento/Captcha/Test/Unit/Observer/CheckContactUsFormObserverTest.php
+++ b/app/code/Magento/Captcha/Test/Unit/Observer/CheckContactUsFormObserverTest.php
@@ -5,94 +5,108 @@
*/
namespace Magento\Captcha\Test\Unit\Observer;
+use Magento\Captcha\Helper\Data;
+use Magento\Captcha\Model\DefaultModel;
+use Magento\Captcha\Observer\CaptchaStringResolver;
+use Magento\Captcha\Observer\CheckContactUsFormObserver;
+use Magento\Framework\App\Action\Action;
+use Magento\Framework\App\ActionFlag;
+use Magento\Framework\App\Request\DataPersistorInterface;
+use Magento\Framework\App\Request\Http;
+use Magento\Framework\App\Response\RedirectInterface;
+use Magento\Framework\Event\Observer;
+use Magento\Framework\Message\ManagerInterface;
+use Magento\Framework\Session\SessionManager;
+use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
+use PHPUnit\Framework\MockObject\MockObject;
+use PHPUnit\Framework\TestCase;
+
/**
+ * Test class for \Magento\Captcha\Observer\CheckContactUsFormObserver
+ *
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class CheckContactUsFormObserverTest extends \PHPUnit\Framework\TestCase
+class CheckContactUsFormObserverTest extends TestCase
{
/**
- * @var \Magento\Captcha\Observer\CheckContactUsFormObserver
+ * @var ObjectManager
*/
- protected $checkContactUsFormObserver;
+ private $objectManagerHelper;
/**
- * @var \Magento\Captcha\Helper\Data|\PHPUnit_Framework_MockObject_MockObject
+ * @var CheckContactUsFormObserver
*/
- protected $helperMock;
+ private $checkContactUsFormObserver;
/**
- * @var \Magento\Framework\App\ActionFlag|\PHPUnit_Framework_MockObject_MockObject
+ * @var Data|MockObject
*/
- protected $actionFlagMock;
+ private $helperMock;
- /*
- * @var \Magento\Framework\Message\ManagerInterface|\PHPUnit_Framework_MockObject_MockObject
+ /**
+ * @var ActionFlag|MockObject
*/
- protected $messageManagerMock;
+ private $actionFlagMock;
/**
- * @var \Magento\Framework\App\Response\RedirectInterface|\PHPUnit_Framework_MockObject_MockObject
+ * @var ManagerInterface|MockObject
*/
- protected $redirectMock;
+ private $messageManagerMock;
/**
- * @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager
+ * @var RedirectInterface|MockObject
*/
- protected $objectManagerHelper;
+ private $redirectMock;
/**
- * @var \Magento\Captcha\Observer\CaptchaStringResolver|\PHPUnit_Framework_MockObject_MockObject
+ * @var CaptchaStringResolver|MockObject
*/
- protected $captchaStringResolverMock;
+ private $captchaStringResolverMock;
/**
- * @var \Magento\Framework\Session\SessionManager|\PHPUnit_Framework_MockObject_MockObject
+ * @var DataPersistorInterface|MockObject
*/
- protected $sessionMock;
+ private $dataPersistorMock;
/**
- * @var \Magento\Captcha\Model\DefaultModel|\PHPUnit_Framework_MockObject_MockObject
+ * @var SessionManager|MockObject
*/
- protected $captchaMock;
+ private $sessionMock;
/**
- * @var \Magento\Framework\App\Request\DataPersistorInterface|\PHPUnit_Framework_MockObject_MockObject
+ * @var DefaultModel|MockObject
*/
- protected $dataPersistorMock;
+ private $captchaMock;
protected function setUp()
{
- $this->objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
+ $this->objectManagerHelper = new ObjectManager($this);
+
+ $this->helperMock = $this->createMock(Data::class);
+ $this->actionFlagMock = $this->createMock(ActionFlag::class);
+ $this->messageManagerMock = $this->createMock(ManagerInterface::class);
+ $this->redirectMock = $this->createMock(RedirectInterface::class);
+ $this->captchaStringResolverMock = $this->createMock(CaptchaStringResolver::class);
+ $this->dataPersistorMock = $this->getMockBuilder(DataPersistorInterface::class)
+ ->getMockForAbstractClass();
- $this->helperMock = $this->createMock(\Magento\Captcha\Helper\Data::class);
- $this->actionFlagMock = $this->createMock(\Magento\Framework\App\ActionFlag::class);
- $this->messageManagerMock = $this->createMock(\Magento\Framework\Message\ManagerInterface::class);
- $this->redirectMock = $this->createMock(\Magento\Framework\App\Response\RedirectInterface::class);
- $this->captchaStringResolverMock = $this->createMock(\Magento\Captcha\Observer\CaptchaStringResolver::class);
$this->sessionMock = $this->createPartialMock(
- \Magento\Framework\Session\SessionManager::class,
+ SessionManager::class,
['addErrorMessage']
);
- $this->dataPersistorMock = $this->getMockBuilder(\Magento\Framework\App\Request\DataPersistorInterface::class)
- ->getMockForAbstractClass();
+ $this->captchaMock = $this->createMock(DefaultModel::class);
$this->checkContactUsFormObserver = $this->objectManagerHelper->getObject(
- \Magento\Captcha\Observer\CheckContactUsFormObserver::class,
+ CheckContactUsFormObserver::class,
[
'helper' => $this->helperMock,
'actionFlag' => $this->actionFlagMock,
'messageManager' => $this->messageManagerMock,
'redirect' => $this->redirectMock,
- 'captchaStringResolver' => $this->captchaStringResolverMock
+ 'captchaStringResolver' => $this->captchaStringResolverMock,
+ 'dataPersistor' => $this->dataPersistorMock
]
);
- $this->objectManagerHelper->setBackwardCompatibleProperty(
- $this->checkContactUsFormObserver,
- 'dataPersistor',
- $this->dataPersistorMock
- );
-
- $this->captchaMock = $this->createMock(\Magento\Captcha\Model\DefaultModel::class);
}
public function testCheckContactUsFormWhenCaptchaIsRequiredAndValid()
@@ -100,14 +114,13 @@ public function testCheckContactUsFormWhenCaptchaIsRequiredAndValid()
$formId = 'contact_us';
$captchaValue = 'some-value';
- $controller = $this->createMock(\Magento\Framework\App\Action\Action::class);
- $request = $this->createMock(\Magento\Framework\App\Request\Http::class);
- $request->expects($this->any())
- ->method('getPost')
- ->with(\Magento\Captcha\Helper\Data::INPUT_NAME_FIELD_VALUE, null)
+ $controller = $this->createMock(Action::class);
+ $request = $this->createMock(Http::class);
+ $request->method('getPost')
+ ->with(Data::INPUT_NAME_FIELD_VALUE, null)
->willReturn([$formId => $captchaValue]);
- $controller->expects($this->any())->method('getRequest')->willReturn($request);
- $this->captchaMock->expects($this->any())->method('isRequired')->willReturn(true);
+ $controller->method('getRequest')->willReturn($request);
+ $this->captchaMock->method('isRequired')->willReturn(true);
$this->captchaMock->expects($this->once())
->method('isCorrect')
->with($captchaValue)
@@ -116,13 +129,13 @@ public function testCheckContactUsFormWhenCaptchaIsRequiredAndValid()
->method('resolve')
->with($request, $formId)
->willReturn($captchaValue);
- $this->helperMock->expects($this->any())
- ->method('getCaptcha')
- ->with($formId)->willReturn($this->captchaMock);
+ $this->helperMock->method('getCaptcha')
+ ->with($formId)
+ ->willReturn($this->captchaMock);
$this->sessionMock->expects($this->never())->method('addErrorMessage');
$this->checkContactUsFormObserver->execute(
- new \Magento\Framework\Event\Observer(['controller_action' => $controller])
+ new Observer(['controller_action' => $controller])
);
}
@@ -135,11 +148,10 @@ public function testCheckContactUsFormRedirectsCustomerWithWarningMessageWhenCap
$redirectUrl = 'http://magento.com/contacts/';
$postData = ['name' => 'Some Name'];
- $request = $this->createMock(\Magento\Framework\App\Request\Http::class);
+ $request = $this->createMock(Http::class);
$response = $this->createMock(\Magento\Framework\App\Response\Http::class);
- $request->expects($this->any())
- ->method('getPost')
- ->with(\Magento\Captcha\Helper\Data::INPUT_NAME_FIELD_VALUE, null)
+ $request->method('getPost')
+ ->with(Data::INPUT_NAME_FIELD_VALUE, null)
->willReturn([$formId => $captchaValue]);
$request->expects($this->once())
->method('getPostValue')
@@ -150,10 +162,10 @@ public function testCheckContactUsFormRedirectsCustomerWithWarningMessageWhenCap
->with($response, $redirectRoutePath, [])
->willReturn($redirectUrl);
- $controller = $this->createMock(\Magento\Framework\App\Action\Action::class);
- $controller->expects($this->any())->method('getRequest')->willReturn($request);
- $controller->expects($this->any())->method('getResponse')->willReturn($response);
- $this->captchaMock->expects($this->any())->method('isRequired')->willReturn(true);
+ $controller = $this->createMock(Action::class);
+ $controller->method('getRequest')->willReturn($request);
+ $controller->method('getResponse')->willReturn($response);
+ $this->captchaMock->method('isRequired')->willReturn(true);
$this->captchaMock->expects($this->once())
->method('isCorrect')
->with($captchaValue)
@@ -162,32 +174,32 @@ public function testCheckContactUsFormRedirectsCustomerWithWarningMessageWhenCap
->method('resolve')
->with($request, $formId)
->willReturn($captchaValue);
- $this->helperMock->expects($this->any())
- ->method('getCaptcha')
+ $this->helperMock->method('getCaptcha')
->with($formId)
->willReturn($this->captchaMock);
- $this->messageManagerMock->expects($this->once())->method('addErrorMessage')->with($warningMessage);
+ $this->messageManagerMock->expects($this->once())
+ ->method('addErrorMessage')
+ ->with($warningMessage);
$this->actionFlagMock->expects($this->once())
->method('set')
- ->with('', \Magento\Framework\App\Action\Action::FLAG_NO_DISPATCH, true);
+ ->with('', Action::FLAG_NO_DISPATCH, true);
$this->dataPersistorMock->expects($this->once())
->method('set')
->with($formId, $postData);
$this->checkContactUsFormObserver->execute(
- new \Magento\Framework\Event\Observer(['controller_action' => $controller])
+ new Observer(['controller_action' => $controller])
);
}
public function testCheckContactUsFormDoesNotCheckCaptchaWhenItIsNotRequired()
{
- $this->helperMock->expects($this->any())
- ->method('getCaptcha')
+ $this->helperMock->method('getCaptcha')
->with('contact_us')
->willReturn($this->captchaMock);
- $this->captchaMock->expects($this->any())->method('isRequired')->willReturn(false);
+ $this->captchaMock->method('isRequired')->willReturn(false);
$this->captchaMock->expects($this->never())->method('isCorrect');
- $this->checkContactUsFormObserver->execute(new \Magento\Framework\Event\Observer());
+ $this->checkContactUsFormObserver->execute(new Observer());
}
}
diff --git a/app/code/Magento/Captcha/Test/Unit/Observer/CheckUserForgotPasswordBackendObserverTest.php b/app/code/Magento/Captcha/Test/Unit/Observer/CheckUserForgotPasswordBackendObserverTest.php
new file mode 100644
index 0000000000000..584e7eb2e215f
--- /dev/null
+++ b/app/code/Magento/Captcha/Test/Unit/Observer/CheckUserForgotPasswordBackendObserverTest.php
@@ -0,0 +1,230 @@
+helperMock = $this->createMock(DataHelper::class);
+ $this->captchaStringResolverMock = $this->createMock(CaptchaStringResolver::class);
+ $this->sessionMock = $this->getMockBuilder(SessionManagerInterface::class)
+ ->setMethods(['setEmail'])
+ ->getMockForAbstractClass();
+ $this->actionFlagMock = $this->createMock(ActionFlag::class);
+ $this->messageManagerMock = $this->createMock(ManagerInterface::class);
+
+ $objectManager = new ObjectManagerHelper($this);
+ $this->observer = $objectManager->getObject(
+ CheckUserForgotPasswordBackendObserver::class,
+ [
+ '_helper' => $this->helperMock,
+ 'captchaStringResolver' => $this->captchaStringResolverMock,
+ '_session' => $this->sessionMock,
+ '_actionFlag' => $this->actionFlagMock,
+ 'messageManager' => $this->messageManagerMock
+ ]
+ );
+
+ $this->captchaMock = $this->getMockBuilder(CaptchaInterface::class)
+ ->setMethods(['isRequired', 'isCorrect'])
+ ->getMockForAbstractClass();
+ $this->helperMock->expects($this->once())
+ ->method('getCaptcha')
+ ->with($formId)
+ ->willReturn($this->captchaMock);
+
+ $this->requestMock = $this->createMock(HttpRequest::class);
+ $this->httpResponseMock = $this->createMock(HttpResponse::class);
+
+ $this->controllerMock = $this->getMockBuilder(Action::class)
+ ->disableOriginalConstructor()
+ ->setMethods(['getUrl', 'getRequest', 'getResponse'])
+ ->getMockForAbstractClass();
+ $this->controllerMock->expects($this->any())
+ ->method('getRequest')
+ ->willReturn($this->requestMock);
+ $this->controllerMock->expects($this->any())
+ ->method('getResponse')
+ ->willReturn($this->httpResponseMock);
+
+ $this->eventObserverMock = $this->createPartialMock(Observer::class, ['getControllerAction']);
+ $this->eventObserverMock->expects($this->any())
+ ->method('getControllerAction')
+ ->willReturn($this->controllerMock);
+ }
+
+ /**
+ * Test case when Captcha is required and was entered correctly.
+ */
+ public function testExecuteWhenCaptchaIsCorrect()
+ {
+ $this->configureRequestMockWithStubValues();
+ $this->captchaMock->expects($this->once())->method('isRequired')->willReturn(true);
+ $this->captchaMock->expects($this->once())->method('isCorrect')->willReturn(true);
+
+ $this->executeOriginalMethodExpectsNoError();
+ }
+
+ /**
+ * Test case when Captcha is required and was entered incorrectly.
+ */
+ public function testExecuteWhenCaptchaIsIncorrect()
+ {
+ $this->configureRequestMockWithStubValues();
+ $this->captchaMock->expects($this->once())->method('isRequired')->willReturn(true);
+ $this->captchaMock->expects($this->once())->method('isCorrect')->willReturn(false);
+
+ $this->sessionMock->expects($this->once())->method('setEmail');
+ $this->actionFlagMock->expects($this->once())->method('set');
+ $this->controllerMock->expects($this->once())->method('getUrl');
+ $this->messageManagerMock->expects($this->once())
+ ->method('addErrorMessage')
+ ->with(__('Incorrect CAPTCHA'));
+ $this->httpResponseMock->expects($this->once())->method('setRedirect')->willReturnSelf();
+
+ $this->observer->execute($this->eventObserverMock);
+ }
+
+ /**
+ * Test case when Captcha is not required.
+ */
+ public function testExecuteWhenCaptchaIsNotRequired()
+ {
+ $this->configureRequestMockWithStubValues();
+ $this->captchaMock->expects($this->once())->method('isRequired')->willReturn(false);
+
+ $this->executeOriginalMethodExpectsNoError();
+ }
+
+ /**
+ * Test case when email is not provided
+ */
+ public function testExecuteWhenEmailParamIsNotPresent()
+ {
+ $this->requestMock->expects($this->any())
+ ->method('getParam')
+ ->with('email')
+ ->willReturn(null);
+ $this->requestMock->expects($this->any())
+ ->method('getParams')
+ ->willReturn(self::STUB_REQUEST_PARAMS);
+ $this->captchaMock->expects($this->never())->method('isRequired');
+ $this->captchaMock->expects($this->never())->method('isCorrect');
+
+ $this->executeOriginalMethodExpectsNoError();
+ }
+
+ /**
+ * Stub params for Request Mock
+ */
+ private function configureRequestMockWithStubValues()
+ {
+ $this->requestMock->expects($this->any())
+ ->method('getParam')
+ ->with('email')
+ ->willReturn(self::STUB_EMAIL);
+ $this->requestMock->expects($this->any())
+ ->method('getParams')
+ ->willReturn(self::STUB_REQUEST_PARAMS);
+ }
+
+ /**
+ * Run original method, expect there is no error
+ */
+ private function executeOriginalMethodExpectsNoError()
+ {
+ $this->messageManagerMock->expects($this->never())->method('addErrorMessage');
+ $this->httpResponseMock->expects($this->never())->method('setRedirect');
+
+ $this->observer->execute($this->eventObserverMock);
+ }
+}
diff --git a/app/code/Magento/Captcha/Test/Unit/Observer/ResetAttemptForBackendObserverTest.php b/app/code/Magento/Captcha/Test/Unit/Observer/ResetAttemptForBackendObserverTest.php
new file mode 100644
index 0000000000000..b984daa8998f3
--- /dev/null
+++ b/app/code/Magento/Captcha/Test/Unit/Observer/ResetAttemptForBackendObserverTest.php
@@ -0,0 +1,53 @@
+createMock(Log::class);
+ $logMock->expects($this->once())->method('deleteUserAttempts')->willReturnSelf();
+
+ $resLogFactoryMock = $this->createMock(LogFactory::class);
+ $resLogFactoryMock->expects($this->once())
+ ->method('create')
+ ->willReturn($logMock);
+
+ /** @var MockObject|Observer $eventObserverMock */
+ $eventObserverMock = $this->createPartialMock(Observer::class, ['getUser']);
+ $eventMock = $this->createMock(Event::class);
+ $eventObserverMock->expects($this->once())
+ ->method('getUser')
+ ->willReturn($eventMock);
+
+ $objectManager = new ObjectManagerHelper($this);
+ /** @var ResetAttemptForBackendObserver $observer */
+ $observer = $objectManager->getObject(
+ ResetAttemptForBackendObserver::class,
+ ['resLogFactory' => $resLogFactoryMock]
+ );
+ $this->assertInstanceOf(Log::class, $observer->execute($eventObserverMock));
+ }
+}
diff --git a/app/code/Magento/Captcha/Test/Unit/Observer/ResetAttemptForFrontendObserverTest.php b/app/code/Magento/Captcha/Test/Unit/Observer/ResetAttemptForFrontendObserverTest.php
new file mode 100644
index 0000000000000..11866c266845e
--- /dev/null
+++ b/app/code/Magento/Captcha/Test/Unit/Observer/ResetAttemptForFrontendObserverTest.php
@@ -0,0 +1,52 @@
+createMock(Log::class);
+ $logMock->expects($this->once())->method('deleteUserAttempts')->willReturnSelf();
+
+ $resLogFactoryMock = $this->createMock(LogFactory::class);
+ $resLogFactoryMock->expects($this->once())
+ ->method('create')
+ ->willReturn($logMock);
+
+ /** @var MockObject|Observer $eventObserverMock */
+ $eventObserverMock = $this->createPartialMock(Observer::class, ['getModel']);
+ $eventObserverMock->expects($this->once())
+ ->method('getModel')
+ ->willReturn($this->createMock(Customer::class));
+
+ $objectManager = new ObjectManagerHelper($this);
+ /** @var ResetAttemptForFrontendObserver $observer */
+ $observer = $objectManager->getObject(
+ ResetAttemptForFrontendObserver::class,
+ ['resLogFactory' => $resLogFactoryMock]
+ );
+ $this->assertInstanceOf(Log::class, $observer->execute($eventObserverMock));
+ }
+}
diff --git a/app/code/Magento/CardinalCommerce/Test/Mftf/Test/AdminCardinalCommerceSettingsHiddenTest.xml b/app/code/Magento/CardinalCommerce/Test/Mftf/Test/AdminCardinalCommerceSettingsHiddenTest.xml
index c891a578cdcca..16f2774e22ccd 100644
--- a/app/code/Magento/CardinalCommerce/Test/Mftf/Test/AdminCardinalCommerceSettingsHiddenTest.xml
+++ b/app/code/Magento/CardinalCommerce/Test/Mftf/Test/AdminCardinalCommerceSettingsHiddenTest.xml
@@ -11,6 +11,7 @@
+
@@ -21,7 +22,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Api/CategoryListDeleteBySkuInterface.php b/app/code/Magento/Catalog/Api/CategoryListDeleteBySkuInterface.php
new file mode 100644
index 0000000000000..62eba5987c35d
--- /dev/null
+++ b/app/code/Magento/Catalog/Api/CategoryListDeleteBySkuInterface.php
@@ -0,0 +1,27 @@
+_customerGroups[$groupId]) ? $this->_customerGroups[$groupId] : [];
+ return $this->_customerGroups[$groupId] ?? [];
}
return $this->_customerGroups;
diff --git a/app/code/Magento/Catalog/Block/Product/ImageFactory.php b/app/code/Magento/Catalog/Block/Product/ImageFactory.php
index 172cd794edfb9..0c69a40b246bb 100644
--- a/app/code/Magento/Catalog/Block/Product/ImageFactory.php
+++ b/app/code/Magento/Catalog/Block/Product/ImageFactory.php
@@ -123,7 +123,7 @@ private function getLabel(Product $product, string $imageType): string
if (empty($label)) {
$label = $product->getName();
}
- return (string) $label;
+ return (string)$label;
}
/**
@@ -161,7 +161,7 @@ public function create(Product $product, string $imageId, array $attributes = nu
}
$attributes = $attributes === null ? [] : $attributes;
-
+
$data = [
'data' => [
'template' => 'Magento_Catalog::product/image_with_borders.phtml',
@@ -169,7 +169,7 @@ public function create(Product $product, string $imageId, array $attributes = nu
'width' => $imageMiscParams['image_width'],
'height' => $imageMiscParams['image_height'],
'label' => $this->getLabel($product, $imageMiscParams['image_type']),
- 'ratio' => $this->getRatio($imageMiscParams['image_width'], $imageMiscParams['image_height']),
+ 'ratio' => $this->getRatio($imageMiscParams['image_width'] ?? 0, $imageMiscParams['image_height'] ?? 0),
'custom_attributes' => $this->getStringCustomAttributes($attributes),
'class' => $this->getClass($attributes),
'product_id' => $product->getId()
diff --git a/app/code/Magento/Catalog/Model/CategoryLinkRepository.php b/app/code/Magento/Catalog/Model/CategoryLinkRepository.php
index fb0ea680569a8..f8de9a37f4ed7 100644
--- a/app/code/Magento/Catalog/Model/CategoryLinkRepository.php
+++ b/app/code/Magento/Catalog/Model/CategoryLinkRepository.php
@@ -6,10 +6,19 @@
namespace Magento\Catalog\Model;
-use Magento\Framework\Exception\InputException;
+use Magento\Catalog\Api\CategoryLinkRepositoryInterface;
+use Magento\Catalog\Api\CategoryListDeleteBySkuInterface;
+use Magento\Catalog\Api\CategoryRepositoryInterface;
+use Magento\Catalog\Api\ProductRepositoryInterface;
+use Magento\Catalog\Model\ResourceModel\Product;
+use Magento\Framework\App\ObjectManager;
use Magento\Framework\Exception\CouldNotSaveException;
+use Magento\Framework\Exception\InputException;
-class CategoryLinkRepository implements \Magento\Catalog\Api\CategoryLinkRepositoryInterface
+/**
+ * @inheritdoc
+ */
+class CategoryLinkRepository implements CategoryLinkRepositoryInterface, CategoryListDeleteBySkuInterface
{
/**
* @var CategoryRepository
@@ -17,24 +26,32 @@ class CategoryLinkRepository implements \Magento\Catalog\Api\CategoryLinkReposit
protected $categoryRepository;
/**
- * @var \Magento\Catalog\Api\ProductRepositoryInterface
+ * @var ProductRepositoryInterface
*/
protected $productRepository;
/**
- * @param \Magento\Catalog\Api\CategoryRepositoryInterface $categoryRepository
- * @param \Magento\Catalog\Api\ProductRepositoryInterface $productRepository
+ * @var Product
+ */
+ private $productResource;
+
+ /**
+ * @param CategoryRepositoryInterface $categoryRepository
+ * @param ProductRepositoryInterface $productRepository
+ * @param Product $productResource
*/
public function __construct(
- \Magento\Catalog\Api\CategoryRepositoryInterface $categoryRepository,
- \Magento\Catalog\Api\ProductRepositoryInterface $productRepository
+ CategoryRepositoryInterface $categoryRepository,
+ ProductRepositoryInterface $productRepository,
+ Product $productResource = null
) {
$this->categoryRepository = $categoryRepository;
$this->productRepository = $productRepository;
+ $this->productResource = $productResource ?? ObjectManager::getInstance()->get(Product::class);
}
/**
- * {@inheritdoc}
+ * @inheritdoc
*/
public function save(\Magento\Catalog\Api\Data\CategoryProductLinkInterface $productLink)
{
@@ -60,7 +77,7 @@ public function save(\Magento\Catalog\Api\Data\CategoryProductLinkInterface $pro
}
/**
- * {@inheritdoc}
+ * @inheritdoc
*/
public function delete(\Magento\Catalog\Api\Data\CategoryProductLinkInterface $productLink)
{
@@ -68,7 +85,7 @@ public function delete(\Magento\Catalog\Api\Data\CategoryProductLinkInterface $p
}
/**
- * {@inheritdoc}
+ * @inheritdoc
*/
public function deleteByIds($categoryId, $sku)
{
@@ -101,4 +118,44 @@ public function deleteByIds($categoryId, $sku)
}
return true;
}
+
+ /**
+ * @inheritdoc
+ */
+ public function deleteBySkus(int $categoryId, array $productSkuList): bool
+ {
+ $category = $this->categoryRepository->get($categoryId);
+ $products = $this->productResource->getProductsIdsBySkus($productSkuList);
+
+ if (!$products) {
+ throw new InputException(__("The category doesn't contain the specified products."));
+ }
+
+ $productPositions = $category->getProductsPosition();
+
+ foreach ($products as $productId) {
+ if (isset($productPositions[$productId])) {
+ unset($productPositions[$productId]);
+ }
+ }
+
+ $category->setPostedProducts($productPositions);
+
+ try {
+ $category->save();
+ } catch (\Exception $e) {
+ throw new CouldNotSaveException(
+ __(
+ 'Could not save products "%products" to category %category',
+ [
+ "products" => implode(',', $productSkuList),
+ "category" => $category->getId()
+ ]
+ ),
+ $e
+ );
+ }
+
+ return true;
+ }
}
diff --git a/app/code/Magento/Catalog/Model/Product.php b/app/code/Magento/Catalog/Model/Product.php
index 12444c9cce202..a9907c1661bd8 100644
--- a/app/code/Magento/Catalog/Model/Product.php
+++ b/app/code/Magento/Catalog/Model/Product.php
@@ -10,6 +10,7 @@
use Magento\Catalog\Api\Data\ProductInterface;
use Magento\Catalog\Api\ProductLinkRepositoryInterface;
use Magento\Catalog\Model\Product\Attribute\Backend\Media\EntryConverterPool;
+use Magento\Catalog\Model\Product\Configuration\Item\Option\OptionInterface;
use Magento\Catalog\Model\FilterProductCustomAttribute;
use Magento\Framework\Api\AttributeValueFactory;
use Magento\Framework\App\Filesystem\DirectoryList;
@@ -108,7 +109,7 @@ class Product extends \Magento\Catalog\Model\AbstractModel implements
/**
* Product object customization (not stored in DB)
*
- * @var array
+ * @var OptionInterface[]
*/
protected $_customOptions = [];
@@ -2062,7 +2063,7 @@ public function addCustomOption($code, $value, $product = null)
/**
* Sets custom options for the product
*
- * @param array $options Array of options
+ * @param OptionInterface[] $options Array of options
* @return void
*/
public function setCustomOptions(array $options)
@@ -2073,7 +2074,7 @@ public function setCustomOptions(array $options)
/**
* Get all custom options of the product
*
- * @return array
+ * @return OptionInterface[]
*/
public function getCustomOptions()
{
@@ -2084,14 +2085,11 @@ public function getCustomOptions()
* Get product custom option info
*
* @param string $code
- * @return array
+ * @return OptionInterface|null
*/
public function getCustomOption($code)
{
- if (isset($this->_customOptions[$code])) {
- return $this->_customOptions[$code];
- }
- return null;
+ return $this->_customOptions[$code] ?? null;
}
/**
@@ -2101,11 +2099,7 @@ public function getCustomOption($code)
*/
public function hasCustomOptions()
{
- if (count($this->_customOptions)) {
- return true;
- } else {
- return false;
- }
+ return (bool)count($this->_customOptions);
}
/**
@@ -2405,16 +2399,14 @@ public function reloadPriceInfo()
}
}
- // phpcs:disable PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames
/**
* Return Data Object data in array format.
*
* @return array
* @todo refactor with converter for AbstractExtensibleModel
*/
- public function __toArray()
+ public function __toArray() //phpcs:ignore PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames
{
- // phpcs:enable PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames
$data = $this->_data;
$hasToArray = function ($model) {
return is_object($model) && method_exists($model, '__toArray') && is_callable([$model, '__toArray']);
diff --git a/app/code/Magento/Catalog/Model/Product/Attribute/Source/Status.php b/app/code/Magento/Catalog/Model/Product/Attribute/Source/Status.php
index 24abb8471d477..0da6da94fde5c 100644
--- a/app/code/Magento/Catalog/Model/Product/Attribute/Source/Status.php
+++ b/app/code/Magento/Catalog/Model/Product/Attribute/Source/Status.php
@@ -37,8 +37,7 @@ public function getVisibleStatusIds()
}
/**
- * Retrieve Saleable Status Ids
- * Default Product Enable status
+ * Retrieve Saleable Status Ids, default Product Enable status
*
* @return int[]
*/
@@ -51,6 +50,7 @@ public function getSaleableStatusIds()
* Retrieve option array
*
* @return string[]
+ * phpcs:disable Magento2.Functions.StaticFunction
*/
public static function getOptionArray()
{
@@ -83,7 +83,7 @@ public function getOptionText($optionId)
{
$options = self::getOptionArray();
- return isset($options[$optionId]) ? $options[$optionId] : null;
+ return $options[$optionId] ?? null;
}
/**
diff --git a/app/code/Magento/Catalog/Model/Product/Copier.php b/app/code/Magento/Catalog/Model/Product/Copier.php
index 91fb5213281ec..b04d3da8f0223 100644
--- a/app/code/Magento/Catalog/Model/Product/Copier.php
+++ b/app/code/Magento/Catalog/Model/Product/Copier.php
@@ -8,10 +8,12 @@
use Magento\Catalog\Api\Data\ProductInterface;
use Magento\Catalog\Model\Attribute\ScopeOverriddenValue;
use Magento\Catalog\Model\Product;
+use Magento\Catalog\Model\Product\Attribute\Source\Status;
use Magento\Catalog\Model\Product\Option\Repository as OptionRepository;
use Magento\Catalog\Model\ProductFactory;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\EntityManager\MetadataPool;
+use Magento\Store\Model\Store;
use Magento\UrlRewrite\Model\Exception\UrlAlreadyExistsException;
/**
@@ -72,40 +74,37 @@ public function __construct(
/**
* Create product duplicate
*
- * @param \Magento\Catalog\Model\Product $product
- *
- * @return \Magento\Catalog\Model\Product
- *
- * @throws \Exception
+ * @param Product $product
+ * @return Product
*/
- public function copy(Product $product)
+ public function copy(Product $product): Product
{
$product->getWebsiteIds();
$product->getCategoryIds();
$metadata = $this->metadataPool->getMetadata(ProductInterface::class);
- /** @var \Magento\Catalog\Model\Product $duplicate */
+ /** @var Product $duplicate */
$duplicate = $this->productFactory->create();
$productData = $product->getData();
$productData = $this->removeStockItem($productData);
$duplicate->setData($productData);
$duplicate->setOptions([]);
+ $duplicate->setMetaTitle(null);
+ $duplicate->setMetaKeyword(null);
+ $duplicate->setMetaDescription(null);
$duplicate->setIsDuplicate(true);
$duplicate->setOriginalLinkId($product->getData($metadata->getLinkField()));
- $duplicate->setStatus(\Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_DISABLED);
+ $duplicate->setStatus(Status::STATUS_DISABLED);
$duplicate->setCreatedAt(null);
$duplicate->setUpdatedAt(null);
$duplicate->setId(null);
- $duplicate->setStoreId(\Magento\Store\Model\Store::DEFAULT_STORE_ID);
+ $duplicate->setStoreId(Store::DEFAULT_STORE_ID);
$this->copyConstructor->build($product, $duplicate);
$this->setDefaultUrl($product, $duplicate);
$this->setStoresUrl($product, $duplicate);
$this->optionRepository->duplicate($product, $duplicate);
- $product->getResource()->duplicate(
- $product->getData($metadata->getLinkField()),
- $duplicate->getData($metadata->getLinkField())
- );
+
return $duplicate;
}
@@ -118,11 +117,11 @@ public function copy(Product $product)
*/
private function setDefaultUrl(Product $product, Product $duplicate) : void
{
- $duplicate->setStoreId(\Magento\Store\Model\Store::DEFAULT_STORE_ID);
+ $duplicate->setStoreId(Store::DEFAULT_STORE_ID);
$resource = $product->getResource();
$attribute = $resource->getAttribute('url_key');
$productId = $product->getId();
- $urlKey = $resource->getAttributeRawValue($productId, 'url_key', \Magento\Store\Model\Store::DEFAULT_STORE_ID);
+ $urlKey = $resource->getAttributeRawValue($productId, 'url_key', Store::DEFAULT_STORE_ID);
do {
$urlKey = $this->modifyUrl($urlKey);
$duplicate->setUrlKey($urlKey);
@@ -175,7 +174,7 @@ private function setStoresUrl(Product $product, Product $duplicate) : void
$productResource->saveAttribute($duplicate, 'url_path');
$productResource->saveAttribute($duplicate, 'url_key');
}
- $duplicate->setStoreId(\Magento\Store\Model\Store::DEFAULT_STORE_ID);
+ $duplicate->setStoreId(Store::DEFAULT_STORE_ID);
}
/**
@@ -197,7 +196,7 @@ private function modifyUrl(string $urlKey) : string
* @param array $productData
* @return array
*/
- private function removeStockItem(array $productData)
+ private function removeStockItem(array $productData): array
{
if (isset($productData[ProductInterface::EXTENSION_ATTRIBUTES_KEY])) {
$extensionAttributes = $productData[ProductInterface::EXTENSION_ATTRIBUTES_KEY];
diff --git a/app/code/Magento/Catalog/Model/Product/Gallery/EntryResolver.php b/app/code/Magento/Catalog/Model/Product/Gallery/EntryResolver.php
index 36eb71abe2a5d..1f36b37c34f6f 100644
--- a/app/code/Magento/Catalog/Model/Product/Gallery/EntryResolver.php
+++ b/app/code/Magento/Catalog/Model/Product/Gallery/EntryResolver.php
@@ -9,6 +9,9 @@
use Magento\Catalog\Model\Product;
+/**
+ * Manage entryes
+ */
class EntryResolver
{
/**
@@ -27,7 +30,7 @@ public function getEntryFilePathById(Product $product, $entryId)
foreach ($mediaGalleryData['images'] as $image) {
if (isset($image['value_id']) && $image['value_id'] == $entryId) {
- return isset($image['file']) ? $image['file'] : null;
+ return $image['file'] ?? null;
}
}
return null;
@@ -49,7 +52,7 @@ public function getEntryIdByFilePath(Product $product, $filePath)
foreach ($mediaGalleryData['images'] as $image) {
if (isset($image['file']) && $image['file'] == $filePath) {
- return isset($image['value_id']) ? $image['value_id'] : null;
+ return $image['value_id'] ?? null;
}
}
return null;
diff --git a/app/code/Magento/Catalog/Model/Product/ProductFrontendAction/Synchronizer.php b/app/code/Magento/Catalog/Model/Product/ProductFrontendAction/Synchronizer.php
index ec2e697ccc849..b736700a4481d 100644
--- a/app/code/Magento/Catalog/Model/Product/ProductFrontendAction/Synchronizer.php
+++ b/app/code/Magento/Catalog/Model/Product/ProductFrontendAction/Synchronizer.php
@@ -20,6 +20,8 @@
*
* Service which allows to sync product widget information, such as product id with db. In order to reuse this info
* on different devices
+ *
+ * @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
*/
class Synchronizer
{
@@ -94,6 +96,7 @@ public function __construct(
*
* @param string $namespace
* @return int
+ * @throws \Magento\Framework\Exception\LocalizedException
*/
private function getLifeTimeByNamespace($namespace)
{
@@ -119,6 +122,7 @@ private function getLifeTimeByNamespace($namespace)
* @param array $productsData (product action data, that came from frontend)
* @param string $typeId namespace (type of action)
* @return array
+ * @throws \Magento\Framework\Exception\LocalizedException
*/
private function filterNewestActions(array $productsData, $typeId)
{
@@ -166,6 +170,7 @@ private function getProductIdsByActions(array $actions)
* @param array $productsData
* @param string $typeId
* @return void
+ * @throws \Exception
*/
public function syncActions(array $productsData, $typeId)
{
@@ -189,8 +194,7 @@ public function syncActions(array $productsData, $typeId)
foreach ($collection as $item) {
$this->entityManager->delete($item);
}
-
- foreach ($productsData as $productId => $productData) {
+ foreach ($productsData as $productData) {
/** @var ProductFrontendActionInterface $action */
$action = $this->productFrontendActionFactory->create(
[
@@ -198,7 +202,7 @@ public function syncActions(array $productsData, $typeId)
'visitor_id' => $customerId ? null : $visitorId,
'customer_id' => $this->session->getCustomerId(),
'added_at' => $productData['added_at'],
- 'product_id' => $productId,
+ 'product_id' => $productData['product_id'],
'type_id' => $typeId
]
]
diff --git a/app/code/Magento/Catalog/Model/Product/Type.php b/app/code/Magento/Catalog/Model/Product/Type.php
index 4c973be20dee5..d7dc74e0d0cc3 100644
--- a/app/code/Magento/Catalog/Model/Product/Type.php
+++ b/app/code/Magento/Catalog/Model/Product/Type.php
@@ -6,43 +6,37 @@
namespace Magento\Catalog\Model\Product;
use Magento\Catalog\Model\Product;
+use Magento\Catalog\Model\Product\Type\Pool;
+use Magento\Catalog\Model\Product\Type\Price;
+use Magento\Catalog\Model\Product\Type\Price\Factory as PriceFactory;
+use Magento\Catalog\Model\Product\Type\Simple;
+use Magento\Catalog\Model\ProductTypes\ConfigInterface;
use Magento\Framework\Data\OptionSourceInterface;
+use Magento\Framework\Pricing\PriceInfo\Factory as PriceInfoFactory;
/**
* Product type model
*
+ *
* @api
* @since 100.0.2
*/
class Type implements OptionSourceInterface
{
- /**#@+
- * Available product types
- */
const TYPE_SIMPLE = 'simple';
const TYPE_BUNDLE = 'bundle';
const TYPE_VIRTUAL = 'virtual';
- /**#@-*/
- /**
- * Default product type
- */
const DEFAULT_TYPE = 'simple';
- /**
- * Default product type model
- */
- const DEFAULT_TYPE_MODEL = \Magento\Catalog\Model\Product\Type\Simple::class;
+ const DEFAULT_TYPE_MODEL = Simple::class;
- /**
- * Default price model
- */
- const DEFAULT_PRICE_MODEL = \Magento\Catalog\Model\Product\Type\Price::class;
+ const DEFAULT_PRICE_MODEL = Price::class;
/**
- * @var \Magento\Catalog\Model\ProductTypes\ConfigInterface
+ * @var ConfigInterface
*/
protected $_config;
@@ -77,35 +71,35 @@ class Type implements OptionSourceInterface
/**
* Product type factory
*
- * @var \Magento\Catalog\Model\Product\Type\Pool
+ * @var Pool
*/
protected $_productTypePool;
/**
* Price model factory
*
- * @var \Magento\Catalog\Model\Product\Type\Price\Factory
+ * @var PriceFactory
*/
protected $_priceFactory;
/**
- * @var \Magento\Framework\Pricing\PriceInfo\Factory
+ * @var PriceInfoFactory
*/
protected $_priceInfoFactory;
/**
* Construct
*
- * @param \Magento\Catalog\Model\ProductTypes\ConfigInterface $config
- * @param \Magento\Catalog\Model\Product\Type\Pool $productTypePool
- * @param \Magento\Catalog\Model\Product\Type\Price\Factory $priceFactory
- * @param \Magento\Framework\Pricing\PriceInfo\Factory $priceInfoFactory
+ * @param ConfigInterface $config
+ * @param Pool $productTypePool
+ * @param PriceFactory $priceFactory
+ * @param PriceInfoFactory $priceInfoFactory
*/
public function __construct(
- \Magento\Catalog\Model\ProductTypes\ConfigInterface $config,
- \Magento\Catalog\Model\Product\Type\Pool $productTypePool,
- \Magento\Catalog\Model\Product\Type\Price\Factory $priceFactory,
- \Magento\Framework\Pricing\PriceInfo\Factory $priceInfoFactory
+ ConfigInterface $config,
+ Pool $productTypePool,
+ PriceFactory $priceFactory,
+ PriceInfoFactory $priceInfoFactory
) {
$this->_config = $config;
$this->_productTypePool = $productTypePool;
@@ -116,8 +110,8 @@ public function __construct(
/**
* Factory to product singleton product type instances
*
- * @param \Magento\Catalog\Model\Product $product
- * @return \Magento\Catalog\Model\Product\Type\AbstractType
+ * @param \Magento\Catalog\Api\Data\ProductInterface $product
+ * @return \Magento\Catalog\Model\Product\Type\AbstractType
*/
public function factory($product)
{
@@ -139,8 +133,8 @@ public function factory($product)
/**
* Product type price model factory
*
- * @param string $productType
- * @return \Magento\Catalog\Model\Product\Type\Price
+ * @param string $productType
+ * @return \Magento\Catalog\Model\Product\Type\Price
*/
public function priceFactory($productType)
{
diff --git a/app/code/Magento/Catalog/Model/Product/Visibility.php b/app/code/Magento/Catalog/Model/Product/Visibility.php
index c05bda7838d78..cd1500406df44 100644
--- a/app/code/Magento/Catalog/Model/Product/Visibility.php
+++ b/app/code/Magento/Catalog/Model/Product/Visibility.php
@@ -133,7 +133,7 @@ public static function getAllOptions()
public static function getOptionText($optionId)
{
$options = self::getOptionArray();
- return isset($options[$optionId]) ? $options[$optionId] : null;
+ return $options[$optionId] ?? null;
}
//phpcs:enable Magento2.Functions.StaticFunction
diff --git a/app/code/Magento/Catalog/Model/Product/Webapi/ProductOutputProcessor.php b/app/code/Magento/Catalog/Model/Product/Webapi/ProductOutputProcessor.php
new file mode 100644
index 0000000000000..4d683829219ba
--- /dev/null
+++ b/app/code/Magento/Catalog/Model/Product/Webapi/ProductOutputProcessor.php
@@ -0,0 +1,101 @@
+request = $request;
+ $this->deserializer = $deserializer;
+ }
+
+ /**
+ * Removing attribute from the result array if its null or empty
+ *
+ * @param ProductInterface $product
+ * @param array $result
+ * @return array
+ */
+ public function execute(
+ ProductInterface $product,
+ array $result
+ ): array {
+ $requestContent = $this->request->getContent() ?? [];
+ if (empty($requestContent)) {
+ return $result;
+ }
+ $requestContentDetails = (array)$this->deserializer->deserialize($requestContent);
+ $requestProductList = $this->extractProductList($requestContentDetails);
+
+ $requestProductList = array_filter(
+ $requestProductList,
+ function ($requestProduct) use ($product) {
+ return isset($requestProduct['sku']) && $requestProduct['sku'] === $product->getSku();
+ }
+ );
+
+ if (empty($requestProductList)) {
+ return $result;
+ }
+
+ $requestProduct = current($requestProductList);
+
+ if (empty($product->getTierPrices()) && !array_key_exists('tier_prices', $requestProduct)) {
+ unset($result['tier_prices']);
+ }
+
+ if (empty($product->getProductLinks()) && !array_key_exists('product_links', $requestProduct)) {
+ unset($result['product_links']);
+ }
+
+ return $result;
+ }
+
+ /**
+ * Extract product list from the request content details
+ *
+ * @param array $contentDetails
+ * @return array
+ */
+ private function extractProductList(array $contentDetails): array
+ {
+ $productList = [];
+ $arrayIterator = new \RecursiveArrayIterator($contentDetails);
+ $iterator = new \RecursiveIteratorIterator($arrayIterator, \RecursiveIteratorIterator::SELF_FIRST);
+ foreach ($iterator as $iteratorKey => $iteratorValue) {
+ if ($iteratorKey === 'product') {
+ array_push($productList, $iteratorValue);
+ }
+ }
+ return $productList;
+ }
+}
diff --git a/app/code/Magento/Catalog/Model/ProductLink/Converter/ConverterPool.php b/app/code/Magento/Catalog/Model/ProductLink/Converter/ConverterPool.php
index f58d1d6b69be8..a50c650e8b264 100644
--- a/app/code/Magento/Catalog/Model/ProductLink/Converter/ConverterPool.php
+++ b/app/code/Magento/Catalog/Model/ProductLink/Converter/ConverterPool.php
@@ -6,6 +6,9 @@
namespace Magento\Catalog\Model\ProductLink\Converter;
+/**
+ * Return converter by link type
+ */
class ConverterPool
{
/**
@@ -34,8 +37,6 @@ public function __construct(array $converters)
*/
public function getConverter($linkType)
{
- return isset($this->converters[$linkType])
- ? $this->converters[$linkType]
- : $this->converters[$this->defaultConverterCode];
+ return $this->converters[$linkType] ?? $this->converters[$this->defaultConverterCode];
}
}
diff --git a/app/code/Magento/Catalog/Model/ProductLink/Link.php b/app/code/Magento/Catalog/Model/ProductLink/Link.php
index ebf90c0523818..48945fbef9d52 100644
--- a/app/code/Magento/Catalog/Model/ProductLink/Link.php
+++ b/app/code/Magento/Catalog/Model/ProductLink/Link.php
@@ -7,6 +7,8 @@
namespace Magento\Catalog\Model\ProductLink;
/**
+ * @inheritdoc
+ *
* @codeCoverageIgnore
*/
class Link extends \Magento\Framework\Model\AbstractExtensibleModel implements
@@ -30,7 +32,7 @@ class Link extends \Magento\Framework\Model\AbstractExtensibleModel implements
*/
protected function _get($key)
{
- return isset($this->_data[$key]) ? $this->_data[$key] : null;
+ return $this->_data[$key] ?? null;
}
/**
@@ -38,9 +40,11 @@ protected function _get($key)
*
* @return array
* @todo refactor with converter for AbstractExtensibleModel
+ * phpcs:disable
*/
public function __toArray()
{
+ //phpcs:enable
$data = $this->_data;
$hasToArray = function ($model) {
return is_object($model) && method_exists($model, '__toArray') && is_callable([$model, '__toArray']);
@@ -169,7 +173,7 @@ public function setPosition($position)
}
/**
- * {@inheritdoc}
+ * @inheritdoc
*
* @return \Magento\Catalog\Api\Data\ProductLinkExtensionInterface|null
*/
@@ -184,7 +188,7 @@ public function getExtensionAttributes()
}
/**
- * {@inheritdoc}
+ * @inheritdoc
*
* @param \Magento\Catalog\Api\Data\ProductLinkExtensionInterface $extensionAttributes
* @return $this
diff --git a/app/code/Magento/Catalog/Model/ProductLink/Management.php b/app/code/Magento/Catalog/Model/ProductLink/Management.php
index 066549274b07c..017985e3f549f 100644
--- a/app/code/Magento/Catalog/Model/ProductLink/Management.php
+++ b/app/code/Magento/Catalog/Model/ProductLink/Management.php
@@ -6,37 +6,42 @@
namespace Magento\Catalog\Model\ProductLink;
-use Magento\Catalog\Api\Data;
use Magento\Framework\Exception\CouldNotSaveException;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Framework\Exception\InputException;
+use Magento\Catalog\Api\ProductRepositoryInterface;
+use Magento\Catalog\Model\Product\LinkTypeProvider;
+use Magento\Catalog\Api\ProductLinkManagementInterface;
-class Management implements \Magento\Catalog\Api\ProductLinkManagementInterface
+/**
+ * Manage product links from api
+ */
+class Management implements ProductLinkManagementInterface
{
/**
- * @var \Magento\Catalog\Api\ProductRepositoryInterface
+ * @var ProductRepositoryInterface
*/
protected $productRepository;
/**
- * @var \Magento\Catalog\Model\Product\LinkTypeProvider
+ * @var LinkTypeProvider
*/
protected $linkTypeProvider;
/**
- * @param \Magento\Catalog\Api\ProductRepositoryInterface $productRepository
- * @param \Magento\Catalog\Model\Product\LinkTypeProvider $linkTypeProvider
+ * @param ProductRepositoryInterface $productRepository
+ * @param LinkTypeProvider $linkTypeProvider
*/
public function __construct(
- \Magento\Catalog\Api\ProductRepositoryInterface $productRepository,
- \Magento\Catalog\Model\Product\LinkTypeProvider $linkTypeProvider
+ ProductRepositoryInterface $productRepository,
+ LinkTypeProvider $linkTypeProvider
) {
$this->productRepository = $productRepository;
$this->linkTypeProvider = $linkTypeProvider;
}
/**
- * {@inheritdoc}
+ * @inheritdoc
*/
public function getLinkedItemsByType($sku, $type)
{
@@ -63,47 +68,42 @@ public function getLinkedItemsByType($sku, $type)
}
/**
- * {@inheritdoc}
+ * @inheritdoc
*/
public function setProductLinks($sku, array $items)
{
+
+ if (empty($items)) {
+ throw InputException::invalidFieldValue('items', 'empty array');
+ }
+
$linkTypes = $this->linkTypeProvider->getLinkTypes();
// Check if product link type is set and correct
- if (!empty($items)) {
- foreach ($items as $newLink) {
- $type = $newLink->getLinkType();
- if ($type == null) {
- throw InputException::requiredField("linkType");
- }
- if (!isset($linkTypes[$type])) {
- throw new NoSuchEntityException(
- __('The "%1" link type wasn\'t found. Verify the type and try again.', $type)
- );
- }
+ foreach ($items as $newLink) {
+ $type = $newLink->getLinkType();
+ if ($type == null) {
+ throw InputException::requiredField("linkType");
+ }
+ if (!isset($linkTypes[$type])) {
+ throw new NoSuchEntityException(
+ __('The "%1" link type wasn\'t found. Verify the type and try again.', $type)
+ );
}
}
$product = $this->productRepository->get($sku);
- // Replace only links of the specified type
$existingLinks = $product->getProductLinks();
- $newLinks = [];
- if (!empty($existingLinks)) {
- foreach ($existingLinks as $link) {
- if ($link->getLinkType() != $type) {
- $newLinks[] = $link;
- }
- }
- $newLinks = array_merge($newLinks, $items);
- } else {
- $newLinks = $items;
- }
+ $newLinks = array_merge($existingLinks, $items);
+
$product->setProductLinks($newLinks);
try {
$this->productRepository->save($product);
} catch (\Exception $exception) {
- throw new CouldNotSaveException(__('The linked products data is invalid. Verify the data and try again.'));
+ throw new CouldNotSaveException(
+ __('The linked products data is invalid. Verify the data and try again.')
+ );
}
return true;
diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php
index e31180d4ff6cf..14daac0147abf 100644
--- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php
+++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php
@@ -1904,6 +1904,7 @@ protected function _productLimitationJoinPrice()
* @see \Magento\Catalog\Model\ResourceModel\Product\Collection::_productLimitationJoinPrice()
* @param bool $joinLeft
* @return $this
+ * @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
protected function _productLimitationPrice($joinLeft = false)
{
@@ -1922,14 +1923,14 @@ protected function _productLimitationPrice($joinLeft = false)
$connection = $this->getConnection();
$select = $this->getSelect();
- $joinCond = join(
- ' AND ',
- [
- 'price_index.entity_id = e.entity_id',
- $connection->quoteInto('price_index.website_id = ?', $filters['website_id']),
- $connection->quoteInto('price_index.customer_group_id = ?', $filters['customer_group_id'])
- ]
- );
+ $joinCondArray = [];
+ $joinCondArray[] = 'price_index.entity_id = e.entity_id';
+ $joinCondArray[] = $connection->quoteInto('price_index.customer_group_id = ?', $filters['customer_group_id']);
+ // Add website condition only if it's different from admin scope
+ if (((int) $filters['website_id']) !== Store::DEFAULT_STORE_ID) {
+ $joinCondArray[] = $connection->quoteInto('price_index.website_id = ?', $filters['website_id']);
+ }
+ $joinCond = join(' AND ', $joinCondArray);
$fromPart = $select->getPart(\Magento\Framework\DB\Select::FROM);
if (!isset($fromPart['price_index'])) {
@@ -2121,7 +2122,9 @@ private function getChildrenCategories(int $categoryId): array
if (in_array($category['parent_id'], $categoryIds)
&& in_array($category['parent_id'], $anchorCategory)) {
$categoryIds[] = (int)$category[$linkField];
- if ($category['is_anchor'] == 1) {
+ // Storefront approach is to treat non-anchor children of anchor category as anchors.
+ // Adding their's IDs to $anchorCategory for consistency.
+ if ($category['is_anchor'] == 1 || in_array($category['parent_id'], $anchorCategory)) {
$anchorCategory[] = (int)$category[$linkField];
}
}
diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAddProductToCategoryActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAddProductToCategoryActionGroup.xml
new file mode 100644
index 0000000000000..bedd55e183290
--- /dev/null
+++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminAddProductToCategoryActionGroup.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+ Add Product to Category
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCategoryPageOpenProductsInCategorySectionActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCategoryPageOpenProductsInCategorySectionActionGroup.xml
new file mode 100644
index 0000000000000..67c68e03fcfa1
--- /dev/null
+++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminCategoryPageOpenProductsInCategorySectionActionGroup.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+ Open 'Products in Category' section on category edit page in Admin.
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminDeleteProductAttributeByLabelActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminDeleteProductAttributeByLabelActionGroup.xml
new file mode 100644
index 0000000000000..7b453735994d7
--- /dev/null
+++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminDeleteProductAttributeByLabelActionGroup.xml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+ Goes to the Admin Product Attributes grid page. Filters the grid for the provided Product Attribute (Label). Deletes the Product Attribute from the grid. Validates that the Success Message is present.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductFormAdvancedPricingAddTierPriceActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductFormAdvancedPricingAddTierPriceActionGroup.xml
new file mode 100644
index 0000000000000..f823db0a86548
--- /dev/null
+++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductFormAdvancedPricingAddTierPriceActionGroup.xml
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+ Add new tier price on Advanced Pricing dialog on the Admin Product creation/edit page.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductFormCloseAdvancedPricingDialogActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductFormCloseAdvancedPricingDialogActionGroup.xml
new file mode 100644
index 0000000000000..03c98c1cb17b7
--- /dev/null
+++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductFormCloseAdvancedPricingDialogActionGroup.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+ Close Advanced Pricing dialog from product form.
+
+
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductFormDoneAdvancedPricingDialogActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductFormDoneAdvancedPricingDialogActionGroup.xml
new file mode 100644
index 0000000000000..10f2d32799200
--- /dev/null
+++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductFormDoneAdvancedPricingDialogActionGroup.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+ Done Advanced Pricing dialog from product form.
+
+
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductFormOpenAdvancedPricingDialogActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductFormOpenAdvancedPricingDialogActionGroup.xml
new file mode 100644
index 0000000000000..1c96ce3469485
--- /dev/null
+++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminProductFormOpenAdvancedPricingDialogActionGroup.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+ Open Advanced Pricing dialog from product form.
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminSaveCategoryFormActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminSaveCategoryFormActionGroup.xml
new file mode 100644
index 0000000000000..564033f459dc9
--- /dev/null
+++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminSaveCategoryFormActionGroup.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+ Save category edit form in Admin and check success message.
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminSetUseInSearchValueForProductAttributeActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminSetUseInSearchValueForProductAttributeActionGroup.xml
new file mode 100644
index 0000000000000..d5c2ed847e33f
--- /dev/null
+++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AdminSetUseInSearchValueForProductAttributeActionGroup.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+ Set 'Use In Search' value for product attribute
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertAdminProductFormAdvancedPricingCheckTierPriceActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertAdminProductFormAdvancedPricingCheckTierPriceActionGroup.xml
new file mode 100644
index 0000000000000..42aee90882400
--- /dev/null
+++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertAdminProductFormAdvancedPricingCheckTierPriceActionGroup.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+ Check AdvancedPricing tier price row.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductOnCategoryPageActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductOnCategoryPageActionGroup.xml
index d35d6a4778dd6..4bd2c97af7afb 100644
--- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductOnCategoryPageActionGroup.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertProductOnCategoryPageActionGroup.xml
@@ -10,7 +10,8 @@
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
- EXTENDS:StorefrontCheckCategorySimpleProduct. Removes 'AssertProductPrice', 'moveMouseOverProduct', 'AssertAddToCart'
+ DEPRECATED. Use AssertStorefrontProductIsPresentOnCategoryPageActionGroup.
+ EXTENDS:StorefrontCheckCategorySimpleProduct. Removes 'AssertProductPrice', 'moveMouseOverProduct', 'AssertAddToCart'
diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertStorefrontCategorySimpleProductShownActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertStorefrontCategorySimpleProductShownActionGroup.xml
new file mode 100644
index 0000000000000..a2940708eeb84
--- /dev/null
+++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertStorefrontCategorySimpleProductShownActionGroup.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+ Validate that the provided Simple Product is present and correct on a Category page.
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertStorefrontProductControlsAreNotVisibleWithoutHoverActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertStorefrontProductControlsAreNotVisibleWithoutHoverActionGroup.xml
new file mode 100644
index 0000000000000..226bb8468d62e
--- /dev/null
+++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertStorefrontProductControlsAreNotVisibleWithoutHoverActionGroup.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+ Validate that the Product Controls Are Not Visible On Category Page Without Hover on Product
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertStorefrontProductControlsAreVisibleOnHoverActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertStorefrontProductControlsAreVisibleOnHoverActionGroup.xml
new file mode 100644
index 0000000000000..60d56df04bd2f
--- /dev/null
+++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertStorefrontProductControlsAreVisibleOnHoverActionGroup.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+ Validate that the Product Controls Are Visible on Category Page on Hover on Product
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertStorefrontProductDetailPageFinalPriceActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertStorefrontProductDetailPageFinalPriceActionGroup.xml
new file mode 100644
index 0000000000000..cf327266909d3
--- /dev/null
+++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertStorefrontProductDetailPageFinalPriceActionGroup.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+ ${{finalProductPrice}}
+ productPriceText
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertStorefrontProductDetailPageNameActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertStorefrontProductDetailPageNameActionGroup.xml
new file mode 100644
index 0000000000000..7ed38153cc446
--- /dev/null
+++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertStorefrontProductDetailPageNameActionGroup.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+ {{productName}}
+ productNameText
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertStorefrontProductDetailPageTierPriceActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertStorefrontProductDetailPageTierPriceActionGroup.xml
new file mode 100644
index 0000000000000..47ef781271ade
--- /dev/null
+++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertStorefrontProductDetailPageTierPriceActionGroup.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+ Buy {{tierProductPriceDiscountQuantity}} for ${{productPriceWithAppliedTierPriceDiscount}} each and save {{productSavedPricePercent}}%
+ tierPriceText
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertStorefrontProductIsPresentOnCategoryPageActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertStorefrontProductIsPresentOnCategoryPageActionGroup.xml
new file mode 100644
index 0000000000000..7c10be74b1b79
--- /dev/null
+++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertStorefrontProductIsPresentOnCategoryPageActionGroup.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+ Validate that the provided Product is present and has correct name on a Category page.
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertStorefrontProductPriceInCategoryPageActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertStorefrontProductPriceInCategoryPageActionGroup.xml
new file mode 100644
index 0000000000000..87f6e6e705263
--- /dev/null
+++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertStorefrontProductPriceInCategoryPageActionGroup.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+ Goes to Storefront Category page for the provided Category. Validates that the Product price is present and correct.
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertStorefrontProductSpecialPriceInCategoryPageActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertStorefrontProductSpecialPriceInCategoryPageActionGroup.xml
new file mode 100644
index 0000000000000..b2a7d5f96ec94
--- /dev/null
+++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/AssertStorefrontProductSpecialPriceInCategoryPageActionGroup.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+ Goes to Storefront Category page for the provided Category. Validates that the Product price and special price are correct.
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductAttributeByLabelActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductAttributeByLabelActionGroup.xml
index fb78909eab0b6..15c3d55fb9382 100644
--- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductAttributeByLabelActionGroup.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/DeleteProductAttributeByLabelActionGroup.xml
@@ -10,7 +10,7 @@
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
- Goes to the Admin Product Attributes grid page. Filters the grid for the provided Product Attribute (Label). Deletes the Product Attribute from the grid. Validates that the Success Message is present.
+ DEPRECATED. Please use AdminDeleteProductAttributeByLabelActionGroup instead. Goes to the Admin Product Attributes grid page. Filters the grid for the provided Product Attribute (Label). Deletes the Product Attribute from the grid. Validates that the Success Message is present.
diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FillAdminSimpleProductFormActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FillAdminSimpleProductFormActionGroup.xml
index 2abfc546e6bb3..ef4f30e353946 100644
--- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FillAdminSimpleProductFormActionGroup.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/FillAdminSimpleProductFormActionGroup.xml
@@ -24,6 +24,7 @@
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ProductSetAdvancedPricingActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ProductSetAdvancedPricingActionGroup.xml
index 95bda64202159..0f7145b607f6e 100644
--- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ProductSetAdvancedPricingActionGroup.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/ProductSetAdvancedPricingActionGroup.xml
@@ -21,7 +21,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SaveCategoryFormActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SaveCategoryFormActionGroup.xml
index ff6afb4aaf0e9..19f11a2402f56 100644
--- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SaveCategoryFormActionGroup.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SaveCategoryFormActionGroup.xml
@@ -10,11 +10,11 @@
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
- Requires navigation to the Category creation/edit page. Checks that the url contains the AdminCategoryPage url. Saves the Category.
+ DEPRECATED. Use AdminSaveCategoryFormActionGroup instead. Requires navigation to the Category creation/edit page. Checks that the url contains the AdminCategoryPage url. Saves the Category.
-
-
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SetProductUrlKeyByStringActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SetProductUrlKeyByStringActionGroup.xml
index d4c654523a40b..1882063081f04 100644
--- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SetProductUrlKeyByStringActionGroup.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/SetProductUrlKeyByStringActionGroup.xml
@@ -16,7 +16,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontNavigateCategoryPageActionGroup.xml b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontNavigateCategoryPageActionGroup.xml
index 39cb9ef1a63d4..dab5142c557ca 100644
--- a/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontNavigateCategoryPageActionGroup.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/ActionGroup/StorefrontNavigateCategoryPageActionGroup.xml
@@ -13,5 +13,6 @@
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Data/AdminProductAttributeMessageData.xml b/app/code/Magento/Catalog/Test/Mftf/Data/AdminProductAttributeMessageData.xml
new file mode 100644
index 0000000000000..834abdad497b8
--- /dev/null
+++ b/app/code/Magento/Catalog/Test/Mftf/Data/AdminProductAttributeMessageData.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+ You deleted the product attribute.
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml b/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml
index 46bb6e527608f..a44db8010a822 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml
@@ -9,13 +9,13 @@
+ testProductName
testSku
+ testurlkey
simple
4
4
- testProductName
123.00
- testurlkey
1
100
1
@@ -23,13 +23,13 @@
CustomAttributeCategoryIds
+ Api Simple Product
api-simple-product
+ api-simple-product
simple
4
4
- Api Simple Product
123.00
- api-simple-product
1
100
EavStockItem
@@ -55,15 +55,15 @@
api-simple-product
+ SimpleProduct
SimpleProduct
+ simpleproduct
simple
4
- SimpleProduct
123.00
4
1
1000
- simpleproduct
1
EavStockItem
CustomAttributeCategoryIds
@@ -72,10 +72,10 @@
SimpleProduct -+~/\\<>\’“:*\$#@()!,.?`=%&^
+ SimpleProduct
simpleProduct
simple
4
- SimpleProduct
123.00
4
1
@@ -86,10 +86,10 @@
CustomAttributeCategoryIds
+ SimpleProductAfterImport1
SimpleProductForTest1
simple
4
- SimpleProductAfterImport1
250.00
4
1
@@ -100,49 +100,50 @@
CustomAttributeCategoryIds
+ SimpleProductAfterImport2
SimpleProductForTest2
+ simple-product-for-test-2
simple
4
- SimpleProductAfterImport2
300.00
4
1
100
- simple-product-for-test-2
1
EavStockItem
CustomAttributeCategoryIds
+ SimpleProductAfterImport3
SimpleProductForTest3
+ simple-product-for-test-3
simple
4
- SimpleProductAfterImport3
350.00
4
1
100
- simple-product-for-test-3
1
EavStockItem
CustomAttributeCategoryIds
+ SimpleProduct
SimpleProduct
simple
4
- SimpleProduct
123.00
4
1
1000
+ 1
EavStockItem
+ simple
simple
simple
4
- simple
123.00
4
1
@@ -152,70 +153,81 @@
CustomAttributeCategoryIds
+ OutOfStockProduct
testSku
+ testurlkey
simple
4
4
- OutOfStockProduct
123.00
- testurlkey
1
0
CustomAttributeCategoryIds
+ OutOfStockProduct
testSku
+ testurlkey
simple
4
4
- OutOfStockProduct
123.00
- testurlkey
1
0
+ SimpleProductInStockQuantityZero
testSku
+ SimpleProductInStockQuantityZero
simple
4
4
- SimpleProductInStockQuantityZero
123.00
- SimpleProductInStockQuantityZero
1
0
EavStock0
+ SimpleOffline
testSku
+ testurlkey
simple
4
4
- SimpleOffline
123.00
2
100
- testurlkey
EavStockItem
CustomAttributeProductAttribute
+ Simple Product Disabled
simple_product_disabled
simple
4
- Simple Product Disabled
123.00
4
2
1001
EavStockItem
+
+ testSku
+ simple
+ 4
+ Simple Product Disabled Quantity Zero
+ 123.00
+ 4
+ 2
+ 0
+ EavStock0
+
+ Simple Product Not Visible Individually
simple_product_not_visible_individually
simple
4
- Simple Product Not Visible Individually
123.00
1
1
@@ -226,10 +238,10 @@
321.00
+ SimpleProduct
SimpleOne
simple
4
- SimpleProduct
1.23
4
1
@@ -237,25 +249,25 @@
CustomAttributeProductAttribute
+ Api Simple Out Of Stock Product
api-simple-product
+ api-simple-product
simple
4
4
- Api Simple Out Of Stock Product
123.00
- api-simple-product
1
100
CustomAttributeProductAttribute
+ Api Simple Product
api-simple-product
+ api-simple-product
simple
4
4
- Api Simple Product
123.00
- api-simple-product
1
100
EavStockItem
@@ -265,26 +277,26 @@
pr
+ Api Simple Product
api-simple-product
+ api-simple-product
simple
4
1
- Api Simple Product
123.00
- api-simple-product
1
100
EavStockItem
CustomAttributeProductAttribute
+ Api Simple Product Two
api-simple-product-two
+ api-simple-product-two
simple
4
4
- Api Simple Product Two
234.00
- api-simple-product-two
1
100
EavStockItem
@@ -300,23 +312,23 @@
70
+ Api Simple Product Two
api-simple-product-two
+ api-simple-product-two
simple
4
1
- Api Simple Product Two
234.00
- api-simple-product-two
1
100
EavStockItem
CustomAttributeProductAttribute
+ VirtualProduct
virtualproduct
virtual
4
- VirtualProduct
99.99
250
0
@@ -324,10 +336,10 @@
EavStockItem
+ SimpleProduct
SimpleTwo
simple
4
- SimpleProduct
1.23
4
1
@@ -378,52 +390,52 @@
test_image
+ 霁产品
霁产品
+ testurlkey
simple
4
4
- 霁产品
123.00
- testurlkey
1
100
EavStockItem
CustomAttributeCategoryIds
+ SimpleOne™Product
SimpleOne™Product
+ testurlkey
simple
4
4
- SimpleOne™Product
50.00
- testurlkey
1
100
EavStockItem
CustomAttributeCategoryIds
+ SimpleTwo霁产品<カネボウPro
SimpleTwo霁产品<カネボウPro
+ testurlkey
simple
4
4
- SimpleTwo霁产品<カネボウPro
50.00
- testurlkey
1
100
EavStockItem
CustomAttributeCategoryIds
+ virtualProduct
virtualProduct
+ virtualproduct
virtual
4
4
- virtualProduct
12.34
- virtualproduct
1
100
0
@@ -431,13 +443,13 @@
CustomAttributeCategoryIds
+ testProductWithDescriptionName
testProductWithDescriptionSku
+ testproductwithdescriptionurlkey
simple
4
4
- testProductWithDescriptionName
123.00
- testproductwithdescriptionurlkey
1
100
EavStockItem
@@ -446,13 +458,13 @@
ApiProductShortDescription
+ Api Simple Product
api-simple-product
+ api-simple-product
simple
4
4
- Api Simple Product
123.00
- api-simple-product
1
100
EavStockItem
@@ -460,13 +472,13 @@
ApiProductShortDescription
+ ApiSimpleProduct
api-simple-product
+ api-simple-product
simple
4
4
- ApiSimpleProduct
123.00
- api-simple-product
1
100
EavStockItem
@@ -474,13 +486,13 @@
ApiProductShortDescription
+ Api Simple Product
api_simple_product
+ api-simple-product
simple
4
4
- Api Simple Product
123.00
- api-simple-product
1
100
EavStockItem
@@ -488,26 +500,26 @@
ApiProductShortDescription
+ testproductname
testSku
+ testurlkey
simple
4
4
- testproductname
123.00
- testurlkey
1
100
EavStockItem
CustomAttributeCategoryIds
+ testProductName
testSku
+ testurlkey
simple
4
- testProductName
123.00
- testurlkey
1
1
100
@@ -572,13 +584,13 @@
ProductOptionFile
+ Api Virtual Product
api-virtual-product
+ api-virtual-product
virtual
4
4
- Api Virtual Product
123.00
- api-virtual-product
1
100
EavStockItem
@@ -586,13 +598,13 @@
ApiProductShortDescription
+ Api Virtual Product
api_virtual_product
+ api-virtual-product
virtual
4
4
- Api Virtual Product
123.00
- api-virtual-product
1
100
EavStockItem
@@ -600,15 +612,15 @@
ApiProductShortDescription
+ SimpleProduct
SimpleProduct
+ simpleproduct
simple
4
- SimpleProduct
125.00
4
1
1000
- simpleproduct
1
EavStockItem
ApiProductNewsFromDate
@@ -635,7 +647,7 @@
- api-simple-product
+ apisimpleproduct
simple
4
4
@@ -643,7 +655,7 @@
1.00
- api-simple-product
+ apisimpleproduct
simple
4
4
@@ -756,6 +768,7 @@
In Stock
Catalog, Search
virtual-product
+ IN STOCK
virtual
diff --git a/app/code/Magento/Catalog/Test/Mftf/Data/TierPriceData.xml b/app/code/Magento/Catalog/Test/Mftf/Data/TierPriceData.xml
index 0c88c666a20ca..c79756507794a 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Data/TierPriceData.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Data/TierPriceData.xml
@@ -64,4 +64,12 @@
30
-
\ No newline at end of file
+
+ 36.00
+ discount
+ 0
+ ALL GROUPS
+ 3
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategoryBasicFieldSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategoryBasicFieldSection.xml
index 92961cc48212a..d6017e801052b 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategoryBasicFieldSection.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategoryBasicFieldSection.xml
@@ -41,6 +41,7 @@
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategoryProductsSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategoryProductsSection.xml
index d89d9a5bd43c0..1627fb9512e64 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategoryProductsSection.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategoryProductsSection.xml
@@ -9,10 +9,7 @@
diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormAdvancedPricingSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormAdvancedPricingSection.xml
index 77b89a07fb76a..91ac52a91a4c4 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormAdvancedPricingSection.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductFormAdvancedPricingSection.xml
@@ -25,5 +25,13 @@
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductMessagesSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductMessagesSection.xml
index 59fbeee142dfe..c51d481d7dc5e 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductMessagesSection.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductMessagesSection.xml
@@ -9,7 +9,7 @@
diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategoryMainSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategoryMainSection.xml
index 9a84f90edcfc0..6b67f5609f7f0 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategoryMainSection.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategoryMainSection.xml
@@ -17,6 +17,9 @@
+
+
+
@@ -27,6 +30,7 @@
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategoryProductSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategoryProductSection.xml
index 4114d64eb39af..61e6a345b9ba5 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategoryProductSection.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontCategoryProductSection.xml
@@ -21,7 +21,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductInfoMainSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductInfoMainSection.xml
index a5a02ad95b1f7..0b44d9bb0ea6b 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductInfoMainSection.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontProductInfoMainSection.xml
@@ -105,5 +105,7 @@
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AddOutOfStockProductToCompareListTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AddOutOfStockProductToCompareListTest.xml
index 9a0f5ad002725..b34e73a7ede9f 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AddOutOfStockProductToCompareListTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AddOutOfStockProductToCompareListTest.xml
@@ -33,7 +33,7 @@
-
+
@@ -60,7 +60,7 @@
-
+
@@ -82,7 +82,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AddToCartCrossSellTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AddToCartCrossSellTest.xml
index 7c0161d443df6..9abad132d32db 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AddToCartCrossSellTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AddToCartCrossSellTest.xml
@@ -33,7 +33,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageForCategoryTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageForCategoryTest.xml
index ed9eb686d2c86..690f2440b2f3b 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageForCategoryTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageForCategoryTest.xml
@@ -25,7 +25,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageToWYSIWYGCatalogTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageToWYSIWYGCatalogTest.xml
index b3e6fcd3bfb55..1850faebd16c6 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageToWYSIWYGCatalogTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageToWYSIWYGCatalogTest.xml
@@ -9,7 +9,7 @@
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
-
+
@@ -55,7 +55,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageToWYSIWYGProductTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageToWYSIWYGProductTest.xml
index edf37542fd830..d86a696880bae 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageToWYSIWYGProductTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddImageToWYSIWYGProductTest.xml
@@ -18,13 +18,13 @@
-
+
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddInStockProductToTheCartTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddInStockProductToTheCartTest.xml
index b98ca3a375a17..9ee5e9138d764 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddInStockProductToTheCartTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAddInStockProductToTheCartTest.xml
@@ -31,7 +31,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminApplyTierPriceToProductTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminApplyTierPriceToProductTest.xml
index 4f1618e076642..bdb2293bed9bc 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminApplyTierPriceToProductTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminApplyTierPriceToProductTest.xml
@@ -33,7 +33,7 @@
-
+
@@ -292,7 +292,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminAssignProductAttributeToAttributeSetTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAssignProductAttributeToAttributeSetTest.xml
index 41b358bbf760e..01a1b26a1f034 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminAssignProductAttributeToAttributeSetTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAssignProductAttributeToAttributeSetTest.xml
@@ -32,7 +32,10 @@
-
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCatalogCategoriesNavigateMenuTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCatalogCategoriesNavigateMenuTest.xml
index a51df86d0327a..03331b0d75cc5 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCatalogCategoriesNavigateMenuTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCatalogCategoriesNavigateMenuTest.xml
@@ -23,7 +23,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCatalogProductsNavigateMenuTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCatalogProductsNavigateMenuTest.xml
index 1d9400bf81e4d..23c9513c7ab49 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCatalogProductsNavigateMenuTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCatalogProductsNavigateMenuTest.xml
@@ -23,7 +23,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminChangeProductAttributeSet.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminChangeProductAttributeSet.xml
index 95620bf75b6d0..cdb9a0a8b75d0 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminChangeProductAttributeSet.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminChangeProductAttributeSet.xml
@@ -47,6 +47,9 @@
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckConfigurableProductPriceWithDisabledChildProductTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckConfigurableProductPriceWithDisabledChildProductTest.xml
index b4381a674827d..bc2efacfcbece 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckConfigurableProductPriceWithDisabledChildProductTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckConfigurableProductPriceWithDisabledChildProductTest.xml
@@ -117,7 +117,10 @@
-
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckCustomAttributeValuesAfterProductSaveTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckCustomAttributeValuesAfterProductSaveTest.xml
index 7c6f6ab66f63d..c9a7bae1753b4 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckCustomAttributeValuesAfterProductSaveTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckCustomAttributeValuesAfterProductSaveTest.xml
@@ -42,7 +42,10 @@
-
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckInactiveAndNotIncludeInMenuCategoryAndSubcategoryIsNotVisibleInNavigationTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckInactiveAndNotIncludeInMenuCategoryAndSubcategoryIsNotVisibleInNavigationTest.xml
index fd22142fcb097..9b95ef726a617 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckInactiveAndNotIncludeInMenuCategoryAndSubcategoryIsNotVisibleInNavigationTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckInactiveAndNotIncludeInMenuCategoryAndSubcategoryIsNotVisibleInNavigationTest.xml
@@ -27,7 +27,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckInactiveCategoryAndSubcategoryIsNotVisibleInNavigationMenuTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckInactiveCategoryAndSubcategoryIsNotVisibleInNavigationMenuTest.xml
index b6c76d6577210..3f180939bc7ea 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckInactiveCategoryAndSubcategoryIsNotVisibleInNavigationMenuTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckInactiveCategoryAndSubcategoryIsNotVisibleInNavigationMenuTest.xml
@@ -26,7 +26,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckInactiveIncludeInMenuCategoryAndSubcategoryIsNotVisibleInNavigationTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckInactiveIncludeInMenuCategoryAndSubcategoryIsNotVisibleInNavigationTest.xml
index c9cd9acd9708c..3edd82e060e2e 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckInactiveIncludeInMenuCategoryAndSubcategoryIsNotVisibleInNavigationTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckInactiveIncludeInMenuCategoryAndSubcategoryIsNotVisibleInNavigationTest.xml
@@ -27,7 +27,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckOutOfStockProductIsNotVisibleInCategoryTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckOutOfStockProductIsNotVisibleInCategoryTest.xml
index cd03d868838f3..9b7ef4077f906 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckOutOfStockProductIsNotVisibleInCategoryTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckOutOfStockProductIsNotVisibleInCategoryTest.xml
@@ -31,7 +31,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckOutOfStockProductIsVisibleInCategoryTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckOutOfStockProductIsVisibleInCategoryTest.xml
index bfea4fa7557f5..433289f59f21b 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckOutOfStockProductIsVisibleInCategoryTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckOutOfStockProductIsVisibleInCategoryTest.xml
@@ -33,7 +33,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckPaginationInStorefrontTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckPaginationInStorefrontTest.xml
index 5bb9cc8a080df..c1f310575de2f 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckPaginationInStorefrontTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckPaginationInStorefrontTest.xml
@@ -87,7 +87,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckSubCategoryIsNotVisibleInNavigationMenuTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckSubCategoryIsNotVisibleInNavigationMenuTest.xml
index f5872ac3efca0..4ea294e3a3f36 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckSubCategoryIsNotVisibleInNavigationMenuTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckSubCategoryIsNotVisibleInNavigationMenuTest.xml
@@ -26,7 +26,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCloneProductWithDuplicateUrlTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCloneProductWithDuplicateUrlTest.xml
index cef5bc622c6cf..a213f2af900cf 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCloneProductWithDuplicateUrlTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCloneProductWithDuplicateUrlTest.xml
@@ -32,7 +32,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAndEditSimpleProductSettingsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAndEditSimpleProductSettingsTest.xml
index 80c20a7e0b5d9..2fddc667b60fd 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAndEditSimpleProductSettingsTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAndEditSimpleProductSettingsTest.xml
@@ -34,7 +34,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAndEditVirtualProductSettingsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAndEditVirtualProductSettingsTest.xml
index 70cbfe7259da0..43fce1cfdd329 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAndEditVirtualProductSettingsTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAndEditVirtualProductSettingsTest.xml
@@ -48,7 +48,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAttributeSetEntityTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAttributeSetEntityTest.xml
index 51518dffaf87e..8f06565c147fa 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAttributeSetEntityTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateAttributeSetEntityTest.xml
@@ -26,6 +26,9 @@
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryTest.xml
index 784b5d3fd1827..44a83f2dbadd4 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryTest.xml
@@ -19,7 +19,7 @@
-
+
@@ -52,7 +52,7 @@
-
+
@@ -83,7 +83,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithAnchorFieldTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithAnchorFieldTest.xml
index 7de1d38f097c5..8900e85ca3431 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithAnchorFieldTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithAnchorFieldTest.xml
@@ -24,7 +24,7 @@
-
+
@@ -64,6 +64,14 @@
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithCustomRootCategoryTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithCustomRootCategoryTest.xml
index a68a585bbf31d..ac237fbe49978 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithCustomRootCategoryTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithCustomRootCategoryTest.xml
@@ -29,7 +29,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithFiveNestingTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithFiveNestingTest.xml
index 530bafaef24c2..bc60f21b5d214 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithFiveNestingTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithFiveNestingTest.xml
@@ -33,7 +33,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithInactiveCategoryTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithInactiveCategoryTest.xml
index fae1a1fa8c2e4..ca2b15658f02e 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithInactiveCategoryTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithInactiveCategoryTest.xml
@@ -22,7 +22,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithInactiveIncludeInMenuTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithInactiveIncludeInMenuTest.xml
index a695aa33079bd..f6b0a0a321c5d 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithInactiveIncludeInMenuTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithInactiveIncludeInMenuTest.xml
@@ -22,7 +22,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithNoAnchorFieldTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithNoAnchorFieldTest.xml
new file mode 100644
index 0000000000000..5342dec6b1ebb
--- /dev/null
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithNoAnchorFieldTest.xml
@@ -0,0 +1,93 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithProductsGridFilter.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithProductsGridFilter.xml
index 6a49b47b75078..2a4718223ef0c 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithProductsGridFilter.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithProductsGridFilter.xml
@@ -29,7 +29,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithRequiredFieldsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithRequiredFieldsTest.xml
index dac2a121d107f..110f52aaeb40a 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithRequiredFieldsTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithRequiredFieldsTest.xml
@@ -22,7 +22,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCustomProductAttributeWithDropdownFieldTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCustomProductAttributeWithDropdownFieldTest.xml
index 2d1a58764e20a..2b33f4a6bb1c0 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCustomProductAttributeWithDropdownFieldTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCustomProductAttributeWithDropdownFieldTest.xml
@@ -42,7 +42,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDatetimeProductAttributeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDatetimeProductAttributeTest.xml
index 981af5b5abb4a..e32aad76c9b28 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDatetimeProductAttributeTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDatetimeProductAttributeTest.xml
@@ -24,7 +24,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDropdownProductAttributeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDropdownProductAttributeTest.xml
index 4118356b07e74..4b69123635852 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDropdownProductAttributeTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDropdownProductAttributeTest.xml
@@ -24,7 +24,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDropdownProductAttributeVisibleInStorefrontAdvancedSearchFormTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDropdownProductAttributeVisibleInStorefrontAdvancedSearchFormTest.xml
index 557f0768c98a3..b36cbc27f7086 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDropdownProductAttributeVisibleInStorefrontAdvancedSearchFormTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDropdownProductAttributeVisibleInStorefrontAdvancedSearchFormTest.xml
@@ -34,7 +34,12 @@
-
+
+
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDuplicateCategoryTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDuplicateCategoryTest.xml
index cbef9566b2b78..4c91c6bac0e1a 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDuplicateCategoryTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDuplicateCategoryTest.xml
@@ -23,7 +23,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDuplicateProductTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDuplicateProductTest.xml
index 3eb617d19d54c..c6703a1109345 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDuplicateProductTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDuplicateProductTest.xml
@@ -29,7 +29,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateInactiveFlatCategoryAndUpdateAsInactiveTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateInactiveFlatCategoryAndUpdateAsInactiveTest.xml
index b0e6fe87be918..bff43cf65faf6 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateInactiveFlatCategoryAndUpdateAsInactiveTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateInactiveFlatCategoryAndUpdateAsInactiveTest.xml
@@ -52,7 +52,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateInactiveFlatCategoryTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateInactiveFlatCategoryTest.xml
index 7de37b9cb77ef..9ef3659cb5ab1 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateInactiveFlatCategoryTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateInactiveFlatCategoryTest.xml
@@ -52,7 +52,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateInactiveInMenuFlatCategoryTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateInactiveInMenuFlatCategoryTest.xml
index c7aba1fe8376f..4623f9ad4005b 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateInactiveInMenuFlatCategoryTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateInactiveInMenuFlatCategoryTest.xml
@@ -52,7 +52,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateMultipleSelectProductAttributeVisibleInStorefrontAdvancedSearchFormTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateMultipleSelectProductAttributeVisibleInStorefrontAdvancedSearchFormTest.xml
index 6bfd012bc88b2..2c8ec9ad7d1b9 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateMultipleSelectProductAttributeVisibleInStorefrontAdvancedSearchFormTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateMultipleSelectProductAttributeVisibleInStorefrontAdvancedSearchFormTest.xml
@@ -40,7 +40,10 @@
-
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateNewAttributeFromProductPageTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateNewAttributeFromProductPageTest.xml
index 51c4a3250d609..4ffb81d9a1d67 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateNewAttributeFromProductPageTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateNewAttributeFromProductPageTest.xml
@@ -23,7 +23,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateNewAttributeFromProductTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateNewAttributeFromProductTest.xml
index 8fb226f5f5585..a39bc0bd39e2f 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateNewAttributeFromProductTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateNewAttributeFromProductTest.xml
@@ -42,7 +42,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateNewGroupForAttributeSetTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateNewGroupForAttributeSetTest.xml
index a105f343d3e21..f468f61fada04 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateNewGroupForAttributeSetTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateNewGroupForAttributeSetTest.xml
@@ -27,7 +27,11 @@
-
+
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductAttributeFromProductPageTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductAttributeFromProductPageTest.xml
index 2e502f58041e6..18d1ec5b30f72 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductAttributeFromProductPageTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductAttributeFromProductPageTest.xml
@@ -39,7 +39,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductAttributeRequiredTextFieldTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductAttributeRequiredTextFieldTest.xml
index 63eed37b1e84f..a6632fa1ddabb 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductAttributeRequiredTextFieldTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductAttributeRequiredTextFieldTest.xml
@@ -37,7 +37,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductDuplicateUrlkeyTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductDuplicateUrlkeyTest.xml
index eacb69db38e9a..ecce1bb1517e1 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductDuplicateUrlkeyTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateProductDuplicateUrlkeyTest.xml
@@ -23,7 +23,7 @@
-
+
@@ -62,7 +62,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateRootCategoryAndSubcategoriesTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateRootCategoryAndSubcategoriesTest.xml
index 7a99750c00e53..2352e231e66a4 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateRootCategoryAndSubcategoriesTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateRootCategoryAndSubcategoriesTest.xml
@@ -36,7 +36,7 @@
-
+
@@ -70,7 +70,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateRootCategoryRequiredFieldsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateRootCategoryRequiredFieldsTest.xml
index 2b824554b9bd4..a5556b076fef6 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateRootCategoryRequiredFieldsTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateRootCategoryRequiredFieldsTest.xml
@@ -26,7 +26,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductNotVisibleIndividuallyTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductNotVisibleIndividuallyTest.xml
new file mode 100644
index 0000000000000..4188fc628064a
--- /dev/null
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductNotVisibleIndividuallyTest.xml
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductTest.xml
index 052f6b1924e89..1c6ed551d3f72 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductTest.xml
@@ -30,6 +30,7 @@
+
@@ -54,7 +55,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductWithCountryOfManufactureAttributeSKUMaskTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductWithCountryOfManufactureAttributeSKUMaskTest.xml
index bbaabffcc5ecd..967babc617ce9 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductWithCountryOfManufactureAttributeSKUMaskTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductWithCountryOfManufactureAttributeSKUMaskTest.xml
@@ -28,7 +28,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductWithDatetimeAttributeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductWithDatetimeAttributeTest.xml
index 0f88fa9d6abf4..fe5b70b8e4ca7 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductWithDatetimeAttributeTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductWithDatetimeAttributeTest.xml
@@ -27,7 +27,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductWithUnicodeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductWithUnicodeTest.xml
index 5dcc23a725b84..9660a46d43dba 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductWithUnicodeTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateSimpleProductWithUnicodeTest.xml
@@ -22,7 +22,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateTextEditorProductAttributeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateTextEditorProductAttributeTest.xml
index 848e765d34d70..bad620b3dab99 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateTextEditorProductAttributeTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateTextEditorProductAttributeTest.xml
@@ -40,7 +40,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductFillingRequiredFieldsOnlyTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductFillingRequiredFieldsOnlyTest.xml
index c3fe666c84fd4..6d39455e4a31b 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductFillingRequiredFieldsOnlyTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductFillingRequiredFieldsOnlyTest.xml
@@ -22,7 +22,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductOutOfStockWithTierPriceTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductOutOfStockWithTierPriceTest.xml
index 9db9f64396826..df46983b361c6 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductOutOfStockWithTierPriceTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductOutOfStockWithTierPriceTest.xml
@@ -28,7 +28,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductWithCustomOptionsSuiteAndImportOptionsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductWithCustomOptionsSuiteAndImportOptionsTest.xml
index fe39bb6ada2bd..899f3af02c78e 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductWithCustomOptionsSuiteAndImportOptionsTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductWithCustomOptionsSuiteAndImportOptionsTest.xml
@@ -28,7 +28,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductWithTierPriceForGeneralGroupTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductWithTierPriceForGeneralGroupTest.xml
index 4c3d519106389..84cba791c6629 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductWithTierPriceForGeneralGroupTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductWithTierPriceForGeneralGroupTest.xml
@@ -10,6 +10,7 @@
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
+
@@ -17,122 +18,96 @@
-
-
-
-
+
+
+
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
selectedCategories
- [$$categoryEntity.name$$]
+ [$categoryEntity.name$]
-
-
+
+
-
-
-
-
+
+
+
+
+
+
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
- As low as ${{tierPriceOnGeneralGroup.price}}
- tierPriceTextOnStorefrontPage
-
-
-
-
-
- Buy {{tierPriceOnGeneralGroup.qty}} for ${{tierPriceOnGeneralGroup.price}} each and save 20%
- tierPriceText
-
+
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductWithTierPriceTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductWithTierPriceTest.xml
index 40f26761e7b6d..ea73de1cab15d 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductWithTierPriceTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductWithTierPriceTest.xml
@@ -24,7 +24,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductWithoutManageStockTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductWithoutManageStockTest.xml
index cb41b0292d33a..685db6db90a10 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductWithoutManageStockTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductWithoutManageStockTest.xml
@@ -24,7 +24,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteAttributeSetTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteAttributeSetTest.xml
index 973ff0381584a..bb4ff7acaa4a7 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteAttributeSetTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteAttributeSetTest.xml
@@ -28,7 +28,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteConfigurableChildProductsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteConfigurableChildProductsTest.xml
index 4a305b8dfec75..3510b99a0c778 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteConfigurableChildProductsTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteConfigurableChildProductsTest.xml
@@ -81,7 +81,10 @@
-
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteDropdownProductAttributeFromAttributeSetTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteDropdownProductAttributeFromAttributeSetTest.xml
index 3abe68a503b57..373d14d4d0db4 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteDropdownProductAttributeFromAttributeSetTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteDropdownProductAttributeFromAttributeSetTest.xml
@@ -28,7 +28,10 @@
-
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteProductAttributeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteProductAttributeTest.xml
index 4060182a9bace..de95604e76a2f 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteProductAttributeTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteProductAttributeTest.xml
@@ -22,7 +22,10 @@
-
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteProductWithCustomOptionTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteProductWithCustomOptionTest.xml
index dec911ec84a8d..834da3f4d4f9b 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteProductWithCustomOptionTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteProductWithCustomOptionTest.xml
@@ -28,7 +28,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteProductsImageInCaseOfMultipleStoresTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteProductsImageInCaseOfMultipleStoresTest.xml
index 55c98bcc13d34..9ed0a8104faa1 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteProductsImageInCaseOfMultipleStoresTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteProductsImageInCaseOfMultipleStoresTest.xml
@@ -67,7 +67,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteRootCategoryAssignedToStoreTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteRootCategoryAssignedToStoreTest.xml
index e4b269dff96ba..77ebf77f05e58 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteRootCategoryAssignedToStoreTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteRootCategoryAssignedToStoreTest.xml
@@ -26,7 +26,7 @@
-
+
@@ -48,4 +48,4 @@
-
\ No newline at end of file
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteRootCategoryTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteRootCategoryTest.xml
index e7ab14c77945a..5e9e536203f1e 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteRootCategoryTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteRootCategoryTest.xml
@@ -22,7 +22,7 @@
-
+
@@ -41,4 +41,4 @@
-
\ No newline at end of file
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteRootSubCategoryTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteRootSubCategoryTest.xml
index 6df571f403ac9..48422d9ba2025 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteRootSubCategoryTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteRootSubCategoryTest.xml
@@ -29,7 +29,7 @@
-
+
@@ -83,8 +83,10 @@
-
-
-
+
+
+
+
+
-
\ No newline at end of file
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteSimpleProductTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteSimpleProductTest.xml
index 5b8ac5157514d..5c8b90a26594b 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteSimpleProductTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteSimpleProductTest.xml
@@ -27,7 +27,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteSystemProductAttributeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteSystemProductAttributeTest.xml
index 6de1a5cd359cd..c3a550165de89 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteSystemProductAttributeTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteSystemProductAttributeTest.xml
@@ -21,7 +21,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteTextFieldProductAttributeFromAttributeSetTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteTextFieldProductAttributeFromAttributeSetTest.xml
index 4f05c364fda0e..8528212e8fa20 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteTextFieldProductAttributeFromAttributeSetTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteTextFieldProductAttributeFromAttributeSetTest.xml
@@ -31,7 +31,10 @@
-
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteVirtualProductTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteVirtualProductTest.xml
index 86f253f358532..642fb1c1f7ba0 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteVirtualProductTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteVirtualProductTest.xml
@@ -27,7 +27,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDisableProductOnChangingAttributeSetTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDisableProductOnChangingAttributeSetTest.xml
index 0fc2c022b81e9..8ce478ff48469 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDisableProductOnChangingAttributeSetTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDisableProductOnChangingAttributeSetTest.xml
@@ -29,7 +29,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminEditTextEditorProductAttributeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminEditTextEditorProductAttributeTest.xml
index feea0930390b7..30b06ac8e0b43 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminEditTextEditorProductAttributeTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminEditTextEditorProductAttributeTest.xml
@@ -18,7 +18,7 @@
-
+
@@ -76,7 +76,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminFilterByNameByStoreViewOnProductGridTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminFilterByNameByStoreViewOnProductGridTest.xml
index 0b230b0b8e002..5ad3ee6f83e2d 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminFilterByNameByStoreViewOnProductGridTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminFilterByNameByStoreViewOnProductGridTest.xml
@@ -26,7 +26,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminFilteringCategoryProductsUsingScopeSelectorTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminFilteringCategoryProductsUsingScopeSelectorTest.xml
index 77b719c03091e..a6f34af9f5315 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminFilteringCategoryProductsUsingScopeSelectorTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminFilteringCategoryProductsUsingScopeSelectorTest.xml
@@ -97,7 +97,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminGridPageNumberAfterSaveAndCloseActionTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminGridPageNumberAfterSaveAndCloseActionTest.xml
index 81d032850bf5a..a42fe576751f7 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminGridPageNumberAfterSaveAndCloseActionTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminGridPageNumberAfterSaveAndCloseActionTest.xml
@@ -47,7 +47,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminImportCustomizableOptionToProductWithSKUTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminImportCustomizableOptionToProductWithSKUTest.xml
index 76c0d7f7b931c..cfce9143f6cc6 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminImportCustomizableOptionToProductWithSKUTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminImportCustomizableOptionToProductWithSKUTest.xml
@@ -46,7 +46,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassProductPriceUpdateTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassProductPriceUpdateTest.xml
index e98b145f01401..f803050b7a59b 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassProductPriceUpdateTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassProductPriceUpdateTest.xml
@@ -26,7 +26,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassUpdateProductAttributesGlobalScopeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassUpdateProductAttributesGlobalScopeTest.xml
index 71873fe5b0960..0fbbca2602e86 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassUpdateProductAttributesGlobalScopeTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassUpdateProductAttributesGlobalScopeTest.xml
@@ -38,7 +38,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassUpdateProductStatusStoreViewScopeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassUpdateProductStatusStoreViewScopeTest.xml
index 21c6c56adfd96..6030e76dca721 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassUpdateProductStatusStoreViewScopeTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMassUpdateProductStatusStoreViewScopeTest.xml
@@ -21,7 +21,7 @@
-
+
@@ -80,7 +80,7 @@
-
+
@@ -171,7 +171,7 @@
-
+
@@ -230,7 +230,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveAnchoredCategoryTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveAnchoredCategoryTest.xml
index f178d55b97fca..72ef78accb7fc 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveAnchoredCategoryTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveAnchoredCategoryTest.xml
@@ -14,11 +14,9 @@
-
+
+
-
-
-
@@ -32,95 +30,102 @@
-
+
+
+
+
+
+
+
-
+
+
+
-
-
-
+
+
-
+
-
-
+
+
-
-
+
+
-
+
-
+
-
+
-
-
+
+
-
-
-
+
+
+
-
-
+
+
-
-
-
-
+
+
+
+
-
+
-
+
-
-
-
+
+
+
-
+
-
+
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
-
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveAnchoredCategoryToDefaultCategoryTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveAnchoredCategoryToDefaultCategoryTest.xml
index a8a8ede297b44..2122d73ca7e62 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveAnchoredCategoryToDefaultCategoryTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveAnchoredCategoryToDefaultCategoryTest.xml
@@ -25,7 +25,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveCategoryAndCheckUrlRewritesTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveCategoryAndCheckUrlRewritesTest.xml
index ba6e6a43674c3..061bc795b2bff 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveCategoryAndCheckUrlRewritesTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveCategoryAndCheckUrlRewritesTest.xml
@@ -19,11 +19,13 @@
-
+
+ true
+
-
+
@@ -31,7 +33,7 @@
-
+
@@ -54,18 +56,19 @@
-
-
+
+
+
-
+
-
+
-
+
@@ -74,7 +77,7 @@
-
+
@@ -83,31 +86,35 @@
-
-
+
+
+
-
+
-
+
-
+
-
-
+
+
+
-
-
-
+
+
+
+
+
-
+
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveCategoryFromParentAnchoredCategoryTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveCategoryFromParentAnchoredCategoryTest.xml
index 271d78ab9cdb0..393d0c49c2e93 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveCategoryFromParentAnchoredCategoryTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveCategoryFromParentAnchoredCategoryTest.xml
@@ -28,7 +28,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveCategoryToAnotherPositionInCategoryTreeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveCategoryToAnotherPositionInCategoryTreeTest.xml
index 6c403fc7714eb..801d925c0fd84 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveCategoryToAnotherPositionInCategoryTreeTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveCategoryToAnotherPositionInCategoryTreeTest.xml
@@ -28,7 +28,7 @@
-
+
@@ -96,21 +96,23 @@
-
-
-
+
+
+
+
-
+
-
+
-
+
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveProductBetweenCategoriesTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveProductBetweenCategoriesTest.xml
index 7e6e79cd08c26..3f7d612a1fdbc 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveProductBetweenCategoriesTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveProductBetweenCategoriesTest.xml
@@ -53,7 +53,7 @@
-
+
@@ -129,7 +129,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMultipleWebsitesUseDefaultValuesTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMultipleWebsitesUseDefaultValuesTest.xml
index f7fd81f28199f..d56f64d72a1c1 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMultipleWebsitesUseDefaultValuesTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMultipleWebsitesUseDefaultValuesTest.xml
@@ -22,9 +22,9 @@
-
+
-
+
@@ -81,4 +81,4 @@
-
\ No newline at end of file
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminNavigateMultipleUpSellProductsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminNavigateMultipleUpSellProductsTest.xml
index 5dd8b2e430941..ab1ced89175bc 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminNavigateMultipleUpSellProductsTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminNavigateMultipleUpSellProductsTest.xml
@@ -78,7 +78,7 @@
-
+
@@ -90,6 +90,9 @@
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductCategoryIndexerInUpdateOnScheduleModeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductCategoryIndexerInUpdateOnScheduleModeTest.xml
index 2283a0e4d6158..b547fbe69fbf7 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductCategoryIndexerInUpdateOnScheduleModeTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductCategoryIndexerInUpdateOnScheduleModeTest.xml
@@ -69,7 +69,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductCustomURLKeyPreservedWhenAssignedToCategoryWithoutCustomURLKey.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductCustomURLKeyPreservedWhenAssignedToCategoryWithoutCustomURLKey.xml
index df09768139533..400cc891b3c91 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductCustomURLKeyPreservedWhenAssignedToCategoryWithoutCustomURLKey.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductCustomURLKeyPreservedWhenAssignedToCategoryWithoutCustomURLKey.xml
@@ -47,7 +47,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductGridFilteringByCustomAttributeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductGridFilteringByCustomAttributeTest.xml
index 6f65865924bad..1f7b88e8bb27f 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductGridFilteringByCustomAttributeTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductGridFilteringByCustomAttributeTest.xml
@@ -89,7 +89,10 @@
-
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductGridFilteringByDateAttributeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductGridFilteringByDateAttributeTest.xml
index d9f894fa5736b..8c334cb84be01 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductGridFilteringByDateAttributeTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductGridFilteringByDateAttributeTest.xml
@@ -24,7 +24,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductImageAssignmentForMultipleStoresTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductImageAssignmentForMultipleStoresTest.xml
index 59be8157d2f87..f32845072ec02 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductImageAssignmentForMultipleStoresTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductImageAssignmentForMultipleStoresTest.xml
@@ -54,7 +54,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductStatusAttributeDisabledByDefaultTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductStatusAttributeDisabledByDefaultTest.xml
index a882c6e7817ce..5f089aad256b7 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductStatusAttributeDisabledByDefaultTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductStatusAttributeDisabledByDefaultTest.xml
@@ -35,7 +35,7 @@
-
+
@@ -56,4 +56,4 @@
-
\ No newline at end of file
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductTypeSwitchingOnEditingTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductTypeSwitchingOnEditingTest.xml
index 0b7e2a70735c3..8e8f3ebccafb1 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductTypeSwitchingOnEditingTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductTypeSwitchingOnEditingTest.xml
@@ -34,7 +34,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminRemoveCustomOptionsFromProductTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminRemoveCustomOptionsFromProductTest.xml
index fb54b0b601d85..90fd42f8b4c95 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminRemoveCustomOptionsFromProductTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminRemoveCustomOptionsFromProductTest.xml
@@ -28,7 +28,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminRemoveImageAffectsAllScopesTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminRemoveImageAffectsAllScopesTest.xml
index 47f497b381553..5e29bf30b4bf2 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminRemoveImageAffectsAllScopesTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminRemoveImageAffectsAllScopesTest.xml
@@ -67,7 +67,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminRemoveImageFromCategoryTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminRemoveImageFromCategoryTest.xml
index ef276114b4de5..b3e5900c9bb76 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminRemoveImageFromCategoryTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminRemoveImageFromCategoryTest.xml
@@ -25,7 +25,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminRequiredFieldsHaveRequiredFieldIndicatorTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminRequiredFieldsHaveRequiredFieldIndicatorTest.xml
index ebae27a1f7182..45c2c9d379033 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminRequiredFieldsHaveRequiredFieldIndicatorTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminRequiredFieldsHaveRequiredFieldIndicatorTest.xml
@@ -18,7 +18,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminRestrictedUserAddCategoryFromProductPageTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminRestrictedUserAddCategoryFromProductPageTest.xml
index 05008b32ed4fb..5f489e337b01a 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminRestrictedUserAddCategoryFromProductPageTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminRestrictedUserAddCategoryFromProductPageTest.xml
@@ -32,7 +32,7 @@
-
+
@@ -47,7 +47,7 @@
-
+
@@ -74,7 +74,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminShouldBeAbleToAssociateSimpleProductToWebsitesTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminShouldBeAbleToAssociateSimpleProductToWebsitesTest.xml
index 9d19a1dedf7ef..190a051c16d44 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminShouldBeAbleToAssociateSimpleProductToWebsitesTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminShouldBeAbleToAssociateSimpleProductToWebsitesTest.xml
@@ -44,7 +44,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminSimpleProductImagesTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminSimpleProductImagesTest.xml
index ff8240655ca03..3d505b9f893eb 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminSimpleProductImagesTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminSimpleProductImagesTest.xml
@@ -34,7 +34,7 @@
-
+
@@ -188,7 +188,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminSimpleProductSetEditContentTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminSimpleProductSetEditContentTest.xml
index 1e1fe4572b28d..80e245818e216 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminSimpleProductSetEditContentTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminSimpleProductSetEditContentTest.xml
@@ -30,7 +30,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminSimpleSetEditRelatedProductsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminSimpleSetEditRelatedProductsTest.xml
index 0c0b8751a732e..84eb3a843aa1f 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminSimpleSetEditRelatedProductsTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminSimpleSetEditRelatedProductsTest.xml
@@ -27,6 +27,8 @@
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminSortingByWebsitesTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminSortingByWebsitesTest.xml
index b20a024a7c586..16bc76cb6446a 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminSortingByWebsitesTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminSortingByWebsitesTest.xml
@@ -45,7 +45,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminStoresAttributeSetNavigateMenuTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminStoresAttributeSetNavigateMenuTest.xml
index ed29c281b804c..544ab05d8783b 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminStoresAttributeSetNavigateMenuTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminStoresAttributeSetNavigateMenuTest.xml
@@ -23,7 +23,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminStoresProductNavigateMenuTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminStoresProductNavigateMenuTest.xml
index 28a33c4f20c01..37571d7b44635 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminStoresProductNavigateMenuTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminStoresProductNavigateMenuTest.xml
@@ -23,7 +23,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminTierPriceNotAvailableForProductOptionsWithoutTierPriceTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminTierPriceNotAvailableForProductOptionsWithoutTierPriceTest.xml
index 4bcb82372e801..ee8dab9c0ee37 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminTierPriceNotAvailableForProductOptionsWithoutTierPriceTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminTierPriceNotAvailableForProductOptionsWithoutTierPriceTest.xml
@@ -82,7 +82,10 @@
-
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUnassignProductAttributeFromAttributeSetTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUnassignProductAttributeFromAttributeSetTest.xml
index 44b4e60973907..c651d2db6a7ce 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUnassignProductAttributeFromAttributeSetTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUnassignProductAttributeFromAttributeSetTest.xml
@@ -36,7 +36,10 @@
-
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateCategoryAndCheckDefaultUrlKeyOnStoreViewTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateCategoryAndCheckDefaultUrlKeyOnStoreViewTest.xml
index d8d462f850f8f..0f4e6e2854948 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateCategoryAndCheckDefaultUrlKeyOnStoreViewTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateCategoryAndCheckDefaultUrlKeyOnStoreViewTest.xml
@@ -29,7 +29,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateCategoryAndMakeInactiveTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateCategoryAndMakeInactiveTest.xml
index 479249ca678dd..b121ba46410e4 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateCategoryAndMakeInactiveTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateCategoryAndMakeInactiveTest.xml
@@ -23,7 +23,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateCategoryNameWithStoreViewTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateCategoryNameWithStoreViewTest.xml
index 2cb4a6b6dd436..51d8b9e1eaf37 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateCategoryNameWithStoreViewTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateCategoryNameWithStoreViewTest.xml
@@ -29,7 +29,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateCategoryStoreUrlKeyTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateCategoryStoreUrlKeyTest.xml
index 01eba2976c3d6..299298266d061 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateCategoryStoreUrlKeyTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateCategoryStoreUrlKeyTest.xml
@@ -22,7 +22,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateCategoryUrlKeyWithStoreViewTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateCategoryUrlKeyWithStoreViewTest.xml
index e7c4a8a093e19..c0c8f53307b20 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateCategoryUrlKeyWithStoreViewTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateCategoryUrlKeyWithStoreViewTest.xml
@@ -29,7 +29,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateCategoryWithInactiveIncludeInMenuTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateCategoryWithInactiveIncludeInMenuTest.xml
index 0c705c180d073..d6c581b18beff 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateCategoryWithInactiveIncludeInMenuTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateCategoryWithInactiveIncludeInMenuTest.xml
@@ -24,7 +24,7 @@
-
+
@@ -54,10 +54,11 @@
-
-
+
+
+
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateCategoryWithProductsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateCategoryWithProductsTest.xml
index ad110ceee32d2..065ebb74785d4 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateCategoryWithProductsTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateCategoryWithProductsTest.xml
@@ -25,7 +25,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateFlatCategoryAndAddProductsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateFlatCategoryAndAddProductsTest.xml
index cebf67ae2ebcf..8a31145f7349d 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateFlatCategoryAndAddProductsTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateFlatCategoryAndAddProductsTest.xml
@@ -54,7 +54,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateFlatCategoryIncludeInNavigationTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateFlatCategoryIncludeInNavigationTest.xml
index d7ce22bdc0097..6575fd1f1c977 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateFlatCategoryIncludeInNavigationTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateFlatCategoryIncludeInNavigationTest.xml
@@ -51,7 +51,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateFlatCategoryNameAndDescriptionTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateFlatCategoryNameAndDescriptionTest.xml
index 2b14973d6ce32..2ae3c67cb222d 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateFlatCategoryNameAndDescriptionTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateFlatCategoryNameAndDescriptionTest.xml
@@ -52,7 +52,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductNameToVerifyDataOverridingOnStoreViewLevelTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductNameToVerifyDataOverridingOnStoreViewLevelTest.xml
index 60e7f03824ab7..2c45e957d801c 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductNameToVerifyDataOverridingOnStoreViewLevelTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductNameToVerifyDataOverridingOnStoreViewLevelTest.xml
@@ -38,7 +38,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductPriceToVerifyDataOverridingOnStoreViewLevelTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductPriceToVerifyDataOverridingOnStoreViewLevelTest.xml
index 7624ad0557b47..4e80f95bbf390 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductPriceToVerifyDataOverridingOnStoreViewLevelTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductPriceToVerifyDataOverridingOnStoreViewLevelTest.xml
@@ -38,7 +38,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductTieredPriceTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductTieredPriceTest.xml
index a848eb3d11e61..7096e547c5aa7 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductTieredPriceTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductTieredPriceTest.xml
@@ -36,7 +36,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockDisabledProductTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockDisabledProductTest.xml
index ff3f56b566b38..270b95b7e52c5 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockDisabledProductTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockDisabledProductTest.xml
@@ -30,7 +30,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockEnabledFlatTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockEnabledFlatTest.xml
index 09ddc18aff4bd..e9c2ed1511ce3 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockEnabledFlatTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockEnabledFlatTest.xml
@@ -33,7 +33,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockNotVisibleIndividuallyTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockNotVisibleIndividuallyTest.xml
index 94aec4cc95d1d..17a91ed2cf4f4 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockNotVisibleIndividuallyTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockNotVisibleIndividuallyTest.xml
@@ -32,7 +32,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockUnassignFromCategoryTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockUnassignFromCategoryTest.xml
index fa3317aa815d9..84f2c4552ae6c 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockUnassignFromCategoryTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockUnassignFromCategoryTest.xml
@@ -30,7 +30,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockVisibleInCatalogAndSearchTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockVisibleInCatalogAndSearchTest.xml
index 95b74f4d38b3f..2490782d86b8b 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockVisibleInCatalogAndSearchTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockVisibleInCatalogAndSearchTest.xml
@@ -32,7 +32,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockVisibleInCatalogOnlyTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockVisibleInCatalogOnlyTest.xml
index af190890ac351..2f0ef84d4be0d 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockVisibleInCatalogOnlyTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockVisibleInCatalogOnlyTest.xml
@@ -32,7 +32,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockVisibleInSearchOnlyTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockVisibleInSearchOnlyTest.xml
index 626c3d00a5caf..5c196744f0181 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockVisibleInSearchOnlyTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockVisibleInSearchOnlyTest.xml
@@ -32,7 +32,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockWithCustomOptionsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockWithCustomOptionsTest.xml
index 13782da076f69..4b13323afdc44 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockWithCustomOptionsTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceInStockWithCustomOptionsTest.xml
@@ -32,7 +32,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceOutOfStockTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceOutOfStockTest.xml
index 285ceb3c4d722..ec19a2a496f9f 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceOutOfStockTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateSimpleProductWithRegularPriceOutOfStockTest.xml
@@ -32,7 +32,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateTopCategoryUrlWithNoRedirectTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateTopCategoryUrlWithNoRedirectTest.xml
index 4dea6663e61bf..df3f0529b1bd4 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateTopCategoryUrlWithNoRedirectTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateTopCategoryUrlWithNoRedirectTest.xml
@@ -32,7 +32,7 @@
-
+
@@ -68,21 +68,27 @@
-
+
-
-
+
+
+
-
-
-
+
+
+
-
+
-
-
+
+
+
+
-
+
-
\ No newline at end of file
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateTopCategoryUrlWithRedirectTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateTopCategoryUrlWithRedirectTest.xml
index ee1ed5f97edfa..fddaced13fa4d 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateTopCategoryUrlWithRedirectTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateTopCategoryUrlWithRedirectTest.xml
@@ -34,7 +34,7 @@
-
+
@@ -66,23 +66,28 @@
-
+
-
-
+
+
+
-
-
-
+
+
+
-
+
-
-
+
+
+
-
-
-
+
+
+
-
\ No newline at end of file
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithRegularPriceInStockVisibleInCategoryOnlyTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithRegularPriceInStockVisibleInCategoryOnlyTest.xml
index 0e9b9431dcfa6..cea09b0cdb4bd 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithRegularPriceInStockVisibleInCategoryOnlyTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithRegularPriceInStockVisibleInCategoryOnlyTest.xml
@@ -33,7 +33,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithRegularPriceInStockWithCustomOptionsVisibleInSearchOnlyTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithRegularPriceInStockWithCustomOptionsVisibleInSearchOnlyTest.xml
index f621813f4f8c0..77de42bdbac21 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithRegularPriceInStockWithCustomOptionsVisibleInSearchOnlyTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithRegularPriceInStockWithCustomOptionsVisibleInSearchOnlyTest.xml
@@ -30,7 +30,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithRegularPriceOutOfStockVisibleInCategoryAndSearchTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithRegularPriceOutOfStockVisibleInCategoryAndSearchTest.xml
index 021ed5593c738..918cda5274216 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithRegularPriceOutOfStockVisibleInCategoryAndSearchTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithRegularPriceOutOfStockVisibleInCategoryAndSearchTest.xml
@@ -33,7 +33,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithRegularPriceOutOfStockVisibleInCategoryOnlyTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithRegularPriceOutOfStockVisibleInCategoryOnlyTest.xml
index d74a6ce508b88..5f6f44110bfb4 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithRegularPriceOutOfStockVisibleInCategoryOnlyTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithRegularPriceOutOfStockVisibleInCategoryOnlyTest.xml
@@ -33,7 +33,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithRegularPriceOutOfStockVisibleInSearchOnlyTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithRegularPriceOutOfStockVisibleInSearchOnlyTest.xml
index aa90d018f7710..393c280eedf1b 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithRegularPriceOutOfStockVisibleInSearchOnlyTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithRegularPriceOutOfStockVisibleInSearchOnlyTest.xml
@@ -31,7 +31,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithSpecialPriceInStockVisibleInCategoryAndSearchTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithSpecialPriceInStockVisibleInCategoryAndSearchTest.xml
index 94ddb3dc5e5da..9658597a04717 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithSpecialPriceInStockVisibleInCategoryAndSearchTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithSpecialPriceInStockVisibleInCategoryAndSearchTest.xml
@@ -33,7 +33,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithSpecialPriceOutOfStockVisibleInCategoryAndSearchTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithSpecialPriceOutOfStockVisibleInCategoryAndSearchTest.xml
index a6a629b35091e..9d3d315487d65 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithSpecialPriceOutOfStockVisibleInCategoryAndSearchTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithSpecialPriceOutOfStockVisibleInCategoryAndSearchTest.xml
@@ -33,7 +33,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithTierPriceInStockVisibleInCategoryAndSearchTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithTierPriceInStockVisibleInCategoryAndSearchTest.xml
index 04110dbd73a4c..f5571633c2da4 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithTierPriceInStockVisibleInCategoryAndSearchTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithTierPriceInStockVisibleInCategoryAndSearchTest.xml
@@ -8,7 +8,7 @@
-
+
@@ -17,147 +17,117 @@
-
-
-
-
+
+
+
+
+
+
+
-
-
-
+
+
-
-
-
-
-
-
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
selectedCategories
- [$$categoryEntity.name$$]
+ [$categoryEntity.name$]
-
-
+
+
+
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
- {{updateVirtualProductTierPriceInStock.storefrontStatus}}
- productStockAvailableStatus
-
-
-
- ${{updateVirtualProductTierPriceInStock.price}}
- productPriceAmount
-
-
-
- Buy {{tierPriceOnVirtualProduct.qty}} for ${{tierPriceOnVirtualProduct.price}} each and save 38%
- tierPriceText
-
+
+
+
+
+
-
-
-
-
-
-
-
-
-
- As low as ${{tierPriceOnVirtualProduct.price}}
- tierPriceTextOnStorefrontPage
-
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithTierPriceInStockVisibleInCategoryOnlyTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithTierPriceInStockVisibleInCategoryOnlyTest.xml
index 0edc487e71edf..5c0b7c31756ca 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithTierPriceInStockVisibleInCategoryOnlyTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithTierPriceInStockVisibleInCategoryOnlyTest.xml
@@ -33,7 +33,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithTierPriceOutOfStockVisibleInCategoryAndSearchTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithTierPriceOutOfStockVisibleInCategoryAndSearchTest.xml
index e513d007e6a09..eeb85e8d6fc2e 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithTierPriceOutOfStockVisibleInCategoryAndSearchTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithTierPriceOutOfStockVisibleInCategoryAndSearchTest.xml
@@ -33,7 +33,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminVerifyProductOrderTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminVerifyProductOrderTest.xml
index b61be7fd95a58..09ddcd040bea4 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminVerifyProductOrderTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminVerifyProductOrderTest.xml
@@ -23,7 +23,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdvanceCatalogSearchSimpleProductTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdvanceCatalogSearchSimpleProductTest.xml
index 3125ba3decce6..14f4a6f6d1cfb 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdvanceCatalogSearchSimpleProductTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdvanceCatalogSearchSimpleProductTest.xml
@@ -25,7 +25,7 @@
-
+
@@ -106,7 +106,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/CheckTierPricingOfProductsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/CheckTierPricingOfProductsTest.xml
index 4e0e8d03f59d5..1fe42a331c80c 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/CheckTierPricingOfProductsTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/CheckTierPricingOfProductsTest.xml
@@ -36,6 +36,7 @@
+
@@ -328,7 +329,8 @@
-
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/CreateProductAttributeEntityTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/CreateProductAttributeEntityTest.xml
index 1e297586ecb65..d5dee9e462560 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/CreateProductAttributeEntityTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/CreateProductAttributeEntityTest.xml
@@ -30,7 +30,7 @@
-
+
@@ -89,7 +89,7 @@
-
+
@@ -149,7 +149,7 @@
-
+
@@ -203,7 +203,7 @@
-
+
@@ -290,7 +290,7 @@
-
+
@@ -358,7 +358,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/DeleteCategoriesTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/DeleteCategoriesTest.xml
index 8609d50fecaf2..604c01f05b838 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/DeleteCategoriesTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/DeleteCategoriesTest.xml
@@ -36,7 +36,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/DeleteUsedInConfigurableProductAttributeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/DeleteUsedInConfigurableProductAttributeTest.xml
index 0daf8361ef9d1..eb6661e12116d 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/DeleteUsedInConfigurableProductAttributeTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/DeleteUsedInConfigurableProductAttributeTest.xml
@@ -72,7 +72,10 @@
-
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/DisplayRefreshCacheAfterChangingCategoryPageLayoutTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/DisplayRefreshCacheAfterChangingCategoryPageLayoutTest.xml
index 1f71ec1e6a850..5a57bd844aa8d 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/DisplayRefreshCacheAfterChangingCategoryPageLayoutTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/DisplayRefreshCacheAfterChangingCategoryPageLayoutTest.xml
@@ -30,7 +30,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/EndToEndB2CAdminTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/EndToEndB2CAdminTest.xml
index 232321610eadc..0400de5227cf3 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/EndToEndB2CAdminTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/EndToEndB2CAdminTest.xml
@@ -21,7 +21,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/ProductAttributeWithoutValueInCompareListTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/ProductAttributeWithoutValueInCompareListTest.xml
index c75abdbe43e24..96907eb091b45 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/ProductAttributeWithoutValueInCompareListTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/ProductAttributeWithoutValueInCompareListTest.xml
@@ -43,7 +43,10 @@
-
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/ProductAvailableAfterEnablingSubCategoriesTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/ProductAvailableAfterEnablingSubCategoriesTest.xml
index c8a7cdee66b53..9e0dea7e06ded 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/ProductAvailableAfterEnablingSubCategoriesTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/ProductAvailableAfterEnablingSubCategoriesTest.xml
@@ -34,7 +34,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/SaveProductWithCustomOptionsSecondWebsiteTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/SaveProductWithCustomOptionsSecondWebsiteTest.xml
index 89e784d67eaea..f2c5750a2b18e 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/SaveProductWithCustomOptionsSecondWebsiteTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/SaveProductWithCustomOptionsSecondWebsiteTest.xml
@@ -53,7 +53,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/StoreFrontProductsDisplayUsingElasticSearchTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/StoreFrontProductsDisplayUsingElasticSearchTest.xml
index 3c1bcb3b352cd..fe37f2110acc9 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/StoreFrontProductsDisplayUsingElasticSearchTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/StoreFrontProductsDisplayUsingElasticSearchTest.xml
@@ -171,7 +171,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/StoreFrontSimpleProductWithSpecialAndTierDiscountPriceTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/StoreFrontSimpleProductWithSpecialAndTierDiscountPriceTest.xml
new file mode 100644
index 0000000000000..6817969de65c3
--- /dev/null
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/StoreFrontSimpleProductWithSpecialAndTierDiscountPriceTest.xml
@@ -0,0 +1,65 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 100.00
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontCatalogNavigationMenuUIDesktopTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontCatalogNavigationMenuUIDesktopTest.xml
index 22ec0048497fa..68ced18a0a7dd 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontCatalogNavigationMenuUIDesktopTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontCatalogNavigationMenuUIDesktopTest.xml
@@ -29,7 +29,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontCategoryHighlightedAndProductDisplayedTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontCategoryHighlightedAndProductDisplayedTest.xml
index 3e72df9133898..b8a9a9cb3e0e6 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontCategoryHighlightedAndProductDisplayedTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontCategoryHighlightedAndProductDisplayedTest.xml
@@ -47,7 +47,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontCheckDefaultNumberProductsToDisplayTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontCheckDefaultNumberProductsToDisplayTest.xml
index 4eef6a2c06800..dc053bb990685 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontCheckDefaultNumberProductsToDisplayTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontCheckDefaultNumberProductsToDisplayTest.xml
@@ -176,7 +176,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontEnsureThatAccordionAnchorIsVisibleOnViewportOnceClickedTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontEnsureThatAccordionAnchorIsVisibleOnViewportOnceClickedTest.xml
index 30461a30e53cb..2695c0f07f19e 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontEnsureThatAccordionAnchorIsVisibleOnViewportOnceClickedTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontEnsureThatAccordionAnchorIsVisibleOnViewportOnceClickedTest.xml
@@ -69,6 +69,9 @@
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontFotoramaArrowsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontFotoramaArrowsTest.xml
index 1a8e0c95a304c..120fa30832075 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontFotoramaArrowsTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontFotoramaArrowsTest.xml
@@ -24,7 +24,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontProductWithEmptyAttributeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontProductWithEmptyAttributeTest.xml
index db693b7229b17..feefcf6f4559d 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontProductWithEmptyAttributeTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontProductWithEmptyAttributeTest.xml
@@ -28,7 +28,10 @@
-
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontProductsCompareWithEmptyAttributeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontProductsCompareWithEmptyAttributeTest.xml
index d7f98c4cdd307..3b6284a6f6efa 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontProductsCompareWithEmptyAttributeTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontProductsCompareWithEmptyAttributeTest.xml
@@ -32,7 +32,10 @@
-
+
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontPurchaseProductCustomOptionsDifferentStoreViewsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontPurchaseProductCustomOptionsDifferentStoreViewsTest.xml
index 8637de9711da0..a8ab4cca1ac78 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontPurchaseProductCustomOptionsDifferentStoreViewsTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontPurchaseProductCustomOptionsDifferentStoreViewsTest.xml
@@ -69,7 +69,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontPurchaseProductWithCustomOptionsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontPurchaseProductWithCustomOptionsTest.xml
index c0653d9dbba7e..066337bf25cb6 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontPurchaseProductWithCustomOptionsTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontPurchaseProductWithCustomOptionsTest.xml
@@ -36,7 +36,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontPurchaseProductWithCustomOptionsWithLongValuesTitle.xml b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontPurchaseProductWithCustomOptionsWithLongValuesTitle.xml
index 7a667ce9667d4..36a803b03199b 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontPurchaseProductWithCustomOptionsWithLongValuesTitle.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontPurchaseProductWithCustomOptionsWithLongValuesTitle.xml
@@ -37,7 +37,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontSpecialPriceForDifferentTimezonesForWebsitesTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontSpecialPriceForDifferentTimezonesForWebsitesTest.xml
index 3e887a0a83aa4..59f0b2f5dd76e 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontSpecialPriceForDifferentTimezonesForWebsitesTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontSpecialPriceForDifferentTimezonesForWebsitesTest.xml
@@ -33,7 +33,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/VerifyCategoryProductAndProductCategoryPartialReindexTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/VerifyCategoryProductAndProductCategoryPartialReindexTest.xml
index e91f9742b2841..4b5689e6b2720 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/VerifyCategoryProductAndProductCategoryPartialReindexTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/VerifyCategoryProductAndProductCategoryPartialReindexTest.xml
@@ -55,8 +55,8 @@
-
-
+
+
@@ -72,7 +72,7 @@
-
+
@@ -138,9 +138,9 @@
-
-
-
+
+
+
@@ -199,9 +199,9 @@
-
-
-
+
+
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/VerifyChildCategoriesShouldNotIncludeInMenuTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/VerifyChildCategoriesShouldNotIncludeInMenuTest.xml
index d39d54400279c..2a6a05c8ffeab 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/VerifyChildCategoriesShouldNotIncludeInMenuTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/VerifyChildCategoriesShouldNotIncludeInMenuTest.xml
@@ -25,7 +25,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/VerifyDefaultWYSIWYGToolbarOnProductTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/VerifyDefaultWYSIWYGToolbarOnProductTest.xml
index fe0ed32f39e1e..8c10f22b7b09e 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/VerifyDefaultWYSIWYGToolbarOnProductTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/VerifyDefaultWYSIWYGToolbarOnProductTest.xml
@@ -19,7 +19,7 @@
-
+
@@ -44,7 +44,7 @@
-
+
@@ -58,7 +58,7 @@
-
+
@@ -83,7 +83,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnCatalogTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnCatalogTest.xml
index cc69d0828015f..b439223674b60 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnCatalogTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnCatalogTest.xml
@@ -19,7 +19,7 @@
-
+
@@ -46,7 +46,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnProductTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnProductTest.xml
index 5a2728b6532c8..1e4adedfc168d 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnProductTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnProductTest.xml
@@ -18,7 +18,7 @@
-
+
@@ -59,7 +59,7 @@
-
+
diff --git a/app/code/Magento/Catalog/Test/Unit/Block/Product/ImageFactoryTest.php b/app/code/Magento/Catalog/Test/Unit/Block/Product/ImageFactoryTest.php
index 95b06e40602bf..9a15a5c6c7243 100644
--- a/app/code/Magento/Catalog/Test/Unit/Block/Product/ImageFactoryTest.php
+++ b/app/code/Magento/Catalog/Test/Unit/Block/Product/ImageFactoryTest.php
@@ -95,6 +95,7 @@ public function createDataProvider(): array
return [
$this->getTestDataWithoutAttributes(),
$this->getTestDataWithAttributes(),
+ $this->getTestDataWithoutDimensions()
];
}
@@ -209,4 +210,21 @@ private function getTestDataWithAttributes(): array
],
];
}
+
+ /**
+ * @return array
+ */
+ private function getTestDataWithoutDimensions(): array
+ {
+ $data = $this->getTestDataWithoutAttributes();
+
+ $data['data']['imageParamsBuilder']['image_width'] = null;
+ $data['data']['imageParamsBuilder']['image_height'] = null;
+
+ $data['expected']['data']['width'] = null;
+ $data['expected']['data']['height'] = null;
+ $data['expected']['data']['ratio'] = 1.0;
+
+ return $data;
+ }
}
diff --git a/app/code/Magento/Catalog/Test/Unit/Model/CategoryLinkRepositoryTest.php b/app/code/Magento/Catalog/Test/Unit/Model/CategoryLinkRepositoryTest.php
index b42262f1f0384..909b952078b58 100644
--- a/app/code/Magento/Catalog/Test/Unit/Model/CategoryLinkRepositoryTest.php
+++ b/app/code/Magento/Catalog/Test/Unit/Model/CategoryLinkRepositoryTest.php
@@ -6,40 +6,74 @@
namespace Magento\Catalog\Test\Unit\Model;
+use Magento\Catalog\Api\CategoryRepositoryInterface;
+use Magento\Catalog\Api\Data\CategoryProductLinkInterface;
+use Magento\Catalog\Api\ProductRepositoryInterface;
+use Magento\Catalog\Model\Category;
+use Magento\Catalog\Model\CategoryLinkRepository;
+use Magento\Catalog\Model\Product as ProductModel;
+use Magento\Catalog\Model\ResourceModel\Product;
+use Magento\Framework\Exception\CouldNotSaveException;
+use Magento\Framework\Exception\InputException;
+use PHPUnit_Framework_MockObject_MockObject as MockObject;
+
+/**
+ * Test for \Magento\Catalog\Model\CategoryLinkRepository
+ * @SuppressWarnings(PHPMD.TooManyFields)
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
+ */
class CategoryLinkRepositoryTest extends \PHPUnit\Framework\TestCase
{
/**
- * @var \Magento\Catalog\Model\CategoryLinkRepository
+ * @var CategoryLinkRepository
*/
- protected $model;
+ private $model;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var CategoryRepositoryInterface|MockObject
*/
- protected $categoryRepositoryMock;
+ private $categoryRepositoryMock;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var ProductRepositoryInterface|MockObject
*/
- protected $productRepositoryMock;
+ private $productRepositoryMock;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var CategoryProductLinkInterface|MockObject
*/
- protected $productLinkMock;
+ private $productLinkMock;
+ /**
+ * @var Product|MockObject
+ */
+ private $productResourceMock;
+
+ /**
+ * Initialize required data
+ */
protected function setUp()
{
- $this->categoryRepositoryMock = $this->createMock(\Magento\Catalog\Api\CategoryRepositoryInterface::class);
- $this->productRepositoryMock = $this->createMock(\Magento\Catalog\Api\ProductRepositoryInterface::class);
- $this->productLinkMock = $this->createMock(\Magento\Catalog\Api\Data\CategoryProductLinkInterface::class);
- $this->model = new \Magento\Catalog\Model\CategoryLinkRepository(
+ $this->productResourceMock = $this->getMockBuilder(Product::class)
+ ->disableOriginalConstructor()
+ ->setMethods(['getProductsIdsBySkus'])
+ ->getMock();
+ $this->categoryRepositoryMock = $this->createMock(CategoryRepositoryInterface::class);
+ $this->productRepositoryMock = $this->createMock(ProductRepositoryInterface::class);
+ $this->productLinkMock = $this->createMock(CategoryProductLinkInterface::class);
+ $this->model = new CategoryLinkRepository(
$this->categoryRepositoryMock,
- $this->productRepositoryMock
+ $this->productRepositoryMock,
+ $this->productResourceMock
);
}
- public function testSave()
+ /**
+ * Assign a product to the category
+ *
+ * @return void
+ */
+ public function testSave(): void
{
$categoryId = 42;
$productId = 55;
@@ -47,10 +81,10 @@ public function testSave()
$sku = 'testSku';
$productPositions = [$productId => $productPosition];
$categoryMock = $this->createPartialMock(
- \Magento\Catalog\Model\Category::class,
+ Category::class,
['getPostedProducts', 'getProductsPosition', 'setPostedProducts', 'save']
);
- $productMock = $this->createMock(\Magento\Catalog\Model\Product::class);
+ $productMock = $this->createMock(ProductModel::class);
$this->productLinkMock->expects($this->once())->method('getCategoryId')->willReturn($categoryId);
$this->productLinkMock->expects($this->once())->method('getSku')->willReturn($sku);
$this->categoryRepositoryMock->expects($this->once())->method('get')->with($categoryId)
@@ -61,14 +95,16 @@ public function testSave()
$this->productLinkMock->expects($this->once())->method('getPosition')->willReturn($productPosition);
$categoryMock->expects($this->once())->method('setPostedProducts')->with($productPositions);
$categoryMock->expects($this->once())->method('save');
+
$this->assertTrue($this->model->save($this->productLinkMock));
}
/**
- * @expectedException \Magento\Framework\Exception\CouldNotSaveException
- * @expectedExceptionMessage Could not save product "55" with position 1 to category 42
+ * Assign a product to the category with `CouldNotSaveException`
+ *
+ * @return void
*/
- public function testSaveWithCouldNotSaveException()
+ public function testSaveWithCouldNotSaveException(): void
{
$categoryId = 42;
$productId = 55;
@@ -76,10 +112,10 @@ public function testSaveWithCouldNotSaveException()
$sku = 'testSku';
$productPositions = [$productId => $productPosition];
$categoryMock = $this->createPartialMock(
- \Magento\Catalog\Model\Category::class,
+ Category::class,
['getProductsPosition', 'setPostedProducts', 'save', 'getId']
);
- $productMock = $this->createMock(\Magento\Catalog\Model\Product::class);
+ $productMock = $this->createMock(ProductModel::class);
$this->productLinkMock->expects($this->once())->method('getCategoryId')->willReturn($categoryId);
$this->productLinkMock->expects($this->once())->method('getSku')->willReturn($sku);
$this->categoryRepositoryMock->expects($this->once())->method('get')->with($categoryId)
@@ -91,20 +127,28 @@ public function testSaveWithCouldNotSaveException()
$categoryMock->expects($this->once())->method('setPostedProducts')->with($productPositions);
$categoryMock->expects($this->once())->method('getId')->willReturn($categoryId);
$categoryMock->expects($this->once())->method('save')->willThrowException(new \Exception());
+
+ $this->expectExceptionMessage('Could not save product "55" with position 1 to category 42');
+ $this->expectException(CouldNotSaveException::class);
$this->model->save($this->productLinkMock);
}
- public function testDeleteByIds()
+ /**
+ * Remove the product assignment from the category
+ *
+ * @return void
+ */
+ public function testDeleteByIds(): void
{
- $categoryId = "42";
- $productSku = "testSku";
+ $categoryId = 42;
+ $productSku = 'testSku';
$productId = 55;
$productPositions = [55 => 1];
$categoryMock = $this->createPartialMock(
- \Magento\Catalog\Model\Category::class,
+ Category::class,
['getProductsPosition', 'setPostedProducts', 'save', 'getId']
);
- $productMock = $this->createMock(\Magento\Catalog\Model\Product::class);
+ $productMock = $this->createMock(ProductModel::class);
$this->categoryRepositoryMock->expects($this->once())->method('get')->with($categoryId)
->willReturn($categoryMock);
$this->productRepositoryMock->expects($this->once())->method('get')->with($productSku)
@@ -113,24 +157,26 @@ public function testDeleteByIds()
$productMock->expects($this->once())->method('getId')->willReturn($productId);
$categoryMock->expects($this->once())->method('setPostedProducts')->with([]);
$categoryMock->expects($this->once())->method('save');
+
$this->assertTrue($this->model->deleteByIds($categoryId, $productSku));
}
/**
- * @expectedException \Magento\Framework\Exception\CouldNotSaveException
- * @expectedExceptionMessage Could not save product "55" with position 1 to category 42
+ * Delete the product assignment from the category with `CouldNotSaveException`
+ *
+ * @return void
*/
- public function testDeleteByIdsWithCouldNotSaveException()
+ public function testDeleteByIdsWithCouldNotSaveException(): void
{
- $categoryId = "42";
- $productSku = "testSku";
+ $categoryId = 42;
+ $productSku = 'testSku';
$productId = 55;
$productPositions = [55 => 1];
$categoryMock = $this->createPartialMock(
- \Magento\Catalog\Model\Category::class,
+ Category::class,
['getProductsPosition', 'setPostedProducts', 'save', 'getId']
);
- $productMock = $this->createMock(\Magento\Catalog\Model\Product::class);
+ $productMock = $this->createMock(ProductModel::class);
$this->categoryRepositoryMock->expects($this->once())->method('get')->with($categoryId)
->willReturn($categoryMock);
$this->productRepositoryMock->expects($this->once())->method('get')->with($productSku)
@@ -140,50 +186,61 @@ public function testDeleteByIdsWithCouldNotSaveException()
$categoryMock->expects($this->once())->method('setPostedProducts')->with([]);
$categoryMock->expects($this->once())->method('getId')->willReturn($categoryId);
$categoryMock->expects($this->once())->method('save')->willThrowException(new \Exception());
+
+ $this->expectExceptionMessage('Could not save product "55" with position 1 to category 42');
+ $this->expectException(CouldNotSaveException::class);
$this->model->deleteByIds($categoryId, $productSku);
}
/**
- * @expectedException \Magento\Framework\Exception\InputException
- * @expectedExceptionMessage The category doesn't contain the specified product.
+ * Delete the product assignment from the category with `InputException`
+ *
+ * @return void
*/
- public function testDeleteWithInputException()
+ public function testDeleteWithInputException(): void
{
- $categoryId = "42";
- $productSku = "testSku";
+ $categoryId = 42;
+ $productSku = 'testSku';
$productId = 60;
$productPositions = [55 => 1];
$this->productLinkMock->expects($this->once())->method('getCategoryId')->willReturn($categoryId);
$this->productLinkMock->expects($this->once())->method('getSku')->willReturn($productSku);
$categoryMock = $this->createPartialMock(
- \Magento\Catalog\Model\Category::class,
+ Category::class,
['getProductsPosition', 'setPostedProducts', 'save', 'getId']
);
- $productMock = $this->createMock(\Magento\Catalog\Model\Product::class);
+ $productMock = $this->createMock(ProductModel::class);
$this->categoryRepositoryMock->expects($this->once())->method('get')->with($categoryId)
->willReturn($categoryMock);
$this->productRepositoryMock->expects($this->once())->method('get')->with($productSku)
->willReturn($productMock);
$categoryMock->expects($this->once())->method('getProductsPosition')->willReturn($productPositions);
$productMock->expects($this->once())->method('getId')->willReturn($productId);
-
$categoryMock->expects($this->never())->method('save');
+
+ $this->expectExceptionMessage('The category doesn\'t contain the specified product.');
+ $this->expectException(InputException::class);
$this->assertTrue($this->model->delete($this->productLinkMock));
}
- public function testDelete()
+ /**
+ * Delete the product assignment from the category
+ *
+ * @return void
+ */
+ public function testDelete(): void
{
- $categoryId = "42";
- $productSku = "testSku";
+ $categoryId = 42;
+ $productSku = 'testSku';
$productId = 55;
$productPositions = [55 => 1];
$this->productLinkMock->expects($this->once())->method('getCategoryId')->willReturn($categoryId);
$this->productLinkMock->expects($this->once())->method('getSku')->willReturn($productSku);
$categoryMock = $this->createPartialMock(
- \Magento\Catalog\Model\Category::class,
+ Category::class,
['getProductsPosition', 'setPostedProducts', 'save', 'getId']
);
- $productMock = $this->createMock(\Magento\Catalog\Model\Product::class);
+ $productMock = $this->createMock(ProductModel::class);
$this->categoryRepositoryMock->expects($this->once())->method('get')->with($categoryId)
->willReturn($categoryMock);
$this->productRepositoryMock->expects($this->once())->method('get')->with($productSku)
@@ -192,6 +249,82 @@ public function testDelete()
$productMock->expects($this->once())->method('getId')->willReturn($productId);
$categoryMock->expects($this->once())->method('setPostedProducts')->with([]);
$categoryMock->expects($this->once())->method('save');
+
$this->assertTrue($this->model->delete($this->productLinkMock));
}
+
+ /**
+ * Delete by products skus
+ *
+ * @return void
+ */
+ public function testDeleteBySkus(): void
+ {
+ $categoryId = 42;
+ $productSkus = ['testSku', 'testSku1', 'testSku2', 'testSku3'];
+ $productPositions = [55 => 1, 56 => 2, 57 => 3, 58 => 4];
+ $categoryMock = $this->createPartialMock(
+ Category::class,
+ ['getProductsPosition', 'setPostedProducts', 'save', 'getId']
+ );
+ $this->categoryRepositoryMock->expects($this->once())->method('get')->with($categoryId)
+ ->willReturn($categoryMock);
+ $this->productResourceMock->expects($this->once())->method('getProductsIdsBySkus')
+ ->willReturn(['testSku' => 55, 'testSku1' => 56, 'testSku2' => 57, 'testSku3' => 58]);
+ $categoryMock->expects($this->once())->method('getProductsPosition')->willReturn($productPositions);
+ $categoryMock->expects($this->once())->method('setPostedProducts')->with([]);
+ $categoryMock->expects($this->once())->method('save');
+
+ $this->assertTrue($this->model->deleteBySkus($categoryId, $productSkus));
+ }
+
+ /**
+ * Delete by products skus with `InputException`
+ *
+ * @return void
+ */
+ public function testDeleteBySkusWithInputException(): void
+ {
+ $categoryId = 42;
+ $productSku = 'testSku';
+ $categoryMock = $this->createPartialMock(
+ Category::class,
+ ['getProductsPosition', 'setPostedProducts', 'save', 'getId']
+ );
+ $this->categoryRepositoryMock->expects($this->once())->method('get')->with($categoryId)
+ ->willReturn($categoryMock);
+
+ $this->expectExceptionMessage('The category doesn\'t contain the specified products.');
+ $this->expectException(InputException::class);
+ $this->model->deleteBySkus($categoryId, [$productSku]);
+ }
+
+ /**
+ * Delete by products skus with `CouldNotSaveException`
+ *
+ * @return void
+ */
+ public function testDeleteSkusIdsWithCouldNotSaveException(): void
+ {
+ $categoryId = 42;
+ $productSku = 'testSku';
+ $productId = 55;
+ $productPositions = [55 => 1];
+ $categoryMock = $this->createPartialMock(
+ Category::class,
+ ['getProductsPosition', 'setPostedProducts', 'save', 'getId']
+ );
+ $this->categoryRepositoryMock->expects($this->once())->method('get')->with($categoryId)
+ ->willReturn($categoryMock);
+ $this->productResourceMock->expects($this->once())->method('getProductsIdsBySkus')
+ ->willReturn(['testSku' => $productId]);
+ $categoryMock->expects($this->once())->method('getProductsPosition')->willReturn($productPositions);
+ $categoryMock->expects($this->once())->method('setPostedProducts')->with([]);
+ $categoryMock->expects($this->once())->method('getId')->willReturn($categoryId);
+ $categoryMock->expects($this->once())->method('save')->willThrowException(new \Exception());
+
+ $this->expectExceptionMessage('Could not save products "testSku" to category 42');
+ $this->expectException(CouldNotSaveException::class);
+ $this->assertTrue($this->model->deleteBySkus($categoryId, [$productSku]));
+ }
}
diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/CopierTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/CopierTest.php
index b72ecbf195d39..91441890e83b1 100644
--- a/app/code/Magento/Catalog/Test/Unit/Model/Product/CopierTest.php
+++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/CopierTest.php
@@ -3,77 +3,91 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
+
namespace Magento\Catalog\Test\Unit\Model\Product;
+use Magento\Catalog\Api\Data\ProductExtension;
use Magento\Catalog\Api\Data\ProductInterface;
+use Magento\Catalog\Model\Attribute\ScopeOverriddenValue;
use Magento\Catalog\Model\Product;
+use Magento\Catalog\Model\Product\Attribute\Source\Status;
use Magento\Catalog\Model\Product\Copier;
+use Magento\Catalog\Model\Product\CopyConstructorInterface;
+use Magento\Catalog\Model\Product\Option\Repository;
+use Magento\Catalog\Model\ProductFactory;
+use Magento\Catalog\Model\ResourceModel\Product as ProductResourceModel;
+use Magento\CatalogInventory\Api\Data\StockItemInterface;
+use Magento\Eav\Model\Entity\AbstractEntity;
+use Magento\Eav\Model\Entity\Attribute\AbstractAttribute;
+use Magento\Framework\EntityManager\EntityMetadata;
+use Magento\Framework\EntityManager\MetadataPool;
+use PHPUnit\Framework\MockObject\MockObject;
+use PHPUnit\Framework\TestCase;
/**
* Test for Magento\Catalog\Model\Product\Copier class.
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class CopierTest extends \PHPUnit\Framework\TestCase
+class CopierTest extends TestCase
{
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var Copier
*/
- private $optionRepositoryMock;
+ private $_model;
/**
- * @var Copier
+ * @var Repository|MockObject
*/
- private $_model;
+ private $optionRepositoryMock;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var CopyConstructorInterface|MockObject
*/
private $copyConstructorMock;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var ProductFactory|MockObject
*/
private $productFactoryMock;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var ScopeOverriddenValue|MockObject
*/
private $scopeOverriddenValueMock;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var Product|MockObject
*/
private $productMock;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var EntityMetadata|MockObject
*/
private $metadata;
+ /**
+ * @ingeritdoc
+ */
protected function setUp()
{
- $this->copyConstructorMock = $this->createMock(\Magento\Catalog\Model\Product\CopyConstructorInterface::class);
- $this->productFactoryMock = $this->createPartialMock(
- \Magento\Catalog\Model\ProductFactory::class,
- ['create']
- );
- $this->scopeOverriddenValueMock = $this->createMock(
- \Magento\Catalog\Model\Attribute\ScopeOverriddenValue::class
- );
- $this->optionRepositoryMock = $this->createMock(
- \Magento\Catalog\Model\Product\Option\Repository::class
- );
+ $this->copyConstructorMock = $this->createMock(CopyConstructorInterface::class);
+ $this->productFactoryMock = $this->createPartialMock(ProductFactory::class, ['create']);
+ $this->scopeOverriddenValueMock = $this->createMock(ScopeOverriddenValue::class);
+ $this->optionRepositoryMock = $this->createMock(Repository::class);
$this->productMock = $this->createMock(Product::class);
- $this->productMock->expects($this->any())->method('getEntityId')->willReturn(1);
- $this->metadata = $this->getMockBuilder(\Magento\Framework\EntityManager\EntityMetadata::class)
+ $this->metadata = $this->getMockBuilder(EntityMetadata::class)
->disableOriginalConstructor()
->getMock();
- $metadataPool = $this->getMockBuilder(\Magento\Framework\EntityManager\MetadataPool::class)
+
+ /** @var MetadataPool|MockObject $metadataPool */
+ $metadataPool = $this->getMockBuilder(MetadataPool::class)
->disableOriginalConstructor()
->getMock();
- $metadataPool->expects($this->any())->method('getMetadata')->willReturn($this->metadata);
+ $metadataPool->expects($this->once())
+ ->method('getMetadata')
+ ->willReturn($this->metadata);
$this->_model = new Copier(
$this->copyConstructorMock,
$this->productFactoryMock,
@@ -84,13 +98,15 @@ protected function setUp()
}
/**
+ * Test duplicate product
+ *
+ * @return void
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
- public function testCopy()
+ public function testCopy(): void
{
- $stockItem = $this->getMockBuilder(\Magento\CatalogInventory\Api\Data\StockItemInterface::class)
- ->getMock();
- $extensionAttributes = $this->getMockBuilder(\Magento\Catalog\Api\Data\ProductExtension::class)
+ $stockItem = $this->createMock(StockItemInterface::class);
+ $extensionAttributes = $this->getMockBuilder(ProductExtension::class)
->setMethods(['getStockItem', 'setData'])
->getMock();
$extensionAttributes
@@ -106,15 +122,19 @@ public function testCopy()
'product data' => ['product data'],
ProductInterface::EXTENSION_ATTRIBUTES_KEY => $extensionAttributes,
];
- $this->productMock->expects($this->atLeastOnce())->method('getWebsiteIds');
- $this->productMock->expects($this->atLeastOnce())->method('getCategoryIds');
- $this->productMock->expects($this->any())->method('getData')->willReturnMap([
- ['', null, $productData],
- ['linkField', null, '1'],
- ]);
+ $this->productMock->expects($this->atLeastOnce())
+ ->method('getWebsiteIds');
+ $this->productMock->expects($this->atLeastOnce())
+ ->method('getCategoryIds');
+ $this->productMock->expects($this->exactly(2))
+ ->method('getData')
+ ->willReturnMap([
+ ['', null, $productData],
+ ['linkField', null, '1'],
+ ]);
$entityMock = $this->getMockForAbstractClass(
- \Magento\Eav\Model\Entity\AbstractEntity::class,
+ AbstractEntity::class,
[],
'',
false,
@@ -122,12 +142,12 @@ public function testCopy()
true,
['checkAttributeUniqueValue']
);
- $entityMock->expects($this->any())
+ $entityMock->expects($this->once())
->method('checkAttributeUniqueValue')
->willReturn(true);
$attributeMock = $this->getMockForAbstractClass(
- \Magento\Eav\Model\Entity\Attribute\AbstractAttribute::class,
+ AbstractAttribute::class,
[],
'',
false,
@@ -135,22 +155,24 @@ public function testCopy()
true,
['getEntity']
);
- $attributeMock->expects($this->any())
+ $attributeMock->expects($this->once())
->method('getEntity')
->willReturn($entityMock);
- $resourceMock = $this->getMockBuilder(\Magento\Catalog\Model\ResourceModel\Product::class)
+ $resourceMock = $this->getMockBuilder(ProductResourceModel::class)
->disableOriginalConstructor()
->setMethods(['getAttributeRawValue', 'duplicate', 'getAttribute'])
->getMock();
- $resourceMock->expects($this->any())
+ $resourceMock->expects($this->once())
->method('getAttributeRawValue')
->willReturn('urk-key-1');
- $resourceMock->expects($this->any())
+ $resourceMock->expects($this->exactly(2))
->method('getAttribute')
->willReturn($attributeMock);
- $this->productMock->expects($this->any())->method('getResource')->will($this->returnValue($resourceMock));
+ $this->productMock->expects($this->exactly(2))
+ ->method('getResource')
+ ->willReturn($resourceMock);
$duplicateMock = $this->createPartialMock(
Product::class,
@@ -170,51 +192,77 @@ public function testCopy()
'setUrlKey',
'setStoreId',
'getStoreIds',
+ 'setMetaTitle',
+ 'setMetaKeyword',
+ 'setMetaDescription',
]
);
- $this->productFactoryMock->expects($this->once())->method('create')->will($this->returnValue($duplicateMock));
+ $this->productFactoryMock->expects($this->once())
+ ->method('create')
+ ->willReturn($duplicateMock);
$duplicateMock->expects($this->once())->method('setOptions')->with([]);
$duplicateMock->expects($this->once())->method('setIsDuplicate')->with(true);
$duplicateMock->expects($this->once())->method('setOriginalLinkId')->with(1);
- $duplicateMock->expects(
- $this->once()
- )->method(
- 'setStatus'
- )->with(
- \Magento\Catalog\Model\Product\Attribute\Source\Status::STATUS_DISABLED
- );
+ $duplicateMock->expects($this->once())
+ ->method('setStatus')
+ ->with(Status::STATUS_DISABLED);
$duplicateMock->expects($this->atLeastOnce())->method('setStoreId');
- $duplicateMock->expects($this->once())->method('setCreatedAt')->with(null);
- $duplicateMock->expects($this->once())->method('setUpdatedAt')->with(null);
- $duplicateMock->expects($this->once())->method('setId')->with(null);
- $duplicateMock->expects($this->atLeastOnce())->method('getStoreIds')->willReturn([]);
- $duplicateMock->expects($this->atLeastOnce())->method('setData')->willReturn($duplicateMock);
- $this->copyConstructorMock->expects($this->once())->method('build')->with($this->productMock, $duplicateMock);
- $duplicateMock->expects($this->once())->method('setUrlKey')->with('urk-key-2')->willReturn($duplicateMock);
- $duplicateMock->expects($this->once())->method('save');
-
- $this->metadata->expects($this->any())->method('getLinkField')->willReturn('linkField');
-
- $duplicateMock->expects($this->any())->method('getData')->willReturnMap([
- ['linkField', null, '2'],
- ]);
+ $duplicateMock->expects($this->once())
+ ->method('setCreatedAt')
+ ->with(null);
+ $duplicateMock->expects($this->once())
+ ->method('setUpdatedAt')
+ ->with(null);
+ $duplicateMock->expects($this->once())
+ ->method('setId')
+ ->with(null);
+ $duplicateMock->expects($this->once())
+ ->method('setMetaTitle')
+ ->with(null);
+ $duplicateMock->expects($this->once())
+ ->method('setMetaKeyword')
+ ->with(null);
+ $duplicateMock->expects($this->once())
+ ->method('setMetaDescription')
+ ->with(null);
+ $duplicateMock->expects($this->atLeastOnce())
+ ->method('getStoreIds')->willReturn([]);
+ $duplicateMock->expects($this->atLeastOnce())
+ ->method('setData')
+ ->willReturn($duplicateMock);
+ $this->copyConstructorMock->expects($this->once())
+ ->method('build')
+ ->with($this->productMock, $duplicateMock);
+ $duplicateMock->expects($this->once())
+ ->method('setUrlKey')
+ ->with('urk-key-2')
+ ->willReturn($duplicateMock);
+ $duplicateMock->expects($this->once())
+ ->method('save');
+ $this->metadata->expects($this->once())
+ ->method('getLinkField')
+ ->willReturn('linkField');
+ $duplicateMock->expects($this->never())
+ ->method('getData');
$this->optionRepositoryMock->expects($this->once())
->method('duplicate')
->with($this->productMock, $duplicateMock);
- $resourceMock->expects($this->once())->method('duplicate')->with(1, 2);
$this->assertEquals($duplicateMock, $this->_model->copy($this->productMock));
}
/**
+ * Test duplicate product with `UrlAlreadyExistsException` while copy stores url
+ *
+ * @return void
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
- public function testUrlAlreadyExistsExceptionWhileCopyStoresUrl()
+ public function testUrlAlreadyExistsExceptionWhileCopyStoresUrl(): void
{
- $stockItem = $this->getMockBuilder(\Magento\CatalogInventory\Api\Data\StockItemInterface::class)
+ $stockItem = $this->getMockBuilder(StockItemInterface::class)
->getMock();
- $extensionAttributes = $this->getMockBuilder(\Magento\Catalog\Api\Data\ProductExtension::class)
+ $extensionAttributes = $this->getMockBuilder(ProductExtension::class)
->setMethods(['getStockItem', 'setData'])
->getMock();
$extensionAttributes
diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/ProductFrontendAction/SynchronizerTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/ProductFrontendAction/SynchronizerTest.php
index 38bed83cb9504..8b70899cd26d3 100644
--- a/app/code/Magento/Catalog/Test/Unit/Model/Product/ProductFrontendAction/SynchronizerTest.php
+++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/ProductFrontendAction/SynchronizerTest.php
@@ -82,15 +82,15 @@ public function testFilterProductActions()
{
$typeId = 'recently_compared_product';
$productsData = [
- 1 => [
+ 'website-1-1' => [
'added_at' => 12,
'product_id' => 1,
],
- 2 => [
+ 'website-1-2' => [
'added_at' => 13,
'product_id' => '2',
],
- 3 => [
+ 'website-2-3' => [
'added_at' => 14,
'product_id' => 3,
]
diff --git a/app/code/Magento/Catalog/Test/Unit/Model/Product/Webapi/ProductOutputProcessorTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Product/Webapi/ProductOutputProcessorTest.php
new file mode 100644
index 0000000000000..fa419d23626ae
--- /dev/null
+++ b/app/code/Magento/Catalog/Test/Unit/Model/Product/Webapi/ProductOutputProcessorTest.php
@@ -0,0 +1,350 @@
+requestMock = $this->createPartialMock(
+ Request::class,
+ ['getContent']
+ );
+ $this->deserializerMock = $this->getMockBuilder(DeserializerInterface::class)
+ ->getMockForAbstractClass();
+ $this->productOutputProcessor = new ProductOutputProcessor($this->requestMock, $this->deserializerMock);
+ }
+
+ /**
+ * @dataProvider getProductProcessorDataProvider
+ * @param $request
+ * @param $product
+ * @param $result
+ * @param $expectedResult
+ */
+ public function testGetByProductType(
+ array $request,
+ ProductInterface $product,
+ array $result,
+ array $expectedResult
+ ) {
+ $this->requestMock
+ ->method('getContent')
+ ->willReturn($request);
+ $this->deserializerMock
+ ->method('deserialize')
+ ->willReturn($request);
+ $this->assertEquals($expectedResult, $this->productOutputProcessor->execute($product, $result));
+ }
+
+ /**
+ * Product data provider
+ *
+ * @return array
+ * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
+ */
+ public function getProductProcessorDataProvider()
+ {
+ return [
+ 'request object contains `product_links` and `tier_prices`' => [
+ 'request' => [
+ [
+ 'product' => [
+ 'sku' => 'MH01',
+ 'status' => 1,
+ 'product_links' => [],
+ 'tier_prices' => []
+ ]
+ ]
+ ],
+ 'product' => $this->setProductInformation(
+ [
+ 'sku' => 'MH01',
+ 'status' => 1,
+ 'product_links' => [],
+ 'tier_prices' => []
+ ]
+ ),
+ 'result' => [
+ 'sku' => 'MH01',
+ 'status' => 1,
+ 'product_links' => [],
+ 'tier_prices' => []
+ ],
+ 'expectedResult' => [
+ 'sku' => 'MH01',
+ 'status' => 1,
+ 'product_links' => [],
+ 'tier_prices' => []
+ ]
+ ],
+ 'request object contains `product_links`' => [
+ 'request' => [
+ [
+ 'product' => [
+ 'sku' => 'MH01',
+ 'status' => 1,
+ 'product_links' => []
+ ]
+ ]
+ ],
+ 'product' => $this->setProductInformation(
+ [
+ 'sku' => 'MH01',
+ 'status' => 1,
+ 'product_links' => [],
+ 'tier_prices' => []
+ ]
+ ),
+ 'result' => [
+ 'sku' => 'MH01',
+ 'status' => 1,
+ 'product_links' => [],
+ 'tier_prices' => []
+ ],
+ 'expectedResult' => [
+ 'sku' => 'MH01',
+ 'status' => 1,
+ 'product_links' => []
+ ]
+ ],
+ 'request object SKU does not match with product object SKU' => [
+ 'request' => [
+ [
+ 'product' => [
+ 'sku' => 'MH01',
+ 'status' => 1
+ ]
+ ]
+ ],
+ 'product' => $this->setProductInformation(
+ [
+ 'sku' => 'MH03',
+ 'status' => 1,
+ 'product_links' => [],
+ 'tier_prices' => []
+ ]
+ ),
+ 'result' => [
+ 'sku' => 'MH01',
+ 'status' => 1,
+ 'product_links' => [],
+ 'tier_prices' => []
+ ],
+ 'expectedResult' => [
+ 'sku' => 'MH01',
+ 'status' => 1,
+ 'product_links' => [],
+ 'tier_prices' => []
+ ]
+ ],
+ 'request object does not contain `sku`' => [
+ 'request' => [
+ [
+ 'product' => [
+ 'status' => 1,
+ 'product_links' => [],
+ 'tier_prices' => []
+ ]
+ ]
+ ],
+ 'product' => $this->setProductInformation(
+ [
+ 'sku' => 'MH01',
+ 'status' => 1,
+ 'product_links' => [],
+ 'tier_prices' => []
+ ]
+ ),
+ 'result' => [
+ 'sku' => 'MH01',
+ 'status' => 1,
+ 'product_links' => [],
+ 'tier_prices' => []
+ ],
+ 'expectedResult' => [
+ 'sku' => 'MH01',
+ 'status' => 1,
+ 'product_links' => [],
+ 'tier_prices' => []
+ ]
+ ],
+ 'request object has empty product' => [
+ 'request' => [
+ [
+ 'product' => []
+ ]
+ ],
+ 'product' => $this->setProductInformation(
+ [
+ 'sku' => 'MH01',
+ 'status' => 1,
+ 'product_links' => [],
+ 'tier_prices' => []
+ ]
+ ),
+ 'result' => [
+ 'sku' => 'MH01',
+ 'status' => 1,
+ 'product_links' => [],
+ 'tier_prices' => []
+ ],
+ 'expectedResult' => [
+ 'sku' => 'MH01',
+ 'status' => 1,
+ 'product_links' => [],
+ 'tier_prices' => []
+ ]
+ ],
+ 'request object does not contain product' => [
+ 'request' => [
+ [
+ 'order' => [
+ 'order_id' => 1,
+ 'order_details' => 'test'
+ ]
+ ]
+ ],
+ 'product' => $this->setProductInformation(
+ [
+ 'sku' => 'MH01',
+ 'status' => 1,
+ 'product_links' => [],
+ 'tier_prices' => []
+ ]
+ ),
+ 'result' => [
+ 'sku' => 'MH01',
+ 'status' => 1,
+ 'product_links' => [],
+ 'tier_prices' => []
+ ],
+ 'expectedResult' => [
+ 'sku' => 'MH01',
+ 'status' => 1,
+ 'product_links' => [],
+ 'tier_prices' => []
+ ]
+ ],
+ 'request object contains `product_links` is null and `tier_prices` is null' => [
+ 'request' => [
+ [
+ 'product' => [
+ 'sku' => 'MH01',
+ 'status' => 1,
+ 'product_links' => null,
+ 'tier_prices' => null
+ ]
+ ]
+ ],
+ 'product' => $this->setProductInformation(
+ [
+ 'sku' => 'MH01',
+ 'status' => 1,
+ 'product_links' => [],
+ 'tier_prices' => []
+ ]
+ ),
+ 'result' => [
+ 'sku' => 'MH01',
+ 'status' => 1,
+ 'product_links' => null,
+ 'tier_prices' => null
+ ],
+ 'expectedResult' => [
+ 'sku' => 'MH01',
+ 'status' => 1,
+ 'product_links' => null,
+ 'tier_prices' => null
+ ]
+ ],
+ 'request object has empty array' => [
+ 'request' => [],
+ 'product' => $this->setProductInformation(
+ [
+ 'sku' => 'MH01',
+ 'status' => 1,
+ 'product_links' => [],
+ 'tier_prices' => []
+ ]
+ ),
+ 'result' => [
+ 'sku' => 'MH01',
+ 'status' => 1
+ ],
+ 'expectedResult' => [
+ 'sku' => 'MH01',
+ 'status' => 1
+ ]
+ ]
+ ];
+ }
+
+ private function setProductInformation($productArr)
+ {
+ $productMock = $this->getMockBuilder(ProductInterface::class)
+ ->disableOriginalConstructor()
+ ->setMethods(
+ [
+ 'setSku',
+ 'setStatus',
+ 'setProductLinks',
+ 'setTierPrices',
+ 'getSku',
+ 'getProductLinks',
+ 'getTierPrices'
+ ]
+ )
+ ->getMockForAbstractClass();
+ $productMock
+ ->method('setSku')
+ ->with($productArr['sku'])
+ ->willReturn(true);
+ $productMock
+ ->method('getSku')
+ ->willReturn($productArr['sku']);
+ $productMock
+ ->method('setStatus')
+ ->with($productArr['status'])
+ ->willReturn(true);
+ $productMock
+ ->method('setProductLinks')
+ ->with($productArr['product_links'])
+ ->willReturn(true);
+ $productMock
+ ->method('getProductLinks')
+ ->willReturn($productArr['product_links']);
+ $productMock
+ ->method('setTierPrices')
+ ->with($productArr['tier_prices'])
+ ->willReturn(true);
+ $productMock
+ ->method('getTierPrices')
+ ->willReturn($productArr['tier_prices']);
+ return $productMock;
+ }
+}
diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ProductLink/ManagementTest.php b/app/code/Magento/Catalog/Test/Unit/Model/ProductLink/ManagementTest.php
index ab52d87f56291..69bd7dc059022 100644
--- a/app/code/Magento/Catalog/Test/Unit/Model/ProductLink/ManagementTest.php
+++ b/app/code/Magento/Catalog/Test/Unit/Model/ProductLink/ManagementTest.php
@@ -7,45 +7,66 @@
namespace Magento\Catalog\Test\Unit\Model\ProductLink;
use Magento\Framework\Exception\NoSuchEntityException;
+use Magento\Framework\Exception\InputException;
+use Magento\Framework\Exception\CouldNotSaveException;
+use Magento\Catalog\Model\ProductLink\Management;
+use Magento\Catalog\Model\ProductRepository;
+use Magento\Catalog\Model\Product;
+use Magento\Catalog\Model\Product\LinkTypeProvider;
+use Magento\Catalog\Model\ProductLink\Link;
+use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
+use PHPUnit\Framework\MockObject\MockObject;
+use PHPUnit\Framework\TestCase;
-class ManagementTest extends \PHPUnit\Framework\TestCase
+/**
+ * Unit Test for Magento\Catalog\Model\ProductLink\Management
+ */
+class ManagementTest extends TestCase
{
+
+ const STUB_PRODUCT_SKU_1 = 'Simple Product 1';
+ const STUB_PRODUCT_SKU_2 = 'Simple Product 2';
+ const STUB_PRODUCT_TYPE = 'simple';
+ const STUB_LINK_TYPE = 'related';
+ const STUB_BAD_TYPE = 'bad type';
+
/**
- * @var \Magento\Catalog\Model\ProductLink\Management
+ * @var Management
*/
protected $model;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var ProductRepository|MockObject
*/
-
protected $productRepositoryMock;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var Product|MockObject
*/
protected $productMock;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var LinkTypeProvider|MockObject
*/
protected $linkTypeProviderMock;
/**
- * @var \Magento\Framework\ObjectManagerInterface
+ * @var ObjectManagerHelper
*/
protected $objectManager;
- protected function setUp()
+ /**
+ * @inheritDoc
+ */
+ protected function setUp(): void
{
- $this->productRepositoryMock = $this->createMock(\Magento\Catalog\Model\ProductRepository::class);
- $this->productMock = $this->createMock(\Magento\Catalog\Model\Product::class);
-
- $this->linkTypeProviderMock = $this->createMock(\Magento\Catalog\Model\Product\LinkTypeProvider::class);
+ $this->productRepositoryMock = $this->createMock(ProductRepository::class);
+ $this->productMock = $this->createMock(Product::class);
+ $this->linkTypeProviderMock = $this->createMock(LinkTypeProvider::class);
- $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
+ $this->objectManager = new ObjectManagerHelper($this);
$this->model = $this->objectManager->getObject(
- \Magento\Catalog\Model\ProductLink\Management::class,
+ Management::class,
[
'productRepository' => $this->productRepositoryMock,
'linkTypeProvider' => $this->linkTypeProviderMock
@@ -53,193 +74,320 @@ protected function setUp()
);
}
- public function testGetLinkedItemsByType()
+ /**
+ * Test getLinkedItemsByType()
+ *
+ * @return void
+ */
+ public function testGetLinkedItemsByType(): void
{
- $productSku = 'Simple Product 1';
- $linkType = 'related';
- $this->productRepositoryMock->expects($this->once())->method('get')->with($productSku)
+ $productSku = self::STUB_PRODUCT_SKU_1;
+ $linkType = self::STUB_LINK_TYPE;
+
+ $this->productRepositoryMock->expects($this->once())
+ ->method('get')
+ ->with($productSku)
->willReturn($this->productMock);
- $inputRelatedLink = $this->objectManager->getObject(\Magento\Catalog\Model\ProductLink\Link::class);
- $inputRelatedLink->setProductSku($productSku);
- $inputRelatedLink->setLinkType($linkType);
- $inputRelatedLink->setData("sku", "Simple Product 2");
- $inputRelatedLink->setData("type_id", "simple");
- $inputRelatedLink->setPosition(0);
- $links = [$inputRelatedLink];
+ $links = $this->getInputRelatedLinkMock(
+ $productSku,
+ $linkType,
+ self::STUB_PRODUCT_SKU_2,
+ self::STUB_PRODUCT_TYPE
+ );
- $linkTypes = ['related' => 1, 'upsell' => 4, 'crosssell' => 5, 'associated' => 3];
- $this->linkTypeProviderMock->expects($this->once())
- ->method('getLinkTypes')
- ->willReturn($linkTypes);
+ $this->getLinkTypesMock();
+
+ $this->productMock->expects($this->once())
+ ->method('getProductLinks')
+ ->willReturn($links);
- $this->productMock->expects($this->once())->method('getProductLinks')->willReturn($links);
- $this->assertEquals($links, $this->model->getLinkedItemsByType($productSku, $linkType));
+ $this->assertEquals(
+ $links,
+ $this->model->getLinkedItemsByType($productSku, $linkType)
+ );
}
/**
- * @expectedException \Magento\Framework\Exception\NoSuchEntityException
- * @expectedExceptionMessage The "bad type" link type is unknown. Verify the type and try again.
+ * Test for GetLinkedItemsByType() with wrong type
+ *
+ * @return void
+ * @throws NoSuchEntityException
*/
- public function testGetLinkedItemsByTypeWithWrongType()
+ public function testGetLinkedItemsByTypeWithWrongType(): void
{
- $productSku = 'Simple Product 1';
- $linkType = 'bad type';
- $this->productRepositoryMock->expects($this->never())->method('get')->with($productSku)
+ $productSku = self::STUB_PRODUCT_SKU_1;
+ $linkType = self::STUB_BAD_TYPE;
+
+ $this->productRepositoryMock->expects($this->never())
+ ->method('get')
+ ->with($productSku)
->willReturn($this->productMock);
- $inputRelatedLink = $this->objectManager->getObject(\Magento\Catalog\Model\ProductLink\Link::class);
- $inputRelatedLink->setProductSku($productSku);
- $inputRelatedLink->setLinkType($linkType);
- $inputRelatedLink->setData("sku", "Simple Product 2");
- $inputRelatedLink->setData("type_id", "simple");
- $inputRelatedLink->setPosition(0);
- $links = [$inputRelatedLink];
+ $links = $this->getInputRelatedLinkMock(
+ $productSku,
+ $linkType,
+ self::STUB_PRODUCT_SKU_2,
+ self::STUB_PRODUCT_TYPE
+ );
- $linkTypes = ['related' => 1, 'upsell' => 4, 'crosssell' => 5, 'associated' => 3];
- $this->linkTypeProviderMock->expects($this->once())
- ->method('getLinkTypes')
- ->willReturn($linkTypes);
+ $this->getLinkTypesMock();
+
+ $this->productMock->expects($this->never())
+ ->method('getProductLinks')
+ ->willReturn($links);
+
+ $this->expectException(NoSuchEntityException::class);
+ $this->expectExceptionMessage(
+ 'The "bad type" link type is unknown. Verify the type and try again.'
+ );
- $this->productMock->expects($this->never())->method('getProductLinks')->willReturn($links);
$this->model->getLinkedItemsByType($productSku, $linkType);
}
- public function testSetProductLinks()
+ /**
+ * Test for setProductLinks()
+ *
+ * @return void
+ */
+ public function testSetProductLinks(): void
{
- $productSku = 'Simple Product 1';
- $linkType = 'related';
- $this->productRepositoryMock->expects($this->once())->method('get')->with($productSku)
+ $productSku = self::STUB_PRODUCT_SKU_1;
+ $linkType = self::STUB_LINK_TYPE;
+
+ $this->productRepositoryMock->expects($this->once())
+ ->method('get')
+ ->with($productSku)
->willReturn($this->productMock);
- $inputRelatedLink = $this->objectManager->getObject(\Magento\Catalog\Model\ProductLink\Link::class);
- $inputRelatedLink->setProductSku($productSku);
- $inputRelatedLink->setLinkType($linkType);
- $inputRelatedLink->setData("sku", "Simple Product 1");
- $inputRelatedLink->setData("type_id", "related");
- $inputRelatedLink->setPosition(0);
- $links = [$inputRelatedLink];
+ $links = $this->getInputRelatedLinkMock(
+ $productSku,
+ $linkType,
+ self::STUB_PRODUCT_SKU_2,
+ self::STUB_PRODUCT_TYPE
+ );
- $linkTypes = ['related' => 1, 'upsell' => 4, 'crosssell' => 5, 'associated' => 3];
- $this->linkTypeProviderMock->expects($this->once())
- ->method('getLinkTypes')
- ->willReturn($linkTypes);
+ $this->getLinkTypesMock();
+
+ $this->productMock->expects($this->once())
+ ->method('getProductLinks')
+ ->willReturn([]);
+ $this->productMock->expects($this->once())
+ ->method('setProductLinks')
+ ->with($links);
- $this->productMock->expects($this->once())->method('getProductLinks')->willReturn([]);
- $this->productMock->expects($this->once())->method('setProductLinks')->with($links);
$this->assertTrue($this->model->setProductLinks($productSku, $links));
}
/**
- * @expectedException \Magento\Framework\Exception\InputException
- * @expectedExceptionMessage "linkType" is required. Enter and try again.
+ * Test for SetProductLinks without link type in link object
+ *
+ * @return void
+ * @throws InputException
*/
- public function testSetProductLinksWithoutLinkTypeInLink()
+ public function testSetProductLinksWithoutLinkTypeInLink(): void
{
- $productSku = 'Simple Product 1';
+ $productSku = self::STUB_PRODUCT_SKU_1;
- $inputRelatedLink = $this->objectManager->getObject(\Magento\Catalog\Model\ProductLink\Link::class);
+ $inputRelatedLink = $this->objectManager->getObject(Link::class);
$inputRelatedLink->setProductSku($productSku);
- $inputRelatedLink->setData("sku", "Simple Product 1");
+ $inputRelatedLink->setData("sku", self::STUB_PRODUCT_SKU_2);
$inputRelatedLink->setPosition(0);
$links = [$inputRelatedLink];
- $linkTypes = ['related' => 1, 'upsell' => 4, 'crosssell' => 5, 'associated' => 3];
- $this->linkTypeProviderMock->expects($this->once())
- ->method('getLinkTypes')
- ->willReturn($linkTypes);
+ $this->getLinkTypesMock();
+
+ $this->expectException(InputException::class);
+ $this->expectExceptionMessage(
+ '"linkType" is required. Enter and try again.'
+ );
$this->assertTrue($this->model->setProductLinks($productSku, $links));
}
/**
- * @expectedException \Magento\Framework\Exception\NoSuchEntityException
- * @expectedExceptionMessage The "bad type" link type wasn't found. Verify the type and try again.
+ * Test for SetProductLinks with empty array of items
+ *
+ * @return void
+ * @throws InputException
+ */
+ public function testSetProductLinksWithEmptyArrayItems(): void
+ {
+ $productSku = self::STUB_PRODUCT_SKU_1;
+
+ $this->productRepositoryMock->expects($this->never())
+ ->method('get')
+ ->with($productSku)
+ ->willReturn($this->productMock);
+
+ $this->linkTypeProviderMock->expects($this->never())
+ ->method('getLinkTypes')
+ ->willReturn([]);
+
+ $this->expectException(InputException::class);
+ $this->expectExceptionMessage(
+ 'Invalid value of "empty array" provided for the items field.'
+ );
+
+ $this->assertTrue($this->model->setProductLinks($productSku, []));
+ }
+
+ /**
+ * Test setProductLinks() throw exception if product link type not exist
+ *
+ * @return void
+ * @throws NoSuchEntityException
*/
public function testSetProductLinksThrowExceptionIfProductLinkTypeDoesNotExist()
{
- $productSku = 'Simple Product 1';
- $linkType = 'bad type';
- $this->productRepositoryMock->expects($this->never())->method('get')->with($productSku)
+ $productSku = self::STUB_PRODUCT_SKU_1;
+ $linkType = self::STUB_BAD_TYPE;
+
+ $this->productRepositoryMock->expects($this->never())
+ ->method('get')
+ ->with($productSku)
->willReturn($this->productMock);
- $inputRelatedLink = $this->objectManager->getObject(\Magento\Catalog\Model\ProductLink\Link::class);
- $inputRelatedLink->setProductSku($productSku);
- $inputRelatedLink->setLinkType($linkType);
- $inputRelatedLink->setData("sku", "Simple Product 2");
- $inputRelatedLink->setData("type_id", "simple");
- $inputRelatedLink->setPosition(0);
- $links = [$inputRelatedLink];
+ $links = $this->getInputRelatedLinkMock(
+ $productSku,
+ $linkType,
+ self::STUB_PRODUCT_SKU_2,
+ self::STUB_PRODUCT_TYPE
+ );
- $linkTypes = ['related' => 1, 'upsell' => 4, 'crosssell' => 5, 'associated' => 3];
- $this->linkTypeProviderMock->expects($this->once())
- ->method('getLinkTypes')
- ->willReturn($linkTypes);
+ $this->getLinkTypesMock();
+
+ $this->expectException(NoSuchEntityException::class);
+ $this->expectExceptionMessage(
+ 'The "bad type" link type wasn\'t found. Verify the type and try again.'
+ );
$this->assertTrue($this->model->setProductLinks('', $links));
}
/**
- * @expectedException \Magento\Framework\Exception\NoSuchEntityException
- * @expectedExceptionMessage The product that was requested doesn't exist. Verify the product and try again.
+ * Test for setProductLinks() with no product exception
+ *
+ * @return void
+ * @throws NoSuchEntityException
*/
public function testSetProductLinksNoProductException()
{
- $productSku = 'Simple Product 1';
- $linkType = 'related';
-
- $inputRelatedLink = $this->objectManager->getObject(\Magento\Catalog\Model\ProductLink\Link::class);
- $inputRelatedLink->setProductSku($productSku);
- $inputRelatedLink->setLinkType($linkType);
- $inputRelatedLink->setData("sku", "Simple Product 2");
- $inputRelatedLink->setData("type_id", "simple");
- $inputRelatedLink->setPosition(0);
- $links = [$inputRelatedLink];
+ $productSku = self::STUB_PRODUCT_SKU_1;
+ $linkType = self::STUB_LINK_TYPE;
+
+ $links = $this->getInputRelatedLinkMock(
+ $productSku,
+ $linkType,
+ self::STUB_PRODUCT_SKU_2,
+ self::STUB_PRODUCT_TYPE
+ );
- $linkTypes = ['related' => 1, 'upsell' => 4, 'crosssell' => 5, 'associated' => 3];
- $this->linkTypeProviderMock->expects($this->once())
- ->method('getLinkTypes')
- ->willReturn($linkTypes);
+ $this->getLinkTypesMock();
$this->productRepositoryMock->expects($this->once())
->method('get')
- ->will(
- $this->throwException(
- new \Magento\Framework\Exception\NoSuchEntityException(
- __("The product that was requested doesn't exist. Verify the product and try again.")
- )
+ ->willThrowException(
+ new NoSuchEntityException(
+ __("The product that was requested doesn't exist. Verify the product and try again.")
)
);
+
+ $this->expectException(NoSuchEntityException::class);
+ $this->expectExceptionMessage(
+ "The product that was requested doesn't exist. Verify the product and try again."
+ );
+
$this->model->setProductLinks($productSku, $links);
}
/**
- * @expectedException \Magento\Framework\Exception\CouldNotSaveException
- * @expectedExceptionMessage The linked products data is invalid. Verify the data and try again.
+ * Test setProductLnks() with invliad data exception
+ *
+ * @return void
+ * @throws CouldNotSaveException
*/
- public function testSetProductLinksInvalidDataException()
+ public function testSetProductLinksInvalidDataException(): void
{
- $productSku = 'Simple Product 1';
- $linkType = 'related';
- $this->productRepositoryMock->expects($this->once())->method('get')->with($productSku)
+ $productSku = self::STUB_PRODUCT_SKU_1;
+ $linkType = self::STUB_LINK_TYPE;
+
+ $this->productRepositoryMock->expects($this->once())
+ ->method('get')
+ ->with($productSku)
->willReturn($this->productMock);
- $inputRelatedLink = $this->objectManager->getObject(\Magento\Catalog\Model\ProductLink\Link::class);
- $inputRelatedLink->setProductSku($productSku);
- $inputRelatedLink->setLinkType($linkType);
- $inputRelatedLink->setData("sku", "bad sku");
- $inputRelatedLink->setData("type_id", "bad type");
- $inputRelatedLink->setPosition(0);
- $links = [$inputRelatedLink];
+ $links = $this->getInputRelatedLinkMock(
+ $productSku,
+ $linkType,
+ self::STUB_PRODUCT_SKU_2,
+ self::STUB_PRODUCT_TYPE
+ );
+
+ $this->getLinkTypesMock();
+
+ $this->productMock->expects($this->once())
+ ->method('getProductLinks')
+ ->willReturn([]);
+
+ $this->productRepositoryMock->expects($this->once())
+ ->method('save')
+ ->willThrowException(
+ new CouldNotSaveException(
+ __("The linked products data is invalid. Verify the data and try again.")
+ )
+ );
+
+ $this->expectException(CouldNotSaveException::class);
+ $this->expectExceptionMessage(
+ "The linked products data is invalid. Verify the data and try again."
+ );
+
+ $this->model->setProductLinks($productSku, $links);
+ }
+
+ /**
+ * Mock for getLinkTypesMock
+ *
+ * @return void
+ */
+ private function getLinkTypesMock(): void
+ {
+ $linkTypes = [
+ 'related' => 1,
+ 'upsell' => 4,
+ 'crosssell' => 5,
+ 'associated' => 3
+ ];
- $linkTypes = ['related' => 1, 'upsell' => 4, 'crosssell' => 5, 'associated' => 3];
$this->linkTypeProviderMock->expects($this->once())
->method('getLinkTypes')
->willReturn($linkTypes);
+ }
- $this->productMock->expects($this->once())->method('getProductLinks')->willReturn([]);
-
- $this->productRepositoryMock->expects($this->once())->method('save')->willThrowException(new \Exception());
- $this->model->setProductLinks($productSku, $links);
+ /**
+ * get inputRelatedLinkMock
+ *
+ * @param string $productSku1
+ * @param string $linkType
+ * @param string $productSku2
+ * @param string $typeId
+ * @return array
+ */
+ private function getInputRelatedLinkMock(
+ string $productSku1,
+ string $linkType,
+ string $productSku2,
+ string $typeId
+ ) {
+
+ $inputRelatedLinkMock = $this->objectManager->getObject(Link::class);
+ $inputRelatedLinkMock->setProductSku($productSku1);
+ $inputRelatedLinkMock->setLinkType($linkType);
+ $inputRelatedLinkMock->setData("sku", $productSku2);
+ $inputRelatedLinkMock->setData("type_id", $typeId);
+ $inputRelatedLinkMock->setPosition(0);
+
+ return [$inputRelatedLinkMock];
}
}
diff --git a/app/code/Magento/Catalog/Test/Unit/Observer/SetSpecialPriceStartDateTest.php b/app/code/Magento/Catalog/Test/Unit/Observer/SetSpecialPriceStartDateTest.php
new file mode 100644
index 0000000000000..c44a64f1d7433
--- /dev/null
+++ b/app/code/Magento/Catalog/Test/Unit/Observer/SetSpecialPriceStartDateTest.php
@@ -0,0 +1,135 @@
+objectManager = new ObjectManager($this);
+ $this->observerMock = $this->createMock(Observer::class);
+ $this->timezone = $this->createMock(Timezone::class);
+ $this->dateObject = $this->createMock(\DateTime::class);
+
+ $this->eventMock = $this->getMockBuilder(Event::class)
+ ->disableOriginalConstructor()
+ ->setMethods(['getProduct'])
+ ->getMock();
+
+ $this->productMock = $this->getMockBuilder(Product::class)
+ ->disableOriginalConstructor()
+ ->setMethods(['getSpecialPrice', 'getSpecialFromDate', 'setData'])
+ ->getMock();
+
+ $this->observer = $this->objectManager->getObject(
+ SetSpecialPriceStartDate::class,
+ [
+ 'localeDate' => $this->timezone
+ ]
+ );
+ }
+
+ /**
+ * Test observer execute method
+ */
+ public function testExecuteModifySpecialFromDate(): void
+ {
+ $specialPrice = 15;
+ $specialFromDate = null;
+ $localeDateMock = ['special_from_date' => $this->returnValue($this->dateObject)];
+
+ $this->observerMock
+ ->expects($this->once())
+ ->method('getEvent')
+ ->willReturn($this->eventMock);
+
+ $this->eventMock
+ ->expects($this->once())
+ ->method('getProduct')
+ ->willReturn($this->productMock);
+
+ $this->dateObject->expects($this->any())
+ ->method('setTime')
+ ->willReturnSelf();
+
+ $this->timezone
+ ->expects($this->once())
+ ->method('date')
+ ->willReturn($this->dateObject);
+
+ $this->productMock
+ ->expects($this->once())
+ ->method('getSpecialPrice')
+ ->willReturn($specialPrice);
+
+ $this->productMock
+ ->expects($this->once())
+ ->method('getSpecialFromDate')
+ ->willReturn($specialFromDate);
+
+ $this->productMock
+ ->expects($this->once())
+ ->method('setData')
+ ->willReturn($localeDateMock);
+
+ $this->observer->execute($this->observerMock);
+ }
+}
diff --git a/app/code/Magento/Catalog/ViewModel/Product/Listing/PreparePostData.php b/app/code/Magento/Catalog/ViewModel/Product/Listing/PreparePostData.php
new file mode 100644
index 0000000000000..c7ea49cc4dc1b
--- /dev/null
+++ b/app/code/Magento/Catalog/ViewModel/Product/Listing/PreparePostData.php
@@ -0,0 +1,46 @@
+urlHelper = $urlHelper;
+ }
+
+ /**
+ * Wrapper for the PostHelper::getPostData()
+ *
+ * @param string $url
+ * @param array $data
+ * @return array
+ */
+ public function getPostData(string $url, array $data = []):array
+ {
+ if (!isset($data[ActionInterface::PARAM_NAME_URL_ENCODED])) {
+ $data[ActionInterface::PARAM_NAME_URL_ENCODED] = $this->urlHelper->getEncodedUrl();
+ }
+ return ['action' => $url, 'data' => $data];
+ }
+}
diff --git a/app/code/Magento/Catalog/etc/di.xml b/app/code/Magento/Catalog/etc/di.xml
index eda6dbd2d9d6f..223d690d28327 100644
--- a/app/code/Magento/Catalog/etc/di.xml
+++ b/app/code/Magento/Catalog/etc/di.xml
@@ -74,6 +74,7 @@
+
diff --git a/app/code/Magento/Catalog/etc/webapi_rest/di.xml b/app/code/Magento/Catalog/etc/webapi_rest/di.xml
index bfbc05b12079d..14779245f21af 100644
--- a/app/code/Magento/Catalog/etc/webapi_rest/di.xml
+++ b/app/code/Magento/Catalog/etc/webapi_rest/di.xml
@@ -28,4 +28,16 @@
+
+
+
+ - Magento\Catalog\Model\Product\Webapi\ProductOutputProcessor\Proxy
+
+
+
+
+
+ Magento\Framework\Webapi\Rest\Request\Deserializer\Json
+
+
diff --git a/app/code/Magento/Catalog/etc/webapi_soap/di.xml b/app/code/Magento/Catalog/etc/webapi_soap/di.xml
index bfbc05b12079d..a709f23d8c12b 100644
--- a/app/code/Magento/Catalog/etc/webapi_soap/di.xml
+++ b/app/code/Magento/Catalog/etc/webapi_soap/di.xml
@@ -28,4 +28,16 @@
+
+
+
+ - Magento\Catalog\Model\Product\Webapi\ProductOutputProcessor\Proxy
+
+
+
+
+
+ Magento\Framework\Webapi\Rest\Request\Deserializer\Xml
+
+
diff --git a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/file.phtml b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/file.phtml
index da0b3b36d561e..89d005a178fac 100644
--- a/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/file.phtml
+++ b/app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/composite/fieldset/options/type/file.phtml
@@ -22,7 +22,7 @@ require(['prototype'], function(){
initializeFile: function(inputBox) {
this.inputFile = inputBox.select('input[name="= /* @noEscape */ $_fileName ?>"]')[0];
this.inputFileAction = inputBox.select('input[name="= /* @noEscape */ $_fieldNameAction ?>"]')[0];
- this.fileNameBox = inputBox.up('dd').select('.= /* @noEscape */ $_fileNamed ?>')[0];
+ this.fileNameBox = inputBox.up('div').select('.= /* @noEscape */ $_fileNamed ?>')[0];
},
toggleFileChange: function(inputBox) {
diff --git a/app/code/Magento/Catalog/view/base/templates/product/price/tier_prices.phtml b/app/code/Magento/Catalog/view/base/templates/product/price/tier_prices.phtml
index 5949b54268a62..af50446c93a95 100644
--- a/app/code/Magento/Catalog/view/base/templates/product/price/tier_prices.phtml
+++ b/app/code/Magento/Catalog/view/base/templates/product/price/tier_prices.phtml
@@ -17,15 +17,15 @@ $tierPrices = $tierPriceModel->getTierPriceList();
$msrpShowOnGesture = $block->getPriceType('msrp_price')->isShowPriceOnGesture();
$product = $block->getSaleableItem();
?>
-
+
- $price) : ?>
+ $price): ?>
-
getId();
$isSaleable = $product->isSaleable();
$popupId = 'msrp-popup-' . $productId . $block->getRandomString(20);
- if ($msrpShowOnGesture && $price['price']->getValue() < $product->getMsrp()) :
+ if ($msrpShowOnGesture && $price['price']->getValue() < $product->getMsrp()):
$addToCartUrl = '';
if ($isSaleable) {
$addToCartUrl = $this->helper(\Magento\Checkout\Helper\Cart::class)
@@ -60,7 +60,7 @@ $product = $block->getSaleableItem();
id="= $block->escapeHtmlAttr($popupId) ?>"
data-tier-price="= $block->escapeHtml($block->jsonEncode($tierPriceData)) ?>">
= $block->escapeHtml(__('Click for price')) ?>
- renderAmount(
$price['price'],
[
@@ -73,11 +73,12 @@ $product = $block->getSaleableItem();
?>
= /* @noEscape */ ($block->getShowDetailedPrice() !== false)
? __(
- 'Buy %1 for %2 each and save %4%',
+ 'Buy %1 for %2 each and '.
+ 'save %4%',
$price['price_qty'],
$priceAmountBlock,
$index,
- $block->formatPercent($price['percentage_value'] ?? $tierPriceModel->getSavePercent($price['price']))
+ $block->formatPercent($tierPriceModel->getSavePercent($price['price']))
)
: __('Buy %1 for %2 each', $price['price_qty'], $priceAmountBlock);
?>
@@ -85,7 +86,7 @@ $product = $block->getSaleableItem();
-
+
+
diff --git a/app/code/Magento/CatalogGraphQl/DataProvider/Product/SearchCriteriaBuilder.php b/app/code/Magento/CatalogGraphQl/DataProvider/Product/SearchCriteriaBuilder.php
index 53d3b624285e9..1057d21283ea8 100644
--- a/app/code/Magento/CatalogGraphQl/DataProvider/Product/SearchCriteriaBuilder.php
+++ b/app/code/Magento/CatalogGraphQl/DataProvider/Product/SearchCriteriaBuilder.php
@@ -123,7 +123,7 @@ private function addVisibilityFilter(SearchCriteriaInterface $searchCriteria, bo
{
if ($isFilter && $isSearch) {
// Index already contains products filtered by visibility: catalog, search, both
- return ;
+ return;
}
$visibilityIds = $isSearch
? $this->visibility->getVisibleInSearchIds()
diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product.php b/app/code/Magento/CatalogImportExport/Model/Import/Product.php
index ae5f0f5d79e2a..d1bce7aaaf951 100644
--- a/app/code/Magento/CatalogImportExport/Model/Import/Product.php
+++ b/app/code/Magento/CatalogImportExport/Model/Import/Product.php
@@ -307,6 +307,7 @@ class Product extends \Magento\ImportExport\Model\Import\Entity\AbstractEntity
// Can't add new translated strings in patch release
'invalidLayoutUpdate' => 'Invalid format.',
'insufficientPermissions' => 'Invalid format.',
+ ValidatorInterface::ERROR_SKU_MARGINAL_WHITESPACES => 'SKU contains marginal whitespaces'
];
//@codingStandardsIgnoreEnd
diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product/RowValidatorInterface.php b/app/code/Magento/CatalogImportExport/Model/Import/Product/RowValidatorInterface.php
index f41596ad185a6..f13b603003898 100644
--- a/app/code/Magento/CatalogImportExport/Model/Import/Product/RowValidatorInterface.php
+++ b/app/code/Magento/CatalogImportExport/Model/Import/Product/RowValidatorInterface.php
@@ -87,6 +87,8 @@ interface RowValidatorInterface extends \Magento\Framework\Validator\ValidatorIn
const ERROR_DUPLICATE_MULTISELECT_VALUES = 'duplicatedMultiselectValues';
+ const ERROR_SKU_MARGINAL_WHITESPACES = 'skuMarginalWhitespaces';
+
/**
* Value that means all entities (e.g. websites, groups etc.)
*/
diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product/Validator.php b/app/code/Magento/CatalogImportExport/Model/Import/Product/Validator.php
index 4b7416f6ad9a6..b2eca68db4d1c 100644
--- a/app/code/Magento/CatalogImportExport/Model/Import/Product/Validator.php
+++ b/app/code/Magento/CatalogImportExport/Model/Import/Product/Validator.php
@@ -10,7 +10,7 @@
use Magento\Catalog\Model\Product\Attribute\Backend\Sku;
/**
- * Class Validator
+ * Product import model validator
*
* @api
* @since 100.0.2
@@ -72,8 +72,12 @@ protected function textValidation($attrCode, $type)
$val = $this->string->cleanString($this->_rowData[$attrCode]);
if ($type == 'text') {
$valid = $this->string->strlen($val) < Product::DB_MAX_TEXT_LENGTH;
- } else if ($attrCode == Product::COL_SKU) {
+ } elseif ($attrCode == Product::COL_SKU) {
$valid = $this->string->strlen($val) <= SKU::SKU_MAX_LENGTH;
+ if ($this->string->strlen($val) !== $this->string->strlen(trim($val))) {
+ $this->_addMessages([RowValidatorInterface::ERROR_SKU_MARGINAL_WHITESPACES]);
+ return false;
+ }
} else {
$valid = $this->string->strlen($val) < Product::DB_MAX_VARCHAR_LENGTH;
}
@@ -359,5 +363,7 @@ public function init($context)
foreach ($this->validators as $validator) {
$validator->init($context);
}
+
+ return $this;
}
}
diff --git a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportBundleProductTest.xml b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportBundleProductTest.xml
index 369805a94dd84..5415f75879ae8 100644
--- a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportBundleProductTest.xml
+++ b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportBundleProductTest.xml
@@ -106,7 +106,10 @@
-
+
+
+
+
diff --git a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportGroupedProductWithSpecialPriceTest.xml b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportGroupedProductWithSpecialPriceTest.xml
index d9b93196db060..adc511542074b 100644
--- a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportGroupedProductWithSpecialPriceTest.xml
+++ b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportGroupedProductWithSpecialPriceTest.xml
@@ -70,7 +70,7 @@
-
+
diff --git a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportImportConfigurableProductWithImagesTest.xml b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportImportConfigurableProductWithImagesTest.xml
index 642bbfc0453c5..9ff9f54d36939 100644
--- a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportImportConfigurableProductWithImagesTest.xml
+++ b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportImportConfigurableProductWithImagesTest.xml
@@ -152,7 +152,10 @@
-
+
+
+
+
diff --git a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleAndConfigurableProductsWithCustomOptionsTest.xml b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleAndConfigurableProductsWithCustomOptionsTest.xml
index 397c1ee57e7f5..03314206fa67f 100644
--- a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleAndConfigurableProductsWithCustomOptionsTest.xml
+++ b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleAndConfigurableProductsWithCustomOptionsTest.xml
@@ -94,7 +94,10 @@
-
+
+
+
+
diff --git a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductAndConfigurableProductsWithAssignedImagesTest.xml b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductAndConfigurableProductsWithAssignedImagesTest.xml
index e00346654ecf4..b199f4546b909 100644
--- a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductAndConfigurableProductsWithAssignedImagesTest.xml
+++ b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductAndConfigurableProductsWithAssignedImagesTest.xml
@@ -110,7 +110,10 @@
-
+
+
+
+
diff --git a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductAssignedToMainWebsiteAndConfigurableProductAssignedToCustomWebsiteTest.xml b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductAssignedToMainWebsiteAndConfigurableProductAssignedToCustomWebsiteTest.xml
index 04be8f3ae823e..578a9586a36c5 100644
--- a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductAssignedToMainWebsiteAndConfigurableProductAssignedToCustomWebsiteTest.xml
+++ b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductAssignedToMainWebsiteAndConfigurableProductAssignedToCustomWebsiteTest.xml
@@ -95,7 +95,10 @@
-
+
+
+
+
diff --git a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductWithCustomAttributeTest.xml b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductWithCustomAttributeTest.xml
index 8553fb8a2cf7e..cefd412025158 100644
--- a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductWithCustomAttributeTest.xml
+++ b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductWithCustomAttributeTest.xml
@@ -47,7 +47,7 @@
-
+
diff --git a/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator/QuoteItemQtyList.php b/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator/QuoteItemQtyList.php
index c0b60c9935d71..600bf9897a036 100644
--- a/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator/QuoteItemQtyList.php
+++ b/app/code/Magento/CatalogInventory/Model/Quote/Item/QuantityValidator/QuoteItemQtyList.php
@@ -5,6 +5,9 @@
*/
namespace Magento\CatalogInventory\Model\Quote\Item\QuantityValidator;
+/**
+ * Class QuoteItemQtyList collects qty of quote items
+ */
class QuoteItemQtyList
{
/**
@@ -17,6 +20,7 @@ class QuoteItemQtyList
/**
* Get product qty includes information from all quote items
+ *
* Need be used only in singleton mode
*
* @param int $productId
@@ -29,9 +33,7 @@ class QuoteItemQtyList
public function getQty($productId, $quoteItemId, $quoteId, $itemQty)
{
$qty = $itemQty;
- if (isset(
- $this->_checkedQuoteItems[$quoteId][$productId]['qty']
- ) && !in_array(
+ if (isset($this->_checkedQuoteItems[$quoteId][$productId]['qty']) && !in_array(
$quoteItemId,
$this->_checkedQuoteItems[$quoteId][$productId]['items']
)
@@ -39,8 +41,10 @@ public function getQty($productId, $quoteItemId, $quoteId, $itemQty)
$qty += $this->_checkedQuoteItems[$quoteId][$productId]['qty'];
}
- $this->_checkedQuoteItems[$quoteId][$productId]['qty'] = $qty;
- $this->_checkedQuoteItems[$quoteId][$productId]['items'][] = $quoteItemId;
+ if ($quoteItemId !== null) {
+ $this->_checkedQuoteItems[$quoteId][$productId]['qty'] = $qty;
+ $this->_checkedQuoteItems[$quoteId][$productId]['items'][] = $quoteItemId;
+ }
return $qty;
}
diff --git a/app/code/Magento/CatalogInventory/Test/Mftf/Test/AdminCreateProductWithZeroMaximumQtyAllowedInShoppingCartTest.xml b/app/code/Magento/CatalogInventory/Test/Mftf/Test/AdminCreateProductWithZeroMaximumQtyAllowedInShoppingCartTest.xml
index 74b24209682ff..43f16c0fa475e 100644
--- a/app/code/Magento/CatalogInventory/Test/Mftf/Test/AdminCreateProductWithZeroMaximumQtyAllowedInShoppingCartTest.xml
+++ b/app/code/Magento/CatalogInventory/Test/Mftf/Test/AdminCreateProductWithZeroMaximumQtyAllowedInShoppingCartTest.xml
@@ -28,7 +28,7 @@
-
+
diff --git a/app/code/Magento/CatalogInventory/Test/Mftf/Test/AssociatedProductToConfigurableOutOfStockTest.xml b/app/code/Magento/CatalogInventory/Test/Mftf/Test/AssociatedProductToConfigurableOutOfStockTest.xml
index 8458fcf3b94e0..d0e3819ccc3cc 100644
--- a/app/code/Magento/CatalogInventory/Test/Mftf/Test/AssociatedProductToConfigurableOutOfStockTest.xml
+++ b/app/code/Magento/CatalogInventory/Test/Mftf/Test/AssociatedProductToConfigurableOutOfStockTest.xml
@@ -80,13 +80,16 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
@@ -132,7 +135,7 @@
-
+
diff --git a/app/code/Magento/CatalogInventory/Test/Unit/Model/Quote/Item/QuantityValidator/QuoteItemQtyListTest.php b/app/code/Magento/CatalogInventory/Test/Unit/Model/Quote/Item/QuantityValidator/QuoteItemQtyListTest.php
new file mode 100644
index 0000000000000..59a391581fb06
--- /dev/null
+++ b/app/code/Magento/CatalogInventory/Test/Unit/Model/Quote/Item/QuantityValidator/QuoteItemQtyListTest.php
@@ -0,0 +1,70 @@
+quoteItemQtyList = $objectManagerHelper->getObject(QuoteItemQtyList::class);
+ }
+
+ /**
+ * This tests the scenario when item has not quote_item_id and after save gets a value.
+ *
+ * @return void
+ */
+ public function testSingleQuoteItemQty()
+ {
+ $this->itemQtyTestValue = 1;
+ $qty = $this->quoteItemQtyList->getQty(125, null, 11232, 1);
+ $this->assertEquals($this->itemQtyTestValue, $qty);
+
+ $qty = $this->quoteItemQtyList->getQty(125, 1, 11232, 1);
+ $this->assertEquals($this->itemQtyTestValue, $qty);
+ }
+
+ /**
+ * This tests the scenario when item has been added twice to the cart.
+ *
+ * @return void
+ */
+ public function testMultipleQuoteItemQty()
+ {
+ $this->itemQtyTestValue = 1;
+ $qty = $this->quoteItemQtyList->getQty(127, 1, 112, 1);
+ $this->assertEquals($this->itemQtyTestValue, $qty);
+
+ $this->itemQtyTestValue = 2;
+ $qty = $this->quoteItemQtyList->getQty(127, 2, 112, 1);
+ $this->assertEquals($this->itemQtyTestValue, $qty);
+ }
+}
diff --git a/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/OpenCatalogPriceRuleActionGroup.xml b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/OpenCatalogPriceRuleActionGroup.xml
index c810d9579df92..68ce445d991b3 100644
--- a/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/OpenCatalogPriceRuleActionGroup.xml
+++ b/app/code/Magento/CatalogRule/Test/Mftf/ActionGroup/OpenCatalogPriceRuleActionGroup.xml
@@ -13,6 +13,7 @@
+
diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithSpecialPricesTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithSpecialPricesTest.xml
index d99ebac94fbec..bf4ec749d7264 100644
--- a/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithSpecialPricesTest.xml
+++ b/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithSpecialPricesTest.xml
@@ -84,7 +84,7 @@
-
+
@@ -92,6 +92,9 @@
+
+
+
diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminCreateInactiveCatalogPriceRuleTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminCreateInactiveCatalogPriceRuleTest.xml
index 83dff1ecdcab5..4211f0fc76508 100644
--- a/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminCreateInactiveCatalogPriceRuleTest.xml
+++ b/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminCreateInactiveCatalogPriceRuleTest.xml
@@ -28,7 +28,7 @@
-
+
diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminDeleteCatalogPriceRuleEntityTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminDeleteCatalogPriceRuleEntityTest.xml
index 02d998870fb65..730e04bfea7cf 100644
--- a/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminDeleteCatalogPriceRuleEntityTest.xml
+++ b/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminDeleteCatalogPriceRuleEntityTest.xml
@@ -42,7 +42,7 @@
-
+
@@ -174,7 +174,7 @@
-
+
@@ -182,6 +182,9 @@
+
+
+
diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminDeleteCatalogPriceRuleTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminDeleteCatalogPriceRuleTest.xml
index a6eb6eb1e5178..dfb846e90b669 100644
--- a/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminDeleteCatalogPriceRuleTest.xml
+++ b/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminDeleteCatalogPriceRuleTest.xml
@@ -43,7 +43,7 @@
-
+
diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminEnableAttributeIsUndefinedCatalogPriceRuleTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminEnableAttributeIsUndefinedCatalogPriceRuleTest.xml
index da855b08cf390..0df73c99595a6 100644
--- a/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminEnableAttributeIsUndefinedCatalogPriceRuleTest.xml
+++ b/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminEnableAttributeIsUndefinedCatalogPriceRuleTest.xml
@@ -62,7 +62,7 @@
-
+
diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminMarketingCatalogPriceRuleNavigateMenuTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminMarketingCatalogPriceRuleNavigateMenuTest.xml
index 0fe35419aaf3e..2a45de28db199 100644
--- a/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminMarketingCatalogPriceRuleNavigateMenuTest.xml
+++ b/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminMarketingCatalogPriceRuleNavigateMenuTest.xml
@@ -23,7 +23,7 @@
-
+
diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogPriceRuleByProductAttributeTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogPriceRuleByProductAttributeTest.xml
index 1615985370182..feb9423151299 100644
--- a/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogPriceRuleByProductAttributeTest.xml
+++ b/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogPriceRuleByProductAttributeTest.xml
@@ -104,7 +104,10 @@
-
+
+
+
+
diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleAndConfigurableProductTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleAndConfigurableProductTest.xml
index 02d6d90ae5d0e..2790dfbe46fda 100644
--- a/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleAndConfigurableProductTest.xml
+++ b/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleAndConfigurableProductTest.xml
@@ -87,7 +87,7 @@
-
+
@@ -96,6 +96,9 @@
+
+
+
diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleProductAndFixedMethodTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleProductAndFixedMethodTest.xml
index bb0a890fd0974..0149a2d0a6abb 100644
--- a/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleProductAndFixedMethodTest.xml
+++ b/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleProductAndFixedMethodTest.xml
@@ -47,7 +47,7 @@
-
+
diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleProductForNewCustomerGroupTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleProductForNewCustomerGroupTest.xml
index 4ab2d0d491548..c70a72d725489 100644
--- a/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleProductForNewCustomerGroupTest.xml
+++ b/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleProductForNewCustomerGroupTest.xml
@@ -58,7 +58,7 @@
-
+
diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleProductWithCustomOptionsTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleProductWithCustomOptionsTest.xml
index 166d202ec2410..9ebab2d28249a 100644
--- a/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleProductWithCustomOptionsTest.xml
+++ b/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleProductWithCustomOptionsTest.xml
@@ -63,7 +63,7 @@
-
+
diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/CatalogPriceRuleAndCustomerGroupMembershipArePersistedUnderLongTermCookieTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/CatalogPriceRuleAndCustomerGroupMembershipArePersistedUnderLongTermCookieTest.xml
index 86d3dccba7595..8130bdaae6303 100644
--- a/app/code/Magento/CatalogRule/Test/Mftf/Test/CatalogPriceRuleAndCustomerGroupMembershipArePersistedUnderLongTermCookieTest.xml
+++ b/app/code/Magento/CatalogRule/Test/Mftf/Test/CatalogPriceRuleAndCustomerGroupMembershipArePersistedUnderLongTermCookieTest.xml
@@ -15,71 +15,88 @@
-
+
-
-
+
+
-
+
- 50
-
-
- 1
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
-
-
+
+
+
+
-
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/StorefrontInactiveCatalogRuleTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/StorefrontInactiveCatalogRuleTest.xml
index 3423baf7970eb..17266b0c80d7a 100644
--- a/app/code/Magento/CatalogRule/Test/Mftf/Test/StorefrontInactiveCatalogRuleTest.xml
+++ b/app/code/Magento/CatalogRule/Test/Mftf/Test/StorefrontInactiveCatalogRuleTest.xml
@@ -16,55 +16,51 @@
-
-
-
-
+
+
-
-
-
-
-
-
-
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithAssignedSimpleProducts2Test.xml b/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithAssignedSimpleProducts2Test.xml
index 8b72b7616b6ff..56e0573649d29 100644
--- a/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithAssignedSimpleProducts2Test.xml
+++ b/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithAssignedSimpleProducts2Test.xml
@@ -171,7 +171,10 @@
-
+
+
+
+
diff --git a/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithAssignedSimpleProductsTest.xml b/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithAssignedSimpleProductsTest.xml
index c110daee35428..bd73501b6117e 100644
--- a/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithAssignedSimpleProductsTest.xml
+++ b/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithAssignedSimpleProductsTest.xml
@@ -175,7 +175,10 @@
-
+
+
+
+
diff --git a/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithOptions2Test.xml b/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithOptions2Test.xml
index bc6c89f2f1155..1cc2a8cb57256 100644
--- a/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithOptions2Test.xml
+++ b/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithOptions2Test.xml
@@ -105,7 +105,10 @@
-
+
+
+
+
diff --git a/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithOptionsTest.xml b/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithOptionsTest.xml
index 05f30fd6fcbde..2375d50d73e3c 100644
--- a/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithOptionsTest.xml
+++ b/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithOptionsTest.xml
@@ -122,7 +122,10 @@
-
+
+
+
+
diff --git a/app/code/Magento/CatalogSearch/Model/Layer/Filter/Attribute.php b/app/code/Magento/CatalogSearch/Model/Layer/Filter/Attribute.php
index d8947ac4224a8..b1aecc6885bf0 100644
--- a/app/code/Magento/CatalogSearch/Model/Layer/Filter/Attribute.php
+++ b/app/code/Magento/CatalogSearch/Model/Layer/Filter/Attribute.php
@@ -67,7 +67,8 @@ public function apply(\Magento\Framework\App\RequestInterface $request)
$labels = [];
foreach ((array) $attributeValue as $value) {
- $labels[] = (array) $this->getOptionText($value);
+ $label = $this->getOptionText($value);
+ $labels[] = is_array($label) ? $label : [$label];
}
$label = implode(',', array_unique(array_merge(...$labels)));
$this->getLayer()
diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontFillFormAdvancedSearchWithCustomDropDownAttributeActionGroup.xml b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontFillFormAdvancedSearchWithCustomDropDownAttributeActionGroup.xml
new file mode 100644
index 0000000000000..1618465769a66
--- /dev/null
+++ b/app/code/Magento/CatalogSearch/Test/Mftf/ActionGroup/StorefrontFillFormAdvancedSearchWithCustomDropDownAttributeActionGroup.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+ Fills in the advanced search form and select the attribute.
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/Test/AdminCreateSearchTermEntityTest.xml b/app/code/Magento/CatalogSearch/Test/Mftf/Test/AdminCreateSearchTermEntityTest.xml
index 86a1d4321cba0..2ab87b3ceb967 100644
--- a/app/code/Magento/CatalogSearch/Test/Mftf/Test/AdminCreateSearchTermEntityTest.xml
+++ b/app/code/Magento/CatalogSearch/Test/Mftf/Test/AdminCreateSearchTermEntityTest.xml
@@ -35,7 +35,7 @@
-
+
diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/Test/AdminDeleteSearchTermTest.xml b/app/code/Magento/CatalogSearch/Test/Mftf/Test/AdminDeleteSearchTermTest.xml
index b449d92d8e003..a950fb6c379cb 100644
--- a/app/code/Magento/CatalogSearch/Test/Mftf/Test/AdminDeleteSearchTermTest.xml
+++ b/app/code/Magento/CatalogSearch/Test/Mftf/Test/AdminDeleteSearchTermTest.xml
@@ -29,7 +29,7 @@
-
+
diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/Test/AdminMarketingSearchTermsNavigateMenuTest.xml b/app/code/Magento/CatalogSearch/Test/Mftf/Test/AdminMarketingSearchTermsNavigateMenuTest.xml
index bc255020d98b3..6be63541f3c27 100644
--- a/app/code/Magento/CatalogSearch/Test/Mftf/Test/AdminMarketingSearchTermsNavigateMenuTest.xml
+++ b/app/code/Magento/CatalogSearch/Test/Mftf/Test/AdminMarketingSearchTermsNavigateMenuTest.xml
@@ -23,7 +23,7 @@
-
+
diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/Test/AdminReportsSearchTermsNavigateMenuTest.xml b/app/code/Magento/CatalogSearch/Test/Mftf/Test/AdminReportsSearchTermsNavigateMenuTest.xml
index 85cf0e3ba90ed..e1a965bd08e0b 100644
--- a/app/code/Magento/CatalogSearch/Test/Mftf/Test/AdminReportsSearchTermsNavigateMenuTest.xml
+++ b/app/code/Magento/CatalogSearch/Test/Mftf/Test/AdminReportsSearchTermsNavigateMenuTest.xml
@@ -23,7 +23,7 @@
-
+
diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/Test/LayerNavigationOfCatalogSearchTest.xml b/app/code/Magento/CatalogSearch/Test/Mftf/Test/LayerNavigationOfCatalogSearchTest.xml
index fa9407495e6e7..c8055d85c98ea 100644
--- a/app/code/Magento/CatalogSearch/Test/Mftf/Test/LayerNavigationOfCatalogSearchTest.xml
+++ b/app/code/Magento/CatalogSearch/Test/Mftf/Test/LayerNavigationOfCatalogSearchTest.xml
@@ -38,7 +38,7 @@
-
+
diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/Test/MinimalQueryLengthForCatalogSearchTest.xml b/app/code/Magento/CatalogSearch/Test/Mftf/Test/MinimalQueryLengthForCatalogSearchTest.xml
index 89269a1ad0d9e..6ae215f821a0b 100644
--- a/app/code/Magento/CatalogSearch/Test/Mftf/Test/MinimalQueryLengthForCatalogSearchTest.xml
+++ b/app/code/Magento/CatalogSearch/Test/Mftf/Test/MinimalQueryLengthForCatalogSearchTest.xml
@@ -31,7 +31,7 @@
-
+
diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/Test/SearchEntityResultsTest.xml b/app/code/Magento/CatalogSearch/Test/Mftf/Test/SearchEntityResultsTest.xml
index 7648b59aaefe8..dc715a5d95f2f 100644
--- a/app/code/Magento/CatalogSearch/Test/Mftf/Test/SearchEntityResultsTest.xml
+++ b/app/code/Magento/CatalogSearch/Test/Mftf/Test/SearchEntityResultsTest.xml
@@ -385,7 +385,7 @@
-
+
@@ -465,7 +465,7 @@
-
+
@@ -517,7 +517,7 @@
-
+
@@ -586,7 +586,7 @@
-
+
diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/Test/StorefrontAdvancedSearchEntitySimpleProductTest.xml b/app/code/Magento/CatalogSearch/Test/Mftf/Test/StorefrontAdvancedSearchEntitySimpleProductTest.xml
index 61f274cd13061..f032a97ac297c 100644
--- a/app/code/Magento/CatalogSearch/Test/Mftf/Test/StorefrontAdvancedSearchEntitySimpleProductTest.xml
+++ b/app/code/Magento/CatalogSearch/Test/Mftf/Test/StorefrontAdvancedSearchEntitySimpleProductTest.xml
@@ -28,7 +28,7 @@
-
+
diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/Test/StorefrontQuickSearchConfigurableChildrenTest.xml b/app/code/Magento/CatalogSearch/Test/Mftf/Test/StorefrontQuickSearchConfigurableChildrenTest.xml
index 44a4001f7b579..5c3f55c7212ad 100644
--- a/app/code/Magento/CatalogSearch/Test/Mftf/Test/StorefrontQuickSearchConfigurableChildrenTest.xml
+++ b/app/code/Magento/CatalogSearch/Test/Mftf/Test/StorefrontQuickSearchConfigurableChildrenTest.xml
@@ -81,7 +81,7 @@
-
+
diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/Test/StorefrontUpdateSearchTermEntityTest.xml b/app/code/Magento/CatalogSearch/Test/Mftf/Test/StorefrontUpdateSearchTermEntityTest.xml
index fab28dc357016..502301939f71a 100644
--- a/app/code/Magento/CatalogSearch/Test/Mftf/Test/StorefrontUpdateSearchTermEntityTest.xml
+++ b/app/code/Magento/CatalogSearch/Test/Mftf/Test/StorefrontUpdateSearchTermEntityTest.xml
@@ -41,7 +41,7 @@
-
+
diff --git a/app/code/Magento/CatalogUrlRewrite/Test/Mftf/Test/AdminCategoryWithRestrictedUrlKeyNotCreatedTest.xml b/app/code/Magento/CatalogUrlRewrite/Test/Mftf/Test/AdminCategoryWithRestrictedUrlKeyNotCreatedTest.xml
index c3c7e3c3281f4..cb969ac2d329e 100644
--- a/app/code/Magento/CatalogUrlRewrite/Test/Mftf/Test/AdminCategoryWithRestrictedUrlKeyNotCreatedTest.xml
+++ b/app/code/Magento/CatalogUrlRewrite/Test/Mftf/Test/AdminCategoryWithRestrictedUrlKeyNotCreatedTest.xml
@@ -36,7 +36,7 @@
-
+
diff --git a/app/code/Magento/CatalogUrlRewrite/Test/Mftf/Test/AdminUrlForProductRewrittenCorrectlyTest.xml b/app/code/Magento/CatalogUrlRewrite/Test/Mftf/Test/AdminUrlForProductRewrittenCorrectlyTest.xml
index cc5f09faca57b..453f18003e694 100644
--- a/app/code/Magento/CatalogUrlRewrite/Test/Mftf/Test/AdminUrlForProductRewrittenCorrectlyTest.xml
+++ b/app/code/Magento/CatalogUrlRewrite/Test/Mftf/Test/AdminUrlForProductRewrittenCorrectlyTest.xml
@@ -33,7 +33,7 @@
-
+
diff --git a/app/code/Magento/CatalogUrlRewrite/Test/Mftf/Test/RewriteStoreLevelUrlKeyOfChildCategoryTest.xml b/app/code/Magento/CatalogUrlRewrite/Test/Mftf/Test/RewriteStoreLevelUrlKeyOfChildCategoryTest.xml
index c3a358bbbd292..e176fba9fd189 100644
--- a/app/code/Magento/CatalogUrlRewrite/Test/Mftf/Test/RewriteStoreLevelUrlKeyOfChildCategoryTest.xml
+++ b/app/code/Magento/CatalogUrlRewrite/Test/Mftf/Test/RewriteStoreLevelUrlKeyOfChildCategoryTest.xml
@@ -58,7 +58,7 @@
-
+
diff --git a/app/code/Magento/CatalogUrlRewrite/Test/Mftf/Test/StorefrontCategoryAccessibleWhenSuffixIsNullTest.xml b/app/code/Magento/CatalogUrlRewrite/Test/Mftf/Test/StorefrontCategoryAccessibleWhenSuffixIsNullTest.xml
index 6674c55064169..99037a5c89af1 100644
--- a/app/code/Magento/CatalogUrlRewrite/Test/Mftf/Test/StorefrontCategoryAccessibleWhenSuffixIsNullTest.xml
+++ b/app/code/Magento/CatalogUrlRewrite/Test/Mftf/Test/StorefrontCategoryAccessibleWhenSuffixIsNullTest.xml
@@ -13,6 +13,7 @@
+
diff --git a/app/code/Magento/CatalogUrlRewrite/Test/Unit/Observer/ProductProcessUrlRewriteRemovingObserverTest.php b/app/code/Magento/CatalogUrlRewrite/Test/Unit/Observer/ProductProcessUrlRewriteRemovingObserverTest.php
new file mode 100644
index 0000000000000..7184f1b3cd275
--- /dev/null
+++ b/app/code/Magento/CatalogUrlRewrite/Test/Unit/Observer/ProductProcessUrlRewriteRemovingObserverTest.php
@@ -0,0 +1,148 @@
+objectManager = new ObjectManager($this);
+ $this->observerMock = $this->createMock(Observer::class);
+
+ $this->eventMock = $this->getMockBuilder(Event::class)
+ ->disableOriginalConstructor()
+ ->setMethods(['getProduct'])
+ ->getMock();
+
+ $this->productMock = $this->getMockBuilder(Product::class)
+ ->disableOriginalConstructor()
+ ->setMethods(['getId'])
+ ->getMock();
+
+ $this->urlPersistMock = $this->getMockBuilder(UrlPersistInterface::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $this->observer = $this->objectManager->getObject(
+ ProductProcessUrlRewriteRemovingObserver::class,
+ [
+ 'urlPersist' => $this->urlPersistMock
+ ]
+ );
+ }
+
+ /**
+ * Test for execute(), covers test case for removing product URLs from storage
+ */
+ public function testRemoveProductUrlsFromStorage(): void
+ {
+ $this->observerMock
+ ->expects($this->once())
+ ->method('getEvent')
+ ->willReturn($this->eventMock);
+
+ $this->eventMock
+ ->expects($this->once())
+ ->method('getProduct')
+ ->willReturn($this->productMock);
+
+ $this->productMock
+ ->expects($this->exactly(2))
+ ->method('getId')
+ ->willReturn(self::STUB_PRODUCT_ID);
+
+ $this->urlPersistMock->expects($this->once())
+ ->method('deleteByData')
+ ->with([
+ UrlRewrite::ENTITY_ID => self::STUB_PRODUCT_ID,
+ UrlRewrite::ENTITY_TYPE => ProductUrlRewriteGenerator::ENTITY_TYPE,
+ ]);
+
+ $this->observer->execute($this->observerMock);
+ }
+
+ /**
+ * Test for execute(), covers test case for removing product URLs when the product doesn't have an ID
+ */
+ public function testRemoveProductUrlsWithEmptyProductId()
+ {
+ $this->observerMock
+ ->expects($this->once())
+ ->method('getEvent')
+ ->willReturn($this->eventMock);
+
+ $this->eventMock
+ ->expects($this->once())
+ ->method('getProduct')
+ ->willReturn($this->productMock);
+
+ $this->productMock
+ ->expects($this->once())
+ ->method('getId')
+ ->willReturn(null);
+
+ $this->urlPersistMock->expects($this->never())->method('deleteByData');
+
+ $this->observer->execute($this->observerMock);
+ }
+}
diff --git a/app/code/Magento/CatalogWidget/Model/Rule/Condition/Product.php b/app/code/Magento/CatalogWidget/Model/Rule/Condition/Product.php
index eca994de0892f..f9340a495de65 100644
--- a/app/code/Magento/CatalogWidget/Model/Rule/Condition/Product.php
+++ b/app/code/Magento/CatalogWidget/Model/Rule/Condition/Product.php
@@ -11,6 +11,7 @@
use Magento\Catalog\Api\Data\ProductInterface;
use Magento\Catalog\Model\ProductCategoryList;
+use Magento\Catalog\Model\ResourceModel\Product\Collection;
use Magento\Store\Model\Store;
/**
@@ -122,46 +123,34 @@ protected function _addSpecialAttributes(array &$attributes)
/**
* Add condition to collection
*
- * @param \Magento\Catalog\Model\ResourceModel\Product\Collection $collection
+ * @param Collection $collection
* @return $this
*/
public function addToCollection($collection)
{
$attribute = $this->getAttributeObject();
+ $attributeCode = $attribute->getAttributeCode();
+ if ($attributeCode !== 'price' || !$collection->getLimitationFilters()->isUsingPriceIndex()) {
+ if ($collection->isEnabledFlat()) {
+ if ($attribute->isEnabledInFlat()) {
+ $alias = array_keys($collection->getSelect()->getPart('from'))[0];
+ $this->joinedAttributes[$attributeCode] = $alias . '.' . $attributeCode;
+ } else {
+ $alias = 'at_' . $attributeCode;
+ if (!in_array($alias, array_keys($collection->getSelect()->getPart('from')))) {
+ $collection->joinAttribute($attributeCode, "catalog_product/$attributeCode", 'entity_id');
+ }
- if ($collection->isEnabledFlat()) {
- if ($attribute->isEnabledInFlat()) {
- $alias = array_keys($collection->getSelect()->getPart('from'))[0];
- $this->joinedAttributes[$attribute->getAttributeCode()] = $alias . '.' . $attribute->getAttributeCode();
- } else {
- $alias = 'at_' . $attribute->getAttributeCode();
- if (!in_array($alias, array_keys($collection->getSelect()->getPart('from')))) {
- $collection->joinAttribute(
- $attribute->getAttributeCode(),
- 'catalog_product/'.$attribute->getAttributeCode(),
- 'entity_id'
- );
+ $this->joinedAttributes[$attributeCode] = $alias . '.value';
}
-
- $this->joinedAttributes[$attribute->getAttributeCode()] = $alias . '.value';
+ } elseif ($attributeCode !== 'category_ids' && !$attribute->isStatic()) {
+ $this->addAttributeToCollection($attribute, $collection);
+ $attributes = $this->getRule()->getCollectedAttributes();
+ $attributes[$attributeCode] = true;
+ $this->getRule()->setCollectedAttributes($attributes);
}
- return $this;
}
- if ('category_ids' == $attribute->getAttributeCode() || $attribute->isStatic()) {
- return $this;
- }
-
- if ($attribute->getBackend() && $attribute->isScopeGlobal()) {
- $this->addGlobalAttribute($attribute, $collection);
- } else {
- $this->addNotGlobalAttribute($attribute, $collection);
- }
-
- $attributes = $this->getRule()->getCollectedAttributes();
- $attributes[$attribute->getAttributeCode()] = true;
- $this->getRule()->setCollectedAttributes($attributes);
-
return $this;
}
@@ -169,12 +158,12 @@ public function addToCollection($collection)
* Adds Attributes that belong to Global Scope
*
* @param \Magento\Catalog\Model\ResourceModel\Eav\Attribute $attribute
- * @param \Magento\Catalog\Model\ResourceModel\Product\Collection $collection
+ * @param Collection $collection
* @return $this
*/
protected function addGlobalAttribute(
\Magento\Catalog\Model\ResourceModel\Eav\Attribute $attribute,
- \Magento\Catalog\Model\ResourceModel\Product\Collection $collection
+ Collection $collection
) {
switch ($attribute->getBackendType()) {
case 'decimal':
@@ -207,12 +196,12 @@ protected function addGlobalAttribute(
* Adds Attributes that don't belong to Global Scope
*
* @param \Magento\Catalog\Model\ResourceModel\Eav\Attribute $attribute
- * @param \Magento\Catalog\Model\ResourceModel\Product\Collection $collection
+ * @param Collection $collection
* @return $this
*/
protected function addNotGlobalAttribute(
\Magento\Catalog\Model\ResourceModel\Eav\Attribute $attribute,
- \Magento\Catalog\Model\ResourceModel\Product\Collection $collection
+ Collection $collection
) {
$storeId = $this->storeManager->getStore()->getId();
$values = $collection->getAllAttributeValues($attribute);
@@ -255,6 +244,8 @@ public function getMappedSqlField()
$result = parent::getMappedSqlField();
} elseif (isset($this->joinedAttributes[$this->getAttribute()])) {
$result = $this->joinedAttributes[$this->getAttribute()];
+ } elseif ($this->getAttribute() === 'price') {
+ $result = 'price_index.min_price';
} elseif ($this->getAttributeObject()->isStatic()) {
$result = $this->getAttributeObject()->getAttributeCode();
} elseif ($this->getValueParsed()) {
@@ -267,11 +258,27 @@ public function getMappedSqlField()
/**
* @inheritdoc
*
- * @param \Magento\Catalog\Model\ResourceModel\Product\Collection $productCollection
+ * @param Collection $productCollection
* @return $this
*/
public function collectValidatedAttributes($productCollection)
{
return $this->addToCollection($productCollection);
}
+
+ /**
+ * Add attribute to collection based on scope
+ *
+ * @param \Magento\Catalog\Model\ResourceModel\Eav\Attribute $attribute
+ * @param Collection $collection
+ * @return void
+ */
+ private function addAttributeToCollection($attribute, $collection): void
+ {
+ if ($attribute->getBackend() && $attribute->isScopeGlobal()) {
+ $this->addGlobalAttribute($attribute, $collection);
+ } else {
+ $this->addNotGlobalAttribute($attribute, $collection);
+ }
+ }
}
diff --git a/app/code/Magento/CatalogWidget/Test/Mftf/ActionGroup/AdminFillCatalogProductsListWidgetCategoryActionGroup.xml b/app/code/Magento/CatalogWidget/Test/Mftf/ActionGroup/AdminFillCatalogProductsListWidgetCategoryActionGroup.xml
new file mode 100644
index 0000000000000..ecc5780da0e02
--- /dev/null
+++ b/app/code/Magento/CatalogWidget/Test/Mftf/ActionGroup/AdminFillCatalogProductsListWidgetCategoryActionGroup.xml
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+ Fill catalog products list widget category.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/CatalogWidget/Test/Mftf/Section/CatalogWidgetSection.xml b/app/code/Magento/CatalogWidget/Test/Mftf/Section/CatalogWidgetSection.xml
index 855d325c9850c..66aa4252f4b5f 100644
--- a/app/code/Magento/CatalogWidget/Test/Mftf/Section/CatalogWidgetSection.xml
+++ b/app/code/Magento/CatalogWidget/Test/Mftf/Section/CatalogWidgetSection.xml
@@ -22,5 +22,6 @@
+
diff --git a/app/code/Magento/CatalogWidget/Test/Mftf/Test/CatalogProductListWidgetOperatorsTest.xml b/app/code/Magento/CatalogWidget/Test/Mftf/Test/CatalogProductListWidgetOperatorsTest.xml
index 13ffedb1f707b..8d4e97420dd0b 100644
--- a/app/code/Magento/CatalogWidget/Test/Mftf/Test/CatalogProductListWidgetOperatorsTest.xml
+++ b/app/code/Magento/CatalogWidget/Test/Mftf/Test/CatalogProductListWidgetOperatorsTest.xml
@@ -151,7 +151,7 @@
-
+
diff --git a/app/code/Magento/CatalogWidget/Test/Mftf/Test/CatalogProductListWidgetOrderTest.xml b/app/code/Magento/CatalogWidget/Test/Mftf/Test/CatalogProductListWidgetOrderTest.xml
index f0af04478bc28..ea6a3a73522e7 100644
--- a/app/code/Magento/CatalogWidget/Test/Mftf/Test/CatalogProductListWidgetOrderTest.xml
+++ b/app/code/Magento/CatalogWidget/Test/Mftf/Test/CatalogProductListWidgetOrderTest.xml
@@ -82,7 +82,7 @@
-
+
diff --git a/app/code/Magento/CatalogWidget/Test/Mftf/Test/StorefrontProductGridUIUpdatesOnDesktopTest.xml b/app/code/Magento/CatalogWidget/Test/Mftf/Test/StorefrontProductGridUIUpdatesOnDesktopTest.xml
new file mode 100644
index 0000000000000..74e1110c95636
--- /dev/null
+++ b/app/code/Magento/CatalogWidget/Test/Mftf/Test/StorefrontProductGridUIUpdatesOnDesktopTest.xml
@@ -0,0 +1,93 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Checkout/Block/Checkout/AttributeMerger.php b/app/code/Magento/Checkout/Block/Checkout/AttributeMerger.php
index 5dedf2c7e7eba..1dd1131cde1f1 100644
--- a/app/code/Magento/Checkout/Block/Checkout/AttributeMerger.php
+++ b/app/code/Magento/Checkout/Block/Checkout/AttributeMerger.php
@@ -289,6 +289,7 @@ protected function getMultilineFieldConfig($attributeCode, array $attributeConfi
'dataScope' => $lineIndex,
'provider' => $providerName,
'validation' => $isFirstLine
+ //phpcs:ignore Magento2.Performance.ForeachArrayMerge
? array_merge(
['required-entry' => (bool)$attributeConfig['required']],
$attributeConfig['validation']
@@ -381,14 +382,14 @@ protected function getCustomer(): ?CustomerInterface
/**
* Retrieve field options from attribute configuration
*
- * @param string $attributeCode
+ * @param mixed $attributeCode
* @param array $attributeConfig
* @return array
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
protected function getFieldOptions($attributeCode, array $attributeConfig)
{
- return isset($attributeConfig['options']) ? $attributeConfig['options'] : [];
+ return $attributeConfig['options'] ?? [];
}
/**
diff --git a/app/code/Magento/Checkout/Block/Checkout/LayoutProcessor.php b/app/code/Magento/Checkout/Block/Checkout/LayoutProcessor.php
index 557f143352446..00cc06ea0ff47 100644
--- a/app/code/Magento/Checkout/Block/Checkout/LayoutProcessor.php
+++ b/app/code/Magento/Checkout/Block/Checkout/LayoutProcessor.php
@@ -3,24 +3,30 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
+declare(strict_types=1);
+
namespace Magento\Checkout\Block\Checkout;
use Magento\Checkout\Helper\Data;
-use Magento\Framework\App\ObjectManager;
+use Magento\Customer\Model\AttributeMetadataDataProvider;
+use Magento\Customer\Model\Options;
+use Magento\Eav\Api\Data\AttributeInterface;
+use Magento\Shipping\Model\Config;
use Magento\Store\Model\StoreManagerInterface;
+use Magento\Ui\Component\Form\AttributeMapper;
/**
- * Class LayoutProcessor
+ * Checkout Layout Processor
*/
-class LayoutProcessor implements \Magento\Checkout\Block\Checkout\LayoutProcessorInterface
+class LayoutProcessor implements LayoutProcessorInterface
{
/**
- * @var \Magento\Customer\Model\AttributeMetadataDataProvider
+ * @var AttributeMetadataDataProvider
*/
private $attributeMetadataDataProvider;
/**
- * @var \Magento\Ui\Component\Form\AttributeMapper
+ * @var AttributeMapper
*/
protected $attributeMapper;
@@ -30,7 +36,7 @@ class LayoutProcessor implements \Magento\Checkout\Block\Checkout\LayoutProcesso
protected $merger;
/**
- * @var \Magento\Customer\Model\Options
+ * @var Options
*/
private $options;
@@ -45,39 +51,35 @@ class LayoutProcessor implements \Magento\Checkout\Block\Checkout\LayoutProcesso
private $storeManager;
/**
- * @var \Magento\Shipping\Model\Config
+ * @var Config
*/
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 \Magento\Customer\Model\Options|null $options
- * @param Data|null $checkoutDataHelper
- * @param \Magento\Shipping\Model\Config|null $shippingConfig
- * @param StoreManagerInterface|null $storeManager
+ * @param Options $options
+ * @param Data $checkoutDataHelper
+ * @param Config $shippingConfig
+ * @param StoreManagerInterface $storeManager
*/
public function __construct(
- \Magento\Customer\Model\AttributeMetadataDataProvider $attributeMetadataDataProvider,
- \Magento\Ui\Component\Form\AttributeMapper $attributeMapper,
+ AttributeMetadataDataProvider $attributeMetadataDataProvider,
+ AttributeMapper $attributeMapper,
AttributeMerger $merger,
- \Magento\Customer\Model\Options $options = null,
- Data $checkoutDataHelper = null,
- \Magento\Shipping\Model\Config $shippingConfig = null,
- StoreManagerInterface $storeManager = null
+ Options $options,
+ Data $checkoutDataHelper,
+ Config $shippingConfig,
+ StoreManagerInterface $storeManager
) {
$this->attributeMetadataDataProvider = $attributeMetadataDataProvider;
$this->attributeMapper = $attributeMapper;
$this->merger = $merger;
- $this->options = $options ?: \Magento\Framework\App\ObjectManager::getInstance()
- ->get(\Magento\Customer\Model\Options::class);
- $this->checkoutDataHelper = $checkoutDataHelper ?: \Magento\Framework\App\ObjectManager::getInstance()
- ->get(Data::class);
- $this->shippingConfig = $shippingConfig ?: \Magento\Framework\App\ObjectManager::getInstance()
- ->get(\Magento\Shipping\Model\Config::class);
- $this->storeManager = $storeManager ?: \Magento\Framework\App\ObjectManager::getInstance()
- ->get(StoreManagerInterface::class);
+ $this->options = $options;
+ $this->checkoutDataHelper = $checkoutDataHelper;
+ $this->shippingConfig = $shippingConfig;
+ $this->storeManager = $storeManager;
}
/**
@@ -87,7 +89,7 @@ public function __construct(
*/
private function getAddressAttributes()
{
- /** @var \Magento\Eav\Api\Data\AttributeInterface[] $attributes */
+ /** @var AttributeInterface[] $attributes */
$attributes = $this->attributeMetadataDataProvider->loadAttributesCollection(
'customer_address',
'customer_register_address'
@@ -157,8 +159,10 @@ public function process($jsLayout)
$elements = $this->getAddressAttributes();
$elements = $this->convertElementsToSelect($elements, $attributesToConvert);
// The following code is a workaround for custom address attributes
- if (isset($jsLayout['components']['checkout']['children']['steps']['children']['billing-step']['children']
- ['payment']['children'])) {
+ if (isset(
+ $jsLayout['components']['checkout']['children']['steps']['children']['billing-step']['children']['payment']
+ ['children']
+ )) {
$jsLayout['components']['checkout']['children']['steps']['children']['billing-step']['children']
['payment']['children'] = $this->processPaymentChildrenComponents(
$jsLayout['components']['checkout']['children']['steps']['children']['billing-step']['children']
@@ -166,8 +170,11 @@ public function process($jsLayout)
$elements
);
}
- if (isset($jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children']
- ['step-config']['children']['shipping-rates-validation']['children'])) {
+
+ if (isset(
+ $jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children']
+ ['step-config']['children']['shipping-rates-validation']['children']
+ )) {
$jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children']
['step-config']['children']['shipping-rates-validation']['children'] =
$this->processShippingChildrenComponents(
@@ -176,8 +183,10 @@ public function process($jsLayout)
);
}
- if (isset($jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']
- ['children']['shippingAddress']['children']['shipping-address-fieldset']['children'])) {
+ if (isset(
+ $jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children']
+ ['shippingAddress']['children']['shipping-address-fieldset']['children']
+ )) {
$fields = $jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']
['children']['shippingAddress']['children']['shipping-address-fieldset']['children'];
$jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']
@@ -188,6 +197,7 @@ public function process($jsLayout)
$fields
);
}
+
return $jsLayout;
}
@@ -304,9 +314,6 @@ private function getBillingAddressComponent($paymentCode, $elements)
'checkoutProvider',
'billingAddress' . $paymentCode,
[
- 'country_id' => [
- 'sortOrder' => 115,
- ],
'region' => [
'visible' => false,
],
diff --git a/app/code/Magento/Checkout/Model/ShippingInformationManagement.php b/app/code/Magento/Checkout/Model/ShippingInformationManagement.php
index 369ae8e6f725e..cbbbd9a9b4d01 100644
--- a/app/code/Magento/Checkout/Model/ShippingInformationManagement.php
+++ b/app/code/Magento/Checkout/Model/ShippingInformationManagement.php
@@ -6,28 +6,38 @@
namespace Magento\Checkout\Model;
+use Magento\Checkout\Api\Data\PaymentDetailsInterface;
+use Magento\Checkout\Api\Data\ShippingInformationInterface;
+use Magento\Checkout\Api\ShippingInformationManagementInterface;
+use Magento\Customer\Api\AddressRepositoryInterface;
+use Magento\Framework\App\Config\ScopeConfigInterface;
+use Magento\Framework\App\ObjectManager;
use Magento\Framework\Exception\InputException;
-use Magento\Framework\Exception\StateException;
+use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Exception\NoSuchEntityException;
+use Magento\Framework\Exception\StateException;
+use Magento\Quote\Api\CartRepositoryInterface;
+use Magento\Quote\Api\CartTotalRepositoryInterface;
use Magento\Quote\Api\Data\AddressInterface;
+use Magento\Quote\Api\Data\CartExtensionFactory;
use Magento\Quote\Api\Data\CartInterface;
-use Psr\Log\LoggerInterface as Logger;
+use Magento\Quote\Api\PaymentMethodManagementInterface;
+use Magento\Quote\Model\Quote;
+use Magento\Quote\Model\Quote\TotalsCollector;
use Magento\Quote\Model\QuoteAddressValidator;
-use Magento\Quote\Api\Data\CartExtensionFactory;
use Magento\Quote\Model\ShippingAssignmentFactory;
use Magento\Quote\Model\ShippingFactory;
-use Magento\Framework\App\ObjectManager;
+use Psr\Log\LoggerInterface as Logger;
/**
- * Class ShippingInformationManagement
+ * Class checkout shipping information management
*
- * @package Magento\Checkout\Model
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class ShippingInformationManagement implements \Magento\Checkout\Api\ShippingInformationManagementInterface
+class ShippingInformationManagement implements ShippingInformationManagementInterface
{
/**
- * @var \Magento\Quote\Api\PaymentMethodManagementInterface
+ * @var PaymentMethodManagementInterface
*/
protected $paymentMethodManagement;
@@ -37,12 +47,12 @@ class ShippingInformationManagement implements \Magento\Checkout\Api\ShippingInf
protected $paymentDetailsFactory;
/**
- * @var \Magento\Quote\Api\CartTotalRepositoryInterface
+ * @var CartTotalRepositoryInterface
*/
protected $cartTotalsRepository;
/**
- * @var \Magento\Quote\Api\CartRepositoryInterface
+ * @var CartRepositoryInterface
*/
protected $quoteRepository;
@@ -57,65 +67,63 @@ class ShippingInformationManagement implements \Magento\Checkout\Api\ShippingInf
protected $addressValidator;
/**
- * @var \Magento\Customer\Api\AddressRepositoryInterface
+ * @var AddressRepositoryInterface
* @deprecated 100.2.0
*/
protected $addressRepository;
/**
- * @var \Magento\Framework\App\Config\ScopeConfigInterface
+ * @var ScopeConfigInterface
* @deprecated 100.2.0
*/
protected $scopeConfig;
/**
- * @var \Magento\Quote\Model\Quote\TotalsCollector
+ * @var TotalsCollector
* @deprecated 100.2.0
*/
protected $totalsCollector;
/**
- * @var \Magento\Quote\Api\Data\CartExtensionFactory
+ * @var CartExtensionFactory
*/
private $cartExtensionFactory;
/**
- * @var \Magento\Quote\Model\ShippingAssignmentFactory
+ * @var ShippingAssignmentFactory
*/
protected $shippingAssignmentFactory;
/**
- * @var \Magento\Quote\Model\ShippingFactory
+ * @var ShippingFactory
*/
private $shippingFactory;
/**
- * Constructor
- *
- * @param \Magento\Quote\Api\PaymentMethodManagementInterface $paymentMethodManagement
- * @param \Magento\Checkout\Model\PaymentDetailsFactory $paymentDetailsFactory
- * @param \Magento\Quote\Api\CartTotalRepositoryInterface $cartTotalsRepository
- * @param \Magento\Quote\Api\CartRepositoryInterface $quoteRepository
- * @param \Magento\Quote\Model\QuoteAddressValidator $addressValidator
+ * @param PaymentMethodManagementInterface $paymentMethodManagement
+ * @param PaymentDetailsFactory $paymentDetailsFactory
+ * @param CartTotalRepositoryInterface $cartTotalsRepository
+ * @param CartRepositoryInterface $quoteRepository
+ * @param QuoteAddressValidator $addressValidator
* @param Logger $logger
- * @param \Magento\Customer\Api\AddressRepositoryInterface $addressRepository
- * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
- * @param \Magento\Quote\Model\Quote\TotalsCollector $totalsCollector
+ * @param AddressRepositoryInterface $addressRepository
+ * @param ScopeConfigInterface $scopeConfig
+ * @param TotalsCollector $totalsCollector
* @param CartExtensionFactory|null $cartExtensionFactory
* @param ShippingAssignmentFactory|null $shippingAssignmentFactory
* @param ShippingFactory|null $shippingFactory
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/
public function __construct(
- \Magento\Quote\Api\PaymentMethodManagementInterface $paymentMethodManagement,
- \Magento\Checkout\Model\PaymentDetailsFactory $paymentDetailsFactory,
- \Magento\Quote\Api\CartTotalRepositoryInterface $cartTotalsRepository,
- \Magento\Quote\Api\CartRepositoryInterface $quoteRepository,
+ PaymentMethodManagementInterface $paymentMethodManagement,
+ PaymentDetailsFactory $paymentDetailsFactory,
+ CartTotalRepositoryInterface $cartTotalsRepository,
+ CartRepositoryInterface $quoteRepository,
QuoteAddressValidator $addressValidator,
Logger $logger,
- \Magento\Customer\Api\AddressRepositoryInterface $addressRepository,
- \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
- \Magento\Quote\Model\Quote\TotalsCollector $totalsCollector,
+ AddressRepositoryInterface $addressRepository,
+ ScopeConfigInterface $scopeConfig,
+ TotalsCollector $totalsCollector,
CartExtensionFactory $cartExtensionFactory = null,
ShippingAssignmentFactory $shippingAssignmentFactory = null,
ShippingFactory $shippingFactory = null
@@ -141,24 +149,23 @@ public function __construct(
* Save address information.
*
* @param int $cartId
- * @param \Magento\Checkout\Api\Data\ShippingInformationInterface $addressInformation
- * @return \Magento\Checkout\Api\Data\PaymentDetailsInterface
+ * @param ShippingInformationInterface $addressInformation
+ * @return PaymentDetailsInterface
* @throws InputException
* @throws NoSuchEntityException
* @throws StateException
*/
public function saveAddressInformation(
$cartId,
- \Magento\Checkout\Api\Data\ShippingInformationInterface $addressInformation
- ) {
- /** @var \Magento\Quote\Model\Quote $quote */
+ ShippingInformationInterface $addressInformation
+ ): PaymentDetailsInterface {
+ /** @var Quote $quote */
$quote = $this->quoteRepository->getActive($cartId);
$this->validateQuote($quote);
$address = $addressInformation->getShippingAddress();
- if (!$address || !$address->getCountryId()) {
- throw new StateException(__('The shipping address is missing. Set the address and try again.'));
- }
+ $this->validateAddress($address);
+
if (!$address->getCustomerAddressId()) {
$address->setCustomerAddressId(null);
}
@@ -182,6 +189,14 @@ public function saveAddressInformation(
$quote->setIsMultiShipping(false);
$this->quoteRepository->save($quote);
+ } catch (LocalizedException $e) {
+ $this->logger->critical($e);
+ throw new InputException(
+ __(
+ 'The shipping information was unable to be saved. Error: "%message"',
+ ['message' => $e->getMessage()]
+ )
+ );
} catch (\Exception $e) {
$this->logger->critical($e);
throw new InputException(
@@ -199,26 +214,39 @@ public function saveAddressInformation(
);
}
- /** @var \Magento\Checkout\Api\Data\PaymentDetailsInterface $paymentDetails */
+ /** @var PaymentDetailsInterface $paymentDetails */
$paymentDetails = $this->paymentDetailsFactory->create();
$paymentDetails->setPaymentMethods($this->paymentMethodManagement->getList($cartId));
$paymentDetails->setTotals($this->cartTotalsRepository->get($cartId));
return $paymentDetails;
}
+ /**
+ * Validate shipping address
+ *
+ * @param AddressInterface|null $address
+ * @return void
+ * @throws StateException
+ */
+ private function validateAddress(?AddressInterface $address): void
+ {
+ if (!$address || !$address->getCountryId()) {
+ throw new StateException(__('The shipping address is missing. Set the address and try again.'));
+ }
+ }
+
/**
* Validate quote
*
- * @param \Magento\Quote\Model\Quote $quote
+ * @param Quote $quote
* @throws InputException
- * @throws NoSuchEntityException
* @return void
*/
- protected function validateQuote(\Magento\Quote\Model\Quote $quote)
+ protected function validateQuote(Quote $quote): void
{
- if (0 == $quote->getItemsCount()) {
+ if (!$quote->getItemsCount()) {
throw new InputException(
- __("The shipping method can't be set for an empty cart. Add an item to cart and try again.")
+ __('The shipping method can\'t be set for an empty cart. Add an item to cart and try again.')
);
}
}
@@ -231,7 +259,7 @@ protected function validateQuote(\Magento\Quote\Model\Quote $quote)
* @param string $method
* @return CartInterface
*/
- private function prepareShippingAssignment(CartInterface $quote, AddressInterface $address, $method)
+ private function prepareShippingAssignment(CartInterface $quote, AddressInterface $address, $method): CartInterface
{
$cartExtension = $quote->getExtensionAttributes();
if ($cartExtension === null) {
diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertStorefrontCheckoutCartEstimateShippingAndTaxAddressActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertStorefrontCheckoutCartEstimateShippingAndTaxAddressActionGroup.xml
new file mode 100644
index 0000000000000..32e529fb7ca0a
--- /dev/null
+++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertStorefrontCheckoutCartEstimateShippingAndTaxAddressActionGroup.xml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+ Check address data in Estimate Shipping And Tax section of shopping cart on storefront
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{postcode}}
+ grabPostCodeText
+
+
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertStorefrontCheckoutCartItemsActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertStorefrontCheckoutCartItemsActionGroup.xml
index fa4db86a5860d..47e44e86affb8 100644
--- a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertStorefrontCheckoutCartItemsActionGroup.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertStorefrontCheckoutCartItemsActionGroup.xml
@@ -19,10 +19,10 @@
-
+
-
-
-
+
+
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertStorefrontOrderIsNotPlacedActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertStorefrontOrderIsNotPlacedActionGroup.xml
new file mode 100644
index 0000000000000..18fc6fac18085
--- /dev/null
+++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertStorefrontOrderIsNotPlacedActionGroup.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+ Validates order cannot be placed and checks error message.
+
+
+
+
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontCheckoutCartFillEstimateShippingAndTaxActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontCheckoutCartFillEstimateShippingAndTaxActionGroup.xml
new file mode 100644
index 0000000000000..543b6bc8cb599
--- /dev/null
+++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontCheckoutCartFillEstimateShippingAndTaxActionGroup.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+ Fill address data in Estimate Shipping And Tax section of shopping cart on storefront
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontCheckoutClickNextOnShippingStepActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontCheckoutClickNextOnShippingStepActionGroup.xml
new file mode 100644
index 0000000000000..1e86becdc0888
--- /dev/null
+++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontCheckoutClickNextOnShippingStepActionGroup.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+ Scrolls and clicks next on Checkout Shipping step
+
+
+
+
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontOpenCustomerAddressesOnPaymentStepInCheckoutActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontOpenCustomerAddressesOnPaymentStepInCheckoutActionGroup.xml
new file mode 100644
index 0000000000000..2ca395cbf6d25
--- /dev/null
+++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontOpenCustomerAddressesOnPaymentStepInCheckoutActionGroup.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+ Click 'Change Address' link on the Storefront Checkout page on the 'Payment' step.
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontOpenMiniCartActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontOpenMiniCartActionGroup.xml
index 4203aa35a3bdb..1dc0b743bdd16 100644
--- a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontOpenMiniCartActionGroup.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontOpenMiniCartActionGroup.xml
@@ -8,6 +8,18 @@
+
+
+ Clicks on the Storefront Mini Shopping Cart icon. Clicks on the 'View and Edit Cart' link. Validates that the URL is present and correct. PLEASE NOTE: The URL is Hardcoded.
+
+
+
+
+
+
+
+
+
Clicks on the Mini Shopping Cart icon in the Storefront Header.
diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontSearchAddressInSelectBillingAddressPopupOnPaymentStepOnCheckoutActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontSearchAddressInSelectBillingAddressPopupOnPaymentStepOnCheckoutActionGroup.xml
new file mode 100644
index 0000000000000..845e0b7733fca
--- /dev/null
+++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontSearchAddressInSelectBillingAddressPopupOnPaymentStepOnCheckoutActionGroup.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+ Search customer address in 'Select Billing Address' popup on the Storefront Checkout on the 'Payment' step.
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutHeaderSection.xml b/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutHeaderSection.xml
index babbe51746df8..615db79b2ba6d 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutHeaderSection.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutHeaderSection.xml
@@ -9,5 +9,6 @@
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/AdminCheckConfigsChangesIsNotAffectedStartedCheckoutProcessTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/AdminCheckConfigsChangesIsNotAffectedStartedCheckoutProcessTest.xml
index 31a9d011a91c7..a9c3d20c447a9 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/AdminCheckConfigsChangesIsNotAffectedStartedCheckoutProcessTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/AdminCheckConfigsChangesIsNotAffectedStartedCheckoutProcessTest.xml
@@ -37,7 +37,7 @@
-
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/CheckCheckoutSuccessPageTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/CheckCheckoutSuccessPageTest.xml
index 5f898492ad016..b939209751fcd 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/CheckCheckoutSuccessPageTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/CheckCheckoutSuccessPageTest.xml
@@ -30,7 +30,7 @@
-
+
@@ -147,7 +147,7 @@
-
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/CheckoutSpecificDestinationsTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/CheckoutSpecificDestinationsTest.xml
index 1bfb1804f41a7..294fc2c562491 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/CheckoutSpecificDestinationsTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/CheckoutSpecificDestinationsTest.xml
@@ -77,7 +77,7 @@
-
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/ConfiguringInstantPurchaseFunctionalityTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/ConfiguringInstantPurchaseFunctionalityTest.xml
index aea0657cc2e3b..899688c80764e 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/ConfiguringInstantPurchaseFunctionalityTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/ConfiguringInstantPurchaseFunctionalityTest.xml
@@ -47,7 +47,7 @@
-
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/DeleteConfigurableProductFromShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/DeleteConfigurableProductFromShoppingCartTest.xml
index 891f647e3d5ef..9d092b4b84a3c 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/DeleteConfigurableProductFromShoppingCartTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/DeleteConfigurableProductFromShoppingCartTest.xml
@@ -60,6 +60,9 @@
+
+
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingDefaultAddressTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingDefaultAddressTest.xml
index f2501fdf4c0c6..c88025feba3d4 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingDefaultAddressTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingDefaultAddressTest.xml
@@ -30,7 +30,7 @@
-
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNewAddressTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNewAddressTest.xml
index b072989bc968c..600163501b556 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNewAddressTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNewAddressTest.xml
@@ -30,7 +30,7 @@
-
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNonDefaultAddressTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNonDefaultAddressTest.xml
index 9b0da574d6307..661957a1de980 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNonDefaultAddressTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNonDefaultAddressTest.xml
@@ -30,7 +30,7 @@
-
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutUsingSignInLinkTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutUsingSignInLinkTest.xml
index 80cf9c14b578e..43ee1c8dd3de4 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutUsingSignInLinkTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutUsingSignInLinkTest.xml
@@ -30,7 +30,7 @@
-
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutWithAllProductTypesTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutWithAllProductTypesTest.xml
index 797172de5de45..4a4428712ac9d 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutWithAllProductTypesTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutWithAllProductTypesTest.xml
@@ -111,6 +111,9 @@
+
+
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StoreFrontCheckCustomerInfoCreatedByGuestTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StoreFrontCheckCustomerInfoCreatedByGuestTest.xml
index c08a930ba6224..d0fb6babb22fa 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/StoreFrontCheckCustomerInfoCreatedByGuestTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/StoreFrontCheckCustomerInfoCreatedByGuestTest.xml
@@ -31,7 +31,7 @@
-
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StoreFrontFreeShippingRecalculationAfterCouponCodeAddedTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StoreFrontFreeShippingRecalculationAfterCouponCodeAddedTest.xml
index 8a2990c5869c9..d7b462d7f649b 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/StoreFrontFreeShippingRecalculationAfterCouponCodeAddedTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/StoreFrontFreeShippingRecalculationAfterCouponCodeAddedTest.xml
@@ -54,7 +54,7 @@
-
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddConfigurableProductToShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddConfigurableProductToShoppingCartTest.xml
index e716ba294f578..7d91b13b7b833 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddConfigurableProductToShoppingCartTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddConfigurableProductToShoppingCartTest.xml
@@ -120,6 +120,9 @@
+
+
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddDownloadableProductToShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddDownloadableProductToShoppingCartTest.xml
index 3c1421f2616aa..e098c15c0eb6a 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddDownloadableProductToShoppingCartTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontAddDownloadableProductToShoppingCartTest.xml
@@ -34,7 +34,7 @@
-
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontApplyPromoCodeDuringCheckoutTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontApplyPromoCodeDuringCheckoutTest.xml
index 5e13ce3e06e10..58cc137efd7b3 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontApplyPromoCodeDuringCheckoutTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontApplyPromoCodeDuringCheckoutTest.xml
@@ -38,7 +38,7 @@
-
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutWithDifferentShippingAndBillingAddressAndProductWithTierPricesTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutWithDifferentShippingAndBillingAddressAndProductWithTierPricesTest.xml
index 92eae461019a2..80da3fb70f944 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutWithDifferentShippingAndBillingAddressAndProductWithTierPricesTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutWithDifferentShippingAndBillingAddressAndProductWithTierPricesTest.xml
@@ -45,7 +45,7 @@
-
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutWithDifferentShippingAndBillingAddressAndRegisterCustomerAfterCheckoutTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutWithDifferentShippingAndBillingAddressAndRegisterCustomerAfterCheckoutTest.xml
index 2f19dcd2dc32f..85e6a6b9c434c 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutWithDifferentShippingAndBillingAddressAndRegisterCustomerAfterCheckoutTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutWithDifferentShippingAndBillingAddressAndRegisterCustomerAfterCheckoutTest.xml
@@ -31,7 +31,7 @@
-
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutWithSpecialPriceProductsTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutWithSpecialPriceProductsTest.xml
index a9db81620d329..c76ec4cbc3c5c 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutWithSpecialPriceProductsTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutWithSpecialPriceProductsTest.xml
@@ -101,7 +101,10 @@
-
+
+
+
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutOnLoginWhenGuestCheckoutIsDisabledTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutOnLoginWhenGuestCheckoutIsDisabledTest.xml
index 1c3d3d4914fb4..f0907e89f00da 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutOnLoginWhenGuestCheckoutIsDisabledTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutOnLoginWhenGuestCheckoutIsDisabledTest.xml
@@ -35,7 +35,7 @@
-
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest.xml
index 8bdbabb584b83..580b4e32b0b28 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutTest.xml
@@ -31,7 +31,7 @@
-
+
@@ -144,7 +144,7 @@
-
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutWithNewCustomerRegistrationAndDisableGuestCheckoutTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutWithNewCustomerRegistrationAndDisableGuestCheckoutTest.xml
index e0fff27a583e7..2b96d385487bc 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutWithNewCustomerRegistrationAndDisableGuestCheckoutTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutWithNewCustomerRegistrationAndDisableGuestCheckoutTest.xml
@@ -35,7 +35,7 @@
-
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutWithoutRegionTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutWithoutRegionTest.xml
index a6b9372679a11..c66c6371ae595 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutWithoutRegionTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerCheckoutWithoutRegionTest.xml
@@ -33,7 +33,7 @@
-
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerLoginDuringCheckoutTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerLoginDuringCheckoutTest.xml
index afefbff5ea59a..f43cadabfd611 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerLoginDuringCheckoutTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerLoginDuringCheckoutTest.xml
@@ -38,7 +38,7 @@
-
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteBundleProductFromMiniShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteBundleProductFromMiniShoppingCartTest.xml
index 8956ed7687f06..1690612fa3242 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteBundleProductFromMiniShoppingCartTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteBundleProductFromMiniShoppingCartTest.xml
@@ -46,7 +46,7 @@
-
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteConfigurableProductFromMiniShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteConfigurableProductFromMiniShoppingCartTest.xml
index 34264e5982651..8fe2ac3a74791 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteConfigurableProductFromMiniShoppingCartTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteConfigurableProductFromMiniShoppingCartTest.xml
@@ -71,7 +71,10 @@
-
+
+
+
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteDownloadableProductFromMiniShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteDownloadableProductFromMiniShoppingCartTest.xml
index dd9259833cbc4..a60fe104ce14b 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteDownloadableProductFromMiniShoppingCartTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteDownloadableProductFromMiniShoppingCartTest.xml
@@ -33,7 +33,7 @@
-
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteProductsWithCartItemsDisplayDefaultLimitationFromMiniShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteProductsWithCartItemsDisplayDefaultLimitationFromMiniShoppingCartTest.xml
index 07215988c945d..992d3eab9b563 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteProductsWithCartItemsDisplayDefaultLimitationFromMiniShoppingCartTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteProductsWithCartItemsDisplayDefaultLimitationFromMiniShoppingCartTest.xml
@@ -63,7 +63,7 @@
-
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteSimpleAndVirtualProductFromMiniShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteSimpleAndVirtualProductFromMiniShoppingCartTest.xml
index b1aa1de71293f..a6ac6d40a0ce0 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteSimpleAndVirtualProductFromMiniShoppingCartTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteSimpleAndVirtualProductFromMiniShoppingCartTest.xml
@@ -32,7 +32,7 @@
-
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteSimpleProductFromMiniShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteSimpleProductFromMiniShoppingCartTest.xml
index 0108b6310f59d..9e0f59f8a0e77 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteSimpleProductFromMiniShoppingCartTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteSimpleProductFromMiniShoppingCartTest.xml
@@ -27,7 +27,7 @@
-
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutTest.xml
index a2007da317c00..cce4d9f0345d7 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutTest.xml
@@ -29,7 +29,7 @@
-
+
@@ -114,7 +114,7 @@
-
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutUsingFreeShippingAndTaxesTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutUsingFreeShippingAndTaxesTest.xml
index b800ef758d65e..3fe5f1be2a53d 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutUsingFreeShippingAndTaxesTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutUsingFreeShippingAndTaxesTest.xml
@@ -108,7 +108,10 @@
-
+
+
+
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutWithCouponAndZeroSubtotalTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutWithCouponAndZeroSubtotalTest.xml
index 97004ea91f5fd..c217eca5053c1 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutWithCouponAndZeroSubtotalTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutWithCouponAndZeroSubtotalTest.xml
@@ -27,7 +27,7 @@
-
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontNotApplicableShippingMethodInReviewAndPaymentStepTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontNotApplicableShippingMethodInReviewAndPaymentStepTest.xml
index f11d25a30f073..d83550a82a87c 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontNotApplicableShippingMethodInReviewAndPaymentStepTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontNotApplicableShippingMethodInReviewAndPaymentStepTest.xml
@@ -16,10 +16,7 @@
-
-
-
-
+
@@ -27,22 +24,26 @@
+
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
@@ -56,9 +57,6 @@
-
-
-
@@ -69,19 +67,23 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -105,7 +107,7 @@
-
+
@@ -122,7 +124,7 @@
-
+
@@ -135,7 +137,7 @@
-
+
@@ -147,53 +149,52 @@
-
+
-
-
+
-
+
-
+
-
+
-
-
+
+
-
+
-
+
-
-
+
+
-
+
-
+
-
+
-
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontOnePageCheckoutDataWhenChangeQtyTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontOnePageCheckoutDataWhenChangeQtyTest.xml
index ae7b8d2446380..e335caa2ddb64 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontOnePageCheckoutDataWhenChangeQtyTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontOnePageCheckoutDataWhenChangeQtyTest.xml
@@ -21,6 +21,8 @@
+
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontProductNameMinicartOnCheckoutPageDifferentStoreViewsTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontProductNameMinicartOnCheckoutPageDifferentStoreViewsTest.xml
index b678cb835f503..1fff7501f578d 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontProductNameMinicartOnCheckoutPageDifferentStoreViewsTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontProductNameMinicartOnCheckoutPageDifferentStoreViewsTest.xml
@@ -32,7 +32,7 @@
-
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontProductQuantityChangesInBackendAfterCustomerCheckoutTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontProductQuantityChangesInBackendAfterCustomerCheckoutTest.xml
index e87aa31576595..44e12d1ea4039 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontProductQuantityChangesInBackendAfterCustomerCheckoutTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontProductQuantityChangesInBackendAfterCustomerCheckoutTest.xml
@@ -28,7 +28,7 @@
-
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontRefreshPageDuringGuestCheckoutTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontRefreshPageDuringGuestCheckoutTest.xml
index bb74726330b68..90896c3eb403e 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontRefreshPageDuringGuestCheckoutTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontRefreshPageDuringGuestCheckoutTest.xml
@@ -30,7 +30,7 @@
-
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUKCustomerCheckoutWithCouponTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUKCustomerCheckoutWithCouponTest.xml
index b53954709b2de..293abcb8197e1 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUKCustomerCheckoutWithCouponTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUKCustomerCheckoutWithCouponTest.xml
@@ -44,7 +44,7 @@
-
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUKGuestCheckoutWithConditionProductQuantityEqualsToOrderedQuantityTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUKGuestCheckoutWithConditionProductQuantityEqualsToOrderedQuantityTest.xml
index ba096d4a59615..04ee2e2adbf28 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUKGuestCheckoutWithConditionProductQuantityEqualsToOrderedQuantityTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUKGuestCheckoutWithConditionProductQuantityEqualsToOrderedQuantityTest.xml
@@ -25,7 +25,7 @@
-
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUSCustomerCheckoutWithCouponAndBankTransferPaymentMethodTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUSCustomerCheckoutWithCouponAndBankTransferPaymentMethodTest.xml
index e67fd938c0a74..bb3bd50072f23 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUSCustomerCheckoutWithCouponAndBankTransferPaymentMethodTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUSCustomerCheckoutWithCouponAndBankTransferPaymentMethodTest.xml
@@ -32,7 +32,7 @@
-
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUpdatePriceInShoppingCartAfterProductSaveTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUpdatePriceInShoppingCartAfterProductSaveTest.xml
index 4bff22950174f..46c4abf4eab1a 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUpdatePriceInShoppingCartAfterProductSaveTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontUpdatePriceInShoppingCartAfterProductSaveTest.xml
@@ -31,7 +31,7 @@
-
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/ZeroSubtotalOrdersWithProcessingStatusTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/ZeroSubtotalOrdersWithProcessingStatusTest.xml
index 0f0b98912de30..781253a707271 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/ZeroSubtotalOrdersWithProcessingStatusTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/ZeroSubtotalOrdersWithProcessingStatusTest.xml
@@ -36,7 +36,7 @@
-
+
diff --git a/app/code/Magento/Checkout/Test/Unit/Block/Checkout/LayoutProcessorTest.php b/app/code/Magento/Checkout/Test/Unit/Block/Checkout/LayoutProcessorTest.php
index 31ca2a2033012..9fff4b622e596 100644
--- a/app/code/Magento/Checkout/Test/Unit/Block/Checkout/LayoutProcessorTest.php
+++ b/app/code/Magento/Checkout/Test/Unit/Block/Checkout/LayoutProcessorTest.php
@@ -10,14 +10,16 @@
use Magento\Checkout\Helper\Data;
use Magento\Customer\Model\AttributeMetadataDataProvider;
use Magento\Customer\Model\Options;
-
+use Magento\Shipping\Model\Config;
+use Magento\Store\Model\StoreManagerInterface;
use Magento\Ui\Component\Form\AttributeMapper;
-use PHPUnit_Framework_MockObject_MockObject as MockObject;
+use PHPUnit\Framework\MockObject\MockObject;
+use PHPUnit\Framework\TestCase;
/**
* LayoutProcessorTest covers a list of variations for checkout layout processor
*/
-class LayoutProcessorTest extends \PHPUnit\Framework\TestCase
+class LayoutProcessorTest extends TestCase
{
/**
* @var AttributeMetadataDataProvider|MockObject
@@ -45,7 +47,7 @@ class LayoutProcessorTest extends \PHPUnit\Framework\TestCase
private $layoutProcessor;
/**
- * @var MockObject
+ * @var StoreManagerInterface|MockObject
*/
private $storeManager;
@@ -75,11 +77,11 @@ protected function setUp()
->disableOriginalConstructor()
->getMock();
- $shippingConfig = $this->getMockBuilder(\Magento\Shipping\Model\Config::class)
+ $shippingConfig = $this->getMockBuilder(Config::class)
->disableOriginalConstructor()
->getMock();
- $this->storeManager = $this->createMock(\Magento\Store\Model\StoreManagerInterface::class);
+ $this->storeManager = $this->createMock(StoreManagerInterface::class);
$this->layoutProcessor = new LayoutProcessor(
$this->attributeDataProvider,
@@ -109,10 +111,12 @@ public function testProcess()
$this->attributeMerger->expects(static::exactly(2))
->method('merge')
- ->willReturnMap([
- ['payment1_1' => $this->getBillingComponent('payment1_1')],
- ['payment2_1' => $this->getBillingComponent('payment2_1')],
- ]);
+ ->willReturnMap(
+ [
+ ['payment1_1' => $this->getBillingComponent('payment1_1')],
+ ['payment2_1' => $this->getBillingComponent('payment2_1')],
+ ]
+ );
$actual = $this->layoutProcessor->process($jsLayout);
@@ -236,9 +240,6 @@ private function getLayoutData()
private function getBillingComponent($paymentCode)
{
return [
- 'country_id' => [
- 'sortOrder' => 115,
- ],
'region' => [
'visible' => false,
],
diff --git a/app/code/Magento/Checkout/Test/Unit/Model/ShippingInformationManagementTest.php b/app/code/Magento/Checkout/Test/Unit/Model/ShippingInformationManagementTest.php
index 93375bb884535..79c4b37fb1813 100644
--- a/app/code/Magento/Checkout/Test/Unit/Model/ShippingInformationManagementTest.php
+++ b/app/code/Magento/Checkout/Test/Unit/Model/ShippingInformationManagementTest.php
@@ -6,101 +6,136 @@
namespace Magento\Checkout\Test\Unit\Model;
+use Magento\Checkout\Api\Data\PaymentDetailsInterface;
+use Magento\Checkout\Api\Data\ShippingInformationInterface;
+use Magento\Checkout\Model\PaymentDetailsFactory;
+use Magento\Checkout\Model\ShippingInformationManagement;
+use Magento\Framework\Exception\InputException;
+use Magento\Framework\Exception\LocalizedException;
+use Magento\Framework\Exception\NoSuchEntityException;
+use Magento\Framework\Exception\StateException;
+use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
+use Magento\Quote\Api\CartRepositoryInterface;
+use Magento\Quote\Api\CartTotalRepositoryInterface;
+use Magento\Quote\Api\Data\AddressInterface;
+use Magento\Quote\Api\Data\CartExtension;
+use Magento\Quote\Api\Data\CartExtensionFactory;
+use Magento\Quote\Api\Data\PaymentMethodInterface;
+use Magento\Quote\Api\Data\TotalsInterface;
+use Magento\Quote\Api\PaymentMethodManagementInterface;
+use Magento\Quote\Model\Quote;
+use Magento\Quote\Model\Quote\Address;
+use Magento\Quote\Model\QuoteAddressValidator;
+use Magento\Quote\Model\Shipping;
+use Magento\Quote\Model\ShippingAssignment;
+use Magento\Quote\Model\ShippingAssignmentFactory;
+use Magento\Quote\Model\ShippingFactory;
+use PHPUnit\Framework\MockObject\MockObject as MockObject;
+use PHPUnit\Framework\TestCase;
+
/**
+ * Test for \Magento\Checkout\Model\ShippingInformationManagement.
+ *
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @SuppressWarnings(PHPMD.TooManyFields)
*/
-class ShippingInformationManagementTest extends \PHPUnit\Framework\TestCase
+class ShippingInformationManagementTest extends TestCase
{
+ private const STUB_CART_ID = 100;
+
+ private const STUB_ITEMS_COUNT = 99;
+
+ private const STUB_CARRIER_CODE = 'carrier_code';
+
+ private const STUB_SHIPPING_METHOD = 'shipping_method';
+
+ private const STUB_ERROR_MESSAGE = 'error message';
+
/**
- * @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager
+ * @var ShippingInformationManagement
*/
- private $objectManager;
+ private $model;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var ObjectManager
*/
- protected $paymentMethodManagementMock;
+ private $objectManager;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var PaymentMethodManagementInterface|MockObject
*/
- protected $paymentDetailsFactoryMock;
+ private $paymentMethodManagementMock;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var PaymentDetailsFactory|MockObject
*/
- protected $cartTotalsRepositoryMock;
+ private $paymentDetailsFactoryMock;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var CartTotalRepositoryInterface|MockObject
*/
- protected $quoteRepositoryMock;
+ private $cartTotalsRepositoryMock;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var CartRepositoryInterface|MockObject
*/
- protected $shippingAddressMock;
+ private $quoteRepositoryMock;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var Address|MockObject
*/
- protected $quoteMock;
+ private $shippingAddressMock;
/**
- * @var \Magento\Checkout\Model\ShippingInformationManagement
+ * @var Quote|MockObject
*/
- protected $model;
+ private $quoteMock;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var ShippingAssignmentFactory|MockObject
*/
private $shippingAssignmentFactoryMock;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var CartExtensionFactory|MockObject
*/
private $cartExtensionFactoryMock;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var ShippingFactory|MockObject
*/
private $shippingFactoryMock;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var CartExtension|MockObject
*/
private $cartExtensionMock;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var ShippingAssignment|MockObject
*/
private $shippingAssignmentMock;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var QuoteAddressValidator|MockObject
*/
- private $shippingMock;
+ private $addressValidatorMock;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @inheritdoc
*/
- private $addressValidatorMock;
-
protected function setUp()
{
- $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
- $this->paymentMethodManagementMock = $this->createMock(
- \Magento\Quote\Api\PaymentMethodManagementInterface::class
- );
+ $this->objectManager = new ObjectManager($this);
+ $this->paymentMethodManagementMock = $this->createMock(PaymentMethodManagementInterface::class);
$this->paymentDetailsFactoryMock = $this->createPartialMock(
- \Magento\Checkout\Model\PaymentDetailsFactory::class,
+ PaymentDetailsFactory::class,
['create']
);
- $this->cartTotalsRepositoryMock = $this->createMock(\Magento\Quote\Api\CartTotalRepositoryInterface::class);
- $this->quoteRepositoryMock = $this->createMock(\Magento\Quote\Api\CartRepositoryInterface::class);
+ $this->cartTotalsRepositoryMock = $this->createMock(CartTotalRepositoryInterface::class);
+ $this->quoteRepositoryMock = $this->createMock(CartRepositoryInterface::class);
$this->shippingAddressMock = $this->createPartialMock(
- \Magento\Quote\Model\Quote\Address::class,
+ Address::class,
[
'getSaveInAddressBook',
'getSameAsBilling',
@@ -120,7 +155,7 @@ protected function setUp()
);
$this->quoteMock = $this->createPartialMock(
- \Magento\Quote\Model\Quote::class,
+ Quote::class,
[
'isVirtual',
'getItemsCount',
@@ -134,24 +169,22 @@ protected function setUp()
'getExtensionAttributes',
'setExtensionAttributes',
'setBillingAddress'
- ],
- [],
- '',
- false
+ ]
);
- $this->shippingAssignmentFactoryMock =
- $this->createPartialMock(\Magento\Quote\Model\ShippingAssignmentFactory::class, ['create']);
- $this->cartExtensionFactoryMock =
- $this->createPartialMock(\Magento\Quote\Api\Data\CartExtensionFactory::class, ['create']);
- $this->shippingFactoryMock =
- $this->createPartialMock(\Magento\Quote\Model\ShippingFactory::class, ['create']);
- $this->addressValidatorMock = $this->createMock(
- \Magento\Quote\Model\QuoteAddressValidator::class
+ $this->shippingAssignmentFactoryMock = $this->createPartialMock(
+ ShippingAssignmentFactory::class,
+ ['create']
);
+ $this->cartExtensionFactoryMock = $this->createPartialMock(
+ CartExtensionFactory::class,
+ ['create']
+ );
+ $this->shippingFactoryMock = $this->createPartialMock(ShippingFactory::class, ['create']);
+ $this->addressValidatorMock = $this->createMock(QuoteAddressValidator::class);
$this->model = $this->objectManager->getObject(
- \Magento\Checkout\Model\ShippingInformationManagement::class,
+ ShippingInformationManagement::class,
[
'paymentMethodManagement' => $this->paymentMethodManagementMock,
'paymentDetailsFactory' => $this->paymentDetailsFactoryMock,
@@ -166,59 +199,80 @@ protected function setUp()
}
/**
- * @expectedException \Magento\Framework\Exception\InputException
- * @expectedExceptionMessage The shipping method can't be set for an empty cart. Add an item to cart and try again.
+ * Save address with `InputException`
+ *
+ * @return void
*/
- public function testSaveAddressInformationIfCartIsEmpty()
+ public function testSaveAddressInformationIfCartIsEmpty(): void
{
- $cartId = 100;
- $addressInformationMock = $this->createMock(\Magento\Checkout\Api\Data\ShippingInformationInterface::class);
+ $cartId = self::STUB_CART_ID;
+ /** @var ShippingInformationInterface|MockObject $addressInformationMock */
+ $addressInformationMock = $this->createMock(ShippingInformationInterface::class);
- $this->quoteMock->expects($this->once())->method('getItemsCount')->willReturn(0);
+ $this->quoteMock->expects($this->once())
+ ->method('getItemsCount')
+ ->willReturn(0);
$this->quoteRepositoryMock->expects($this->once())
->method('getActive')
->with($cartId)
->willReturn($this->quoteMock);
+ $this->expectException(InputException::class);
+ $this->expectExceptionMessage(
+ 'The shipping method can\'t be set for an empty cart. Add an item to cart and try again.'
+ );
$this->model->saveAddressInformation($cartId, $addressInformationMock);
}
/**
+ * Sets shipping assignments
+ *
* @param string $shippingMethod
+ * @return void
*/
- private function setShippingAssignmentsMocks($shippingMethod)
+ private function setShippingAssignmentsMocks($shippingMethod): void
{
- $this->quoteMock->expects($this->once())->method('getExtensionAttributes')->willReturn(null);
- $this->shippingAddressMock->expects($this->once())->method('setLimitCarrier');
+ $this->quoteMock->expects($this->once())
+ ->method('getExtensionAttributes')
+ ->willReturn(null);
+ $this->shippingAddressMock->expects($this->once())
+ ->method('setLimitCarrier');
$this->cartExtensionMock = $this->createPartialMock(
- \Magento\Quote\Api\Data\CartExtension::class,
+ CartExtension::class,
['getShippingAssignments', 'setShippingAssignments']
);
$this->cartExtensionFactoryMock->expects($this->once())
->method('create')
->willReturn($this->cartExtensionMock);
- $this->cartExtensionMock->expects($this->once())->method('getShippingAssignments')->willReturn(null);
+ $this->cartExtensionMock->expects($this->once())
+ ->method('getShippingAssignments')
+ ->willReturn(null);
- $this->shippingAssignmentMock = $this->createMock(
- \Magento\Quote\Model\ShippingAssignment::class
- );
+ $this->shippingAssignmentMock = $this->createMock(ShippingAssignment::class);
$this->shippingAssignmentFactoryMock->expects($this->once())
->method('create')
->willReturn($this->shippingAssignmentMock);
- $this->shippingAssignmentMock->expects($this->once())->method('getShipping')->willReturn(null);
+ $this->shippingAssignmentMock->expects($this->once())
+ ->method('getShipping')
+ ->willReturn(null);
- $this->shippingMock = $this->createMock(\Magento\Quote\Model\Shipping::class);
- $this->shippingFactoryMock->expects($this->once())->method('create')->willReturn($this->shippingMock);
+ $shippingMock = $this->createMock(Shipping::class);
+ $this->shippingFactoryMock->expects($this->once())
+ ->method('create')
+ ->willReturn($shippingMock);
- $this->shippingMock->expects($this->once())
+ $shippingMock->expects($this->once())
->method('setAddress')
->with($this->shippingAddressMock)
->willReturnSelf();
- $this->shippingMock->expects($this->once())->method('setMethod')->with($shippingMethod)->willReturnSelf();
+ $shippingMock->expects($this->once())
+ ->method('setMethod')
+ ->with($shippingMethod)
+ ->willReturnSelf();
$this->shippingAssignmentMock->expects($this->once())
->method('setShipping')
- ->with($this->shippingMock)
+ ->with($shippingMock)
->willReturnSelf();
$this->cartExtensionMock->expects($this->once())
@@ -233,38 +287,116 @@ private function setShippingAssignmentsMocks($shippingMethod)
}
/**
- * @expectedException \Magento\Framework\Exception\StateException
- * @expectedExceptionMessage The shipping address is missing. Set the address and try again.
+ * Save address with `StateException`
+ *
+ * @return void
*/
- public function testSaveAddressInformationIfShippingAddressNotSet()
+ public function testSaveAddressInformationIfShippingAddressNotSet(): void
{
- $cartId = 100;
- $addressInformationMock = $this->createMock(\Magento\Checkout\Api\Data\ShippingInformationInterface::class);
+ $cartId = self::STUB_CART_ID;
+ /** @var ShippingInformationInterface|MockObject $addressInformationMock */
+ $addressInformationMock = $this->createMock(ShippingInformationInterface::class);
$addressInformationMock->expects($this->once())
->method('getShippingAddress')
->willReturn($this->shippingAddressMock);
- $this->shippingAddressMock->expects($this->once())->method('getCountryId')->willReturn(null);
+ $this->shippingAddressMock->expects($this->once())
+ ->method('getCountryId')
+ ->willReturn(null);
+
+ $this->quoteRepositoryMock->expects($this->once())
+ ->method('getActive')
+ ->with($cartId)
+ ->willReturn($this->quoteMock);
+ $this->quoteMock->expects($this->once())
+ ->method('getItemsCount')
+ ->willReturn(self::STUB_ITEMS_COUNT);
+
+ $this->expectException(StateException::class);
+ $this->expectExceptionMessage('The shipping address is missing. Set the address and try again.');
+ $this->model->saveAddressInformation($cartId, $addressInformationMock);
+ }
+
+ /**
+ * Save address with `LocalizedException`
+ *
+ * @return void
+ */
+ public function testSaveAddressInformationWithLocalizedException(): void
+ {
+ $cartId = self::STUB_CART_ID;
+ $carrierCode = self::STUB_CARRIER_CODE;
+ $shippingMethod = self::STUB_SHIPPING_METHOD;
+ $errorMessage = self::STUB_ERROR_MESSAGE;
+ $exception = new LocalizedException(__($errorMessage));
+ /** @var ShippingInformationInterface|MockObject $addressInformationMock */
+ $addressInformationMock = $this->createMock(ShippingInformationInterface::class);
+
+ $this->addressValidatorMock->expects($this->exactly(2))
+ ->method('validateForCart');
$this->quoteRepositoryMock->expects($this->once())
->method('getActive')
->with($cartId)
->willReturn($this->quoteMock);
- $this->quoteMock->expects($this->once())->method('getItemsCount')->willReturn(100);
+ $addressInformationMock->expects($this->once())
+ ->method('getShippingAddress')
+ ->willReturn($this->shippingAddressMock);
+ $addressInformationMock->expects($this->once())
+ ->method('getShippingCarrierCode')
+ ->willReturn($carrierCode);
+ $addressInformationMock->expects($this->once())
+ ->method('getShippingMethodCode')
+ ->willReturn($shippingMethod);
+
+ $billingAddress = $this->createMock(AddressInterface::class);
+ $addressInformationMock->expects($this->once())
+ ->method('getBillingAddress')
+ ->willReturn($billingAddress);
+
+ $this->shippingAddressMock->expects($this->once())
+ ->method('getCountryId')
+ ->willReturn('USA');
+
+ $this->setShippingAssignmentsMocks($carrierCode . '_' . $shippingMethod);
+
+ $this->quoteMock->expects($this->once())
+ ->method('getItemsCount')
+ ->willReturn(self::STUB_ITEMS_COUNT);
+ $this->quoteMock->expects($this->once())
+ ->method('setIsMultiShipping')
+ ->with(false)
+ ->willReturnSelf();
+ $this->quoteMock->expects($this->once())
+ ->method('setBillingAddress')
+ ->with($billingAddress)
+ ->willReturnSelf();
+
+ $this->quoteRepositoryMock->expects($this->once())
+ ->method('save')
+ ->with($this->quoteMock)
+ ->willThrowException($exception);
+
+ $this->expectException(LocalizedException::class);
+ $this->expectExceptionMessage(
+ 'The shipping information was unable to be saved. Error: "' . $errorMessage . '"'
+ );
$this->model->saveAddressInformation($cartId, $addressInformationMock);
}
/**
- * @expectedException \Magento\Framework\Exception\InputException
- * @expectedExceptionMessage The shipping information was unable to be saved. Verify the input data and try again.
+ * Save address with `InputException`
+ *
+ * @return void
*/
- public function testSaveAddressInformationIfCanNotSaveQuote()
+ public function testSaveAddressInformationIfCanNotSaveQuote(): void
{
- $cartId = 100;
- $carrierCode = 'carrier_code';
- $shippingMethod = 'shipping_method';
- $addressInformationMock = $this->createMock(\Magento\Checkout\Api\Data\ShippingInformationInterface::class);
+ $cartId = self::STUB_CART_ID;
+ $carrierCode = self::STUB_CARRIER_CODE;
+ $shippingMethod = self::STUB_SHIPPING_METHOD;
+ /** @var ShippingInformationInterface|MockObject $addressInformationMock */
+ $addressInformationMock = $this->createMock(ShippingInformationInterface::class);
$this->addressValidatorMock->expects($this->exactly(2))
->method('validateForCart');
@@ -277,38 +409,59 @@ public function testSaveAddressInformationIfCanNotSaveQuote()
$addressInformationMock->expects($this->once())
->method('getShippingAddress')
->willReturn($this->shippingAddressMock);
- $addressInformationMock->expects($this->once())->method('getShippingCarrierCode')->willReturn($carrierCode);
- $addressInformationMock->expects($this->once())->method('getShippingMethodCode')->willReturn($shippingMethod);
+ $addressInformationMock->expects($this->once())
+ ->method('getShippingCarrierCode')
+ ->willReturn($carrierCode);
+ $addressInformationMock->expects($this->once())
+ ->method('getShippingMethodCode')
+ ->willReturn($shippingMethod);
- $billingAddress = $this->createMock(\Magento\Quote\Api\Data\AddressInterface::class);
- $addressInformationMock->expects($this->once())->method('getBillingAddress')->willReturn($billingAddress);
+ $billingAddress = $this->createMock(AddressInterface::class);
+ $addressInformationMock->expects($this->once())
+ ->method('getBillingAddress')
+ ->willReturn($billingAddress);
- $this->shippingAddressMock->expects($this->once())->method('getCountryId')->willReturn('USA');
+ $this->shippingAddressMock->expects($this->once())
+ ->method('getCountryId')
+ ->willReturn('USA');
$this->setShippingAssignmentsMocks($carrierCode . '_' . $shippingMethod);
- $this->quoteMock->expects($this->once())->method('getItemsCount')->willReturn(100);
- $this->quoteMock->expects($this->once())->method('setIsMultiShipping')->with(false)->willReturnSelf();
- $this->quoteMock->expects($this->once())->method('setBillingAddress')->with($billingAddress)->willReturnSelf();
+ $this->quoteMock->expects($this->once())
+ ->method('getItemsCount')
+ ->willReturn(self::STUB_ITEMS_COUNT);
+ $this->quoteMock->expects($this->once())
+ ->method('setIsMultiShipping')
+ ->with(false)->willReturnSelf();
+ $this->quoteMock->expects($this->once())
+ ->method('setBillingAddress')
+ ->with($billingAddress)
+ ->willReturnSelf();
$this->quoteRepositoryMock->expects($this->once())
->method('save')
->with($this->quoteMock)
->willThrowException(new \Exception());
+ $this->expectException(InputException::class);
+ $this->expectExceptionMessage(
+ 'The shipping information was unable to be saved. Verify the input data and try again.'
+ );
$this->model->saveAddressInformation($cartId, $addressInformationMock);
}
/**
- * @expectedException \Magento\Framework\Exception\NoSuchEntityException
- * @expectedExceptionMessage Carrier with such method not found: carrier_code, shipping_method
+ * Save address with `NoSuchEntityException`
+ *
+ * @return void
*/
- public function testSaveAddressInformationIfCarrierCodeIsInvalid()
+ public function testSaveAddressInformationIfCarrierCodeIsInvalid(): void
{
- $cartId = 100;
- $carrierCode = 'carrier_code';
- $shippingMethod = 'shipping_method';
- $addressInformationMock = $this->createMock(\Magento\Checkout\Api\Data\ShippingInformationInterface::class);
+ $cartId = self::STUB_CART_ID;
+ $carrierCode = self::STUB_CARRIER_CODE;
+ $shippingMethod = self::STUB_SHIPPING_METHOD;
+ /** @var ShippingInformationInterface|MockObject $addressInformationMock */
+ $addressInformationMock = $this->createMock(ShippingInformationInterface::class);
$this->addressValidatorMock->expects($this->exactly(2))
->method('validateForCart');
@@ -320,39 +473,70 @@ public function testSaveAddressInformationIfCarrierCodeIsInvalid()
$addressInformationMock->expects($this->once())
->method('getShippingAddress')
->willReturn($this->shippingAddressMock);
- $addressInformationMock->expects($this->once())->method('getShippingCarrierCode')->willReturn($carrierCode);
- $addressInformationMock->expects($this->once())->method('getShippingMethodCode')->willReturn($shippingMethod);
+ $addressInformationMock->expects($this->once())
+ ->method('getShippingCarrierCode')
+ ->willReturn($carrierCode);
+ $addressInformationMock->expects($this->once())
+ ->method('getShippingMethodCode')
+ ->willReturn($shippingMethod);
- $billingAddress = $this->createMock(\Magento\Quote\Api\Data\AddressInterface::class);
- $addressInformationMock->expects($this->once())->method('getBillingAddress')->willReturn($billingAddress);
- $this->shippingAddressMock->expects($this->once())->method('getCountryId')->willReturn('USA');
+ $billingAddress = $this->createMock(AddressInterface::class);
+ $addressInformationMock->expects($this->once())
+ ->method('getBillingAddress')
+ ->willReturn($billingAddress);
+ $this->shippingAddressMock->expects($this->once())
+ ->method('getCountryId')
+ ->willReturn('USA');
$this->setShippingAssignmentsMocks($carrierCode . '_' . $shippingMethod);
- $this->quoteMock->expects($this->once())->method('getItemsCount')->willReturn(100);
- $this->quoteMock->expects($this->once())->method('setIsMultiShipping')->with(false)->willReturnSelf();
- $this->quoteMock->expects($this->once())->method('setBillingAddress')->with($billingAddress)->willReturnSelf();
- $this->quoteMock->expects($this->once())->method('getShippingAddress')->willReturn($this->shippingAddressMock);
+ $this->quoteMock->expects($this->once())
+ ->method('getItemsCount')
+ ->willReturn(self::STUB_ITEMS_COUNT);
+ $this->quoteMock->expects($this->once())
+ ->method('setIsMultiShipping')
+ ->with(false)
+ ->willReturnSelf();
+ $this->quoteMock->expects($this->once())
+ ->method('setBillingAddress')
+ ->with($billingAddress)
+ ->willReturnSelf();
+ $this->quoteMock->expects($this->once())
+ ->method('getShippingAddress')
+ ->willReturn($this->shippingAddressMock);
$this->quoteRepositoryMock->expects($this->once())
->method('save')
->with($this->quoteMock);
- $this->shippingAddressMock->expects($this->once())->method('getShippingMethod')->willReturn($shippingMethod);
+ $this->shippingAddressMock->expects($this->once())
+ ->method('getShippingMethod')
+ ->willReturn($shippingMethod);
$this->shippingAddressMock->expects($this->once())
->method('getShippingRateByCode')
->with($shippingMethod)
->willReturn(false);
+ $this->expectException(NoSuchEntityException::class);
+ $this->expectExceptionMessage(
+ 'Carrier with such method not found: ' . self::STUB_CARRIER_CODE . ', ' . self::STUB_SHIPPING_METHOD
+ );
+
$this->model->saveAddressInformation($cartId, $addressInformationMock);
}
- public function testSaveAddressInformation()
+ /**
+ * Save address info test
+ *
+ * @return void
+ */
+ public function testSaveAddressInformation(): void
{
- $cartId = 100;
- $carrierCode = 'carrier_code';
- $shippingMethod = 'shipping_method';
- $addressInformationMock = $this->createMock(\Magento\Checkout\Api\Data\ShippingInformationInterface::class);
+ $cartId = self::STUB_CART_ID;
+ $carrierCode = self::STUB_CARRIER_CODE;
+ $shippingMethod = self::STUB_SHIPPING_METHOD;
+ /** @var ShippingInformationInterface|MockObject $addressInformationMock */
+ $addressInformationMock = $this->createMock(ShippingInformationInterface::class);
$this->addressValidatorMock->expects($this->exactly(2))
->method('validateForCart');
@@ -364,40 +548,62 @@ public function testSaveAddressInformation()
$addressInformationMock->expects($this->once())
->method('getShippingAddress')
->willReturn($this->shippingAddressMock);
- $addressInformationMock->expects($this->once())->method('getShippingCarrierCode')->willReturn($carrierCode);
- $addressInformationMock->expects($this->once())->method('getShippingMethodCode')->willReturn($shippingMethod);
+ $addressInformationMock->expects($this->once())
+ ->method('getShippingCarrierCode')
+ ->willReturn($carrierCode);
+ $addressInformationMock->expects($this->once())
+ ->method('getShippingMethodCode')
+ ->willReturn($shippingMethod);
- $billingAddress = $this->createMock(\Magento\Quote\Api\Data\AddressInterface::class);
- $addressInformationMock->expects($this->once())->method('getBillingAddress')->willReturn($billingAddress);
- $this->shippingAddressMock->expects($this->once())->method('getCountryId')->willReturn('USA');
+ $billingAddress = $this->createMock(AddressInterface::class);
+ $addressInformationMock->expects($this->once())
+ ->method('getBillingAddress')
+ ->willReturn($billingAddress);
+ $this->shippingAddressMock->expects($this->once())
+ ->method('getCountryId')
+ ->willReturn('USA');
$this->setShippingAssignmentsMocks($carrierCode . '_' . $shippingMethod);
- $this->quoteMock->expects($this->once())->method('getItemsCount')->willReturn(100);
- $this->quoteMock->expects($this->once())->method('setIsMultiShipping')->with(false)->willReturnSelf();
- $this->quoteMock->expects($this->once())->method('setBillingAddress')->with($billingAddress)->willReturnSelf();
- $this->quoteMock->expects($this->once())->method('getShippingAddress')->willReturn($this->shippingAddressMock);
+ $this->quoteMock->expects($this->once())
+ ->method('getItemsCount')
+ ->willReturn(self::STUB_ITEMS_COUNT);
+ $this->quoteMock->expects($this->once())
+ ->method('setIsMultiShipping')
+ ->with(false)
+ ->willReturnSelf();
+ $this->quoteMock->expects($this->once())
+ ->method('setBillingAddress')
+ ->with($billingAddress)
+ ->willReturnSelf();
+ $this->quoteMock->expects($this->once())
+ ->method('getShippingAddress')
+ ->willReturn($this->shippingAddressMock);
$this->quoteRepositoryMock->expects($this->once())
->method('save')
->with($this->quoteMock);
- $this->shippingAddressMock->expects($this->once())->method('getShippingMethod')->willReturn($shippingMethod);
+ $this->shippingAddressMock->expects($this->once())
+ ->method('getShippingMethod')
+ ->willReturn($shippingMethod);
$this->shippingAddressMock->expects($this->once())
->method('getShippingRateByCode')
->with($shippingMethod)
->willReturn('rates');
- $paymentDetailsMock = $this->createMock(\Magento\Checkout\Api\Data\PaymentDetailsInterface::class);
- $this->paymentDetailsFactoryMock->expects($this->once())->method('create')->willReturn($paymentDetailsMock);
+ $paymentDetailsMock = $this->createMock(PaymentDetailsInterface::class);
+ $this->paymentDetailsFactoryMock->expects($this->once())
+ ->method('create')
+ ->willReturn($paymentDetailsMock);
- $paymentMethodMock = $this->createMock(\Magento\Quote\Api\Data\PaymentMethodInterface::class);
+ $paymentMethodMock = $this->createMock(PaymentMethodInterface::class);
$this->paymentMethodManagementMock->expects($this->once())
->method('getList')
->with($cartId)
->willReturn([$paymentMethodMock]);
- $cartTotalsMock = $this->createMock(\Magento\Quote\Api\Data\TotalsInterface::class);
+ $cartTotalsMock = $this->createMock(TotalsInterface::class);
$this->cartTotalsRepositoryMock->expects($this->once())
->method('get')
->with($cartId)
@@ -407,7 +613,9 @@ public function testSaveAddressInformation()
->method('setPaymentMethods')
->with([$paymentMethodMock])
->willReturnSelf();
- $paymentDetailsMock->expects($this->once())->method('setTotals')->with()->willReturnSelf($cartTotalsMock);
+ $paymentDetailsMock->expects($this->once())
+ ->method('setTotals')
+ ->willReturn($cartTotalsMock);
$this->assertEquals(
$paymentDetailsMock,
diff --git a/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_index.xml b/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_index.xml
index 69d2523d88dfb..4b5d1033408e4 100644
--- a/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_index.xml
+++ b/app/code/Magento/Checkout/view/frontend/layout/checkout_cart_index.xml
@@ -189,6 +189,7 @@
crosssell
+ Magento\Catalog\ViewModel\Product\Listing\PreparePostData
0
- -
-
- 115
-
-
-
-
diff --git a/app/code/Magento/Checkout/view/frontend/requirejs-config.js b/app/code/Magento/Checkout/view/frontend/requirejs-config.js
index 1f552b779539c..602a1227644c0 100644
--- a/app/code/Magento/Checkout/view/frontend/requirejs-config.js
+++ b/app/code/Magento/Checkout/view/frontend/requirejs-config.js
@@ -12,7 +12,8 @@ var config = {
sidebar: 'Magento_Checkout/js/sidebar',
checkoutLoader: 'Magento_Checkout/js/checkout-loader',
checkoutData: 'Magento_Checkout/js/checkout-data',
- proceedToCheckout: 'Magento_Checkout/js/proceed-to-checkout'
+ proceedToCheckout: 'Magento_Checkout/js/proceed-to-checkout',
+ catalogAddToCart: 'Magento_Catalog/js/catalog-add-to-cart'
}
}
};
diff --git a/app/code/Magento/Checkout/view/frontend/web/js/action/select-billing-address.js b/app/code/Magento/Checkout/view/frontend/web/js/action/select-billing-address.js
index 086859fa8021d..1f14ab444e0c1 100644
--- a/app/code/Magento/Checkout/view/frontend/web/js/action/select-billing-address.js
+++ b/app/code/Magento/Checkout/view/frontend/web/js/action/select-billing-address.js
@@ -18,7 +18,7 @@ define([
if (quote.shippingAddress() && billingAddress.getCacheKey() == //eslint-disable-line eqeqeq
quote.shippingAddress().getCacheKey()
) {
- address = $.extend({}, billingAddress);
+ address = $.extend(true, {}, billingAddress);
address.saveInAddressBook = null;
} else {
address = billingAddress;
diff --git a/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateActiveHtmlTermEntityTest.xml b/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateActiveHtmlTermEntityTest.xml
index dc329ae63ba21..1e87d73c26205 100644
--- a/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateActiveHtmlTermEntityTest.xml
+++ b/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateActiveHtmlTermEntityTest.xml
@@ -32,7 +32,7 @@
-
+
diff --git a/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateActiveTextTermEntityTest.xml b/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateActiveTextTermEntityTest.xml
index a7baa061750c5..2db3377e0e89e 100644
--- a/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateActiveTextTermEntityTest.xml
+++ b/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateActiveTextTermEntityTest.xml
@@ -32,7 +32,7 @@
-
+
diff --git a/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateDisabledTextTermEntityTest.xml b/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateDisabledTextTermEntityTest.xml
index d5f35fc79fbed..df666ecab817b 100644
--- a/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateDisabledTextTermEntityTest.xml
+++ b/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateDisabledTextTermEntityTest.xml
@@ -32,7 +32,7 @@
-
+
diff --git a/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateEnabledTextTermOnMultishippingEntityTest.xml b/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateEnabledTextTermOnMultishippingEntityTest.xml
index 462b13ae386c4..fec2365431862 100644
--- a/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateEnabledTextTermOnMultishippingEntityTest.xml
+++ b/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminCreateEnabledTextTermOnMultishippingEntityTest.xml
@@ -36,7 +36,7 @@
-
+
diff --git a/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminStoresTermsAndConditionsNavigateMenuTest.xml b/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminStoresTermsAndConditionsNavigateMenuTest.xml
index d2d4cb9138bd5..7ffabcfa51215 100644
--- a/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminStoresTermsAndConditionsNavigateMenuTest.xml
+++ b/app/code/Magento/CheckoutAgreements/Test/Mftf/Test/AdminStoresTermsAndConditionsNavigateMenuTest.xml
@@ -23,7 +23,7 @@
-
+
diff --git a/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Directive.php b/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Directive.php
index 97d0b35a2354f..a3370b2666264 100644
--- a/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Directive.php
+++ b/app/code/Magento/Cms/Controller/Adminhtml/Wysiwyg/Directive.php
@@ -21,6 +21,7 @@
use Magento\Framework\Controller\Result\RawFactory;
use Magento\Backend\App\Action\Context;
use Magento\Framework\App\ObjectManager;
+use Magento\Framework\Filesystem\Driver\File;
/**
* Process template text for wysiwyg editor.
@@ -67,6 +68,11 @@ class Directive extends Action implements HttpGetActionInterface
*/
private $filter;
+ /**
+ * @var File
+ */
+ private $file;
+
/**
* Constructor
*
@@ -77,6 +83,7 @@ class Directive extends Action implements HttpGetActionInterface
* @param LoggerInterface|null $logger
* @param Config|null $config
* @param Filter|null $filter
+ * @param File|null $file
*/
public function __construct(
Context $context,
@@ -85,7 +92,8 @@ public function __construct(
AdapterFactory $adapterFactory = null,
LoggerInterface $logger = null,
Config $config = null,
- Filter $filter = null
+ Filter $filter = null,
+ File $file = null
) {
parent::__construct($context);
$this->urlDecoder = $urlDecoder;
@@ -94,6 +102,7 @@ public function __construct(
$this->logger = $logger ?: ObjectManager::getInstance()->get(LoggerInterface::class);
$this->config = $config ?: ObjectManager::getInstance()->get(Config::class);
$this->filter = $filter ?: ObjectManager::getInstance()->get(Filter::class);
+ $this->file = $file ?: ObjectManager::getInstance()->get(File::class);
}
/**
@@ -127,6 +136,15 @@ public function execute()
$this->logger->warning($e);
}
}
+ $mimeType = $image->getMimeType();
+ unset($image);
+ // To avoid issues with PNG images with alpha blending we return raw file
+ // after validation as an image source instead of generating the new PNG image
+ // with image adapter
+ $content = $this->file->fileGetContents($imagePath);
+ $resultRaw->setHeader('Content-Type', $mimeType);
+ $resultRaw->setContents($content);
+
return $resultRaw;
}
}
diff --git a/app/code/Magento/Cms/Model/ResourceModel/Block.php b/app/code/Magento/Cms/Model/ResourceModel/Block.php
index 30e817713755c..1324b9bd127e9 100644
--- a/app/code/Magento/Cms/Model/ResourceModel/Block.php
+++ b/app/code/Magento/Cms/Model/ResourceModel/Block.php
@@ -185,13 +185,9 @@ public function getIsUniqueBlockToStores(AbstractModel $object)
$entityMetadata = $this->metadataPool->getMetadata(BlockInterface::class);
$linkField = $entityMetadata->getLinkField();
- $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;
- }
+ $stores = $this->_storeManager->isSingleStoreMode()
+ ? [Store::DEFAULT_STORE_ID]
+ : (array)$object->getData('store_id');
$select = $this->getConnection()->select()
->from(['cb' => $this->getMainTable()])
@@ -200,11 +196,8 @@ public function getIsUniqueBlockToStores(AbstractModel $object)
'cb.' . $linkField . ' = cbs.' . $linkField,
[]
)
- ->where('cb.identifier = ? ', $object->getData('identifier'));
-
- if (!$isDefaultStore) {
- $select->where('cbs.store_id IN (?)', $stores);
- }
+ ->where('cb.identifier = ? ', $object->getData('identifier'))
+ ->where('cbs.store_id IN (?)', $stores);
if ($object->getId()) {
$select->where('cb.' . $entityMetadata->getIdentifierField() . ' <> ?', $object->getId());
diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminClickInsertWidgetActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminClickInsertWidgetActionGroup.xml
new file mode 100644
index 0000000000000..c221dd62cd7f6
--- /dev/null
+++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminClickInsertWidgetActionGroup.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+ Click "Insert Widget" button in the opened widget popup
+
+
+
+
+
+
diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminFillCmsBlockFormActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminFillCmsBlockFormActionGroup.xml
new file mode 100644
index 0000000000000..685385382027b
--- /dev/null
+++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminFillCmsBlockFormActionGroup.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+ Fills in the Block Title, Identifier with marginal space, Store View and Content. PLEASE NOTE: The values are passed through arguments in test.
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminInsertWidgetToCmsPageContentActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminInsertWidgetToCmsPageContentActionGroup.xml
new file mode 100644
index 0000000000000..734d8d98722b2
--- /dev/null
+++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminInsertWidgetToCmsPageContentActionGroup.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+ Insert widget to CMS Page content field. You are on CMS edit page, content tab is expanded.
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminSaveAndDuplicateCMSPageWithSplitButtonActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminSaveAndDuplicateCMSPageWithSplitButtonActionGroup.xml
new file mode 100644
index 0000000000000..43c0fc9ff3a45
--- /dev/null
+++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AdminSaveAndDuplicateCMSPageWithSplitButtonActionGroup.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+ Clicks on the Save and Duplicate button.
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/AssertAdminCmsPageSaveSplitButtonActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AssertAdminCmsPageSaveSplitButtonActionGroup.xml
new file mode 100644
index 0000000000000..6ea87aeae5998
--- /dev/null
+++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/AssertAdminCmsPageSaveSplitButtonActionGroup.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+ Verify Save and Duplicate and Save and Close button.
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/SaveAndCloseCMSBlockWithSplitButtonActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/SaveAndCloseCMSBlockWithSplitButtonActionGroup.xml
index 95ce3c499b6b8..44e29f7e2fe55 100644
--- a/app/code/Magento/Cms/Test/Mftf/ActionGroup/SaveAndCloseCMSBlockWithSplitButtonActionGroup.xml
+++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/SaveAndCloseCMSBlockWithSplitButtonActionGroup.xml
@@ -17,6 +17,7 @@
-
+
+
diff --git a/app/code/Magento/Cms/Test/Mftf/ActionGroup/VerifyCmsBlockSaveSplitButtonActionGroup.xml b/app/code/Magento/Cms/Test/Mftf/ActionGroup/VerifyCmsBlockSaveSplitButtonActionGroup.xml
index fee2f984c42d2..bc30098cb43c7 100644
--- a/app/code/Magento/Cms/Test/Mftf/ActionGroup/VerifyCmsBlockSaveSplitButtonActionGroup.xml
+++ b/app/code/Magento/Cms/Test/Mftf/ActionGroup/VerifyCmsBlockSaveSplitButtonActionGroup.xml
@@ -17,6 +17,7 @@
+
diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddImageToCMSPageTinyMCE3Test.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddImageToCMSPageTinyMCE3Test.xml
index 69f9d24699db0..f54547015eb9c 100644
--- a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddImageToCMSPageTinyMCE3Test.xml
+++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddImageToCMSPageTinyMCE3Test.xml
@@ -28,7 +28,7 @@
-
+
diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddImageToWYSIWYGBlockTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddImageToWYSIWYGBlockTest.xml
index 64b775c6cbef9..e22f6e085a32b 100644
--- a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddImageToWYSIWYGBlockTest.xml
+++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddImageToWYSIWYGBlockTest.xml
@@ -20,7 +20,7 @@
-
+
@@ -63,7 +63,7 @@
-
+
diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddImageToWYSIWYGCMSTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddImageToWYSIWYGCMSTest.xml
index 201a84ecb3c65..51afa7b59d366 100644
--- a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddImageToWYSIWYGCMSTest.xml
+++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddImageToWYSIWYGCMSTest.xml
@@ -19,7 +19,7 @@
-
+
@@ -58,7 +58,7 @@
-
+
diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddVariableToWYSIWYGBlockTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddVariableToWYSIWYGBlockTest.xml
index cc7f59c7a9478..32bd75d373115 100644
--- a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddVariableToWYSIWYGBlockTest.xml
+++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddVariableToWYSIWYGBlockTest.xml
@@ -20,7 +20,7 @@
-
+
@@ -143,7 +143,7 @@
-
+
diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddVariableToWYSIWYGCMSTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddVariableToWYSIWYGCMSTest.xml
index 92164f34f5a83..55c01f3818a19 100644
--- a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddVariableToWYSIWYGCMSTest.xml
+++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddVariableToWYSIWYGCMSTest.xml
@@ -17,7 +17,7 @@
-
+
@@ -95,7 +95,7 @@
-
+
diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGBlockTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGBlockTest.xml
index 24440a6164e84..e5aecd0f3da81 100644
--- a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGBlockTest.xml
+++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGBlockTest.xml
@@ -20,7 +20,7 @@
-
+
@@ -81,7 +81,7 @@
-
+
diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCMSPageLinkTypeTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCMSPageLinkTypeTest.xml
index 53ed63c89bfb6..5f9bfaf47a157 100644
--- a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCMSPageLinkTypeTest.xml
+++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCMSPageLinkTypeTest.xml
@@ -19,7 +19,7 @@
-
+
@@ -67,7 +67,7 @@
-
+
diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCMSStaticBlockTypeTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCMSStaticBlockTypeTest.xml
index c199601231a13..81826eeab5e10 100644
--- a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCMSStaticBlockTypeTest.xml
+++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCMSStaticBlockTypeTest.xml
@@ -20,7 +20,7 @@
-
+
@@ -69,7 +69,7 @@
-
+
diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCatalogCategoryLinkTypeTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCatalogCategoryLinkTypeTest.xml
index 0237d3704f7c1..5d745c625ac10 100644
--- a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCatalogCategoryLinkTypeTest.xml
+++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCatalogCategoryLinkTypeTest.xml
@@ -19,7 +19,7 @@
-
+
@@ -77,7 +77,7 @@
-
+
diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCatalogProductLinkTypeTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCatalogProductLinkTypeTest.xml
index 4e7ecd48a6af4..940c1979710e1 100644
--- a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCatalogProductLinkTypeTest.xml
+++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCatalogProductLinkTypeTest.xml
@@ -23,7 +23,7 @@
-
+
@@ -84,7 +84,7 @@
-
+
diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCatalogProductListTypeTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCatalogProductListTypeTest.xml
index 2cd41eb9d9f7b..f849c31948c3c 100644
--- a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCatalogProductListTypeTest.xml
+++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithCatalogProductListTypeTest.xml
@@ -25,7 +25,7 @@
-
+
@@ -100,7 +100,7 @@
-
+
diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeTest.xml
index 803a3b692dbe2..f4f1da8763fbb 100644
--- a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeTest.xml
+++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithRecentlyComparedProductsTypeTest.xml
@@ -24,7 +24,7 @@
-
+
@@ -83,7 +83,7 @@
-
+
diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithRecentlyViewedProductsTypeTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithRecentlyViewedProductsTypeTest.xml
index 2c3b060d3bc15..d9c080e034dd2 100644
--- a/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithRecentlyViewedProductsTypeTest.xml
+++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminAddWidgetToWYSIWYGWithRecentlyViewedProductsTypeTest.xml
@@ -23,7 +23,7 @@
-
+
@@ -73,7 +73,7 @@
-
+
diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreateDisabledPageTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreateDisabledPageTest.xml
index a5f43b090e9d6..3c6d70dc53418 100644
--- a/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreateDisabledPageTest.xml
+++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreateDisabledPageTest.xml
@@ -24,7 +24,7 @@
-
+
diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageForDefaultStoreTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageForDefaultStoreTest.xml
index d63952f7eb6c8..036efab75f963 100644
--- a/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageForDefaultStoreTest.xml
+++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageForDefaultStoreTest.xml
@@ -24,7 +24,7 @@
-
+
diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageInSingleStoreModeTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageInSingleStoreModeTest.xml
index d2124b5d83be6..1b3a7e74af08f 100644
--- a/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageInSingleStoreModeTest.xml
+++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageInSingleStoreModeTest.xml
@@ -26,7 +26,7 @@
-
+
diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageTest.xml
index d33d7484f7770..a097a6d11403e 100644
--- a/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageTest.xml
+++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageTest.xml
@@ -24,7 +24,7 @@
-
+
diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageWithBlockTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageWithBlockTest.xml
index 1600a0d9d8d0f..9c2f1abc4d522 100644
--- a/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageWithBlockTest.xml
+++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCMSPageCreatePageWithBlockTest.xml
@@ -24,7 +24,7 @@
-
+
diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageMassActionTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageMassActionTest.xml
index 7cc0719dcbeb2..4c9ef31b0d202 100644
--- a/app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageMassActionTest.xml
+++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCmsPageMassActionTest.xml
@@ -10,6 +10,7 @@
+
@@ -27,7 +28,7 @@
-
+
diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminConfigDefaultCMSPageLayoutFromConfigurationSettingTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminConfigDefaultCMSPageLayoutFromConfigurationSettingTest.xml
new file mode 100644
index 0000000000000..99990595fca95
--- /dev/null
+++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminConfigDefaultCMSPageLayoutFromConfigurationSettingTest.xml
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminContentBlocksNavigateMenuTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminContentBlocksNavigateMenuTest.xml
index 19f501d6aa209..bb15904540be4 100644
--- a/app/code/Magento/Cms/Test/Mftf/Test/AdminContentBlocksNavigateMenuTest.xml
+++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminContentBlocksNavigateMenuTest.xml
@@ -23,7 +23,7 @@
-
+
diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminContentPagesNavigateMenuTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminContentPagesNavigateMenuTest.xml
index 323a1de7b9a4e..c7726e7e427ce 100644
--- a/app/code/Magento/Cms/Test/Mftf/Test/AdminContentPagesNavigateMenuTest.xml
+++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminContentPagesNavigateMenuTest.xml
@@ -23,7 +23,7 @@
-
+
diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsBlockTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsBlockTest.xml
index 33d7b06a064e4..eb13bb71b5f6b 100644
--- a/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsBlockTest.xml
+++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsBlockTest.xml
@@ -17,16 +17,16 @@
+
-
-
+
-
+
@@ -42,4 +42,4 @@
-
\ No newline at end of file
+
diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsBlockWithMarginalSpaceTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsBlockWithMarginalSpaceTest.xml
new file mode 100644
index 0000000000000..07f033b18ea39
--- /dev/null
+++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsBlockWithMarginalSpaceTest.xml
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsPageTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsPageTest.xml
index e6fcbab4de644..b2fca0ff99115 100644
--- a/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsPageTest.xml
+++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsPageTest.xml
@@ -17,88 +17,20 @@
+
-
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateDuplicatedCmsPageTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateDuplicatedCmsPageTest.xml
new file mode 100644
index 0000000000000..1e2e47de8c17f
--- /dev/null
+++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateDuplicatedCmsPageTest.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminMediaGalleryPopupUploadImagesWithoutErrorTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminMediaGalleryPopupUploadImagesWithoutErrorTest.xml
index ff389a6ce2965..58803533efaf2 100644
--- a/app/code/Magento/Cms/Test/Mftf/Test/AdminMediaGalleryPopupUploadImagesWithoutErrorTest.xml
+++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminMediaGalleryPopupUploadImagesWithoutErrorTest.xml
@@ -26,14 +26,14 @@
-
+
-
+
diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminSaveAndCloseCmsBlockTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminSaveAndCloseCmsBlockTest.xml
index 8c89c47ab5077..e2800c2ac3094 100644
--- a/app/code/Magento/Cms/Test/Mftf/Test/AdminSaveAndCloseCmsBlockTest.xml
+++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminSaveAndCloseCmsBlockTest.xml
@@ -16,21 +16,25 @@
+
+
-
-
+
+
-
+
+
+
-
+
-
+
-
\ No newline at end of file
+
diff --git a/app/code/Magento/Cms/Test/Mftf/Test/CheckOrderOfProdsInWidgetOnCMSPageTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/CheckOrderOfProdsInWidgetOnCMSPageTest.xml
index afcf5e3764ef7..58adae02298b7 100644
--- a/app/code/Magento/Cms/Test/Mftf/Test/CheckOrderOfProdsInWidgetOnCMSPageTest.xml
+++ b/app/code/Magento/Cms/Test/Mftf/Test/CheckOrderOfProdsInWidgetOnCMSPageTest.xml
@@ -39,7 +39,7 @@
-
+
diff --git a/app/code/Magento/Cms/Test/Mftf/Test/CheckStaticBlocksTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/CheckStaticBlocksTest.xml
index e6ab1c130606b..385616dcca9b9 100644
--- a/app/code/Magento/Cms/Test/Mftf/Test/CheckStaticBlocksTest.xml
+++ b/app/code/Magento/Cms/Test/Mftf/Test/CheckStaticBlocksTest.xml
@@ -56,12 +56,23 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Cms/Test/Mftf/Test/StoreViewLanguageCorrectSwitchTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/StoreViewLanguageCorrectSwitchTest.xml
index 6569c07f4580a..a73e41de6b861 100644
--- a/app/code/Magento/Cms/Test/Mftf/Test/StoreViewLanguageCorrectSwitchTest.xml
+++ b/app/code/Magento/Cms/Test/Mftf/Test/StoreViewLanguageCorrectSwitchTest.xml
@@ -32,7 +32,7 @@
-
+
diff --git a/app/code/Magento/Cms/Test/Mftf/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnBlockTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnBlockTest.xml
index 944cd02d87b86..58f3b9d5bd3b1 100644
--- a/app/code/Magento/Cms/Test/Mftf/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnBlockTest.xml
+++ b/app/code/Magento/Cms/Test/Mftf/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnBlockTest.xml
@@ -20,7 +20,7 @@
-
+
@@ -91,7 +91,7 @@
-
+
diff --git a/app/code/Magento/Cms/Test/Mftf/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnCMSPageTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnCMSPageTest.xml
index 24377e92fe083..43615ac906b00 100644
--- a/app/code/Magento/Cms/Test/Mftf/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnCMSPageTest.xml
+++ b/app/code/Magento/Cms/Test/Mftf/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnCMSPageTest.xml
@@ -19,7 +19,7 @@
-
+
@@ -51,7 +51,7 @@
-
+
diff --git a/app/code/Magento/Cms/Test/Unit/Controller/Adminhtml/Wysiwyg/DirectiveTest.php b/app/code/Magento/Cms/Test/Unit/Controller/Adminhtml/Wysiwyg/DirectiveTest.php
index 5fea276225622..be9f6b8d8ccd5 100644
--- a/app/code/Magento/Cms/Test/Unit/Controller/Adminhtml/Wysiwyg/DirectiveTest.php
+++ b/app/code/Magento/Cms/Test/Unit/Controller/Adminhtml/Wysiwyg/DirectiveTest.php
@@ -5,100 +5,123 @@
*/
namespace Magento\Cms\Test\Unit\Controller\Adminhtml\Wysiwyg;
+use Magento\Backend\App\Action\Context;
+use Magento\Cms\Controller\Adminhtml\Wysiwyg\Directive;
+use Magento\Cms\Model\Template\Filter;
+use Magento\Cms\Model\Wysiwyg\Config;
+use Magento\Framework\App\RequestInterface;
+use Magento\Framework\App\ResponseInterface;
+use Magento\Framework\Controller\Result\Raw;
+use Magento\Framework\Controller\Result\RawFactory;
+use Magento\Framework\Filesystem\Driver\File;
+use Magento\Framework\Image\Adapter\AdapterInterface;
+use Magento\Framework\Image\AdapterFactory;
+use Magento\Framework\ObjectManagerInterface;
+use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
+use Magento\Framework\Url\DecoderInterface;
+use PHPUnit\Framework\TestCase;
+use PHPUnit_Framework_MockObject_MockObject;
+use Psr\Log\LoggerInterface;
+
/**
* @covers \Magento\Cms\Controller\Adminhtml\Wysiwyg\Directive
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class DirectiveTest extends \PHPUnit\Framework\TestCase
+class DirectiveTest extends TestCase
{
const IMAGE_PATH = 'pub/media/wysiwyg/image.jpg';
/**
- * @var \Magento\Cms\Controller\Adminhtml\Wysiwyg\Directive
+ * @var Directive
*/
protected $wysiwygDirective;
/**
- * @var \Magento\Backend\App\Action\Context|\PHPUnit_Framework_MockObject_MockObject
+ * @var Context|PHPUnit_Framework_MockObject_MockObject
*/
protected $actionContextMock;
/**
- * @var \Magento\Framework\App\RequestInterface|\PHPUnit_Framework_MockObject_MockObject
+ * @var RequestInterface|PHPUnit_Framework_MockObject_MockObject
*/
protected $requestMock;
/**
- * @var \Magento\Framework\Url\DecoderInterface|\PHPUnit_Framework_MockObject_MockObject
+ * @var DecoderInterface|PHPUnit_Framework_MockObject_MockObject
*/
protected $urlDecoderMock;
/**
- * @var \Magento\Framework\ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject
+ * @var ObjectManagerInterface|PHPUnit_Framework_MockObject_MockObject
*/
protected $objectManagerMock;
/**
- * @var \Magento\Cms\Model\Template\Filter|\PHPUnit_Framework_MockObject_MockObject
+ * @var Filter|PHPUnit_Framework_MockObject_MockObject
*/
protected $templateFilterMock;
/**
- * @var \Magento\Framework\Image\AdapterFactory|\PHPUnit_Framework_MockObject_MockObject
+ * @var AdapterFactory|PHPUnit_Framework_MockObject_MockObject
*/
protected $imageAdapterFactoryMock;
/**
- * @var \Magento\Framework\Image\Adapter\AdapterInterface|\PHPUnit_Framework_MockObject_MockObject
+ * @var AdapterInterface|PHPUnit_Framework_MockObject_MockObject
*/
protected $imageAdapterMock;
/**
- * @var \Magento\Framework\App\ResponseInterface|\PHPUnit_Framework_MockObject_MockObject
+ * @var ResponseInterface|PHPUnit_Framework_MockObject_MockObject
*/
protected $responseMock;
/**
- * @var \Magento\Cms\Model\Wysiwyg\Config|\PHPUnit_Framework_MockObject_MockObject
+ * @var File|PHPUnit_Framework_MockObject_MockObject
+ */
+ protected $fileMock;
+
+ /**
+ * @var Config|PHPUnit_Framework_MockObject_MockObject
*/
protected $wysiwygConfigMock;
/**
- * @var \Psr\Log\LoggerInterface|\PHPUnit_Framework_MockObject_MockObject
+ * @var LoggerInterface|PHPUnit_Framework_MockObject_MockObject
*/
protected $loggerMock;
/**
- * @var \Magento\Framework\Controller\Result\RawFactory|\PHPUnit_Framework_MockObject_MockObject
+ * @var RawFactory|PHPUnit_Framework_MockObject_MockObject
*/
protected $rawFactoryMock;
/**
- * @var \Magento\Framework\Controller\Result\Raw|\PHPUnit_Framework_MockObject_MockObject
+ * @var Raw|PHPUnit_Framework_MockObject_MockObject
*/
protected $rawMock;
protected function setUp()
{
- $this->actionContextMock = $this->getMockBuilder(\Magento\Backend\App\Action\Context::class)
+ $this->actionContextMock = $this->getMockBuilder(Context::class)
->disableOriginalConstructor()
->getMock();
- $this->requestMock = $this->getMockBuilder(\Magento\Framework\App\RequestInterface::class)
+ $this->requestMock = $this->getMockBuilder(RequestInterface::class)
->disableOriginalConstructor()
->getMock();
- $this->urlDecoderMock = $this->getMockBuilder(\Magento\Framework\Url\DecoderInterface::class)
+ $this->urlDecoderMock = $this->getMockBuilder(DecoderInterface::class)
->disableOriginalConstructor()
->getMock();
- $this->objectManagerMock = $this->getMockBuilder(\Magento\Framework\ObjectManagerInterface::class)
+ $this->objectManagerMock = $this->getMockBuilder(ObjectManagerInterface::class)
->disableOriginalConstructor()
->getMock();
- $this->templateFilterMock = $this->getMockBuilder(\Magento\Cms\Model\Template\Filter::class)
+ $this->templateFilterMock = $this->getMockBuilder(Filter::class)
->disableOriginalConstructor()
->getMock();
- $this->imageAdapterFactoryMock = $this->getMockBuilder(\Magento\Framework\Image\AdapterFactory::class)
+ $this->imageAdapterFactoryMock = $this->getMockBuilder(AdapterFactory::class)
->disableOriginalConstructor()
->getMock();
- $this->imageAdapterMock = $this->getMockBuilder(\Magento\Framework\Image\Adapter\AdapterInterface::class)
+ $this->imageAdapterMock = $this->getMockBuilder(AdapterInterface::class)
->disableOriginalConstructor()
->setMethods(
[
@@ -117,21 +140,25 @@ protected function setUp()
]
)
->getMock();
- $this->responseMock = $this->getMockBuilder(\Magento\Framework\App\ResponseInterface::class)
+ $this->responseMock = $this->getMockBuilder(ResponseInterface::class)
->disableOriginalConstructor()
->setMethods(['setHeader', 'setBody', 'sendResponse'])
->getMock();
- $this->wysiwygConfigMock = $this->getMockBuilder(\Magento\Cms\Model\Wysiwyg\Config::class)
+ $this->fileMock = $this->getMockBuilder(File::class)
->disableOriginalConstructor()
+ ->setMethods(['fileGetContents'])
->getMock();
- $this->loggerMock = $this->getMockBuilder(\Psr\Log\LoggerInterface::class)
+ $this->wysiwygConfigMock = $this->getMockBuilder(Config::class)
->disableOriginalConstructor()
->getMock();
- $this->rawFactoryMock = $this->getMockBuilder(\Magento\Framework\Controller\Result\RawFactory::class)
+ $this->loggerMock = $this->getMockBuilder(LoggerInterface::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->rawFactoryMock = $this->getMockBuilder(RawFactory::class)
->setMethods(['create'])
->disableOriginalConstructor()
->getMock();
- $this->rawMock = $this->getMockBuilder(\Magento\Framework\Controller\Result\Raw::class)
+ $this->rawMock = $this->getMockBuilder(Raw::class)
->disableOriginalConstructor()
->getMock();
@@ -145,9 +172,9 @@ protected function setUp()
->method('getObjectManager')
->willReturn($this->objectManagerMock);
- $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
+ $objectManager = new ObjectManager($this);
$this->wysiwygDirective = $objectManager->getObject(
- \Magento\Cms\Controller\Adminhtml\Wysiwyg\Directive::class,
+ Directive::class,
[
'context' => $this->actionContextMock,
'urlDecoder' => $this->urlDecoderMock,
@@ -155,7 +182,8 @@ protected function setUp()
'adapterFactory' => $this->imageAdapterFactoryMock,
'logger' => $this->loggerMock,
'config' => $this->wysiwygConfigMock,
- 'filter' => $this->templateFilterMock
+ 'filter' => $this->templateFilterMock,
+ 'file' => $this->fileMock,
]
);
}
@@ -172,23 +200,29 @@ public function testExecute()
$this->imageAdapterMock->expects($this->once())
->method('open')
->with(self::IMAGE_PATH);
- $this->imageAdapterMock->expects($this->once())
+ $this->imageAdapterMock->expects($this->atLeastOnce())
->method('getMimeType')
->willReturn($mimeType);
- $this->rawMock->expects($this->once())
+ $this->rawMock->expects($this->atLeastOnce())
->method('setHeader')
->with('Content-Type', $mimeType)
->willReturnSelf();
- $this->rawMock->expects($this->once())
+ $this->rawMock->expects($this->atLeastOnce())
->method('setContents')
->with($imageBody)
->willReturnSelf();
$this->imageAdapterMock->expects($this->once())
->method('getImage')
->willReturn($imageBody);
+ $this->fileMock->expects($this->once())
+ ->method('fileGetContents')
+ ->willReturn($imageBody);
$this->rawFactoryMock->expects($this->any())
->method('create')
->willReturn($this->rawMock);
+ $this->imageAdapterFactoryMock->expects($this->once())
+ ->method('create')
+ ->willReturn($this->imageAdapterMock);
$this->assertSame(
$this->rawMock,
@@ -217,20 +251,23 @@ public function testExecuteException()
$this->imageAdapterMock->expects($this->at(1))
->method('open')
->with($placeholderPath);
- $this->imageAdapterMock->expects($this->once())
+ $this->imageAdapterMock->expects($this->atLeastOnce())
->method('getMimeType')
->willReturn($mimeType);
- $this->rawMock->expects($this->once())
+ $this->rawMock->expects($this->atLeastOnce())
->method('setHeader')
->with('Content-Type', $mimeType)
->willReturnSelf();
- $this->rawMock->expects($this->once())
+ $this->rawMock->expects($this->atLeastOnce())
->method('setContents')
->with($imageBody)
->willReturnSelf();
- $this->imageAdapterMock->expects($this->once())
+ $this->imageAdapterMock->expects($this->any())
->method('getImage')
->willReturn($imageBody);
+ $this->fileMock->expects($this->once())
+ ->method('fileGetContents')
+ ->willReturn($imageBody);
$this->loggerMock->expects($this->once())
->method('warning')
->with($exception);
@@ -238,6 +275,10 @@ public function testExecuteException()
->method('create')
->willReturn($this->rawMock);
+ $this->imageAdapterFactoryMock->expects($this->exactly(1))
+ ->method('create')
+ ->willReturn($this->imageAdapterMock);
+
$this->assertSame(
$this->rawMock,
$this->wysiwygDirective->execute()
@@ -297,6 +338,20 @@ public function testExecuteWithDeletedImage()
->method('warning')
->with($exception);
+ $this->rawMock->expects($this->once())
+ ->method('setHeader')
+ ->with('Content-Type', null)
+ ->willReturnSelf();
+
+ $this->rawMock->expects($this->once())
+ ->method('setContents')
+ ->with(null)
+ ->willReturnSelf();
+
+ $this->rawFactoryMock->expects($this->any())
+ ->method('create')
+ ->willReturn($this->rawMock);
+
$this->wysiwygDirective->execute();
}
}
diff --git a/app/code/Magento/Cms/Test/Unit/Ui/Component/Listing/Column/PageActionsTest.php b/app/code/Magento/Cms/Test/Unit/Ui/Component/Listing/Column/PageActionsTest.php
index 53d8ee5220768..781d6d31246ca 100644
--- a/app/code/Magento/Cms/Test/Unit/Ui/Component/Listing/Column/PageActionsTest.php
+++ b/app/code/Magento/Cms/Test/Unit/Ui/Component/Listing/Column/PageActionsTest.php
@@ -3,91 +3,112 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
+declare(strict_types=1);
+
namespace Magento\Cms\Test\Unit\Ui\Component\Listing\Column;
use Magento\Cms\Ui\Component\Listing\Column\PageActions;
+use Magento\Cms\ViewModel\Page\Grid\UrlBuilder;
use Magento\Framework\Escaper;
+use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
+use Magento\Framework\UrlInterface;
+use Magento\Framework\View\Element\UiComponent\ContextInterface;
+use Magento\Framework\View\Element\UiComponent\Processor;
+use PHPUnit\Framework\TestCase;
+use PHPUnit_Framework_MockObject_MockObject as MockObject;
/**
* Test for Magento\Cms\Ui\Component\Listing\Column\PageActions class.
*/
-class PageActionsTest extends \PHPUnit\Framework\TestCase
+class PageActionsTest extends TestCase
{
- public function testPrepareItemsByPageId()
+
+ /**
+ * @var UrlInterface|MockObject
+ */
+ private $urlBuilderMock;
+
+ /**
+ * @var UrlBuilder|MockObject
+ */
+ private $scopeUrlBuilderMock;
+
+ /**
+ * @var ContextInterface|MockObject
+ */
+ private $contextMock;
+
+ /**
+ * @var Processor|MockObject
+ */
+ private $processorMock;
+
+ /**
+ * @var Escaper|MockObject
+ */
+ private $escaperMock;
+
+ /**
+ * @var PageActions
+ */
+ private $model;
+
+ /**
+ * @inheritDoc
+ */
+ public function setUp()
{
- $pageId = 1;
- // Create Mocks and SUT
- $objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
- /** @var \PHPUnit_Framework_MockObject_MockObject $urlBuilderMock */
- $urlBuilderMock = $this->getMockBuilder(\Magento\Framework\UrlInterface::class)
- ->disableOriginalConstructor()
- ->getMock();
- $contextMock = $this->getMockBuilder(\Magento\Framework\View\Element\UiComponent\ContextInterface::class)
+ $this->urlBuilderMock = $this->createMock(UrlInterface::class);
+ $this->scopeUrlBuilderMock = $this->createMock(UrlBuilder::class);
+ $this->processorMock = $this->createMock(Processor::class);
+ $this->contextMock = $this->getMockBuilder(ContextInterface::class)
->getMockForAbstractClass();
- $processor = $this->getMockBuilder(\Magento\Framework\View\Element\UiComponent\Processor::class)
+ $this->escaperMock = $this->getMockBuilder(Escaper::class)
->disableOriginalConstructor()
+ ->setMethods(['escapeHtml'])
->getMock();
- $contextMock->expects($this->never())->method('getProcessor')->willReturn($processor);
- /** @var \Magento\Cms\Ui\Component\Listing\Column\PageActions $model */
- $model = $objectManager->getObject(
- \Magento\Cms\Ui\Component\Listing\Column\PageActions::class,
+ $objectManager = new ObjectManager($this);
+
+ $this->model = $objectManager->getObject(
+ PageActions::class,
[
- 'urlBuilder' => $urlBuilderMock,
- 'context' => $contextMock,
+ 'urlBuilder' => $this->urlBuilderMock,
+ 'context' => $this->contextMock,
+ 'scopeUrlBuilder' => $this->scopeUrlBuilderMock
]
);
- $escaper = $this->getMockBuilder(Escaper::class)
- ->disableOriginalConstructor()
- ->setMethods(['escapeHtml'])
- ->getMock();
- $objectManager->setBackwardCompatibleProperty($model, 'escaper', $escaper);
-
- // Define test input and expectations
- $title = 'page title';
- $items = [
- 'data' => [
- 'items' => [
- [
- 'page_id' => $pageId,
- 'title' => $title
- ]
- ]
- ]
- ];
- $name = 'item_name';
- $expectedItems = [
- [
- 'page_id' => $pageId,
- 'title' => $title,
- $name => [
- 'edit' => [
- 'href' => 'test/url/edit',
- 'label' => __('Edit'),
- '__disableTmpl' => true,
- ],
- 'delete' => [
- 'href' => 'test/url/delete',
- 'label' => __('Delete'),
- 'confirm' => [
- 'title' => __('Delete %1', $title),
- 'message' => __('Are you sure you want to delete a %1 record?', $title),
- '__disableTmpl' => true,
- ],
- 'post' => true,
- '__disableTmpl' => true,
- ],
- ],
- ],
- ];
+ $objectManager->setBackwardCompatibleProperty($this->model, 'escaper', $this->escaperMock);
+ }
- $escaper->expects(static::once())
+ /**
+ * Verify Prepare Items by page Id.
+ *
+ * @dataProvider configDataProvider
+ * @param int $pageId
+ * @param string $title
+ * @param string $name
+ * @param array $items
+ * @param array $expectedItems
+ * @return void
+ */
+ public function testPrepareItemsByPageId(
+ int $pageId,
+ string $title,
+ string $name,
+ array $items,
+ array $expectedItems
+ ):void {
+ $this->contextMock->expects($this->never())
+ ->method('getProcessor')
+ ->willReturn($this->processorMock);
+ $this->escaperMock->expects(static::once())
->method('escapeHtml')
->with($title)
->willReturn($title);
// Configure mocks and object data
- $urlBuilderMock->expects($this->any())
+ $this->urlBuilderMock->expects($this->any())
->method('getUrl')
->willReturnMap(
[
@@ -107,9 +128,77 @@ public function testPrepareItemsByPageId()
],
]
);
- $model->setName($name);
- $items = $model->prepareDataSource($items);
+
+ $this->scopeUrlBuilderMock->expects($this->any())
+ ->method('getUrl')
+ ->willReturn('test/url/view');
+
+ $this->model->setName($name);
+ $items = $this->model->prepareDataSource($items);
// Run test
$this->assertEquals($expectedItems, $items['data']['items']);
}
+
+ /**
+ * Data provider for testPrepareItemsByPageId
+ *
+ * @return array
+ */
+ public function configDataProvider():array
+ {
+ $pageId = 1;
+ $title = 'page title';
+ $identifier = 'page_identifier';
+ $name = 'item_name';
+
+ return [
+ [
+ 'pageId' => $pageId,
+ 'title' => $title,
+ 'name' => $name,
+ 'items' => [
+ 'data' => [
+ 'items' => [
+ [
+ 'page_id' => $pageId,
+ 'title' => $title,
+ 'identifier' => $identifier
+ ]
+ ]
+ ]
+ ],
+ 'expectedItems' => [
+ [
+ 'page_id' => $pageId,
+ 'title' => $title,
+ 'identifier' => $identifier,
+ $name => [
+ 'edit' => [
+ 'href' => 'test/url/edit',
+ 'label' => __('Edit'),
+ '__disableTmpl' => true,
+ ],
+ 'delete' => [
+ 'href' => 'test/url/delete',
+ 'label' => __('Delete'),
+ 'confirm' => [
+ 'title' => __('Delete %1', $title),
+ 'message' => __('Are you sure you want to delete a %1 record?', $title),
+ '__disableTmpl' => true,
+ ],
+ 'post' => true,
+ '__disableTmpl' => true,
+ ],
+ 'preview' => [
+ 'href' => 'test/url/view',
+ 'label' => __('View'),
+ '__disableTmpl' => true,
+ 'target' => '_blank'
+ ]
+ ],
+ ],
+ ]
+ ]
+ ];
+ }
}
diff --git a/app/code/Magento/Cms/Ui/Component/Listing/Column/PageActions.php b/app/code/Magento/Cms/Ui/Component/Listing/Column/PageActions.php
index fa3756abfded4..0c6000bdbab84 100644
--- a/app/code/Magento/Cms/Ui/Component/Listing/Column/PageActions.php
+++ b/app/code/Magento/Cms/Ui/Component/Listing/Column/PageActions.php
@@ -14,7 +14,7 @@
use Magento\Ui\Component\Listing\Columns\Column;
/**
- * Class PageActions
+ * Class prepare Page Actions
*/
class PageActions extends Column
{
@@ -111,6 +111,7 @@ public function prepareDataSource(array $dataSource)
),
'label' => __('View'),
'__disableTmpl' => true,
+ 'target' => '_blank'
];
}
}
diff --git a/app/code/Magento/Cms/view/adminhtml/ui_component/cms_block_listing.xml b/app/code/Magento/Cms/view/adminhtml/ui_component/cms_block_listing.xml
index 793fc7d26cb4a..af54df24b64f5 100644
--- a/app/code/Magento/Cms/view/adminhtml/ui_component/cms_block_listing.xml
+++ b/app/code/Magento/Cms/view/adminhtml/ui_component/cms_block_listing.xml
@@ -146,6 +146,7 @@
true
+ true
text
diff --git a/app/code/Magento/Config/Model/Config/Structure/AbstractElement.php b/app/code/Magento/Config/Model/Config/Structure/AbstractElement.php
index 23a3dea1a7029..c4a0cb5e886d9 100644
--- a/app/code/Magento/Config/Model/Config/Structure/AbstractElement.php
+++ b/app/code/Magento/Config/Model/Config/Structure/AbstractElement.php
@@ -103,7 +103,7 @@ public function getData()
*/
public function getId()
{
- return isset($this->_data['id']) ? $this->_data['id'] : '';
+ return $this->_data['id'] ?? '';
}
/**
@@ -133,7 +133,7 @@ public function getComment()
*/
public function getFrontendModel()
{
- return isset($this->_data['frontend_model']) ? $this->_data['frontend_model'] : '';
+ return $this->_data['frontend_model'] ?? '';
}
/**
@@ -194,7 +194,7 @@ protected function _hasVisibilityValue($key)
*/
public function getClass()
{
- return isset($this->_data['class']) ? $this->_data['class'] : '';
+ return $this->_data['class'] ?? '';
}
/**
diff --git a/app/code/Magento/Config/Model/Config/Structure/Element/Field.php b/app/code/Magento/Config/Model/Config/Structure/Element/Field.php
index 834b2a9e17e37..2a4397b3300c0 100644
--- a/app/code/Magento/Config/Model/Config/Structure/Element/Field.php
+++ b/app/code/Magento/Config/Model/Config/Structure/Element/Field.php
@@ -150,7 +150,7 @@ public function getTooltip()
*/
public function getType()
{
- return isset($this->_data['type']) ? $this->_data['type'] : 'text';
+ return $this->_data['type'] ?? 'text';
}
/**
@@ -204,7 +204,7 @@ public function getRequiredFields($fieldPrefix = '')
*/
public function getFrontendClass()
{
- return isset($this->_data['frontend_class']) ? $this->_data['frontend_class'] : '';
+ return $this->_data['frontend_class'] ?? '';
}
/**
@@ -256,7 +256,7 @@ public function getGroupPath()
*/
public function getConfigPath()
{
- return isset($this->_data['config_path']) ? $this->_data['config_path'] : null;
+ return $this->_data['config_path'] ?? null;
}
/**
@@ -334,7 +334,7 @@ public function hasValidation()
*/
public function getValidation()
{
- return isset($this->_data['validate']) ? $this->_data['validate'] : null;
+ return $this->_data['validate'] ?? null;
}
/**
diff --git a/app/code/Magento/Config/Model/Config/Structure/Element/Section.php b/app/code/Magento/Config/Model/Config/Structure/Element/Section.php
index 80c029dfea2d0..15f590dfd2ffa 100644
--- a/app/code/Magento/Config/Model/Config/Structure/Element/Section.php
+++ b/app/code/Magento/Config/Model/Config/Structure/Element/Section.php
@@ -6,7 +6,7 @@
namespace Magento\Config\Model\Config\Structure\Element;
/**
- * Section
+ * Element section
*
* @api
* @since 100.0.2
@@ -43,7 +43,7 @@ public function __construct(
*/
public function getHeaderCss()
{
- return isset($this->_data['header_css']) ? $this->_data['header_css'] : '';
+ return $this->_data['header_css'] ?? '';
}
/**
diff --git a/app/code/Magento/Config/Test/Mftf/Test/CheckingCountryDropDownWithOneAllowedCountryTest.xml b/app/code/Magento/Config/Test/Mftf/Test/CheckingCountryDropDownWithOneAllowedCountryTest.xml
index 1d54f2ef52c02..32fa1d13023de 100644
--- a/app/code/Magento/Config/Test/Mftf/Test/CheckingCountryDropDownWithOneAllowedCountryTest.xml
+++ b/app/code/Magento/Config/Test/Mftf/Test/CheckingCountryDropDownWithOneAllowedCountryTest.xml
@@ -30,7 +30,7 @@
-
+
diff --git a/app/code/Magento/Config/Test/Mftf/Test/ConfigurationTest.xml b/app/code/Magento/Config/Test/Mftf/Test/ConfigurationTest.xml
index 66aacf706b039..916a5a09a09c0 100644
--- a/app/code/Magento/Config/Test/Mftf/Test/ConfigurationTest.xml
+++ b/app/code/Magento/Config/Test/Mftf/Test/ConfigurationTest.xml
@@ -23,7 +23,7 @@
-
+
diff --git a/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php b/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php
index fa677b0b8b421..1b3ecfb1d222a 100644
--- a/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php
+++ b/app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php
@@ -1270,14 +1270,8 @@ private function getCatalogConfig()
*/
public function isPossibleBuyFromList($product)
{
- $isAllCustomOptionsDisplayed = true;
- foreach ($this->getConfigurableAttributes($product) as $attribute) {
- $eavAttribute = $attribute->getProductAttribute();
-
- $isAllCustomOptionsDisplayed = ($isAllCustomOptionsDisplayed && $eavAttribute->getUsedInProductListing());
- }
-
- return $isAllCustomOptionsDisplayed;
+ //such cases already handled by add to cart action
+ return true;
}
/**
diff --git a/app/code/Magento/ConfigurableProduct/Pricing/Render/TierPriceBox.php b/app/code/Magento/ConfigurableProduct/Pricing/Render/TierPriceBox.php
index 447ba16d72710..4be124f6d9e5b 100644
--- a/app/code/Magento/ConfigurableProduct/Pricing/Render/TierPriceBox.php
+++ b/app/code/Magento/ConfigurableProduct/Pricing/Render/TierPriceBox.php
@@ -9,8 +9,6 @@
/**
* Responsible for displaying tier price box on configurable product page.
- *
- * @package Magento\ConfigurableProduct\Pricing\Render
*/
class TierPriceBox extends FinalPriceBox
{
@@ -23,6 +21,7 @@ public function toHtml()
if (!$this->isMsrpPriceApplicable() && $this->isTierPriceApplicable()) {
return parent::toHtml();
}
+ return '';
}
/**
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/CreateApiConfigurableProductWithProductAttributeAdvanceSearchActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/CreateApiConfigurableProductWithProductAttributeAdvanceSearchActionGroup.xml
new file mode 100644
index 0000000000000..77fcc137a0db5
--- /dev/null
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/CreateApiConfigurableProductWithProductAttributeAdvanceSearchActionGroup.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+ Creates a Configurable Product with Description and 2 Product Options via API.
+
+
+
+
+ {{productName}}
+
+
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Data/ConfigurableProductData.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Data/ConfigurableProductData.xml
index 3edb7c0f17ab9..87b181616bd7a 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Data/ConfigurableProductData.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Data/ConfigurableProductData.xml
@@ -23,12 +23,12 @@
CustomAttributeCategoryIds
+ API Configurable Product
api-configurable-product
+ api-configurable-product
configurable
4
4
- API Configurable Product
- api-configurable-product
123.00
2
1
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Section/StorefrontProductInfoMainSection.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Section/StorefrontProductInfoMainSection.xml
index 0853d22eda7b9..cf0e99f7c45c0 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Section/StorefrontProductInfoMainSection.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Section/StorefrontProductInfoMainSection.xml
@@ -10,6 +10,7 @@
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminAddDefaultImageConfigurableTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminAddDefaultImageConfigurableTest.xml
index 2f9347157ef33..a10545ba415fe 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminAddDefaultImageConfigurableTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminAddDefaultImageConfigurableTest.xml
@@ -89,6 +89,9 @@
+
+
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminAddingNewOptionsWithImagesAndPricesToConfigurableProductTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminAddingNewOptionsWithImagesAndPricesToConfigurableProductTest.xml
index a70a62470ecbc..543ead3f6732a 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminAddingNewOptionsWithImagesAndPricesToConfigurableProductTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminAddingNewOptionsWithImagesAndPricesToConfigurableProductTest.xml
@@ -34,7 +34,7 @@
-
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminAssertNoticeThatExistingSkuAutomaticallyChangedWhenSavingProductWithSameSkuTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminAssertNoticeThatExistingSkuAutomaticallyChangedWhenSavingProductWithSameSkuTest.xml
index 1613452dfc47c..a6c3794a2d622 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminAssertNoticeThatExistingSkuAutomaticallyChangedWhenSavingProductWithSameSkuTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminAssertNoticeThatExistingSkuAutomaticallyChangedWhenSavingProductWithSameSkuTest.xml
@@ -32,7 +32,7 @@
-
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckConfigurableProductAttributeValueUniquenessTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckConfigurableProductAttributeValueUniquenessTest.xml
index 98cb03916bdab..79d109de31821 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckConfigurableProductAttributeValueUniquenessTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckConfigurableProductAttributeValueUniquenessTest.xml
@@ -33,7 +33,10 @@
-
+
+
+
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckResultsOfColorAndOtherFiltersTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckResultsOfColorAndOtherFiltersTest.xml
index fabd4a2c253b6..7843d387eb2b9 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckResultsOfColorAndOtherFiltersTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckResultsOfColorAndOtherFiltersTest.xml
@@ -109,7 +109,10 @@
-
+
+
+
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckValidatorConfigurableProductTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckValidatorConfigurableProductTest.xml
index 5bdccf15b19d3..635e4c6f84c72 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckValidatorConfigurableProductTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckValidatorConfigurableProductTest.xml
@@ -43,7 +43,10 @@
-
+
+
+
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductCreateTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductCreateTest.xml
index 2a1c38ee135eb..692ba32c6db28 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductCreateTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductCreateTest.xml
@@ -26,7 +26,7 @@
-
+
@@ -92,7 +92,7 @@
-
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductDeleteTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductDeleteTest.xml
index 83e428b454c46..eabeb1b6881a0 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductDeleteTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductDeleteTest.xml
@@ -66,10 +66,13 @@
-
+
+
+
+
@@ -216,7 +219,7 @@
-
+
@@ -225,6 +228,9 @@
+
+
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductLongSkuTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductLongSkuTest.xml
index baea299581052..24a7a590566bd 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductLongSkuTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductLongSkuTest.xml
@@ -52,7 +52,10 @@
-
+
+
+
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductOutOfStockTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductOutOfStockTest.xml
index 6bba4aa6b43ce..2ab3a9e6e60c9 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductOutOfStockTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductOutOfStockTest.xml
@@ -77,12 +77,15 @@
-
+
+
+
+
@@ -200,10 +203,13 @@
-
+
+
+
+
@@ -301,11 +307,14 @@
-
+
+
+
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductSearchTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductSearchTest.xml
index 889ca5b24b242..7c20574868a66 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductSearchTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductSearchTest.xml
@@ -68,11 +68,14 @@
-
+
+
+
+
@@ -147,11 +150,14 @@
-
+
+
+
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateAttributeTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateAttributeTest.xml
index c437b39a405cd..fc10b2cc3b4e3 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateAttributeTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateAttributeTest.xml
@@ -96,7 +96,7 @@
-
+
@@ -105,6 +105,9 @@
+
+
+
@@ -213,7 +216,7 @@
-
+
@@ -221,6 +224,9 @@
+
+
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateTest.xml
index da0c5a65f944d..be039eb2f3389 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateTest.xml
@@ -41,7 +41,7 @@
-
+
@@ -145,6 +145,9 @@
+
+
+
@@ -238,6 +241,9 @@
+
+
+
@@ -280,7 +286,7 @@
-
+
@@ -329,7 +335,7 @@
-
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableSetEditRelatedProductsTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableSetEditRelatedProductsTest.xml
index bba8232139d69..924707a16600f 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableSetEditRelatedProductsTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableSetEditRelatedProductsTest.xml
@@ -21,6 +21,8 @@
+
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateAndEditConfigurableProductSettingsTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateAndEditConfigurableProductSettingsTest.xml
index 6632cbcee30f2..2503af780d5d3 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateAndEditConfigurableProductSettingsTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateAndEditConfigurableProductSettingsTest.xml
@@ -24,7 +24,7 @@
-
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml
index fa515c89fa460..7e2639c7e6e25 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateAndSwitchProductType.xml
@@ -149,7 +149,7 @@
-
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductBasedOnParentSkuTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductBasedOnParentSkuTest.xml
index 578e908664ecb..41ba0fc048120 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductBasedOnParentSkuTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductBasedOnParentSkuTest.xml
@@ -32,7 +32,7 @@
-
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithCreatingCategoryAndAttributeTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithCreatingCategoryAndAttributeTest.xml
index 363daa0ec8bb2..cef95ec7835d0 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithCreatingCategoryAndAttributeTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithCreatingCategoryAndAttributeTest.xml
@@ -49,7 +49,7 @@
-
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithDisabledChildrenProductsTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithDisabledChildrenProductsTest.xml
index f64ba4a63cec9..586a22982b334 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithDisabledChildrenProductsTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithDisabledChildrenProductsTest.xml
@@ -53,7 +53,10 @@
-
+
+
+
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithImagesTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithImagesTest.xml
index b448131e75f15..7f03efbc7fd65 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithImagesTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithImagesTest.xml
@@ -56,7 +56,10 @@
-
+
+
+
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithThreeProductDisplayOutOfStockProductsTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithThreeProductDisplayOutOfStockProductsTest.xml
index 1c6908818b4da..41a446e6bc320 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithThreeProductDisplayOutOfStockProductsTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithThreeProductDisplayOutOfStockProductsTest.xml
@@ -76,7 +76,10 @@
-
+
+
+
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithThreeProductDontDisplayOutOfStockProductsTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithThreeProductDontDisplayOutOfStockProductsTest.xml
index 1b7fc2c153208..95891b286ab53 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithThreeProductDontDisplayOutOfStockProductsTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithThreeProductDontDisplayOutOfStockProductsTest.xml
@@ -75,7 +75,10 @@
-
+
+
+
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithTierPriceForOneItemTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithTierPriceForOneItemTest.xml
index e67788d5e7bb0..f9729c42f0acf 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithTierPriceForOneItemTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithTierPriceForOneItemTest.xml
@@ -64,7 +64,10 @@
-
+
+
+
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithTwoOptionsAssignedToCategoryTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithTwoOptionsAssignedToCategoryTest.xml
index 6ab4734a074a5..4c39b0c2a54fb 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithTwoOptionsAssignedToCategoryTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithTwoOptionsAssignedToCategoryTest.xml
@@ -52,7 +52,7 @@
-
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithTwoOptionsWithoutAssignedToCategoryTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithTwoOptionsWithoutAssignedToCategoryTest.xml
index 14303aa9b650b..31851fc78968b 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithTwoOptionsWithoutAssignedToCategoryTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithTwoOptionsWithoutAssignedToCategoryTest.xml
@@ -45,7 +45,7 @@
-
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminDeleteConfigurableProductTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminDeleteConfigurableProductTest.xml
index c2edbaa4e6e87..68f86a7d07890 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminDeleteConfigurableProductTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminDeleteConfigurableProductTest.xml
@@ -26,7 +26,7 @@
-
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminProductTypeSwitchingOnEditingTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminProductTypeSwitchingOnEditingTest.xml
index f1535d62861ac..e308bafb2ac46 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminProductTypeSwitchingOnEditingTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminProductTypeSwitchingOnEditingTest.xml
@@ -43,7 +43,10 @@
-
+
+
+
+
@@ -147,7 +150,10 @@
-
+
+
+
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminRelatedProductsTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminRelatedProductsTest.xml
index 710430cf123dc..d764876d3b5cc 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminRelatedProductsTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminRelatedProductsTest.xml
@@ -89,6 +89,9 @@
+
+
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminRemoveDefaultImageConfigurableTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminRemoveDefaultImageConfigurableTest.xml
index 0cc73f117aaad..e0c4fda005666 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminRemoveDefaultImageConfigurableTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminRemoveDefaultImageConfigurableTest.xml
@@ -89,6 +89,8 @@
+
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdvanceCatalogSearchConfigurableTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdvanceCatalogSearchConfigurableTest.xml
index 0370280309272..05a9222eacaf9 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdvanceCatalogSearchConfigurableTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdvanceCatalogSearchConfigurableTest.xml
@@ -82,6 +82,10 @@
+
+
+
+
@@ -158,6 +162,10 @@
+
+
+
+
@@ -234,6 +242,10 @@
+
+
+
+
@@ -310,6 +322,10 @@
+
+
+
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/ConfigurableProductPriceAdditionalStoreViewTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/ConfigurableProductPriceAdditionalStoreViewTest.xml
index 124f0eea2e77a..49a1ab6b5e11d 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/ConfigurableProductPriceAdditionalStoreViewTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/ConfigurableProductPriceAdditionalStoreViewTest.xml
@@ -77,7 +77,9 @@
-
+
+
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/EndToEndB2CGuestUserTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/EndToEndB2CGuestUserTest.xml
index 59bb7f53f0aa8..a4904c67e0ef8 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/EndToEndB2CGuestUserTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/EndToEndB2CGuestUserTest.xml
@@ -73,6 +73,9 @@
+
+
+
@@ -282,6 +285,9 @@
+
+
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/EndToEndB2CLoggedInUserTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/EndToEndB2CLoggedInUserTest.xml
index dd0673563838e..847ee728d5e78 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/EndToEndB2CLoggedInUserTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/EndToEndB2CLoggedInUserTest.xml
@@ -61,6 +61,8 @@
+
+
@@ -73,6 +75,9 @@
+
+
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/NewProductsListWidgetConfigurableProductTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/NewProductsListWidgetConfigurableProductTest.xml
index eadc7dadaf708..5caba34def165 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/NewProductsListWidgetConfigurableProductTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/NewProductsListWidgetConfigurableProductTest.xml
@@ -70,6 +70,9 @@
+
+
+
@@ -88,4 +91,4 @@
-
\ No newline at end of file
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/NoErrorForMiniCartItemEditTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/NoErrorForMiniCartItemEditTest.xml
index 914550fabf39b..18993269ab0b1 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/NoErrorForMiniCartItemEditTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/NoErrorForMiniCartItemEditTest.xml
@@ -35,7 +35,7 @@
-
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/NoOptionAvailableToConfigureDisabledProductTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/NoOptionAvailableToConfigureDisabledProductTest.xml
index 5224cc6a9cced..55a109aee4b37 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/NoOptionAvailableToConfigureDisabledProductTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/NoOptionAvailableToConfigureDisabledProductTest.xml
@@ -102,7 +102,10 @@
-
+
+
+
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/ProductsQtyReturnAfterOrderCancelTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/ProductsQtyReturnAfterOrderCancelTest.xml
index 6045ca5567b45..24c60006a3504 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/ProductsQtyReturnAfterOrderCancelTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/ProductsQtyReturnAfterOrderCancelTest.xml
@@ -32,7 +32,7 @@
-
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontAdvanceCatalogSearchConfigurableBySkuWithHyphenTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontAdvanceCatalogSearchConfigurableBySkuWithHyphenTest.xml
index a8e982475253f..020e5dbbdfc77 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontAdvanceCatalogSearchConfigurableBySkuWithHyphenTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontAdvanceCatalogSearchConfigurableBySkuWithHyphenTest.xml
@@ -83,6 +83,10 @@
+
+
+
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductChildSearchTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductChildSearchTest.xml
index 294ab9fd0664d..eaf9fa689d218 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductChildSearchTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductChildSearchTest.xml
@@ -132,7 +132,7 @@
-
+
@@ -140,6 +140,9 @@
+
+
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductDetailsTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductDetailsTest.xml
index 42b9dfc92760a..387f2e212c4aa 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductDetailsTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductDetailsTest.xml
@@ -35,7 +35,7 @@
-
+
@@ -80,7 +80,7 @@
-
+
@@ -125,7 +125,7 @@
-
+
@@ -167,7 +167,7 @@
-
+
@@ -219,7 +219,10 @@
-
+
+
+
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductViewTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductViewTest.xml
index bfdadd54b872c..7e9ee68b9f2f7 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductViewTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductViewTest.xml
@@ -37,7 +37,7 @@
-
+
@@ -73,7 +73,7 @@
-
+
@@ -111,7 +111,7 @@
-
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductWithFileCustomOptionTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductWithFileCustomOptionTest.xml
index e24c8e4d94916..4de8dedefab48 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductWithFileCustomOptionTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductWithFileCustomOptionTest.xml
@@ -25,7 +25,7 @@
-
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontShouldSeeOnlyConfigurableProductChildAssignedToSeparateCategoryTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontShouldSeeOnlyConfigurableProductChildAssignedToSeparateCategoryTest.xml
index 56e5bedc9eab1..fc32a1ca6ac8c 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontShouldSeeOnlyConfigurableProductChildAssignedToSeparateCategoryTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontShouldSeeOnlyConfigurableProductChildAssignedToSeparateCategoryTest.xml
@@ -94,7 +94,10 @@
-
+
+
+
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontSortingByPriceForConfigurableWithCatalogRuleAppliedTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontSortingByPriceForConfigurableWithCatalogRuleAppliedTest.xml
index 15df342ca47a8..fcb9811a93dfa 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontSortingByPriceForConfigurableWithCatalogRuleAppliedTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontSortingByPriceForConfigurableWithCatalogRuleAppliedTest.xml
@@ -99,8 +99,8 @@
-
-
+
+
@@ -121,10 +121,10 @@
-
+
-
-
+
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontVerifyConfigurableProductLayeredNavigationTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontVerifyConfigurableProductLayeredNavigationTest.xml
index 3ebd9d6ef5367..32f9d78828ed1 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontVerifyConfigurableProductLayeredNavigationTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontVerifyConfigurableProductLayeredNavigationTest.xml
@@ -116,7 +116,10 @@
-
+
+
+
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontVisibilityOfDuplicateProductTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontVisibilityOfDuplicateProductTest.xml
index b8b0007c63d5f..6befc15044cc5 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontVisibilityOfDuplicateProductTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontVisibilityOfDuplicateProductTest.xml
@@ -45,7 +45,7 @@
-
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Unit/Pricing/Render/TierPriceBoxTest.php b/app/code/Magento/ConfigurableProduct/Test/Unit/Pricing/Render/TierPriceBoxTest.php
new file mode 100644
index 0000000000000..95f592daaa06a
--- /dev/null
+++ b/app/code/Magento/ConfigurableProduct/Test/Unit/Pricing/Render/TierPriceBoxTest.php
@@ -0,0 +1,117 @@
+context = $this->createPartialMock(Context::class, []);
+ $this->saleableItem = $this->createPartialMock(Product::class, ['getPriceInfo']);
+ $this->price = $this->createMock(PriceInterface::class);
+ $this->rendererPool = $this->createPartialMock(RendererPool::class, []);
+ $this->salableResolver = $this->createPartialMock(SalableResolverInterface::class, ['isSalable']);
+ $this->minimalPriceCalculator = $this->createMock(MinimalPriceCalculatorInterface::class);
+ $this->configurableOptionsProvider = $this->createMock(ConfigurableOptionsProviderInterface::class);
+
+ $this->model = (new ObjectManager($this))->getObject(
+ TierPriceBox::class,
+ [
+ 'context' => $this->context,
+ 'saleableItem' => $this->saleableItem,
+ 'price' => $this->price,
+ 'rendererPool' => $this->rendererPool,
+ 'salableResolver' => $this->salableResolver,
+ 'minimalPriceCalculator' => $this->minimalPriceCalculator,
+ 'configurableOptionsProvider' => $this->configurableOptionsProvider,
+ ]
+ );
+ }
+
+ public function testToHtmlEmptyWhenMsrpPriceIsApplicable(): void
+ {
+ $msrpPriceMock = $this->createPartialMock(
+ MsrpPrice::class,
+ ['canApplyMsrp', 'isMinimalPriceLessMsrp']
+ );
+ $msrpPriceMock->expects($this->once())
+ ->method('canApplyMsrp')
+ ->willReturn(true);
+ $msrpPriceMock->expects($this->once())
+ ->method('isMinimalPriceLessMsrp')
+ ->willReturn(true);
+
+ $priceInfoMock = $this->createMock(PriceInfoInterface::class);
+ $priceInfoMock->expects($this->once())
+ ->method('getPrice')
+ ->willReturn($msrpPriceMock);
+
+ $this->saleableItem->expects($this->once())
+ ->method('getPriceInfo')
+ ->willReturn($priceInfoMock);
+
+ $result = $this->model->toHtml();
+ $this->assertSame('', $result);
+ }
+}
diff --git a/app/code/Magento/Contact/view/frontend/templates/form.phtml b/app/code/Magento/Contact/view/frontend/templates/form.phtml
index 3a7c4c8b6d865..d218e650657ac 100644
--- a/app/code/Magento/Contact/view/frontend/templates/form.phtml
+++ b/app/code/Magento/Contact/view/frontend/templates/form.phtml
@@ -52,7 +52,7 @@ $viewModel = $block->getViewModel();
title="= $block->escapeHtmlAttr(__('Phone Number')) ?>"
value="= $block->escapeHtmlAttr($viewModel->getUserTelephone()) ?>"
class="input-text"
- type="text" />
+ type="tel" />