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/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/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/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/App/AbstractAction.php b/app/code/Magento/Backend/App/AbstractAction.php index fb2daa283f111..2f01700bdf51c 100644 --- a/app/code/Magento/Backend/App/AbstractAction.php +++ b/app/code/Magento/Backend/App/AbstractAction.php @@ -3,11 +3,26 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Backend\App; +use Magento\Backend\App\Action\Context; +use Magento\Backend\Helper\Data as BackendHelper; +use Magento\Backend\Model\Auth; +use Magento\Backend\Model\Session; +use Magento\Backend\Model\UrlInterface; +use Magento\Framework\App\RequestInterface; +use Magento\Framework\AuthorizationInterface; +use Magento\Framework\Data\Form\FormKey\Validator as FormKeyValidator; +use Magento\Framework\Locale\ResolverInterface; +use Magento\Framework\View\Element\AbstractBlock; + /** * Generic backend controller * + * @deprecated Use \Magento\Framework\App\ActionInterface + * + * phpcs:disable Magento2.Classes.AbstractApi * @api * @SuppressWarnings(PHPMD.NumberOfChildren) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) @@ -45,32 +60,32 @@ abstract class AbstractAction extends \Magento\Framework\App\Action\Action protected $_sessionNamespace = self::SESSION_NAMESPACE; /** - * @var \Magento\Backend\Helper\Data + * @var BackendHelper */ protected $_helper; /** - * @var \Magento\Backend\Model\Session + * @var Session */ protected $_session; /** - * @var \Magento\Framework\AuthorizationInterface + * @var AuthorizationInterface */ protected $_authorization; /** - * @var \Magento\Backend\Model\Auth + * @var Auth */ protected $_auth; /** - * @var \Magento\Backend\Model\UrlInterface + * @var UrlInterface */ protected $_backendUrl; /** - * @var \Magento\Framework\Locale\ResolverInterface + * @var ResolverInterface */ protected $_localeResolver; @@ -80,14 +95,14 @@ abstract class AbstractAction extends \Magento\Framework\App\Action\Action protected $_canUseBaseUrl; /** - * @var \Magento\Framework\Data\Form\FormKey\Validator + * @var FormKeyValidator */ protected $_formKeyValidator; /** - * @param \Magento\Backend\App\Action\Context $context + * @param Context $context */ - public function __construct(Action\Context $context) + public function __construct(Context $context) { parent::__construct($context); $this->_authorization = $context->getAuthorization(); @@ -101,6 +116,95 @@ public function __construct(Action\Context $context) } /** + * Dispatches the Action + * + * @param RequestInterface $request + * @return \Magento\Framework\App\ResponseInterface + */ + public function dispatch(RequestInterface $request) + { + if ($request->isDispatched() && $request->getActionName() !== 'denied' && !$this->_isAllowed()) { + $this->_response->setStatusHeader(403, '1.1', 'Forbidden'); + if (!$this->_auth->isLoggedIn()) { + return $this->_redirect('*/auth/login'); + } + + $this->_view->loadLayout(['default', 'adminhtml_denied'], true, true, false); + $this->_view->renderLayout(); + $this->_request->setDispatched(true); + + return $this->_response; + } + + if ($this->_isUrlChecked()) { + $this->_actionFlag->set('', self::FLAG_IS_URLS_CHECKED, true); + } + + $this->_processLocaleSettings(); + + // Need to preload isFirstPageAfterLogin (see https://github.com/magento/magento2/issues/15510) + if ($this->_auth->isLoggedIn()) { + $this->_auth->getAuthStorage()->isFirstPageAfterLogin(); + } + + return parent::dispatch($request); + } + + /** + * Check url keys. If non valid - redirect + * + * @return bool + * + * @see \Magento\Backend\App\Request\BackendValidator for default request validation. + */ + public function _processUrlKeys() + { + $_isValidFormKey = true; + $_isValidSecretKey = true; + $_keyErrorMsg = ''; + if ($this->_auth->isLoggedIn()) { + if ($this->getRequest()->isPost()) { + $_isValidFormKey = $this->_formKeyValidator->validate($this->getRequest()); + $_keyErrorMsg = __('Invalid Form Key. Please refresh the page.'); + } elseif ($this->_backendUrl->useSecretKey()) { + $_isValidSecretKey = $this->_validateSecretKey(); + $_keyErrorMsg = __('You entered an invalid Secret Key. Please refresh the page.'); + } + } + if (!$_isValidFormKey || !$_isValidSecretKey) { + $this->_actionFlag->set('', self::FLAG_NO_DISPATCH, true); + $this->_actionFlag->set('', self::FLAG_NO_POST_DISPATCH, true); + if ($this->getRequest()->getQuery('isAjax', false) || $this->getRequest()->getQuery('ajax', false)) { + $this->getResponse()->representJson( + $this->_objectManager->get( + \Magento\Framework\Json\Helper\Data::class + )->jsonEncode( + ['error' => true, 'message' => $_keyErrorMsg] + ) + ); + } else { + $this->_redirect($this->_backendUrl->getStartupPageUrl()); + } + return false; + } + return true; + } + + /** + * Generate url by route and parameters + * + * @param string $route + * @param array $params + * @return string + */ + public function getUrl($route = '', $params = []) + { + return $this->_helper->getUrl($route, $params); + } + + /** + * Determines whether current user is allowed to access Action + * * @return bool */ protected function _isAllowed() @@ -119,6 +223,8 @@ protected function _getSession() } /** + * Returns instantiated Message\ManagerInterface. + * * @return \Magento\Framework\Message\ManagerInterface */ protected function getMessageManager() @@ -146,6 +252,8 @@ protected function _setActiveMenu($itemId) } /** + * Adds element to Breadcrumbs block + * * @param string $label * @param string $title * @param string|null $link @@ -158,79 +266,51 @@ protected function _addBreadcrumb($label, $title, $link = null) } /** - * @param \Magento\Framework\View\Element\AbstractBlock $block + * Adds block to `content` block + * + * @param AbstractBlock $block * @return $this */ - protected function _addContent(\Magento\Framework\View\Element\AbstractBlock $block) + protected function _addContent(AbstractBlock $block) { return $this->_moveBlockToContainer($block, 'content'); } /** - * @param \Magento\Framework\View\Element\AbstractBlock $block + * Moves Block to `left` container + * + * @param AbstractBlock $block * @return $this */ - protected function _addLeft(\Magento\Framework\View\Element\AbstractBlock $block) + protected function _addLeft(AbstractBlock $block) { return $this->_moveBlockToContainer($block, 'left'); } /** - * @param \Magento\Framework\View\Element\AbstractBlock $block + * Adds Block to `js` container + * + * @param AbstractBlock $block * @return $this */ - protected function _addJs(\Magento\Framework\View\Element\AbstractBlock $block) + protected function _addJs(AbstractBlock $block) { return $this->_moveBlockToContainer($block, 'js'); } /** - * Set specified block as an anonymous child to specified container - * - * The block will be moved to the container from previous parent after all other elements + * Set specified block as an anonymous child to specified container. * - * @param \Magento\Framework\View\Element\AbstractBlock $block + * @param AbstractBlock $block * @param string $containerName * @return $this */ - private function _moveBlockToContainer(\Magento\Framework\View\Element\AbstractBlock $block, $containerName) + private function _moveBlockToContainer(AbstractBlock $block, $containerName) { $this->_view->getLayout()->setChild($containerName, $block->getNameInLayout(), ''); return $this; } - /** - * @param \Magento\Framework\App\RequestInterface $request - * @return \Magento\Framework\App\ResponseInterface - */ - public function dispatch(\Magento\Framework\App\RequestInterface $request) - { - if ($request->isDispatched() && $request->getActionName() !== 'denied' && !$this->_isAllowed()) { - $this->_response->setStatusHeader(403, '1.1', 'Forbidden'); - if (!$this->_auth->isLoggedIn()) { - return $this->_redirect('*/auth/login'); - } - $this->_view->loadLayout(['default', 'adminhtml_denied'], true, true, false); - $this->_view->renderLayout(); - $this->_request->setDispatched(true); - - return $this->_response; - } - - if ($this->_isUrlChecked()) { - $this->_actionFlag->set('', self::FLAG_IS_URLS_CHECKED, true); - } - - $this->_processLocaleSettings(); - - // Need to preload isFirstPageAfterLogin (see https://github.com/magento/magento2/issues/15510) - if ($this->_auth->isLoggedIn()) { - $this->_auth->getAuthStorage()->isFirstPageAfterLogin(); - } - - return parent::dispatch($request); - } - /** * Check whether url is checked * @@ -239,55 +319,13 @@ public function dispatch(\Magento\Framework\App\RequestInterface $request) protected function _isUrlChecked() { return !$this->_actionFlag->get('', self::FLAG_IS_URLS_CHECKED) - && !$this->getRequest()->isForwarded() - && !$this->_getSession()->getIsUrlNotice(true) - && !$this->_canUseBaseUrl; - } - - /** - * Check url keys. If non valid - redirect - * - * @return bool - * - * @see \Magento\Backend\App\Request\BackendValidator for default - * request validation. - */ - public function _processUrlKeys() - { - $_isValidFormKey = true; - $_isValidSecretKey = true; - $_keyErrorMsg = ''; - if ($this->_auth->isLoggedIn()) { - if ($this->getRequest()->isPost()) { - $_isValidFormKey = $this->_formKeyValidator->validate($this->getRequest()); - $_keyErrorMsg = __('Invalid Form Key. Please refresh the page.'); - } elseif ($this->_backendUrl->useSecretKey()) { - $_isValidSecretKey = $this->_validateSecretKey(); - $_keyErrorMsg = __('You entered an invalid Secret Key. Please refresh the page.'); - } - } - if (!$_isValidFormKey || !$_isValidSecretKey) { - $this->_actionFlag->set('', self::FLAG_NO_DISPATCH, true); - $this->_actionFlag->set('', self::FLAG_NO_POST_DISPATCH, true); - if ($this->getRequest()->getQuery('isAjax', false) || $this->getRequest()->getQuery('ajax', false)) { - $this->getResponse()->representJson( - $this->_objectManager->get( - \Magento\Framework\Json\Helper\Data::class - )->jsonEncode( - ['error' => true, 'message' => $_keyErrorMsg] - ) - ); - } else { - $this->_redirect($this->_backendUrl->getStartupPageUrl()); - } - return false; - } - return true; + && !$this->getRequest()->isForwarded() + && !$this->_getSession()->getIsUrlNotice(true) + && !$this->_canUseBaseUrl; } /** - * Set session locale, - * process force locale set through url params + * Set session locale, process force locale set through url params * * @return $this */ @@ -309,8 +347,8 @@ protected function _processLocaleSettings() * Set redirect into response * * @TODO MAGETWO-28356: Refactor controller actions to new ResultInterface - * @param string $path - * @param array $arguments + * @param string $path + * @param array $arguments * @return \Magento\Framework\App\ResponseInterface */ protected function _redirect($path, $arguments = []) @@ -333,19 +371,7 @@ protected function _redirect($path, $arguments = []) protected function _forward($action, $controller = null, $module = null, array $params = null) { $this->_getSession()->setIsUrlNotice($this->_actionFlag->get('', self::FLAG_IS_URLS_CHECKED)); - return parent::_forward($action, $controller, $module, $params); - } - - /** - * Generate url by route and parameters - * - * @param string $route - * @param array $params - * @return string - */ - public function getUrl($route = '', $params = []) - { - return $this->_helper->getUrl($route, $params); + parent::_forward($action, $controller, $module, $params); } /** @@ -359,7 +385,7 @@ protected function _validateSecretKey() return true; } - $secretKey = $this->getRequest()->getParam(\Magento\Backend\Model\UrlInterface::SECRET_KEY_PARAM_NAME, null); + $secretKey = $this->getRequest()->getParam(UrlInterface::SECRET_KEY_PARAM_NAME, null); if (!$secretKey || $secretKey != $this->_backendUrl->getSecretKey()) { return false; } diff --git a/app/code/Magento/Backend/App/Action/Plugin/LoadDesignPlugin.php b/app/code/Magento/Backend/App/Action/Plugin/LoadDesignPlugin.php new file mode 100644 index 0000000000000..7075e1b05e7db --- /dev/null +++ b/app/code/Magento/Backend/App/Action/Plugin/LoadDesignPlugin.php @@ -0,0 +1,46 @@ +designLoader = $designLoader; + } + + /** + * Initiates design before dispatching Backend Actions. + * + * @param AbstractAction $backendAction + * @param RequestInterface $request + * @return void + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function beforeDispatch(AbstractAction $backendAction, RequestInterface $request) + { + $this->designLoader->load(); + } +} 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/LoginActionGroup.xml b/app/code/Magento/Backend/Test/Mftf/ActionGroup/LoginActionGroup.xml deleted file mode 100644 index 8f61a0a06dd5e..0000000000000 --- a/app/code/Magento/Backend/Test/Mftf/ActionGroup/LoginActionGroup.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - DEPRECATED. Please use LoginAsAdmin instead. - 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/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/di.xml b/app/code/Magento/Backend/etc/adminhtml/di.xml index 5f566396ab500..1bfc504cf50e9 100644 --- a/app/code/Magento/Backend/etc/adminhtml/di.xml +++ b/app/code/Magento/Backend/etc/adminhtml/di.xml @@ -60,8 +60,9 @@ - - + + + 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/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/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/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 6c6cc9185380b..4bb54436e8729 100644 --- a/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontCheckBundleProductOptionTierPrices.xml +++ b/app/code/Magento/Bundle/Test/Mftf/Test/StorefrontCheckBundleProductOptionTierPrices.xml @@ -42,7 +42,7 @@ - + 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/Captcha/Observer/CheckUserForgotPasswordBackendObserver.php b/app/code/Magento/Captcha/Observer/CheckUserForgotPasswordBackendObserver.php index e11e48a527169..21d7e2f1993b7 100644 --- a/app/code/Magento/Captcha/Observer/CheckUserForgotPasswordBackendObserver.php +++ b/app/code/Magento/Captcha/Observer/CheckUserForgotPasswordBackendObserver.php @@ -3,19 +3,28 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Captcha\Observer; +use Magento\Captcha\Helper\Data as CaptchaHelper; +use Magento\Framework\App\Action\Action; +use Magento\Framework\App\ActionFlag; +use Magento\Framework\App\ObjectManager; +use Magento\Framework\App\RequestInterface; +use Magento\Framework\Event\Observer as Event; use Magento\Framework\Event\ObserverInterface; +use Magento\Framework\Message\ManagerInterface; +use Magento\Framework\Session\SessionManagerInterface; /** - * Class CheckUserForgotPasswordBackendObserver + * Handle request for Forgot Password * * @SuppressWarnings(PHPMD.CookieAndSessionMisuse) */ class CheckUserForgotPasswordBackendObserver implements ObserverInterface { /** - * @var \Magento\Captcha\Helper\Data + * @var CaptchaHelper */ protected $_helper; @@ -25,62 +34,70 @@ class CheckUserForgotPasswordBackendObserver implements ObserverInterface protected $captchaStringResolver; /** - * @var \Magento\Framework\Session\SessionManagerInterface + * @var SessionManagerInterface */ protected $_session; /** - * @var \Magento\Framework\App\ActionFlag + * @var ActionFlag */ protected $_actionFlag; /** - * @var \Magento\Framework\Message\ManagerInterface + * @var ManagerInterface */ protected $messageManager; /** - * @param \Magento\Captcha\Helper\Data $helper + * @var RequestInterface + */ + private $request; + + /** + * @param CaptchaHelper $helper * @param CaptchaStringResolver $captchaStringResolver - * @param \Magento\Framework\Session\SessionManagerInterface $session - * @param \Magento\Framework\App\ActionFlag $actionFlag - * @param \Magento\Framework\Message\ManagerInterface $messageManager + * @param SessionManagerInterface $session + * @param ActionFlag $actionFlag + * @param ManagerInterface $messageManager + * @param RequestInterface|null $request */ public function __construct( - \Magento\Captcha\Helper\Data $helper, + CaptchaHelper $helper, CaptchaStringResolver $captchaStringResolver, - \Magento\Framework\Session\SessionManagerInterface $session, - \Magento\Framework\App\ActionFlag $actionFlag, - \Magento\Framework\Message\ManagerInterface $messageManager + SessionManagerInterface $session, + ActionFlag $actionFlag, + ManagerInterface $messageManager, + RequestInterface $request = null ) { $this->_helper = $helper; $this->captchaStringResolver = $captchaStringResolver; $this->_session = $session; $this->_actionFlag = $actionFlag; $this->messageManager = $messageManager; + $this->request = $request ?? ObjectManager::getInstance()->get(RequestInterface::class); } /** * Check Captcha On User Login Backend Page * - * @param \Magento\Framework\Event\Observer $observer - * @throws \Magento\Framework\Exception\Plugin\AuthenticationException + * @param Event $observer * @return $this + * @throws \Magento\Framework\Exception\Plugin\AuthenticationException */ - public function execute(\Magento\Framework\Event\Observer $observer) + public function execute(Event $observer) { $formId = 'backend_forgotpassword'; $captchaModel = $this->_helper->getCaptcha($formId); $controller = $observer->getControllerAction(); - $email = (string)$observer->getControllerAction()->getRequest()->getParam('email'); - $params = $observer->getControllerAction()->getRequest()->getParams(); - if (!empty($email) - && !empty($params) + $params = $this->request->getParams(); + $email = (string)$this->request->getParam('email'); + if (!empty($params) + && !empty($email) && $captchaModel->isRequired() - && !$captchaModel->isCorrect($this->captchaStringResolver->resolve($controller->getRequest(), $formId)) + && !$captchaModel->isCorrect($this->captchaStringResolver->resolve($this->request, $formId)) ) { - $this->_session->setEmail((string)$controller->getRequest()->getPost('email')); - $this->_actionFlag->set('', \Magento\Framework\App\Action\Action::FLAG_NO_DISPATCH, true); + $this->_session->setEmail($email); + $this->_actionFlag->set('', Action::FLAG_NO_DISPATCH, true); $this->messageManager->addErrorMessage(__('Incorrect CAPTCHA')); $controller->getResponse()->setRedirect( $controller->getUrl('*/*/forgotpassword', ['_nosecret' => true]) diff --git a/app/code/Magento/Captcha/Test/Unit/Observer/CheckUserForgotPasswordBackendObserverTest.php b/app/code/Magento/Captcha/Test/Unit/Observer/CheckUserForgotPasswordBackendObserverTest.php index 584e7eb2e215f..9d3aa88ed9be4 100644 --- a/app/code/Magento/Captcha/Test/Unit/Observer/CheckUserForgotPasswordBackendObserverTest.php +++ b/app/code/Magento/Captcha/Test/Unit/Observer/CheckUserForgotPasswordBackendObserverTest.php @@ -101,6 +101,7 @@ protected function setUp() ->getMockForAbstractClass(); $this->actionFlagMock = $this->createMock(ActionFlag::class); $this->messageManagerMock = $this->createMock(ManagerInterface::class); + $this->requestMock = $this->createMock(HttpRequest::class); $objectManager = new ObjectManagerHelper($this); $this->observer = $objectManager->getObject( @@ -110,7 +111,8 @@ protected function setUp() 'captchaStringResolver' => $this->captchaStringResolverMock, '_session' => $this->sessionMock, '_actionFlag' => $this->actionFlagMock, - 'messageManager' => $this->messageManagerMock + 'messageManager' => $this->messageManagerMock, + 'request' => $this->requestMock ] ); @@ -122,16 +124,12 @@ protected function setUp() ->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']) + ->setMethods(['getUrl', 'getResponse']) ->getMockForAbstractClass(); - $this->controllerMock->expects($this->any()) - ->method('getRequest') - ->willReturn($this->requestMock); $this->controllerMock->expects($this->any()) ->method('getResponse') ->willReturn($this->httpResponseMock); 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 @@ + <description value="CardinalCommerce config shouldn't be visible if the 3D secure is disabled for Authorize.Net."/> <severity value="MINOR"/> @@ -21,7 +22,7 @@ </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <magentoCLI command="config:set three_d_secure/cardinal/enabled_authorizenet 0" stepKey="disableCardinalCommerce"/> </after> diff --git a/app/code/Magento/Catalog/Api/ProductLinkManagementInterface.php b/app/code/Magento/Catalog/Api/ProductLinkManagementInterface.php index 8286175123fe2..84cb853ad5982 100644 --- a/app/code/Magento/Catalog/Api/ProductLinkManagementInterface.php +++ b/app/code/Magento/Catalog/Api/ProductLinkManagementInterface.php @@ -17,6 +17,7 @@ interface ProductLinkManagementInterface * * @param string $sku * @param string $type + * @throws \Magento\Framework\Exception\NoSuchEntityException * @return \Magento\Catalog\Api\Data\ProductLinkInterface[] */ public function getLinkedItemsByType($sku, $type); @@ -28,6 +29,7 @@ public function getLinkedItemsByType($sku, $type); * @param \Magento\Catalog\Api\Data\ProductLinkInterface[] $items * @throws \Magento\Framework\Exception\NoSuchEntityException * @throws \Magento\Framework\Exception\CouldNotSaveException + * @throws \Magento\Framework\Exception\InputException * @return bool */ public function setProductLinks($sku, array $items); diff --git a/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Gallery/Content.php b/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Gallery/Content.php index 8e6011c09a27f..4cf67858fe287 100644 --- a/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Gallery/Content.php +++ b/app/code/Magento/Catalog/Block/Adminhtml/Product/Helper/Form/Gallery/Content.php @@ -13,16 +13,20 @@ */ namespace Magento\Catalog\Block\Adminhtml\Product\Helper\Form\Gallery; -use Magento\Framework\App\ObjectManager; +use Magento\Backend\Block\DataProviders\ImageUploadConfig as ImageUploadConfigDataProvider; use Magento\Backend\Block\Media\Uploader; -use Magento\Framework\View\Element\AbstractBlock; use Magento\Framework\App\Filesystem\DirectoryList; +use Magento\Framework\App\ObjectManager; use Magento\Framework\Exception\FileSystemException; -use Magento\Backend\Block\DataProviders\ImageUploadConfig as ImageUploadConfigDataProvider; +use Magento\Framework\Storage\FileNotFoundException; +use Magento\Framework\Storage\StorageProvider; +use Magento\Framework\View\Element\AbstractBlock; use Magento\MediaStorage\Helper\File\Storage\Database; /** * Block for gallery content. + * + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class Content extends \Magento\Backend\Block\Widget { @@ -55,11 +59,21 @@ class Content extends \Magento\Backend\Block\Widget * @var Database */ private $fileStorageDatabase; + /** + * @var StorageProvider + */ + private $storageProvider; + + /** + * @var \Magento\Framework\Filesystem\Directory\ReadInterface + */ + private $mediaDirectory; /** * @param \Magento\Backend\Block\Template\Context $context * @param \Magento\Framework\Json\EncoderInterface $jsonEncoder * @param \Magento\Catalog\Model\Product\Media\Config $mediaConfig + * @param StorageProvider $storageProvider * @param array $data * @param ImageUploadConfigDataProvider $imageUploadConfigDataProvider * @param Database $fileStorageDatabase @@ -68,6 +82,7 @@ public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Framework\Json\EncoderInterface $jsonEncoder, \Magento\Catalog\Model\Product\Media\Config $mediaConfig, + StorageProvider $storageProvider, array $data = [], ImageUploadConfigDataProvider $imageUploadConfigDataProvider = null, Database $fileStorageDatabase = null @@ -75,10 +90,12 @@ public function __construct( $this->_jsonEncoder = $jsonEncoder; $this->_mediaConfig = $mediaConfig; parent::__construct($context, $data); + $this->mediaDirectory = $this->_filesystem->getDirectoryRead(DirectoryList::MEDIA); $this->imageUploadConfigDataProvider = $imageUploadConfigDataProvider ?: ObjectManager::getInstance()->get(ImageUploadConfigDataProvider::class); $this->fileStorageDatabase = $fileStorageDatabase ?: ObjectManager::getInstance()->get(Database::class); + $this->storageProvider = $storageProvider; } /** @@ -157,10 +174,49 @@ public function getAddImagesButton() ); } + /** + * Sync images to database + * + * @param string $fileName + */ + private function syncImageToDatabase(string $fileName): void + { + if ($this->fileStorageDatabase->checkDbUsage() && + !$this->mediaDirectory->isFile($this->_mediaConfig->getMediaPath($fileName)) + ) { + $this->fileStorageDatabase->saveFileToFilesystem( + $this->_mediaConfig->getMediaPath($fileName) + ); + } + } + + /** + * Returns file metadata as an associative array + * + * @param string $fileName + * @return array + * @throws FileNotFoundException + */ + private function getFileMetadata(string $fileName): array + { + $metadata = []; + try { + $info = $this->storageProvider->get('media') + ->getMetadata($this->_mediaConfig->getMediaPath($fileName)); + $metadata['size'] = $info['size']; + } catch (FileSystemException $e) { + $metadata['url'] = $this->getImageHelper()->getDefaultPlaceholderUrl('small_image'); + $metadata['size'] = 0; + $this->_logger->warning($e); + } + return $metadata; + } + /** * Returns image json * * @return string + * @throws FileNotFoundException */ public function getImagesJson() { @@ -170,24 +226,14 @@ public function getImagesJson() is_array($value['images']) && count($value['images']) ) { - $mediaDir = $this->_filesystem->getDirectoryRead(DirectoryList::MEDIA); $images = $this->sortImagesByPosition($value['images']); foreach ($images as &$image) { $image['url'] = $this->_mediaConfig->getMediaUrl($image['file']); - if ($this->fileStorageDatabase->checkDbUsage() && - !$mediaDir->isFile($this->_mediaConfig->getMediaPath($image['file'])) - ) { - $this->fileStorageDatabase->saveFileToFilesystem( - $this->_mediaConfig->getMediaPath($image['file']) - ); - } - try { - $fileHandler = $mediaDir->stat($this->_mediaConfig->getMediaPath($image['file'])); - $image['size'] = $fileHandler['size']; - } catch (FileSystemException $e) { - $image['url'] = $this->getImageHelper()->getDefaultPlaceholderUrl('small_image'); - $image['size'] = 0; - $this->_logger->warning($e); + $this->syncImageToDatabase($image['file']); + if (isset($image['image_metadata']) && is_array($image['image_metadata'])) { + $image = array_replace_recursive($image, $image['image_metadata']); + } else { + $image = array_replace_recursive($image, $this->getFileMetadata($image['file'])); } } return $this->_jsonEncoder->encode($images); diff --git a/app/code/Magento/Catalog/Block/Product/Gallery.php b/app/code/Magento/Catalog/Block/Product/Gallery.php index 54f848a92e958..2e9dcd1fe6952 100644 --- a/app/code/Magento/Catalog/Block/Product/Gallery.php +++ b/app/code/Magento/Catalog/Block/Product/Gallery.php @@ -11,9 +11,13 @@ */ namespace Magento\Catalog\Block\Product; +use Magento\Framework\Storage\FileNotFoundException; use Magento\Catalog\Model\Product; -use Magento\Framework\App\Filesystem\DirectoryList; +use Magento\Catalog\Model\Product\Media\Config; +use Magento\Framework\App\ObjectManager; use Magento\Framework\Data\Collection; +use Magento\Framework\Registry; +use Magento\Framework\Storage\StorageProvider; /** * Product gallery block @@ -26,22 +30,37 @@ class Gallery extends \Magento\Framework\View\Element\Template /** * Core registry * - * @var \Magento\Framework\Registry + * @var Registry */ protected $_coreRegistry = null; + /** + * @var StorageProvider + */ + private $storageProvider; + /** + * @var Config + */ + private $mediaConfig; + /** * @param \Magento\Framework\View\Element\Template\Context $context - * @param \Magento\Framework\Registry $registry + * @param Registry $registry * @param array $data + * @param StorageProvider $storageProvider + * @param Config $mediaConfig */ public function __construct( \Magento\Framework\View\Element\Template\Context $context, - \Magento\Framework\Registry $registry, - array $data = [] + Registry $registry, + array $data = [], + StorageProvider $storageProvider = null, + Config $mediaConfig = null ) { $this->_coreRegistry = $registry; parent::__construct($context, $data); + $this->storageProvider = $storageProvider ?? ObjectManager::getInstance()->get(StorageProvider::class); + $this->mediaConfig = $mediaConfig ?? ObjectManager::getInstance()->get(Config::class); } /** @@ -121,16 +140,24 @@ public function getImageFile() */ public function getImageWidth() { - $file = $this->getCurrentImage()->getPath(); - - if ($this->_filesystem->getDirectoryRead(DirectoryList::MEDIA)->isFile($file)) { - $size = getimagesize($file); - if (isset($size[0])) { - if ($size[0] > 600) { + $file = $this->getCurrentImage()->getFile(); + if (!$file) { + return false; + } + $productMediaFile = $this->mediaConfig->getMediaPath($file); + + $mediaStorage = $this->storageProvider->get('media'); + if ($mediaStorage->has($productMediaFile)) { + try { + $meta = $mediaStorage->getMetadata($productMediaFile); + $size = $meta['size']; + if ($size > 600) { return 600; } else { - return (int) $size[0]; + return (int) $size; } + } catch (FileNotFoundException $e) { + return false; } } 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/Controller/Adminhtml/Product/Gallery/Upload.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Gallery/Upload.php index 3e7cc3ee962b9..fda3d0abced7f 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/Gallery/Upload.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/Gallery/Upload.php @@ -8,7 +8,7 @@ use Magento\Framework\App\Action\HttpPostActionInterface as HttpPostActionInterface; use Magento\Framework\App\Filesystem\DirectoryList; use Magento\Framework\App\ObjectManager; -use Magento\Framework\Exception\LocalizedException; +use Magento\Framework\Storage\StorageProvider; /** * Upload product image action controller @@ -52,9 +52,15 @@ class Upload extends \Magento\Backend\App\Action implements HttpPostActionInterf */ private $productMediaConfig; + /** + * @var StorageProvider + */ + private $storageProvider; + /** * @param \Magento\Backend\App\Action\Context $context * @param \Magento\Framework\Controller\Result\RawFactory $resultRawFactory + * @param StorageProvider $storageProvider * @param \Magento\Framework\Image\AdapterFactory $adapterFactory * @param \Magento\Framework\Filesystem $filesystem * @param \Magento\Catalog\Model\Product\Media\Config $productMediaConfig @@ -62,6 +68,7 @@ class Upload extends \Magento\Backend\App\Action implements HttpPostActionInterf public function __construct( \Magento\Backend\App\Action\Context $context, \Magento\Framework\Controller\Result\RawFactory $resultRawFactory, + StorageProvider $storageProvider, \Magento\Framework\Image\AdapterFactory $adapterFactory = null, \Magento\Framework\Filesystem $filesystem = null, \Magento\Catalog\Model\Product\Media\Config $productMediaConfig = null @@ -74,6 +81,7 @@ public function __construct( ->get(\Magento\Framework\Filesystem::class); $this->productMediaConfig = $productMediaConfig ?: ObjectManager::getInstance() ->get(\Magento\Catalog\Model\Product\Media\Config::class); + $this->storageProvider = $storageProvider; } /** @@ -84,6 +92,7 @@ public function __construct( public function execute() { try { + /** @var \Magento\MediaStorage\Model\File\Uploader $uploader */ $uploader = $this->_objectManager->create( \Magento\MediaStorage\Model\File\Uploader::class, ['fileId' => 'image'] @@ -93,11 +102,18 @@ public function execute() $uploader->addValidateCallback('catalog_product_image', $imageAdapter, 'validateUploadFile'); $uploader->setAllowRenameFiles(true); $uploader->setFilesDispersion(true); + $mediaDirectory = $this->filesystem->getDirectoryRead(DirectoryList::MEDIA); + $baseImagePath = $this->productMediaConfig->getBaseTmpMediaPath(); $result = $uploader->save( - $mediaDirectory->getAbsolutePath($this->productMediaConfig->getBaseTmpMediaPath()) + $mediaDirectory->getAbsolutePath($baseImagePath) ); + $origFile = $this->productMediaConfig->getTmpMediaPath($result['file']); + $storage = $this->storageProvider->get('media'); + $content = $mediaDirectory->readFile($origFile); + $storage->put($origFile, $content); + $this->_eventManager->dispatch( 'catalog_product_gallery_upload_image_after', ['result' => $result, 'action' => $this] diff --git a/app/code/Magento/Catalog/Controller/Adminhtml/Product/MassDelete.php b/app/code/Magento/Catalog/Controller/Adminhtml/Product/MassDelete.php index 7fa9d36163502..c779c01cd7d71 100644 --- a/app/code/Magento/Catalog/Controller/Adminhtml/Product/MassDelete.php +++ b/app/code/Magento/Catalog/Controller/Adminhtml/Product/MassDelete.php @@ -8,15 +8,13 @@ namespace Magento\Catalog\Controller\Adminhtml\Product; -use Magento\Framework\App\Action\HttpPostActionInterface as HttpPostActionInterface; -use Magento\Framework\Controller\ResultFactory; use Magento\Backend\App\Action\Context; -use Magento\Ui\Component\MassAction\Filter; -use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory; use Magento\Catalog\Api\ProductRepositoryInterface; -use Magento\Framework\Exception\CouldNotSaveException; -use Magento\Framework\Exception\StateException; +use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory; +use Magento\Framework\App\Action\HttpPostActionInterface as HttpPostActionInterface; +use Magento\Framework\Controller\ResultFactory; use Magento\Framework\Exception\LocalizedException; +use Magento\Ui\Component\MassAction\Filter; use Psr\Log\LoggerInterface; /** diff --git a/app/code/Magento/Catalog/Helper/Image.php b/app/code/Magento/Catalog/Helper/Image.php index 5b0aa0c496ecd..f220fa0ef0444 100644 --- a/app/code/Magento/Catalog/Helper/Image.php +++ b/app/code/Magento/Catalog/Helper/Image.php @@ -13,7 +13,7 @@ use Magento\Framework\View\Element\Block\ArgumentInterface; /** - * Catalog image helper. + * Catalog image helper * * @api * @SuppressWarnings(PHPMD.TooManyFields) @@ -166,7 +166,8 @@ public function __construct( $this->_assetRepo = $assetRepo; $this->viewConfig = $viewConfig; $this->viewAssetPlaceholderFactory = $placeholderFactory - ?: ObjectManager::getInstance()->get(PlaceholderFactory::class); + ?: ObjectManager::getInstance() + ->get(PlaceholderFactory::class); $this->mediaConfig = $mediaConfig ?: ObjectManager::getInstance()->get(CatalogMediaConfig::class); } @@ -573,6 +574,9 @@ public function save() * Return resized product image information * * @return array + * @deprecated Magento is not responsible for image resizing anymore. This method works with local filesystem only. + * Service that provides resized images should guarantee that the image sizes correspond to requested ones. + * Use `getWidth()` and `getHeight()` instead. */ public function getResizedImageInfo() { diff --git a/app/code/Magento/Catalog/Model/Config/Source/Web/CatalogMediaUrlFormat.php b/app/code/Magento/Catalog/Model/Config/Source/Web/CatalogMediaUrlFormat.php index f24044fc92c95..0ceeeb596655d 100644 --- a/app/code/Magento/Catalog/Model/Config/Source/Web/CatalogMediaUrlFormat.php +++ b/app/code/Magento/Catalog/Model/Config/Source/Web/CatalogMediaUrlFormat.php @@ -24,7 +24,7 @@ public function toOptionArray() 'value' => CatalogMediaConfig::IMAGE_OPTIMIZATION_PARAMETERS, 'label' => __('Image optimization based on query parameters') ], - ['value' => CatalogMediaConfig::HASH, 'label' => __('Unique hash per image variant (Legacy mode)')] + ['value' => CatalogMediaConfig::HASH, 'label' => __('Legacy mode (unique hash per image variant)')] ]; } } diff --git a/app/code/Magento/Catalog/Model/ImageUploader.php b/app/code/Magento/Catalog/Model/ImageUploader.php index 0c3e008fa8bb5..d333ea589b997 100644 --- a/app/code/Magento/Catalog/Model/ImageUploader.php +++ b/app/code/Magento/Catalog/Model/ImageUploader.php @@ -6,6 +6,7 @@ namespace Magento\Catalog\Model; use Magento\Framework\File\Uploader; +use Magento\Framework\Storage\StorageProvider; /** * Catalog image uploader @@ -73,6 +74,11 @@ class ImageUploader */ private $allowedMimeTypes; + /** + * @var StorageProvider + */ + private $storageProvider; + /** * ImageUploader constructor * @@ -84,7 +90,9 @@ class ImageUploader * @param string $baseTmpPath * @param string $basePath * @param string[] $allowedExtensions + * @param StorageProvider $storageProvider * @param string[] $allowedMimeTypes + * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( \Magento\MediaStorage\Helper\File\Storage\Database $coreFileStorageDatabase, @@ -95,6 +103,7 @@ public function __construct( $baseTmpPath, $basePath, $allowedExtensions, + StorageProvider $storageProvider, $allowedMimeTypes = [] ) { $this->coreFileStorageDatabase = $coreFileStorageDatabase; @@ -106,6 +115,7 @@ public function __construct( $this->basePath = $basePath; $this->allowedExtensions = $allowedExtensions; $this->allowedMimeTypes = $allowedMimeTypes; + $this->storageProvider = $storageProvider; } /** @@ -220,6 +230,11 @@ public function moveFileFromTmp($imageName, $returnRelativePath = false) $baseTmpImagePath, $baseImagePath ); + + $storage = $this->storageProvider->get('media'); + $content = $this->mediaDirectory->readFile($baseImagePath); + $storage->put($baseImagePath, $content); + } catch (\Exception $e) { throw new \Magento\Framework\Exception\LocalizedException( __('Something went wrong while saving the file(s).') diff --git a/app/code/Magento/Catalog/Model/Product.php b/app/code/Magento/Catalog/Model/Product.php index 12444c9cce202..c5dce0df14755 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 = []; @@ -1539,7 +1540,11 @@ public function getMediaGalleryImages() } $image['url'] = $this->getMediaConfig()->getMediaUrl($image['file']); $image['id'] = $image['value_id']; + + // @deprecated 'path' should not be used + // The file can be absent in local filesystem if remote storage is used $image['path'] = $directory->getAbsolutePath($this->getMediaConfig()->getMediaPath($image['file'])); + $images->addItem(new \Magento\Framework\DataObject($image)); } $this->setData('media_gallery_images', $images); @@ -2062,7 +2067,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 +2078,7 @@ public function setCustomOptions(array $options) /** * Get all custom options of the product * - * @return array + * @return OptionInterface[] */ public function getCustomOptions() { @@ -2084,14 +2089,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 +2103,7 @@ public function getCustomOption($code) */ public function hasCustomOptions() { - if (count($this->_customOptions)) { - return true; - } else { - return false; - } + return (bool)count($this->_customOptions); } /** @@ -2405,16 +2403,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/Gallery/CreateHandler.php b/app/code/Magento/Catalog/Model/Product/Gallery/CreateHandler.php index 225a3a4c44a9b..e56fb8e59d0e9 100644 --- a/app/code/Magento/Catalog/Model/Product/Gallery/CreateHandler.php +++ b/app/code/Magento/Catalog/Model/Product/Gallery/CreateHandler.php @@ -11,6 +11,7 @@ use Magento\Framework\App\Filesystem\DirectoryList; use Magento\Framework\App\ObjectManager; use Magento\Framework\EntityManager\Operation\ExtensionInterface; +use Magento\Framework\Storage\StorageProvider; use Magento\MediaStorage\Model\File\Uploader as FileUploader; use Magento\Store\Model\StoreManagerInterface; @@ -88,6 +89,10 @@ class CreateHandler implements ExtensionInterface * @var \Magento\Store\Model\StoreManagerInterface */ private $storeManager; + /** + * @var StorageProvider + */ + private $storageProvider; /** * @param \Magento\Framework\EntityManager\MetadataPool $metadataPool @@ -98,6 +103,7 @@ class CreateHandler implements ExtensionInterface * @param \Magento\Framework\Filesystem $filesystem * @param \Magento\MediaStorage\Helper\File\Storage\Database $fileStorageDb * @param \Magento\Store\Model\StoreManagerInterface|null $storeManager + * @param StorageProvider $storageProvider * @throws \Magento\Framework\Exception\FileSystemException */ public function __construct( @@ -108,7 +114,8 @@ public function __construct( \Magento\Catalog\Model\Product\Media\Config $mediaConfig, \Magento\Framework\Filesystem $filesystem, \Magento\MediaStorage\Helper\File\Storage\Database $fileStorageDb, - \Magento\Store\Model\StoreManagerInterface $storeManager = null + \Magento\Store\Model\StoreManagerInterface $storeManager = null, + StorageProvider $storageProvider = null ) { $this->metadata = $metadataPool->getMetadata(\Magento\Catalog\Api\Data\ProductInterface::class); $this->attributeRepository = $attributeRepository; @@ -118,6 +125,7 @@ public function __construct( $this->mediaDirectory = $filesystem->getDirectoryWrite(DirectoryList::MEDIA); $this->fileStorageDb = $fileStorageDb; $this->storeManager = $storeManager ?: ObjectManager::getInstance()->get(StoreManagerInterface::class); + $this->storageProvider = $storageProvider ?: ObjectManager::getInstance()->get(StorageProvider::class); } /** @@ -245,7 +253,6 @@ public function getAttribute() 'media_gallery' ); } - return $this->attribute; } @@ -290,7 +297,8 @@ protected function processNewAndExistingImages($product, array &$images) $data['position'] = isset($image['position']) ? (int)$image['position'] : 0; $data['disabled'] = isset($image['disabled']) ? (int)$image['disabled'] : 0; $data['store_id'] = (int)$product->getStoreId(); - + $stat = $this->mediaDirectory->stat($this->mediaConfig->getMediaPath($image['file'])); + $data['image_metadata']['size'] = $stat['size']; $data[$this->metadata->getLinkField()] = (int)$product->getData($this->metadata->getLinkField()); $this->resourceModel->insertGalleryValueInStore($data); @@ -366,20 +374,20 @@ protected function moveImageFromTmp($file) $file = $this->getFilenameFromTmp($this->getSafeFilename($file)); $destinationFile = $this->getUniqueFileName($file); - if ($this->fileStorageDb->checkDbUsage()) { - $this->fileStorageDb->renameFile( - $this->mediaConfig->getTmpMediaShortUrl($file), - $this->mediaConfig->getMediaShortUrl($destinationFile) - ); + $tmpMediaPath = $this->mediaConfig->getTmpMediaPath($file); + $mediaPath = $this->mediaConfig->getMediaPath($destinationFile); + $this->mediaDirectory->renameFile( + $tmpMediaPath, + $mediaPath + ); + $this->fileStorageDb->renameFile( + $this->mediaConfig->getTmpMediaShortUrl($file), + $this->mediaConfig->getMediaShortUrl($destinationFile) + ); - $this->mediaDirectory->delete($this->mediaConfig->getTmpMediaPath($file)); - $this->mediaDirectory->delete($this->mediaConfig->getMediaPath($destinationFile)); - } else { - $this->mediaDirectory->renameFile( - $this->mediaConfig->getTmpMediaPath($file), - $this->mediaConfig->getMediaPath($destinationFile) - ); - } + $storage = $this->storageProvider->get('media'); + $content = $this->mediaDirectory->readFile($mediaPath); + $storage->put($mediaPath, $content); return str_replace('\\', '/', $destinationFile); } diff --git a/app/code/Magento/Catalog/Model/Product/Image.php b/app/code/Magento/Catalog/Model/Product/Image.php index 7c2a53768fd47..6a0032ca694a5 100644 --- a/app/code/Magento/Catalog/Model/Product/Image.php +++ b/app/code/Magento/Catalog/Model/Product/Image.php @@ -14,7 +14,8 @@ use Magento\Framework\Image as MagentoImage; use Magento\Framework\Serialize\SerializerInterface; use Magento\Catalog\Model\Product\Image\ParamsBuilder; -use Magento\Framework\Filesystem\Driver\File as FilesystemDriver; +use Magento\Framework\Storage\StorageInterface; +use Magento\Framework\Storage\StorageProvider; /** * Image operations @@ -203,9 +204,9 @@ class Image extends \Magento\Framework\Model\AbstractModel private $serializer; /** - * @var FilesystemDriver + * @var StorageInterface */ - private $filesystemDriver; + private $storage; /** * Constructor @@ -222,12 +223,12 @@ class Image extends \Magento\Framework\Model\AbstractModel * @param ImageFactory $viewAssetImageFactory * @param PlaceholderFactory $viewAssetPlaceholderFactory * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig + * @param StorageProvider $storageProvider * @param \Magento\Framework\Model\ResourceModel\AbstractResource $resource * @param \Magento\Framework\Data\Collection\AbstractDb $resourceCollection * @param array $data * @param SerializerInterface $serializer * @param ParamsBuilder $paramsBuilder - * @param FilesystemDriver $filesystemDriver * @throws \Magento\Framework\Exception\FileSystemException * @SuppressWarnings(PHPMD.ExcessiveParameterList) * @SuppressWarnings(PHPMD.UnusedLocalVariable) @@ -245,27 +246,30 @@ public function __construct( ImageFactory $viewAssetImageFactory, PlaceholderFactory $viewAssetPlaceholderFactory, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, + StorageProvider $storageProvider, \Magento\Framework\Model\ResourceModel\AbstractResource $resource = null, \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, array $data = [], SerializerInterface $serializer = null, - ParamsBuilder $paramsBuilder = null, - FilesystemDriver $filesystemDriver = null + ParamsBuilder $paramsBuilder = null ) { $this->_storeManager = $storeManager; $this->_catalogProductMediaConfig = $catalogProductMediaConfig; - $this->_coreFileStorageDatabase = $coreFileStorageDatabase; - parent::__construct($context, $registry, $resource, $resourceCollection, $data); + $this->_mediaDirectory = $filesystem->getDirectoryWrite(DirectoryList::MEDIA); + $this->_coreFileStorageDatabase = $coreFileStorageDatabase; $this->_imageFactory = $imageFactory; + $this->viewAssetImageFactory = $viewAssetImageFactory; + + $this->storage = $storageProvider->get('media'); + + parent::__construct($context, $registry, $resource, $resourceCollection, $data); $this->_assetRepo = $assetRepo; $this->_viewFileSystem = $viewFileSystem; $this->_scopeConfig = $scopeConfig; - $this->viewAssetImageFactory = $viewAssetImageFactory; $this->viewAssetPlaceholderFactory = $viewAssetPlaceholderFactory; $this->serializer = $serializer ?: ObjectManager::getInstance()->get(SerializerInterface::class); $this->paramsBuilder = $paramsBuilder ?: ObjectManager::getInstance()->get(ParamsBuilder::class); - $this->filesystemDriver = $filesystemDriver ?: ObjectManager::getInstance()->get(FilesystemDriver::class); } /** @@ -433,19 +437,20 @@ public function setBaseFile($file) { $this->_isBaseFilePlaceholder = false; - $this->imageAsset = $this->viewAssetImageFactory->create( - [ - 'miscParams' => $this->getMiscParams(), - 'filePath' => $file, - ] - ); - if ($file == 'no_selection' || !$this->_fileExists($this->imageAsset->getSourceFile())) { + if ($file == 'no_selection' || empty($file)) { $this->_isBaseFilePlaceholder = true; $this->imageAsset = $this->viewAssetPlaceholderFactory->create( [ 'type' => $this->getDestinationSubdir(), ] ); + } else { + $this->imageAsset = $this->viewAssetImageFactory->create( + [ + 'miscParams' => $this->getMiscParams(), + 'filePath' => $file, + ] + ); } $this->_baseFile = $this->imageAsset->getSourceFile(); @@ -677,12 +682,7 @@ public function getDestinationSubdir() public function isCached() { $path = $this->imageAsset->getPath(); - try { - $isCached = is_array($this->loadImageInfoFromCache($path)) || $this->filesystemDriver->isExists($path); - } catch (FileSystemException $e) { - $isCached = false; - } - return $isCached; + return is_array($this->loadImageInfoFromCache($path)) || $this->_mediaDirectory->isExist($path); } /** @@ -854,35 +854,20 @@ public function clearCache() { $directory = $this->_catalogProductMediaConfig->getBaseMediaPath() . '/cache'; $this->_mediaDirectory->delete($directory); + $this->storage->deleteDir($directory); $this->_coreFileStorageDatabase->deleteFolder($this->_mediaDirectory->getAbsolutePath($directory)); $this->clearImageInfoFromCache(); } - /** - * First check this file on FS - * - * If it doesn't exist - try to download it from DB - * - * @param string $filename - * @return bool - */ - protected function _fileExists($filename) - { - if ($this->_mediaDirectory->isFile($filename)) { - return true; - } else { - return $this->_coreFileStorageDatabase->saveFileToFilesystem( - $this->_mediaDirectory->getAbsolutePath($filename) - ); - } - } - /** * Return resized product image information * * @return array * @throws NotLoadInfoImageException + * @deprecated Magento is not responsible for image resizing anymore. This method works with local filesystem only. + * Service that provides resized images should guarantee that the image sizes correspond to requested ones. + * Use `getWidth()` and `getHeight()` instead. */ public function getResizedImageInfo() { 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/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 afbe279045a38..12e3c6b53d701 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php @@ -12,6 +12,7 @@ use Magento\Catalog\Model\Indexer\Product\Price\PriceTableResolver; use Magento\Catalog\Model\Product\Attribute\Source\Status as ProductStatus; use Magento\Catalog\Model\Product\Gallery\ReadHandler as GalleryReadHandler; +use Magento\Catalog\Model\ResourceModel\Category; use Magento\Catalog\Model\ResourceModel\Product\Collection\ProductLimitationFactory; use Magento\CatalogUrlRewrite\Model\ProductUrlRewriteGenerator; use Magento\CatalogUrlRewrite\Model\Storage\DbStorage; @@ -23,7 +24,6 @@ use Magento\Framework\Indexer\DimensionFactory; use Magento\Store\Model\Indexer\WebsiteDimensionProvider; use Magento\Store\Model\Store; -use Magento\Catalog\Model\ResourceModel\Category; /** * Product collection @@ -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'])) { @@ -2336,49 +2337,35 @@ public function addPriceDataFieldFilter($comparisonFormat, $fields) * @SuppressWarnings(PHPMD.NPathComplexity) * @since 101.0.1 * @throws \Magento\Framework\Exception\LocalizedException + * @throws \Zend_Db_Statement_Exception */ public function addMediaGalleryData() { if ($this->getFlag('media_gallery_added')) { return $this; } - if (!$this->getSize()) { return $this; } - - $items = $this->getItems(); - $linkField = $this->getProductEntityMetadata()->getLinkField(); - - $select = $this->getMediaGalleryResource() - ->createBatchBaseSelect( - $this->getStoreId(), - $this->getAttribute('media_gallery')->getAttributeId() - )->reset( - Select::ORDER // we don't care what order is in current scenario - )->where( - 'entity.' . $linkField . ' IN (?)', - array_map( - function ($item) use ($linkField) { - return (int) $item->getOrigData($linkField); - }, - $items - ) - ); - + if (!$this->isLoaded()) { + $this->load(); + } + $records = $this->getMediaGalleryResource()->getMediaRecords( + $this->getStoreId(), + $this->getLoadedIds() + ); $mediaGalleries = []; - foreach ($this->getConnection()->fetchAll($select) as $row) { - $mediaGalleries[$row[$linkField]][] = $row; + foreach ($records as $record) { + $mediaGalleries[$record['entity_id']][] = $record; } - foreach ($items as $item) { + foreach ($this->getItems() as $item) { $this->getGalleryReadHandler() ->addMediaDataToProduct( $item, - $mediaGalleries[$item->getOrigData($linkField)] ?? [] + $mediaGalleries[$item->getId()] ?? [] ); } - $this->setFlag('media_gallery_added', true); return $this; } diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Gallery.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Gallery.php index a9741cd8e1ec7..6acda0e574828 100644 --- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Gallery.php +++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Gallery.php @@ -6,6 +6,8 @@ namespace Magento\Catalog\Model\ResourceModel\Product; +use Magento\Framework\DB\Select; +use Magento\Framework\DB\Sql\ColumnValueExpression; use Magento\Store\Model\Store; /** @@ -33,9 +35,12 @@ class Gallery extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb protected $metadata; /** + * Gallery constructor. + * * @param \Magento\Framework\Model\ResourceModel\Db\Context $context * @param \Magento\Framework\EntityManager\MetadataPool $metadataPool * @param string $connectionName + * @throws \Exception */ public function __construct( \Magento\Framework\Model\ResourceModel\Db\Context $context, @@ -45,7 +50,6 @@ public function __construct( $this->metadata = $metadataPool->getMetadata( \Magento\Catalog\Api\Data\ProductInterface::class ); - parent::__construct($context, $connectionName); } @@ -122,19 +126,14 @@ public function loadDataFromTableByValueId( * @param int $attributeId * @return array * @since 101.0.0 + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + * @throws \Magento\Framework\Exception\LocalizedException + * @throws \Zend_Db_Statement_Exception */ - public function loadProductGalleryByAttributeId($product, $attributeId) + public function loadProductGalleryByAttributeId($product, $attributeId = null) { - $select = $this->createBaseLoadSelect( - $product->getData($this->metadata->getLinkField()), - $product->getStoreId(), - $attributeId - ); - - $result = $this->getConnection()->fetchAll($select); - + $result = $this->getMediaRecords($product->getStoreId(), [$product->getId()], true); $this->removeDuplicates($result); - return $result; } @@ -144,6 +143,7 @@ public function loadProductGalleryByAttributeId($product, $attributeId) * @param int $entityId * @param int $storeId * @param int $attributeId + * @deprecated Misleading method, methods relies on autoincrement field instead of entity ID * @return \Magento\Framework\DB\Select * @throws \Magento\Framework\Exception\LocalizedException * @since 101.0.0 @@ -159,6 +159,35 @@ protected function createBaseLoadSelect($entityId, $storeId, $attributeId) return $select; } + /** + * Returns media entries from database + * + * @param int $storeId + * @param array $entityIds + * @param bool $preserveSortOrder + * @return array + * @throws \Magento\Framework\Exception\LocalizedException + * @throws \Zend_Db_Statement_Exception + */ + public function getMediaRecords(int $storeId, array $entityIds, bool $preserveSortOrder = false) : array + { + $output = []; + $select = $this->createBatchBaseSelect($storeId) + ->where('cpe.entity_id IN (?)', $entityIds); + if (!$preserveSortOrder) { + // due to performance consideration it is better to do not use sorting for this query + $select->reset(Select::ORDER); + } + $cursor = $this->getConnection()->query($select); + while ($row = $cursor->fetch()) { + if (!empty($row['image_metadata'])) { + $row['image_metadata'] = $this->getSerializer()->unserialize($row['image_metadata']); + } + $output[] = $row; + } + return $output; + } + /** * Create batch base select * @@ -166,9 +195,10 @@ protected function createBaseLoadSelect($entityId, $storeId, $attributeId) * @param int $attributeId * @return \Magento\Framework\DB\Select * @throws \Magento\Framework\Exception\LocalizedException + * @SuppressWarnings(PHPMD.UnusedFormalParameter) Media gallery doesn't support other attributes than media_galley * @since 101.0.1 */ - public function createBatchBaseSelect($storeId, $attributeId) + public function createBatchBaseSelect($storeId, $attributeId = null) { $linkField = $this->metadata->getLinkField(); @@ -191,6 +221,10 @@ public function createBatchBaseSelect($storeId, $attributeId) ['entity' => $this->getTable(self::GALLERY_VALUE_TO_ENTITY_TABLE)], $mainTableAlias . '.value_id = entity.value_id', [$linkField] + )->joinInner( + ['cpe' => $this->getTable('catalog_product_entity')], + sprintf('cpe.%1$s = entity.%1$s', $linkField), + ['entity_id' => 'cpe.entity_id'] )->joinLeft( ['value' => $this->getTable(self::GALLERY_VALUE_TABLE)], implode( @@ -219,16 +253,15 @@ public function createBatchBaseSelect($storeId, $attributeId) 'disabled' => $this->getConnection()->getIfNullSql('`value`.`disabled`', '`default_value`.`disabled`'), 'label_default' => 'default_value.label', 'position_default' => 'default_value.position', - 'disabled_default' => 'default_value.disabled' + 'disabled_default' => 'default_value.disabled', + 'image_metadata' => new ColumnValueExpression( + 'JSON_MERGE_PATCH(default_value.image_metadata, value.image_metadata)' + ) ])->where( - $mainTableAlias . '.attribute_id = ?', - $attributeId - )->where( $mainTableAlias . '.disabled = 0' )->order( $positionCheckSql . ' ' . \Magento\Framework\DB\Select::SQL_ASC ); - return $select; } @@ -357,6 +390,9 @@ public function insertGalleryValueInStore($data) $this->getTable(self::GALLERY_VALUE_TABLE) ); + if (!empty($data['image_metadata'])) { + $data['image_metadata'] = $this->getSerializer()->serialize($data['image_metadata']); + } $this->getConnection()->insert( $this->getTable(self::GALLERY_VALUE_TABLE), $data diff --git a/app/code/Magento/Catalog/Model/View/Asset/Image/Context.php b/app/code/Magento/Catalog/Model/View/Asset/Image/Context.php index 49d150a31750c..ead68c897f95f 100644 --- a/app/code/Magento/Catalog/Model/View/Asset/Image/Context.php +++ b/app/code/Magento/Catalog/Model/View/Asset/Image/Context.php @@ -47,11 +47,10 @@ public function __construct( $this->mediaConfig = $mediaConfig; $this->filesystem = $filesystem; $this->mediaDirectory = $this->filesystem->getDirectoryWrite(DirectoryList::MEDIA); - $this->mediaDirectory->create($this->mediaConfig->getBaseMediaPath()); } /** - * {@inheritdoc} + * @inheritdoc */ public function getPath() { @@ -59,7 +58,7 @@ public function getPath() } /** - * {@inheritdoc} + * @inheritdoc */ public function getBaseUrl() { diff --git a/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml b/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml index 5174620764271..a44db8010a822 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Data/ProductData.xml @@ -212,6 +212,17 @@ <data key="quantity">1001</data> <requiredEntity type="product_extension_attribute">EavStockItem</requiredEntity> </entity> + <entity name="SimpleProductDisabledStockQuantityZero" type="product"> + <data key="sku" unique="suffix">testSku</data> + <data key="type_id">simple</data> + <data key="attribute_set_id">4</data> + <data key="name" unique="suffix">Simple Product Disabled Quantity Zero</data> + <data key="price">123.00</data> + <data key="visibility">4</data> + <data key="status">2</data> + <data key="quantity">0</data> + <requiredEntity type="product_extension_attribute">EavStock0</requiredEntity> + </entity> <entity name="SimpleProductNotVisibleIndividually" type="product"> <data key="name" unique="suffix">Simple Product Not Visible Individually</data> <data key="sku" unique="suffix">simple_product_not_visible_individually</data> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AddOutOfStockProductToCompareListTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AddOutOfStockProductToCompareListTest.xml index 9991bc882e5be..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 @@ <magentoCLI command="cache:flush" stepKey="flushCache"/> <deleteData createDataKey="product" stepKey="deleteProduct"/> <deleteData createDataKey="category" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Open product page--> <comment userInput="Open product page" stepKey="openProdPage"/> 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 @@ <actionGroup ref="LoginAsAdmin" stepKey="logInAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> <deleteData createDataKey="simpleProduct1" stepKey="deleteSimp1"/> <deleteData createDataKey="simpleProduct2" stepKey="deleteSimp2"/> 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 @@ <actionGroup ref="DeleteCategoryActionGroup" stepKey="DeleteCategory"> <argument name="categoryEntity" value="SimpleSubCategory"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Go to create a new category with image --> 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"> <test name="AdminAddImageToWYSIWYGCatalogTest"> <before> - <actionGroup ref="LoginActionGroup" stepKey="login"/> + <actionGroup ref="AdminLoginActionGroup" stepKey="login"/> <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> @@ -55,7 +55,7 @@ <argument name="categoryEntity" value="SimpleSubCategory"/> </actionGroup> <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> </test> </tests> 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 @@ <testCaseId value="MAGETWO-84375"/> </annotations> <before> - <actionGroup ref="LoginActionGroup" stepKey="login"/> + <actionGroup ref="AdminLoginActionGroup" stepKey="login"/> <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> <after> <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <amOnPage url="{{AdminProductCreatePage.url(AddToDefaultSet.attributeSetId, 'simple')}}" stepKey="navigateToNewProduct"/> 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 @@ <!--Delete created entity --> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Open Product Index Page and filter the product--> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> 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 @@ <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex1"/> <waitForPageLoad time="30" stepKey="waitForProductIndexPageLoad"/> <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetGridToDefaultKeywordSearch"/> - <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> </after> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> <!--Case: Group Price--> @@ -292,7 +292,7 @@ <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> <waitForPageLoad time="30" stepKey="waitForProductIndexPageLoad"/> <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetGridToDefaultKeywordSearch"/> - <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> </after> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> <actionGroup ref="SearchForProductOnBackendActionGroup" stepKey="searchForSimpleProduct"> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminAssignProductAttributeToAttributeSetTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminAssignProductAttributeToAttributeSetTest.xml index bcb8af7209d8f..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,7 @@ </before> <after> <deleteData createDataKey="attribute" stepKey="deleteAttribute"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> 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 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToCategoriesPage"> <argument name="menuUiId" value="{{AdminMenuCatalog.dataUiId}}"/> 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 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToCatalogProductsPage"> <argument name="menuUiId" value="{{AdminMenuCatalog.dataUiId}}"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckConfigurableProductPriceWithDisabledChildProductTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckConfigurableProductPriceWithDisabledChildProductTest.xml index 6a3ff738f1846..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,7 @@ <deleteData createDataKey="createConfigChildProduct2" stepKey="deleteConfigChildProduct2"/> <deleteData createDataKey="createConfigChildProduct3" stepKey="deleteConfigChildProduct3"/> <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteAttribute"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckCustomAttributeValuesAfterProductSaveTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCheckCustomAttributeValuesAfterProductSaveTest.xml index 4aa9474aba6fe..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,7 @@ <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> <deleteData createDataKey="createMultiSelectProductAttribute" stepKey="deleteMultiSelectProductAttribute"/> <!-- Logout from Admin page --> - <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> 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 @@ <after> <!--Delete created data--> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Open Category Page--> <amOnPage url="{{AdminCategoryPage.url}}" stepKey="openAdminCategoryIndexPage"/> 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 @@ <after> <!--Delete created data--> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Open Category Page--> <amOnPage url="{{AdminCategoryPage.url}}" stepKey="openAdminCategoryIndexPage"/> 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 @@ <after> <!--Delete created data--> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Open Category Page--> <amOnPage url="{{AdminCategoryPage.url}}" stepKey="openAdminCategoryIndexPage"/> 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 @@ <!-- Delete created entity --> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Open Product Index Page and filter the product--> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> 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 @@ <!-- Delete created entity --> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <magentoCLI stepKey="setDisplayOutOfStockProduct" command="config:set cataloginventory/options/show_out_of_stock 0" /> </after> <!--Open Product Index Page and filter the product--> 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 @@ <deleteData createDataKey="simpleProduct28" stepKey="deleteSimpleProduct28"/> <deleteData createDataKey="simpleProduct29" stepKey="deleteSimpleProduct29"/> <deleteData createDataKey="simpleProduct30" stepKey="deleteSimpleProduct30"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Verify default number of products displayed in the grid view--> <comment userInput="Verify default number of products displayed in the grid view" stepKey="commentVerifyDefaultValues"/> 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 @@ <after> <!--Delete created data--> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Open Category Page--> <amOnPage url="{{AdminCategoryPage.url}}" stepKey="openAdminCategoryIndexPage"/> 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 @@ <argument name="product" value="$$createSimpleProduct$$"/> </actionGroup> <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetFiltersIfExist"/> - <actionGroup ref="logout" stepKey="logoutOfAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutOfAdmin"/> </after> <amOnPage url="{{AdminProductEditPage.url($$createSimpleProduct.id$$)}}" stepKey="goToProductEditPage"/> <waitForPageLoad stepKey="waitForSimpleProductPageLoad"/> 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 @@ <deleteData createDataKey="createThirdRelatedProduct" stepKey="deleteThirdRelatedProduct"/> <!-- Log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Create new simple product --> 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 @@ <deleteData createDataKey="createThirdRelatedProduct" stepKey="deleteThirdRelatedProduct"/> <!-- Log out --> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> </after> <comment userInput="remove me" stepKey="disableWYSIWYG"/> 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 @@ <group value="category"/> </annotations> <after> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> </after> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin1"/> @@ -52,7 +52,7 @@ </before> <after> <actionGroup ref="RestoreLayoutSetting" stepKey="sampleActionGroup"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <amOnPage url="{{WebConfigurationPage.url}}" stepKey="navigateToWebConfigurationPage"/> <waitForPageLoad stepKey="waitForPageLoad"/> @@ -83,7 +83,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <amOnPage url="{{AdminCategoryPage.url}}" stepKey="navigateToCategoryPage"/> <waitForPageLoad time="30" stepKey="waitForPageLoad1"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithAnchorFieldTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithAnchorFieldTest.xml index 5e7a8defdc28f..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 @@ </before> <after> <actionGroup ref="DeleteCategoryActionGroup" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <deleteData createDataKey="createDefaultCMSBlock" stepKey="deleteDefaultCMSBlock"/> <deleteData stepKey="deleteSimpleProduct" createDataKey="simpleProduct"/> </after> 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 @@ <actionGroup ref="DeleteCategoryActionGroup" stepKey="deleteCreatedNewRootCategory"> <argument name="categoryEntity" value="NewRootCategory"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <amOnPage url="{{AdminCategoryPage.url}}" stepKey="openAdminCategoryIndexPage"/> <waitForPageLoad stepKey="waitForCategoryIndexPageToBeLoaded"/> 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 @@ <see selector="You deleted the category." stepKey="seeDeleteSuccess"/> <click selector="{{AdminCategorySidebarTreeSection.expandAll}}" stepKey="expandToSeeAllCategories"/> <dontSee selector="{{AdminCategorySidebarTreeSection.categoryInTree(FirstLevelSubCat.name)}}" stepKey="dontSeeCategoryInTree"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Create Category with Five Nesting --> <amOnPage url="{{AdminCategoryPage.url}}" stepKey="openAdminCategoryIndexPage"/> 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 @@ </before> <after> <actionGroup ref="DeleteCategoryActionGroup" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Create In active Category --> <amOnPage url="{{AdminCategoryPage.url}}" stepKey="openAdminCategoryIndexPage"/> 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 @@ </before> <after> <actionGroup ref="DeleteCategoryActionGroup" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Create Category with not included in menu Subcategory --> <amOnPage url="{{AdminCategoryPage.url}}" stepKey="openAdminCategoryIndexPage"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithNoAnchorFieldTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithNoAnchorFieldTest.xml index 9957198285056..5342dec6b1ebb 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithNoAnchorFieldTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateCategoryWithNoAnchorFieldTest.xml @@ -24,7 +24,7 @@ </before> <after> <actionGroup ref="DeleteCategoryActionGroup" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <deleteData createDataKey="createDefaultCMSBlock" stepKey="deleteDefaultCMSBlock"/> <deleteData stepKey="deleteSimpleProduct" createDataKey="simpleProduct"/> </after> 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 @@ <argument name="product" value="SimpleProduct"/> </actionGroup> <actionGroup ref="NavigateToAndResetProductGridToDefaultViewActionGroup" stepKey="NavigateToAndResetProductGridToDefaultView"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductList"/> <waitForPageLoad stepKey="waitForProductList"/> 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 @@ </before> <after> <actionGroup ref="DeleteCategoryActionGroup" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Create subcategory with required fields --> <amOnPage url="{{AdminCategoryPage.url}}" stepKey="openAdminCategoryIndexPage"/> 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 @@ <argument name="ProductAttribute" value="newProductAttribute"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Open Product Index Page--> 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 @@ <argument name="ProductAttribute" value="DatetimeProductAttribute"/> </actionGroup> <actionGroup ref="AdminGridFilterResetActionGroup" stepKey="resetGridFilter"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Generate the datetime default value --> <generateDate date="now" format="n/j/y g:i A" stepKey="generateDefaultValue"/> 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 @@ <actionGroup ref="DeleteProductAttributeActionGroup" stepKey="deleteAttribute"> <argument name="ProductAttribute" value="productDropDownAttribute"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <amOnPage url="{{ProductAttributePage.url}}" stepKey="navigateToNewProductAttributePage"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDropdownProductAttributeVisibleInStorefrontAdvancedSearchFormTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDropdownProductAttributeVisibleInStorefrontAdvancedSearchFormTest.xml index 00e0758f6e70b..b36cbc27f7086 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDropdownProductAttributeVisibleInStorefrontAdvancedSearchFormTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateDropdownProductAttributeVisibleInStorefrontAdvancedSearchFormTest.xml @@ -36,7 +36,7 @@ <after> <deleteData createDataKey="attribute" stepKey="deleteProductAttribute"/> <deleteData createDataKey="createAttributeSet" stepKey="deleteAttributeSet"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> 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 @@ </before> <after> <deleteData createDataKey="category" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Open Category Page and select Add category --> 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 @@ <after> <deleteData createDataKey="subCategory" stepKey="deleteSubCategory"/> <deleteData createDataKey="category" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Go to new simple product page --> 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 @@ <actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteStoreViewFr"> <argument name="customStore" value="customStoreFR"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Select created category and make category inactive--> <amOnPage url="{{AdminCategoryPage.url}}" stepKey="openAdminCategoryIndexPage"/> 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 @@ <actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteStoreViewFr"> <argument name="customStore" value="customStoreFR"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Select created category and make category inactive--> <amOnPage url="{{AdminCategoryPage.url}}" stepKey="openAdminCategoryIndexPage"/> 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 @@ <argument name="customStore" value="customStoreFR"/> </actionGroup> <deleteData createDataKey="category" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Select created category and disable Include In Menu option--> <amOnPage url="{{AdminCategoryPage.url}}" stepKey="openAdminCategoryIndexPage"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateMultipleSelectProductAttributeVisibleInStorefrontAdvancedSearchFormTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateMultipleSelectProductAttributeVisibleInStorefrontAdvancedSearchFormTest.xml index 56a6a869d8d35..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,7 @@ <!-- Delete product attribute set --> <deleteData createDataKey="createAttributeSet" stepKey="deleteAttributeSet"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> 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 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="GoToProductCatalogPageActionGroup" stepKey="goToProductCatalogPage"/> 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 @@ <argument name="ProductAttribute" value="productDropDownAttribute"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Create 2 store views--> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateNewGroupForAttributeSetTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateNewGroupForAttributeSetTest.xml index 12d4f825c3764..f468f61fada04 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateNewGroupForAttributeSetTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateNewGroupForAttributeSetTest.xml @@ -28,7 +28,7 @@ <after> <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/> <deleteData createDataKey="createAttributeSet" stepKey="deleteAttributeSet"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> 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 @@ <argument name="ProductAttribute" value="newProductAttribute"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Open Product Index Page--> 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 @@ <actionGroup ref="DeleteProductAttributeActionGroup" stepKey="deleteCreatedAttribute"> <argument name="ProductAttribute" value="newProductAttribute"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Open Product Index Page--> 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 @@ </createData> </before> <after> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> <deleteData createDataKey="simpleProduct" stepKey="deleteProduct"/> </after> @@ -62,7 +62,7 @@ <argument name="product" value="$$createSimpleProduct$$"/> </actionGroup> <deleteData createDataKey="createCategory" stepKey="deletePreReqCatalog" /> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> <actionGroup ref="SearchForProductOnBackendActionGroup" stepKey="searchForSimpleProduct1"> 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 @@ <actionGroup ref="DeleteCategoryActionGroup" stepKey="deleteCreatedNewRootCategory"> <argument name="categoryEntity" value="NewRootCategory"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout2"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout2"/> </after> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin1"/> <amOnPage url="{{AdminCategoryPage.url}}" stepKey="amOnAdminCategoryPage"/> @@ -70,7 +70,7 @@ <selectOption userInput="{{NewRootCategory.name}}" selector="{{AdminNewStoreGroupSection.storeRootCategoryDropdown}}" stepKey="selectOptionCreatedNewRootCategory"/> <click selector="{{AdminStoreGroupActionsSection.saveButton}}" stepKey="clickSaveStoreButton"/> <click selector="{{AdminConfirmationModalSection.ok}}" stepKey="clickOkOnModalDialog1"/> - <actionGroup ref="logout" stepKey="logout1"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout1"/> <!--Go to storefront and verify created subcategory on frontend--> <amOnPage url="{{StorefrontHomePage.url}}" stepKey="goToStorefrontPage"/> <waitForPageLoad stepKey="waitForPageAdminSystemStoreLoad2"/> 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 @@ <actionGroup ref="DeleteCategoryActionGroup" stepKey="deleteCategory"> <argument name="categoryEntity" value="_defaultCategory" /> </actionGroup> - <actionGroup ref="logout" stepKey="logout" /> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout" /> </after> <amOnPage url="{{AdminCategoryPage.url}}" stepKey="OpenAdminCatergoryIndexPage"/> 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 @@ <argument name="category" value="$$createPreReqCategory$$"/> <argument name="simpleProduct" value="_defaultProduct"/> </actionGroup> + <magentoCLI stepKey="runCronIndex" command="cron:run --group=index"/> <actionGroup ref="AssertProductInStorefrontCategoryPage" stepKey="assertProductInStorefront1"> <argument name="category" value="$$createPreReqCategory$$"/> <argument name="product" value="_defaultProduct"/> @@ -54,7 +55,7 @@ </before> <after> <actionGroup ref="RestoreLayoutSetting" stepKey="sampleActionGroup"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <amOnPage url="{{WebConfigurationPage.url}}" stepKey="navigateToWebConfigurationPage"/> <waitForPageLoad stepKey="waitForPageLoad"/> 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 @@ <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteCreatedProduct"> <argument name="sku" value="{{nameAndAttributeSkuMaskSimpleProduct.name}}-{{nameAndAttributeSkuMaskSimpleProduct.country_of_manufacture_label}}" /> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <amOnPage url="{{ProductCatalogPage.url}}" stepKey="openProductCatalogPage"/> 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 @@ <argument name="sku" value="{{_defaultProduct.sku}}"/> </actionGroup> <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearFiltersOnProductIndexPage"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Generate default value --> 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 @@ <createData entity="_defaultCategory" stepKey="createPreReqCategory"/> </before> <after> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> <deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCategory"/> </after> 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 @@ </actionGroup> <!-- Log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Go to Stores > Product, click "Add New Attribute" --> 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 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <amOnPage url="{{ProductCatalogPage.url}}" stepKey="OpenProductCatalogPage"/> 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 @@ <argument name="sku" value="{{virtualProductOutOfStock.sku}}"/> </actionGroup> <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearFilter"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <amOnPage url="{{ProductCatalogPage.url}}" stepKey="OpenProductCatalogPage"/> 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 @@ <argument name="sku" value="{{virtualProductCustomImportOptions.sku}}"/> </actionGroup> <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="resetOrderFilter"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <amOnPage url="{{ProductCatalogPage.url}}" stepKey="OpenProductCatalogPage"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductWithTierPriceForGeneralGroupTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductWithTierPriceForGeneralGroupTest.xml index b2ddaac65d070..84cba791c6629 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductWithTierPriceForGeneralGroupTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminCreateVirtualProductWithTierPriceForGeneralGroupTest.xml @@ -33,7 +33,7 @@ <waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitForSuccessMessageAppears"/> <see selector="{{AdminMessagesSection.success}}" userInput="A total of 1 record(s) have been deleted." stepKey="seeSuccessMessage"/> <actionGroup ref="AdminClearFiltersActionGroup" stepKey="clearFiltersAfter"/> - <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> </after> <!-- Create virtual product--> 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 @@ </before> <after> <deleteData stepKey="deleteSimpleSubCategory" createDataKey="categoryEntity"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <amOnPage url="{{ProductCatalogPage.url}}" stepKey="OpenProductCatalogPage"/> 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 @@ </before> <after> <deleteData stepKey="deleteSimpleSubCategory" createDataKey="categoryEntity"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <amOnPage url="{{ProductCatalogPage.url}}" stepKey="OpenProductCatalogPage"/> 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 @@ </before> <after> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <amOnPage url="{{AdminProductAttributeSetGridPage.url}}" stepKey="goToAttributeSetsPage"/> <fillField selector="{{AdminProductAttributeSetGridSection.filter}}" userInput="$$createAttributeSet.attribute_set_name$$" stepKey="filterByAttributeName"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteConfigurableChildProductsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteConfigurableChildProductsTest.xml index 04a4eff0a26d4..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,7 @@ <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/> <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteAttribute"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteDropdownProductAttributeFromAttributeSetTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteDropdownProductAttributeFromAttributeSetTest.xml index 58e60da3bdac5..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,7 @@ <after> <!--Delete Created Data --> <deleteData createDataKey="createAttributeSet" stepKey="deleteAttributeSet"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteProductAttributeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteProductAttributeTest.xml index d72806cb0991d..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,7 @@ <createData entity="productAttributeWysiwyg" stepKey="createProductAttribute"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> 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 @@ </before> <after> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteSimpleProductFilteredBySkuAndName"> <argument name="product" value="$$createSimpleProduct$$"/> 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 @@ <deleteData createDataKey="createRootCategory" stepKey="deleteRootCategory"/> <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> <createData entity="DefaultWebUrlOptionsConfig" stepKey="defaultWebUrlOptionsConfig"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Grab new store view code--> <amOnPage url="{{AdminSystemStorePage.url}}" stepKey="navigateToNewWebsitePage"/> 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 @@ <argument name="storeGroupName" value="customStore.code"/> </actionGroup> <deleteData createDataKey="rootCategory" stepKey="deleteRootCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <amOnPage url="{{AdminSystemStorePage.url}}" stepKey="amOnAdminSystemStorePage"/> @@ -48,4 +48,4 @@ <!--Verify Delete button is not displayed--> <dontSeeElement selector="{{AdminCategoryMainActionsSection.DeleteButton}}" stepKey="dontSeeDeleteButton"/> </test> -</tests> \ No newline at end of file +</tests> 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 @@ <createData entity="NewRootCategory" stepKey="rootCategory" /> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Verify Created root Category--> @@ -41,4 +41,4 @@ <click selector="{{AdminCategorySidebarTreeSection.expandAll}}" stepKey="expandToSeeAllCategories1"/> <dontSee selector="{{AdminCategoryBasicFieldSection.CategoryNameInput}}" userInput="{{NewRootCategory.name}}" stepKey="dontSeeRootCategory"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteRootSubCategoryTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteRootSubCategoryTest.xml index 14e8fa0bab7ba..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 @@ <argument name="storeGroupName" value="customStore.code"/> </actionGroup> <deleteData createDataKey="rootCategory" stepKey="deleteRootCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Create a Store--> @@ -89,4 +89,4 @@ <waitForPageLoad stepKey="waitForPageToLoad1"/> <see selector="{{AdminDataGridTableSection.dataGridEmpty}}" userInput="We couldn't find any records." stepKey="seeEmptyRow"/> </test> -</tests> \ No newline at end of file +</tests> 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 @@ </before> <after> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteSimpleProductFilteredBySkuAndName"> <argument name="product" value="$$createSimpleProduct$$"/> 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 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="navigateToProductAttribute"/> <waitForPageLoad stepKey="waitForPageLoad"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteTextFieldProductAttributeFromAttributeSetTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminDeleteTextFieldProductAttributeFromAttributeSetTest.xml index e12bac55d8bc8..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,7 @@ <after> <!--Delete cteated Data --> <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimplaeProduct"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> 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 @@ </before> <after> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteVirtualProductFilteredBySkuAndName"> 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 @@ <deleteData createDataKey="createSimpleProduct" stepKey="deleteProduct"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <actionGroup ref="ClearProductsFilterActionGroup" stepKey="clearProductsFilter"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="LoginAsAdmin" stepKey="login"/> <amOnPage url="{{AdminProductAttributeSetEditPage.url}}/$$createAttributeSet.attribute_set_id$$/" stepKey="onAttributeSetEdit"/> 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 @@ <testCaseId value="MC-6215"/> </annotations> <before> - <actionGroup ref="LoginActionGroup" stepKey="loginGetFromGeneralFile"/> + <actionGroup ref="AdminLoginActionGroup" stepKey="loginGetFromGeneralFile"/> <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> <createData stepKey="myProductAttributeCreation" entity="productAttributeWysiwyg"/> @@ -76,7 +76,7 @@ <after> <deleteData createDataKey="myProductAttributeCreation" stepKey="deletePreReqProductAttribute" /> <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> </test> </tests> 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 @@ <after> <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> <actionGroup ref="ClearProductsFilterActionGroup" stepKey="clearProductsFilter"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <amOnPage url="{{AdminProductEditPage.url($$createSimpleProduct.id$$)}}" stepKey="goToEditPage"/> <actionGroup ref="AdminSwitchStoreViewActionGroup" stepKey="switchToDefaultStoreView"> 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 @@ <deleteData createDataKey="createProduct2" stepKey="deleteProduct2"/> <deleteData createDataKey="createProduct12" stepKey="deleteProduct3"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Step 1-2: Open Category page and Set scope selector to All Store Views--> <amOnPage url="{{AdminCategoryPage.url}}" stepKey="goToCategoryPage"/> 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 @@ <deleteData stepKey="deleteProduct1" createDataKey="product1"/> <deleteData stepKey="deleteCategory2" createDataKey="category2"/> <deleteData stepKey="deleteProduct2" createDataKey="product2"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <amOnPage url="{{ProductCatalogPage.url}}" stepKey="goToProductCatalog"/> <waitForPageLoad stepKey="waitForProductIndexPage"/> 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 @@ <argument name="sku" value="$$createFirstProduct.sku$$-1"/> </actionGroup> <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearProductGridFilter"/> - <actionGroup ref="logout" stepKey="logoutOfAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutOfAdmin"/> </after> <!--Change second product sku to first product sku--> <amOnPage url="{{AdminProductEditPage.url($$createSecondProduct.id$$)}}" stepKey="goToProductEditPage1"/> 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 @@ <after> <deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/> <deleteData createDataKey="simpleProduct2" stepKey="deleteSimpleProduct2"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Open Product Index Page--> 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 @@ <actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="AdminDeleteStoreViewActionGroup"/> <click selector="{{AdminStoresGridSection.resetButton}}" stepKey="resetSearchFilter"/> <actionGroup ref="ClearProductsFilterActionGroup" stepKey="clearProductFilter"/> - <actionGroup ref="logout" stepKey="amOnLogoutPage"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="amOnLogoutPage"/> </after> <!-- Search and select products --> 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 @@ <group value="SearchEngineElasticsearch"/> </annotations> <before> - <actionGroup ref="LoginActionGroup" stepKey="loginAsAdmin"/> + <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/> <!--Create Website --> <actionGroup ref="AdminCreateWebsiteActionGroup" stepKey="createAdditionalWebsite"> @@ -80,7 +80,7 @@ <actionGroup ref="DeleteProductActionGroup" stepKey="deleteProduct2"> <argument name="productName" value="simpleProductForMassUpdate2.name"/> </actionGroup> - <actionGroup ref="logout" stepKey="amOnLogoutPage"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="amOnLogoutPage"/> </after> <!-- Search and select products --> @@ -171,7 +171,7 @@ <group value="SearchEngineMysql"/> </annotations> <before> - <actionGroup ref="LoginActionGroup" stepKey="loginAsAdmin"/> + <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/> <!--Create Website --> <actionGroup ref="AdminCreateWebsiteActionGroup" stepKey="createAdditionalWebsite"> @@ -230,7 +230,7 @@ <actionGroup ref="DeleteProductActionGroup" stepKey="deleteProduct2"> <argument name="productName" value="simpleProductForMassUpdate2.name"/> </actionGroup> - <actionGroup ref="logout" stepKey="amOnLogoutPage"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="amOnLogoutPage"/> </after> <!-- Search and select products --> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveAnchoredCategoryTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveAnchoredCategoryTest.xml index f01becd2034d8..72ef78accb7fc 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveAnchoredCategoryTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveAnchoredCategoryTest.xml @@ -44,7 +44,7 @@ <deleteData createDataKey="simpleSubCategoryWithParent" stepKey="deleteSubcategoryWithParent"/> <deleteData createDataKey="simpleSubCategoryOne" stepKey="deleteSubcategoryOne"/> <deleteData createDataKey="simpleSubCategoryTwo" stepKey="deleteSubcategoryTwo"/> - <actionGroup ref="logout" stepKey="logoutAdminUserAfterTest"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutAdminUserAfterTest"/> </after> <!--Move category one to category two--> 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 @@ <after> <deleteData createDataKey="createDefaultCategory" stepKey="deleteDefaultCategory"/> <deleteData createDataKey="simpleProduct" stepKey="deleteSimpleProduct"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Open Category Page--> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveCategoryAndCheckUrlRewritesTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveCategoryAndCheckUrlRewritesTest.xml index 3d51d8cb99298..061bc795b2bff 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveCategoryAndCheckUrlRewritesTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveCategoryAndCheckUrlRewritesTest.xml @@ -25,7 +25,7 @@ </before> <after> <deleteData createDataKey="createDefaultCategory" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Open category page--> 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 @@ <actionGroup ref="DeleteCategoryActionGroup" stepKey="deleteCategory"> <argument name="categoryEntity" value="SimpleSubCategory"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Open Category page--> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveCategoryToAnotherPositionInCategoryTreeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminMoveCategoryToAnotherPositionInCategoryTreeTest.xml index 044b120173423..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 @@ <actionGroup ref="DeleteCategoryActionGroup" stepKey="SecondLevelSubCat"> <argument name="categoryEntity" value="SecondLevelSubCat"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Open Category Page --> 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 @@ <deleteData createDataKey="simpleProduct" stepKey="deleteProduct"/> <deleteData createDataKey="createSecondCategory" stepKey="deleteSecondCategory"/> <deleteData createDataKey="createAnchoredCategory1" stepKey="deleteAnchoredCategory1"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Create the anchored category <Cat1_anchored> --> <actionGroup ref="AdminAnchorCategoryActionGroup" stepKey="anchorCategory"> @@ -129,7 +129,7 @@ <waitForPageLoad stepKey="waitForRefresh"/> <see userInput="2 cache type(s) refreshed." stepKey="seeCacheRefreshedMessage"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!-- Open frontend --> <amOnPage url="{{StorefrontHomePage.url}}" stepKey="onFrontend"/> 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 @@ <actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteSecondWebsite"> <argument name="websiteName" value="Second Website"/> </actionGroup> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> </after> - <actionGroup ref="LoginActionGroup" stepKey="loginAsAdmin"/> + <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/> <actionGroup ref="AdminCreateWebsiteActionGroup" stepKey="createAdditionalWebsite"> <argument name="newWebsiteName" value="Second Website"/> <argument name="websiteCode" value="second_website"/> @@ -81,4 +81,4 @@ <seeCheckboxIsChecked selector="{{AdminProductFormSection.productTaxClassUseDefault}}" stepKey="seeTaxClassCheckboxChecked"/> <seeCheckboxIsChecked selector="{{AdminProductFormSection.visibilityUseDefault}}" stepKey="seeVisibilityCheckboxChecked"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminNavigateMultipleUpSellProductsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminNavigateMultipleUpSellProductsTest.xml index 7bfe3ae50c58b..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 @@ </before> <after> <!--Logout as admin--> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!--Delete created data--> <deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/> 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 @@ <deleteData createDataKey="createCategoryA" stepKey="deleteCategoryA"/> <deleteData createDataKey="createCategoryC" stepKey="deleteCategoryC"/> <deleteData createDataKey="createCategoryB" stepKey="deleteCategoryB"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Case: change product category from product page --> 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 @@ <argument name="customStore" value="storeViewData"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Open product --> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductGridFilteringByCustomAttributeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductGridFilteringByCustomAttributeTest.xml index a4986117380ff..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,7 @@ <!--Delete category--> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <actionGroup ref="NavigateToAndResetProductGridToDefaultViewActionGroup" stepKey="NavigateToAndResetProductGridToDefaultViewAfterTest"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> 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 @@ </before> <after> <deleteData createDataKey="createSimpleProductWithDate" stepKey="deleteProduct"/> - <actionGroup ref="logout" stepKey="logoutOfAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutOfAdmin"/> </after> <amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="navigateToProductAttribute"/> <waitForPageLoad stepKey="wait1"/> 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 @@ <!-- Clear Filter Product --> <actionGroup ref="AdminClearFiltersActionGroup" stepKey="clearProductFilters"/> <!-- Logout Admin --> - <actionGroup ref="logout" stepKey="logoutOfAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutOfAdmin"/> </after> <!-- Search Product and Open Edit --> <actionGroup ref="SearchForProductOnBackendActionGroup" stepKey="searchProduct"> 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 @@ <waitForPageLoad stepKey="waitForSaveAttribute1"/> <actionGroup ref="ClearCacheActionGroup" stepKey="clearCache1"/> - <actionGroup ref="logout" stepKey="logoutOfAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutOfAdmin"/> </after> <amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="navigateToProductAttribute"/> <waitForPageLoad stepKey="wait1"/> @@ -56,4 +56,4 @@ <dontSeeCheckboxIsChecked selector="{{AdminProductFormSection.productStatus}}" stepKey="dontSeeCheckboxEnableProductIsChecked"/> </test> -</tests> \ No newline at end of file +</tests> 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 @@ <comment userInput="Delete product" stepKey="commentDeleteProduct"/> <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> <actionGroup ref="AdminClearFiltersActionGroup" stepKey="clearProductFilters"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Change product type to Downloadable--> <comment userInput="Change product type to Downloadable" stepKey="commentCreateDownloadable"/> 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 @@ <deleteData createDataKey="createProduct" stepKey="deleteProductWithOptions"/> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearProductFilter"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> <!-- Edit Simple Product --> 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 @@ <deleteData createDataKey="product" stepKey="deleteFirstProduct"/> <magentoCLI stepKey="reindex" command="indexer:reindex"/> <magentoCLI stepKey="flushCache" command="cache:flush"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Create product--> 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 @@ <actionGroup ref="DeleteCategoryActionGroup" stepKey="DeleteCategory"> <argument name="categoryEntity" value="SimpleSubCategory"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Go to create a new category with image --> 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 @@ <group value="Catalog"/> </annotations> <after> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> </after> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin1"/> 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 @@ <argument name="sku" value="{{_defaultProduct.sku}}"/> </actionGroup> <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetFiltersIfExist"/> - <actionGroup ref="logout" stepKey="logoutOfUser"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutOfUser"/> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> <!--Delete created data--> <comment userInput="Delete created data" stepKey="commentDeleteCreatedData"/> @@ -47,7 +47,7 @@ <argument name="userName" value="{{admin2.username}}"/> </actionGroup> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="logoutOfAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutOfAdmin"/> </after> <!--Create user role--> <comment userInput="Create user role" stepKey="commentCreateUserRole"/> @@ -74,7 +74,7 @@ </actionGroup> <!--Log out of admin and login with newly created user--> <comment userInput="Log out of admin and login with newly created user" stepKey="commentLoginWithNewUser"/> - <actionGroup ref="logout" stepKey="logoutOfAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutOfAdmin"/> <actionGroup ref="LoginAsAdmin" stepKey="loginAsNewUser"> <argument name="adminUser" value="admin2"/> </actionGroup> 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 @@ <actionGroup ref="AdminGridFilterResetActionGroup" stepKey="resetFiltersOnStoresIndexPage"/> <actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="openProductIndexPageToResetFilters"/> <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearFiltersOnProductIndexPage"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- 1. Go to product page in admin panel to edit --> 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 @@ <deleteData createDataKey="category" stepKey="deletePreReqCategory"/> <deleteData createDataKey="firstProduct" stepKey="deleteFirstProduct"/> <deleteData createDataKey="secondProduct" stepKey="deleteSecondProduct"/> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> </after> <!-- Go to the first product edit page --> @@ -188,7 +188,7 @@ <after> <deleteData createDataKey="category" stepKey="deletePreReqCategory"/> <deleteData createDataKey="product" stepKey="deleteProduct"/> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> </after> <!-- Go to the product edit page --> 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 @@ <argument name="product" value="SimpleProduct"/> </actionGroup> <!--Admin Logout--> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Create product --> 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 @@ <actionGroup ref="ResetWebUrlOptionsActionGroup" stepKey="resetUrlOption"/> <magentoCLI command="indexer:reindex" stepKey="reindex"/> <magentoCLI command="cache:flush" stepKey="flushCache"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Assign Custom Website to Simple Product --> 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 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToAttributeSetPage"> <argument name="menuUiId" value="{{AdminMenuStores.dataUiId}}"/> 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 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToProductAttributePage"> <argument name="menuUiId" value="{{AdminMenuStores.dataUiId}}"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminTierPriceNotAvailableForProductOptionsWithoutTierPriceTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminTierPriceNotAvailableForProductOptionsWithoutTierPriceTest.xml index 7f62dd14a4f32..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,7 @@ <deleteData createDataKey="createConfigChildProduct2" stepKey="deleteConfigChildProduct2"/> <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/> - <actionGroup ref="logout" stepKey="logoutOfAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutOfAdmin"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUnassignProductAttributeFromAttributeSetTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUnassignProductAttributeFromAttributeSetTest.xml index c508e3ae94d67..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,7 @@ <deleteData createDataKey="product" stepKey="deleteProduct"/> <deleteData createDataKey="attribute" stepKey="deleteAttribute"/> <magentoCLI command="cron:run --group=index" stepKey="runCron"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> 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 @@ <argument name="storeGroupName" value="customStore.name"/> </actionGroup> <deleteData createDataKey="rootCategory" stepKey="deleteRootCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Open Store Page --> 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 @@ </before> <after> <deleteData createDataKey="createDefaultCategory" stepKey="deleteCreatedCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Open category page--> 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 @@ <argument name="storeGroupName" value="customStore.name"/> </actionGroup> <deleteData createDataKey="rootCategory" stepKey="deleteRootCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Open store page --> 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 @@ <actionGroup ref="DeleteCategoryActionGroup" stepKey="deleteCategory"> <argument name="categoryEntity" value="_defaultCategory"/> </actionGroup> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> </after> <!-- Create category, change store view to default --> 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 @@ <argument name="storeGroupName" value="customStore.name"/> </actionGroup> <deleteData createDataKey="rootCategory" stepKey="deleteRootCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Open Store Page --> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateCategoryWithInactiveIncludeInMenuTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateCategoryWithInactiveIncludeInMenuTest.xml index 7a7c701fca429..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 @@ </before> <after> <deleteData createDataKey="createDefaultCategory" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Open Category Page--> 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 @@ <after> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="simpleProduct" stepKey="deleteSimpleProduct"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Open Category Page--> 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 @@ </actionGroup> <deleteData createDataKey="category" stepKey="deleteCategory"/> <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Select Created Category--> <magentoCLI command="indexer:reindex" stepKey="reindexBeforeFlow"/> 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 @@ <actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteStoreViewFr"> <argument name="customStore" value="customStoreFR"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Verify Category is not listed in navigation menu--> <amOnPage url="/{{CatNotIncludeInMenu.name_lwr}}.html" stepKey="openCategoryPage"/> 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 @@ <actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteStoreViewFr"> <argument name="customStore" value="customStoreFR"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Select Created Category--> <amOnPage url="{{AdminCategoryPage.url}}" stepKey="openAdminCategoryIndexPage"/> 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 @@ <actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteStoreView"> <argument name="customStore" value="customStoreFR"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Search default simple product in grid --> 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 @@ <actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteStoreView"> <argument name="customStore" value="customStoreFR"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Search default simple product in grid --> 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 @@ <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteCreatedProduct"> <argument name="sku" value="{{simpleProductTierPrice300InStock.sku}}"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Search default simple product in the grid --> 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 @@ <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteCreatedProduct"> <argument name="sku" value="{{simpleProductDisabled.sku}}"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Search default simple product in the grid page --> 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 @@ <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteCreatedProduct"> <argument name="sku" value="{{simpleProductEnabledFlat.sku}}"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <magentoCLI stepKey="unsetFlatCatalogProduct" command="config:set catalog/frontend/flat_catalog_product 0"/> </after> 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 @@ <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteCreatedProduct"> <argument name="sku" value="{{simpleProductNotVisibleIndividually.sku}}"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Search default simple product in the grid page --> 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 @@ <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteCreatedProduct"> <argument name="sku" value="$$initialSimpleProduct.sku$$"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Search default simple product in the grid page --> 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 @@ <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteCreatedProduct"> <argument name="sku" value="{{simpleProductRegularPrice245InStock.sku}}"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Search default simple product in the grid page --> 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 @@ <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteCreatedProduct"> <argument name="sku" value="{{simpleProductRegularPrice32501InStock.sku}}"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Search default simple product in the grid --> 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 @@ <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteCreatedProduct"> <argument name="sku" value="{{simpleProductRegularPrice325InStock.sku}}"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Search default simple product in the grid --> 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 @@ <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteCreatedProduct"> <argument name="sku" value="{{simpleProductRegularPriceCustomOptions.sku}}"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Search default simple product in the grid --> 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 @@ <actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteCreatedProduct"> <argument name="sku" value="{{simpleProductRegularPrice32503OutOfStock.sku}}"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Search default simple product in the grid --> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateTopCategoryUrlWithNoRedirectTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateTopCategoryUrlWithNoRedirectTest.xml index ae91779f58cca..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 @@ <actionGroup ref="LoginAsAdmin" stepKey="login"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <deleteData createDataKey="createThreeLevelNestedCategories" stepKey="deleteThreeNestedCategories"/> <deleteData createDataKey="createTwoLevelNestedCategories" stepKey="deleteTwoLevelNestedCategory"/> @@ -91,4 +91,4 @@ <waitForPageLoad stepKey="waitForPageToLoad4"/> <see stepKey="seeEmptyRecodsMessage" selector="{{AdminDataGridTableSection.dataGridEmpty}}" userInput="We couldn't find any records."/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateTopCategoryUrlWithRedirectTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateTopCategoryUrlWithRedirectTest.xml index dfaeea11d33a5..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 @@ <deleteData createDataKey="createThreeLevelNestedCategories" stepKey="deleteThreeNestedCategories"/> <deleteData createDataKey="createTwoLevelNestedCategories" stepKey="deleteTwoLevelNestedCategory"/> <deleteData createDataKey="createDefaultCategory" stepKey="deleteDefaultCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Open Category page --> @@ -90,4 +90,4 @@ <see selector="{{AdminUrlRewriteIndexSection.gridCellByColumnRowNumber('1', 'Target Path')}}" userInput="$$createDefaultCategory.name$$/$$createTwoLevelNestedCategories.name$$/updateredirecturl.html" stepKey="seeTheTargetPathForOldUrl"/> <see selector="{{AdminUrlRewriteIndexSection.gridCellByColumnRowNumber('1', 'Redirect Type')}}" userInput="Permanent (301)" stepKey="seeTheRedirectTypeForOldUrl"/> </test> -</tests> \ No newline at end of file +</tests> 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 @@ </actionGroup> <deleteData stepKey="deleteSimpleSubCategory" createDataKey="initialCategoryEntity"/> <deleteData stepKey="deleteSimpleSubCategory2" createDataKey="categoryEntity"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Search default virtual product in the grid page --> 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 @@ <after> <deleteData stepKey="deleteSimpleSubCategory" createDataKey="initialCategoryEntity"/> <deleteData stepKey="deleteSimpleSubCategory2" createDataKey="categoryEntity"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Search default virtual product in the grid page --> 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 @@ </actionGroup> <deleteData stepKey="deleteSimpleSubCategory" createDataKey="initialCategoryEntity"/> <deleteData stepKey="deleteSimpleSubCategory2" createDataKey="categoryEntity"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Search default virtual product in the grid page --> 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 @@ </actionGroup> <deleteData stepKey="deleteSimpleSubCategory" createDataKey="initialCategoryEntity"/> <deleteData stepKey="deleteSimpleSubCategory2" createDataKey="categoryEntity"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Search default virtual product in the grid page --> 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 @@ <argument name="sku" value="{{updateVirtualProductRegularPrice99OutOfStock.sku}}"/> </actionGroup> <deleteData stepKey="deleteSimpleSubCategory" createDataKey="initialCategoryEntity"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Search default virtual product in the grid page --> 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 @@ </actionGroup> <deleteData stepKey="deleteSimpleSubCategory" createDataKey="initialCategoryEntity"/> <deleteData stepKey="deleteSimpleSubCategory2" createDataKey="categoryEntity"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Search default virtual product in the grid page --> 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 @@ </actionGroup> <deleteData stepKey="deleteSimpleSubCategory" createDataKey="initialCategoryEntity"/> <deleteData stepKey="deleteSimpleSubCategory2" createDataKey="categoryEntity"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Search default virtual product in the grid page --> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithTierPriceInStockVisibleInCategoryAndSearchTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithTierPriceInStockVisibleInCategoryAndSearchTest.xml index ea331bfc97db2..f5571633c2da4 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithTierPriceInStockVisibleInCategoryAndSearchTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminUpdateVirtualProductWithTierPriceInStockVisibleInCategoryAndSearchTest.xml @@ -38,7 +38,7 @@ <argument name="product" value="updateVirtualProductTierPriceInStock"/> </actionGroup> <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearProductsGridFilters"/> - <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> </after> <actionGroup ref="FilterAndSelectProductActionGroup" stepKey="openProductEditPageBySKU"> 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 @@ </actionGroup> <deleteData stepKey="deleteSimpleSubCategory" createDataKey="initialCategoryEntity"/> <deleteData stepKey="deleteSimpleSubCategory2" createDataKey="categoryEntity"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Search default virtual product in the grid page --> 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 @@ </actionGroup> <deleteData stepKey="deleteSimpleSubCategory" createDataKey="initialCategoryEntity"/> <deleteData stepKey="deleteSimpleSubCategory2" createDataKey="categoryEntity"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Search default virtual product in the grid page --> 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 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin1"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="GoToProductCatalogPageActionGroup" stepKey="goToProductCatalogPage"/> <actionGroup ref="VerifyProductTypeOrder" stepKey="verifyProductTypeOrder"/> 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 @@ </before> <after> <deleteData createDataKey="product" stepKey="delete"/> - <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> </after> </test> <test name="AdvanceCatalogSearchSimpleProductBySkuTest"> @@ -106,7 +106,7 @@ </before> <after> <deleteData createDataKey="product" stepKey="delete"/> - <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> </after> </test> </tests> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/CheckTierPricingOfProductsTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/CheckTierPricingOfProductsTest.xml index f80cfed54c8f3..1fe42a331c80c 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Test/CheckTierPricingOfProductsTest.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Test/CheckTierPricingOfProductsTest.xml @@ -330,7 +330,7 @@ <argument name="websiteName" value="secondWebsite"/> </actionGroup> <createData entity="CustomerAccountSharingDefault" stepKey="setConfigCustomerAccountDefault"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!--Do reindex and flush cache--> <magentoCLI command="indexer:reindex" stepKey="reindex"/> 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 @@ <click stepKey="clickDelete" selector="{{AttributePropertiesSection.DeleteAttribute}}"/> <click stepKey="clickOk" selector="{{AttributeDeleteModalSection.confirm}}"/> <waitForPageLoad stepKey="waitForDeletion"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Navigate to Stores > Attributes > Product.--> @@ -89,7 +89,7 @@ <click stepKey="clickDelete" selector="{{AttributePropertiesSection.DeleteAttribute}}"/> <click stepKey="clickOk" selector="{{AttributeDeleteModalSection.confirm}}"/> <waitForPageLoad stepKey="waitForDeletion"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Generate date for use as default value, needs to be MM/d/YYYY --> @@ -149,7 +149,7 @@ <click stepKey="clickDelete" selector="{{AttributePropertiesSection.DeleteAttribute}}"/> <click stepKey="clickOk" selector="{{AttributeDeleteModalSection.confirm}}"/> <waitForPageLoad stepKey="waitForDeletion"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Navigate to Stores > Attributes > Product.--> @@ -203,7 +203,7 @@ <click stepKey="clickDelete" selector="{{AttributePropertiesSection.DeleteAttribute}}"/> <click stepKey="clickOk" selector="{{AttributeDeleteModalSection.confirm}}"/> <waitForPageLoad stepKey="waitForDeletion"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Navigate to Stores > Attributes > Product.--> @@ -290,7 +290,7 @@ <click stepKey="clickDelete" selector="{{AttributePropertiesSection.DeleteAttribute}}"/> <click stepKey="clickOk" selector="{{AttributeDeleteModalSection.confirm}}"/> <waitForPageLoad stepKey="waitForDeletion"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Navigate to Stores > Attributes > Product.--> @@ -358,7 +358,7 @@ <click stepKey="clickDelete" selector="{{AttributePropertiesSection.DeleteAttribute}}"/> <click stepKey="clickOk" selector="{{AttributeDeleteModalSection.confirm}}"/> <waitForPageLoad stepKey="waitForDeletion"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Navigate to Stores > Attributes > Product.--> 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 @@ <createData entity="NewRootCategory" stepKey="createNewRootCategoryA"/> </before> <after> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> <deleteData createDataKey="createProduct1" stepKey="deleteProduct1"/> <deleteData createDataKey="createProduct2" stepKey="deleteProduct2"/> <deleteData createDataKey="createProduct3" stepKey="deleteProduct3"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/DeleteUsedInConfigurableProductAttributeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/DeleteUsedInConfigurableProductAttributeTest.xml index 0d382798a6266..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,7 @@ <deleteData createDataKey="productAttributeHandle" stepKey="deleteProductAttribute"/> <!-- Logout --> - <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> 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 @@ <!-- Delete category and log out --> <comment userInput="Delete category and log out" stepKey="deleteCategoryAndLogOut"/> <deleteData createDataKey="simpleCategory" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="logOutFromAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logOutFromAdmin"/> <magentoCLI command="cache:flush" stepKey="flushCache"/> </after> <!-- Navigate to category details page --> 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 @@ </skip> </annotations> <after> - <actionGroup ref="logout" stepKey="logoutOfAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutOfAdmin"/> </after> <!--Login to Admin Area--> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/ProductAttributeWithoutValueInCompareListTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/ProductAttributeWithoutValueInCompareListTest.xml index 93afb7f1c2df1..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,7 @@ <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createAttributeSet" stepKey="deleteAttributeSet"/> <deleteData createDataKey="createProductAttribute" stepKey="deleteProductAttribute"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> 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 @@ <after> <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <amOnPage url="$$createCategory.name$$.html" stepKey="goToCategoryStorefront2"/> 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 @@ <actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteTestWebsite"> <argument name="websiteName" value="Second Website"/> </actionGroup> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> </after> <actionGroup ref="EnableWebUrlOptionsActionGroup" stepKey="addStoreCodeToUrls"/> 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 @@ <actionGroup ref="ResetSearchEngineConfigurationActionGroup" stepKey="resetCatalogSearchConfiguration"/> <magentoCLI command="indexer:reindex" stepKey="performReindexAfterElasticSearchDisable"/> <magentoCLI command="cache:flush" stepKey="cleanCacheAfterElasticSearchDisable"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Open Storefront on the myCategory page--> 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 @@ <argument name="theme" value="{{MagentoLumaTheme.name}}"/> </actionGroup> <!-- Admin log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Go to Content > Themes. Change theme to Blank --> 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 @@ <deleteData createDataKey="category2" stepKey="deleteCategory2"/> <deleteData createDataKey="category3" stepKey="deleteCategory3"/> <deleteData createDataKey="category4" stepKey="deleteCategory4"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Open Storefront home page--> <comment userInput="Open Storefront home page" stepKey="openStorefrontHomePage"/> 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 @@ <deleteData createDataKey="createSimpleProductThirtyFive" stepKey="deleteProductThirtyFive"/> <deleteData createDataKey="createSimpleProductThirtySix" stepKey="deleteProductThirtySix"/> <deleteData createDataKey="createSimpleProductThirtySeven" stepKey="deleteProductThirtySeven"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Verify configuration for default number of products displayed in the grid view--> <comment userInput="Verify configuration for default number of products displayed in the grid view" stepKey="commentVerifyDefaultValues"/> 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 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> </after> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontProductWithEmptyAttributeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontProductWithEmptyAttributeTest.xml index 7ba8f26ba1c05..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,7 @@ </actionGroup> <deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCategory"/> <deleteData createDataKey="createProductAttribute" stepKey="deleteProductAttribute"/> - <actionGroup ref="logout" stepKey="logoutOfAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutOfAdmin"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontProductsCompareWithEmptyAttributeTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/StorefrontProductsCompareWithEmptyAttributeTest.xml index 3aa12a7268593..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,7 @@ <deleteData createDataKey="createProductAttribute" stepKey="deleteProductAttribute"/> <deleteData createDataKey="createSimpleProduct1" stepKey="deleteSimpleProduct1"/> <deleteData createDataKey="createSimpleProduct2" stepKey="deleteSimpleProduct2"/> - <actionGroup ref="logout" stepKey="logoutOfAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutOfAdmin"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> 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 @@ <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="amOnProductGridPage"/> <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearProductsGridFilters"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="customerLogoutStorefront"/> </after> 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 @@ <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <actionGroup ref="AdminOrdersGridClearFiltersActionGroup" stepKey="clearOrderListingFilters"/> - <actionGroup ref="logout" stepKey="logoutAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutAdmin"/> <!-- Logout customer --> <actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="customerLogoutStorefront"/> </after> 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 @@ <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <actionGroup ref="AdminOrdersGridClearFiltersActionGroup" stepKey="clearFilters"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Login Customer Storefront --> 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 @@ <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Set timezone for default config--> 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 @@ <argument name="categoryName" value="$$categoryN.name$$, $$categoryM.name$$"/> </actionGroup> - <magentoCLI command="indexer:reindex" stepKey="reindex"/> - <magentoCLI command="cache:flush" arguments="full_page" stepKey="flushCache"/> + <wait stepKey="waitBeforeRunCronIndex" time="30"/> + <magentoCLI stepKey="runCronIndex" command="cron:run --group=index"/> </before> <after> <!-- Change "Category Products" and "Product Categories" indexers to "Update on Save" mode --> @@ -72,7 +72,7 @@ <deleteData createDataKey="categoryL" stepKey="deleteCategoryL"/> <deleteData createDataKey="categoryK" stepKey="deleteCategoryK"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Open categories K, L, M, N on Storefront --> @@ -138,9 +138,9 @@ <amOnPage url="{{StorefrontCategoryPage.url($$categoryK.custom_attributes[url_key]$$/$$categoryN.custom_attributes[url_key]$$)}}" stepKey="amOnCategoryN"/> <see userInput="$$productC.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="seeProductInCategoryN"/> - <!-- Run cron twice --> - <magentoCLI command="cron:run" stepKey="runCron"/> - <magentoCLI command="cron:run" stepKey="runCronAgain"/> + <!-- Run cron --> + <wait stepKey="waitBeforeRunMagentoCron" time="30"/> + <magentoCLI stepKey="runMagentoCron" command="cron:run --group=index"/> <!-- Open categories K, L, M, N on Storefront in order to make sure that new assigments are applied --> <!-- Category K contains only Products A, C --> @@ -199,9 +199,9 @@ <amOnPage url="{{StorefrontCategoryPage.url($$categoryK.custom_attributes[url_key]$$/$$categoryN.custom_attributes[url_key]$$)}}" stepKey="onStorefrontCategoryN"/> <see userInput="$$productC.name$$" selector="{{StorefrontCategoryMainSection.productName}}" stepKey="productCOnCategoryN"/> - <!-- Run cron twice --> - <magentoCLI command="cron:run" stepKey="firstCronRun"/> - <magentoCLI command="cron:run" stepKey="secondCronRun"/> + <!-- Run Cron once to reindex product changes --> + <wait stepKey="waitBeforeRunCronIndexAfterProductAssignToCategory" time="30"/> + <magentoCLI stepKey="runCronIndexAfterProductAssignToCategory" command="cron:run --group=index"/> <!-- Open categories K, L, M, N on Storefront in order to make sure that new assigments are applied --> 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 @@ <actionGroup ref="DeleteCategoryActionGroup" stepKey="deleteCategory"> <argument name="categoryEntity" value="SimpleSubCategory"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> <amOnPage url="{{AdminCategoryPage.url}}" stepKey="navigateToCategoryPage1"/> 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 @@ <testCaseId value="MAGETWO-80505"/> </annotations> <before> - <actionGroup ref="LoginActionGroup" stepKey="loginGetFromGeneralFile"/> + <actionGroup ref="AdminLoginActionGroup" stepKey="loginGetFromGeneralFile"/> <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> @@ -44,7 +44,7 @@ <seeElement selector="{{ProductDescriptionWYSIWYGToolbarSection.SpecialCharacter}}" stepKey="assertInfo14"/> <after> <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> </test> <test name="Verifydefaultcontrolsonproductshortdescription"> @@ -58,7 +58,7 @@ <testCaseId value="MAGETWO-80505"/> </annotations> <before> - <actionGroup ref="LoginActionGroup" stepKey="loginGetFromGeneralFile"/> + <actionGroup ref="AdminLoginActionGroup" stepKey="loginGetFromGeneralFile"/> <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> @@ -83,7 +83,7 @@ <seeElement selector="{{ProductShortDescriptionWYSIWYGToolbarSection.SpecialCharacter}}" stepKey="assertInfo28"/> <after> <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> </test> </tests> 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 @@ <testCaseId value="MAGETWO-82551"/> </annotations> <before> - <actionGroup ref="LoginActionGroup" stepKey="loginGetFromGeneralFile"/> + <actionGroup ref="AdminLoginActionGroup" stepKey="loginGetFromGeneralFile"/> <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> @@ -46,7 +46,7 @@ <see userInput="Hello World!" selector="{{StorefrontCategoryMainSection.CatalogDescription}}" stepKey="assertCatalogDescription"/> <after> <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> </test> </tests> 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 @@ <testCaseId value="MAGETWO-81819"/> </annotations> <before> - <actionGroup ref="LoginActionGroup" stepKey="loginGetFromGeneralFile"/> + <actionGroup ref="AdminLoginActionGroup" stepKey="loginGetFromGeneralFile"/> <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> @@ -59,7 +59,7 @@ <see userInput="Hello World! Short Content" selector="{{StorefrontProductInfoMainSection.productShortDescription}}" stepKey="assertProductShortDescription"/> <after> <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> </test> </tests> 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/Config/CatalogClone/Media/ImageTest.php b/app/code/Magento/Catalog/Test/Unit/Model/Config/CatalogClone/Media/ImageTest.php deleted file mode 100644 index 23f0aec5b69a2..0000000000000 --- a/app/code/Magento/Catalog/Test/Unit/Model/Config/CatalogClone/Media/ImageTest.php +++ /dev/null @@ -1,153 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Catalog\Test\Unit\Model\Config\CatalogClone\Media; - -use Magento\Catalog\Model\Product; -use Magento\Eav\Model\Entity\Attribute\Frontend\AbstractFrontend; -use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; - -/** - * Tests \Magento\Catalog\Model\Config\CatalogClone\Media\Image. - * - * @SuppressWarnings(PHPMD.CouplingBetweenObjects) - */ -class ImageTest extends \PHPUnit\Framework\TestCase -{ - /** - * @var \Magento\Catalog\Model\Config\CatalogClone\Media\Image - */ - private $model; - - /** - * @var \Magento\Eav\Model\Config|\PHPUnit_Framework_MockObject_MockObject - */ - private $eavConfig; - - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - private $attributeCollectionFactory; - - /** - * @var \Magento\Catalog\Model\ResourceModel\Product\Attribute\Collection|\PHPUnit_Framework_MockObject_MockObject - */ - private $attributeCollection; - - /** - * @var \Magento\Eav\Model\Entity\Attribute|\PHPUnit_Framework_MockObject_MockObject - */ - private $attribute; - - /** - * @var \Magento\Framework\Escaper|\PHPUnit_Framework_MockObject_MockObject - */ - private $escaperMock; - - /** - * @inheritdoc - */ - protected function setUp() - { - $this->eavConfig = $this->getMockBuilder(\Magento\Eav\Model\Config::class) - ->disableOriginalConstructor() - ->getMock(); - - $this->attributeCollection = $this->getMockBuilder( - \Magento\Catalog\Model\ResourceModel\Product\Attribute\Collection::class - ) - ->disableOriginalConstructor() - ->getMock(); - - $this->attributeCollectionFactory = $this->getMockBuilder( - \Magento\Catalog\Model\ResourceModel\Product\Attribute\CollectionFactory::class - ) - ->setMethods(['create']) - ->disableOriginalConstructor() - ->getMock(); - $this->attributeCollectionFactory->expects($this->any())->method('create')->will( - $this->returnValue($this->attributeCollection) - ); - - $this->attribute = $this->getMockBuilder(\Magento\Eav\Model\Entity\Attribute::class) - ->disableOriginalConstructor() - ->getMock(); - - $this->escaperMock = $this->getMockBuilder( - \Magento\Framework\Escaper::class - ) - ->disableOriginalConstructor() - ->setMethods(['escapeHtml']) - ->getMock(); - - $helper = new ObjectManager($this); - $this->model = $helper->getObject( - \Magento\Catalog\Model\Config\CatalogClone\Media\Image::class, - [ - 'eavConfig' => $this->eavConfig, - 'attributeCollectionFactory' => $this->attributeCollectionFactory, - 'escaper' => $this->escaperMock, - ] - ); - } - - /** - * @param string $actualLabel - * @param string $expectedLabel - * @return void - * - * @dataProvider getPrefixesDataProvider - */ - public function testGetPrefixes(string $actualLabel, string $expectedLabel): void - { - $entityTypeId = 3; - /** @var \Magento\Eav\Model\Entity\Type|\PHPUnit_Framework_MockObject_MockObject $entityType */ - $entityType = $this->getMockBuilder(\Magento\Eav\Model\Entity\Type::class) - ->disableOriginalConstructor() - ->getMock(); - $entityType->expects($this->once())->method('getId')->willReturn($entityTypeId); - - /** @var AbstractFrontend|\PHPUnit_Framework_MockObject_MockObject $frontend */ - $frontend = $this->getMockBuilder(\Magento\Eav\Model\Entity\Attribute\Frontend\AbstractFrontend::class) - ->setMethods(['getLabel']) - ->disableOriginalConstructor() - ->getMockForAbstractClass(); - $frontend->expects($this->once())->method('getLabel')->willReturn($actualLabel); - - $this->attributeCollection->expects($this->once())->method('setEntityTypeFilter')->with($entityTypeId); - $this->attributeCollection->expects($this->once())->method('setFrontendInputTypeFilter')->with('media_image'); - - $this->attribute->expects($this->once())->method('getAttributeCode')->willReturn('attributeCode'); - $this->attribute->expects($this->once())->method('getFrontend')->willReturn($frontend); - - $this->attributeCollection->expects($this->any())->method('getIterator') - ->willReturn(new \ArrayIterator([$this->attribute])); - - $this->eavConfig->expects($this->any())->method('getEntityType')->with(Product::ENTITY) - ->willReturn($entityType); - - $this->escaperMock->expects($this->once())->method('escapeHtml')->with($actualLabel) - ->willReturn($expectedLabel); - - $this->assertEquals([['field' => 'attributeCode_', 'label' => $expectedLabel]], $this->model->getPrefixes()); - } - - /** - * @return array - */ - public function getPrefixesDataProvider(): array - { - return [ - [ - 'actual_label' => 'testLabel', - 'expected_label' => 'testLabel', - ], - [ - 'actual_label' => '<media-image-attributelabel', - 'expected_label' => '<media-image-attributelabel', - ], - ]; - } -} 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/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/Model/ResourceModel/Product/CollectionTest.php b/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Product/CollectionTest.php index 0316b2e374d2f..b49decf96452d 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Product/CollectionTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Product/CollectionTest.php @@ -230,46 +230,6 @@ public function testAddProductCategoriesFilter() $this->collection->addCategoriesFilter([$conditionType => $values]); } - public function testAddMediaGalleryData() - { - $attributeId = 42; - $rowId = 4; - $linkField = 'row_id'; - $mediaGalleriesMock = [[$linkField => $rowId]]; - $itemMock = $this->getMockBuilder(\Magento\Catalog\Model\Product::class) - ->disableOriginalConstructor() - ->setMethods(['getOrigData']) - ->getMock(); - $attributeMock = $this->getMockBuilder(\Magento\Eav\Model\Entity\Attribute\AbstractAttribute::class) - ->disableOriginalConstructor() - ->getMock(); - $selectMock = $this->getMockBuilder(\Magento\Framework\DB\Select::class) - ->disableOriginalConstructor() - ->getMock(); - $metadataMock = $this->getMockBuilder(\Magento\Framework\EntityManager\EntityMetadataInterface::class) - ->disableOriginalConstructor() - ->getMock(); - $this->collection->addItem($itemMock); - $this->galleryResourceMock->expects($this->once())->method('createBatchBaseSelect')->willReturn($selectMock); - $attributeMock->expects($this->once())->method('getAttributeId')->willReturn($attributeId); - $this->entityMock->expects($this->once())->method('getAttribute')->willReturn($attributeMock); - $itemMock->expects($this->atLeastOnce())->method('getOrigData')->willReturn($rowId); - $selectMock->expects($this->once())->method('reset')->with(Select::ORDER)->willReturnSelf(); - $selectMock->expects($this->once())->method('where')->with('entity.' . $linkField . ' IN (?)', [$rowId]) - ->willReturnSelf(); - $this->metadataPoolMock->expects($this->once())->method('getMetadata')->willReturn($metadataMock); - $metadataMock->expects($this->once())->method('getLinkField')->willReturn($linkField); - - $this->connectionMock->expects($this->once())->method('fetchOne')->with($selectMock)->willReturn(42); - $this->connectionMock->expects($this->once())->method('fetchAll')->with($selectMock)->willReturn( - [['row_id' => $rowId]] - ); - $this->galleryReadHandlerMock->expects($this->once())->method('addMediaDataToProduct') - ->with($itemMock, $mediaGalleriesMock); - - $this->assertSame($this->collection, $this->collection->addMediaGalleryData()); - } - /** * Test addTierPriceDataByGroupId method. * diff --git a/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Product/GalleryTest.php b/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Product/GalleryTest.php index 47ef3c999125f..43c1abc91a1a9 100644 --- a/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Product/GalleryTest.php +++ b/app/code/Magento/Catalog/Test/Unit/Model/ResourceModel/Product/GalleryTest.php @@ -5,6 +5,8 @@ */ namespace Magento\Catalog\Test\Unit\Model\ResourceModel\Product; +use Magento\Framework\DB\Sql\ColumnValueExpression; + /** * Unit test for product media gallery resource. */ @@ -280,200 +282,4 @@ public function testBindValueToEntityRecordExists() $entityId = 1; $this->resource->bindValueToEntity($valueId, $entityId); } - - /** - * @SuppressWarnings(PHPMD.ExcessiveMethodLength) - */ - public function testLoadGallery() - { - $productId = 5; - $storeId = 1; - $attributeId = 6; - $getTableReturnValue = 'table'; - $quoteInfoReturnValue = - 'main.value_id = value.value_id AND value.store_id = ' . $storeId - . ' AND value.entity_id = entity.entity_id'; - $quoteDefaultInfoReturnValue = - 'main.value_id = default_value.value_id AND default_value.store_id = 0' - . ' AND default_value.entity_id = entity.entity_id'; - - $positionCheckSql = 'testchecksql'; - $resultRow = [ - [ - 'value_id' => '1', - 'file' => '/d/o/download_7.jpg', - 'label' => null, - 'position' => '1', - 'disabled' => '0', - 'label_default' => null, - 'position_default' => '1', - 'disabled_default' => '0', - ], - ]; - - $this->connection->expects($this->once())->method('getCheckSql')->with( - 'value.position IS NULL', - 'default_value.position', - 'value.position' - )->will($this->returnValue($positionCheckSql)); - $this->connection->expects($this->once())->method('select')->will($this->returnValue($this->select)); - $this->select->expects($this->at(0))->method('from')->with( - [ - 'main' => $getTableReturnValue, - ], - [ - 'value_id', - 'file' => 'value', - 'media_type' - ] - )->willReturnSelf(); - $this->select->expects($this->at(1))->method('joinInner')->with( - ['entity' => $getTableReturnValue], - 'main.value_id = entity.value_id', - ['entity_id'] - )->willReturnSelf(); - $this->product->expects($this->at(0))->method('getData') - ->with('entity_id')->willReturn($productId); - $this->product->expects($this->at(1))->method('getStoreId')->will($this->returnValue($storeId)); - $this->connection->expects($this->exactly(2))->method('quoteInto')->withConsecutive( - ['value.store_id = ?'], - ['default_value.store_id = ?'] - )->willReturnOnConsecutiveCalls( - 'value.store_id = ' . $storeId, - 'default_value.store_id = ' . 0 - ); - $this->connection->expects($this->any())->method('getIfNullSql')->will( - $this->returnValueMap([ - [ - '`value`.`label`', - '`default_value`.`label`', - 'IFNULL(`value`.`label`, `default_value`.`label`)' - ], - [ - '`value`.`position`', - '`default_value`.`position`', - 'IFNULL(`value`.`position`, `default_value`.`position`)' - ], - [ - '`value`.`disabled`', - '`default_value`.`disabled`', - 'IFNULL(`value`.`disabled`, `default_value`.`disabled`)' - ] - ]) - ); - $this->select->expects($this->at(2))->method('joinLeft')->with( - ['value' => $getTableReturnValue], - $quoteInfoReturnValue, - [] - )->willReturnSelf(); - $this->select->expects($this->at(3))->method('joinLeft')->with( - ['default_value' => $getTableReturnValue], - $quoteDefaultInfoReturnValue, - [] - )->willReturnSelf(); - $this->select->expects($this->at(4))->method('columns')->with([ - 'label' => 'IFNULL(`value`.`label`, `default_value`.`label`)', - 'position' => 'IFNULL(`value`.`position`, `default_value`.`position`)', - 'disabled' => 'IFNULL(`value`.`disabled`, `default_value`.`disabled`)', - 'label_default' => 'default_value.label', - 'position_default' => 'default_value.position', - 'disabled_default' => 'default_value.disabled' - ])->willReturnSelf(); - $this->select->expects($this->at(5))->method('where')->with( - 'main.attribute_id = ?', - $attributeId - )->willReturnSelf(); - $this->select->expects($this->at(6))->method('where') - ->with('main.disabled = 0')->willReturnSelf(); - $this->select->expects($this->at(8))->method('where') - ->with('entity.entity_id = ?', $productId) - ->willReturnSelf(); - $this->select->expects($this->once())->method('order') - ->with($positionCheckSql . ' ' . \Magento\Framework\DB\Select::SQL_ASC) - ->willReturnSelf(); - $this->connection->expects($this->once())->method('fetchAll') - ->with($this->select) - ->willReturn($resultRow); - - $this->assertEquals($resultRow, $this->resource->loadProductGalleryByAttributeId($this->product, $attributeId)); - } - - public function testInsertGalleryValueInStore() - { - $data = [ - 'value_id' => '8', - 'store_id' => 0, - 'provider' => '', - 'url' => 'https://www.youtube.com/watch?v=abcdfghijk', - 'title' => 'New Title', - 'description' => 'New Description', - 'metadata' => 'New metadata', - ]; - - $this->connection->expects($this->once())->method('describeTable')->willReturn($this->fields); - $this->connection->expects($this->any())->method('prepareColumnValue')->willReturnOnConsecutiveCalls( - '8', - 0, - '', - 'https://www.youtube.com/watch?v=abcdfghijk', - 'New Title', - 'New Description', - 'New metadata' - ); - - $this->resource->insertGalleryValueInStore($data); - } - - public function testDeleteGalleryValueInStore() - { - $valueId = 4; - $entityId = 6; - $storeId = 1; - - $this->connection->expects($this->exactly(3))->method('quoteInto')->withConsecutive( - ['value_id = ?', (int)$valueId], - ['entity_id = ?', (int)$entityId], - ['store_id = ?', (int)$storeId] - )->willReturnOnConsecutiveCalls( - 'value_id = ' . $valueId, - 'entity_id = ' . $entityId, - 'store_id = ' . $storeId - ); - - $this->connection->expects($this->once())->method('delete')->with( - 'table', - 'value_id = 4 AND entity_id = 6 AND store_id = 1' - )->willReturnSelf(); - - $this->resource->deleteGalleryValueInStore($valueId, $entityId, $storeId); - } - - public function testCountImageUses() - { - $results = [ - [ - 'value_id' => '1', - 'attribute_id' => 90, - 'value' => '/d/o/download_7.jpg', - 'media_type' => 'image', - 'disabled' => '0', - ], - ]; - - $this->connection->expects($this->once())->method('select')->will($this->returnValue($this->select)); - $this->select->expects($this->at(0))->method('from')->with( - [ - 'main' => 'table', - ], - '*' - )->willReturnSelf(); - $this->select->expects($this->at(1))->method('where')->with( - 'value = ?', - 1 - )->willReturnSelf(); - $this->connection->expects($this->once())->method('fetchAll') - ->with($this->select) - ->willReturn($results); - $this->assertEquals($this->resource->countImageUses(1), count($results)); - } } 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 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +namespace Magento\Catalog\Test\Unit\Observer; + +use Magento\Catalog\Model\Product; +use Magento\Catalog\Observer\SetSpecialPriceStartDate; +use Magento\Framework\Event; +use Magento\Framework\Event\Observer; +use Magento\Framework\Stdlib\DateTime\Timezone; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; + +/** + * Unit test for \Magento\Catalog\Observer\SetSpecialPriceStartDate + */ +class SetSpecialPriceStartDateTest extends TestCase +{ + /** + * Testable Object + * + * @var SetSpecialPriceStartDate + */ + private $observer; + + /** + * @var ObjectManager + */ + private $objectManager; + + /** + * @var Observer|MockObject + */ + private $observerMock; + + /** + * @var Event|MockObject + */ + private $eventMock; + + /** + * @var Product|MockObject + */ + private $productMock; + + /** + * @var Timezone|MockObject + */ + private $timezone; + + /** + * @var \DateTime|MockObject + */ + private $dateObject; + + /** + * @inheritdoc + */ + protected function setUp(): void + { + $this->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/etc/db_schema.xml b/app/code/Magento/Catalog/etc/db_schema.xml index d5b318f671726..9f43c8a69b5e5 100644 --- a/app/code/Magento/Catalog/etc/db_schema.xml +++ b/app/code/Magento/Catalog/etc/db_schema.xml @@ -813,6 +813,7 @@ default="0" comment="Is Disabled"/> <column xsi:type="int" name="record_id" padding="10" unsigned="true" nullable="false" identity="true" comment="Record ID"/> + <column xsi:type="json" name="image_metadata" comment="Image metadata"/> <constraint xsi:type="primary" referenceId="PRIMARY"> <column name="record_id"/> </constraint> diff --git a/app/code/Magento/Catalog/etc/db_schema_whitelist.json b/app/code/Magento/Catalog/etc/db_schema_whitelist.json index d4bd6927d4345..a9b5dd2084c35 100644 --- a/app/code/Magento/Catalog/etc/db_schema_whitelist.json +++ b/app/code/Magento/Catalog/etc/db_schema_whitelist.json @@ -479,7 +479,8 @@ "label": true, "position": true, "disabled": true, - "record_id": true + "record_id": true, + "image_metadata": true }, "index": { "CATALOG_PRODUCT_ENTITY_MEDIA_GALLERY_VALUE_STORE_ID": true, diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/image.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/image.phtml index 5a31f3d125c81..24cae93ca61c0 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/image.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/image.phtml @@ -4,11 +4,15 @@ * See COPYING.txt for license details. */ ?> -<?php /** @var $block \Magento\Catalog\Block\Product\Image */ ?> +<?php +/** @var $block \Magento\Catalog\Block\Product\Image */ +/** @var $escaper \Magento\Framework\Escaper */ +?> -<img class="photo image <?= $block->escapeHtmlAttr($block->getClass()) ?>" - <?= $block->escapeHtml($block->getCustomAttributes()) ?> - src="<?= $block->escapeUrl($block->getImageUrl()) ?>" - width="<?= $block->escapeHtmlAttr($block->getWidth()) ?>" - height="<?= $block->escapeHtmlAttr($block->getHeight()) ?>" - alt="<?= /* @noEscape */ $block->stripTags($block->getLabel(), null, true) ?>" /> +<img class="photo image <?= $escaper->escapeHtmlAttr($block->getClass()) ?>" + <?= $escaper->escapeHtml($block->getCustomAttributes()) ?> + src="<?= $escaper->escapeUrl($block->getImageUrl()) ?>" + loading="lazy" + width="<?= $escaper->escapeHtmlAttr($block->getWidth()) ?>" + height="<?= $escaper->escapeHtmlAttr($block->getHeight()) ?>" + alt="<?= $escaper->escapeHtmlAttr($block->getLabel()) ?>" /> diff --git a/app/code/Magento/Catalog/view/frontend/templates/product/image_with_borders.phtml b/app/code/Magento/Catalog/view/frontend/templates/product/image_with_borders.phtml index 33f7620f1a1f5..e8ddabce504ea 100644 --- a/app/code/Magento/Catalog/view/frontend/templates/product/image_with_borders.phtml +++ b/app/code/Magento/Catalog/view/frontend/templates/product/image_with_borders.phtml @@ -4,16 +4,20 @@ * See COPYING.txt for license details. */ ?> -<?php /** @var $block \Magento\Catalog\Block\Product\Image */ ?> +<?php +/** @var $block \Magento\Catalog\Block\Product\Image */ +/** @var $escaper \Magento\Framework\Escaper */ +?> <span class="product-image-container" - style="width:<?= $block->escapeHtmlAttr($block->getWidth()) ?>px;"> + style="width:<?= $escaper->escapeHtmlAttr($block->getWidth()) ?>px;"> <span class="product-image-wrapper" style="padding-bottom: <?= ($block->getRatio() * 100) ?>%;"> - <img class="<?= $block->escapeHtmlAttr($block->getClass()) ?>" - <?= $block->escapeHtmlAttr($block->getCustomAttributes()) ?> - src="<?= $block->escapeUrl($block->getImageUrl()) ?>" - max-width="<?= $block->escapeHtmlAttr($block->getWidth()) ?>" - max-height="<?= $block->escapeHtmlAttr($block->getHeight()) ?>" - alt="<?= /* @noEscape */ $block->stripTags($block->getLabel(), null, true) ?>"/></span> + <img class="<?= $escaper->escapeHtmlAttr($block->getClass()) ?>" + <?= $escaper->escapeHtmlAttr($block->getCustomAttributes()) ?> + src="<?= $escaper->escapeUrl($block->getImageUrl()) ?>" + loading="lazy" + width="<?= $escaper->escapeHtmlAttr($block->getWidth()) ?>" + height="<?= $escaper->escapeHtmlAttr($block->getHeight()) ?>" + alt="<?= $escaper->escapeHtmlAttr($block->getLabel()) ?>"/></span> </span> 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 7fb4d8b025b07..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,7 @@ <argument name="rowIndex" value="0"/> </actionGroup> <!-- Log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> 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 @@ <argument name="rowIndex" value="0"/> </actionGroup> <!-- Log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Go to export page --> diff --git a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportImportConfigurableProductWithImagesTest.xml b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportImportConfigurableProductWithImagesTest.xml index c27a1716e84e5..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,7 @@ <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetProductGridColumnsInitial"/> <!-- Admin logout--> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> diff --git a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleAndConfigurableProductsWithCustomOptionsTest.xml b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleAndConfigurableProductsWithCustomOptionsTest.xml index a55e92d64ce00..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,7 @@ <argument name="rowIndex" value="0"/> </actionGroup> <!-- Log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> diff --git a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductAndConfigurableProductsWithAssignedImagesTest.xml b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductAndConfigurableProductsWithAssignedImagesTest.xml index 7131fe41ea5ec..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,7 @@ <argument name="rowIndex" value="0"/> </actionGroup> <!-- Log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> diff --git a/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductAssignedToMainWebsiteAndConfigurableProductAssignedToCustomWebsiteTest.xml b/app/code/Magento/CatalogImportExport/Test/Mftf/Test/AdminExportSimpleProductAssignedToMainWebsiteAndConfigurableProductAssignedToCustomWebsiteTest.xml index ea27d61e3b00c..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,7 @@ <argument name="rowIndex" value="0"/> </actionGroup> <!-- Log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> 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 @@ <argument name="rowIndex" value="0"/> </actionGroup> <!-- Log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Go to export page --> 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 @@ <after> <createData entity="DefaultValueForMaxSaleQty" stepKey="setDefaultValueForMaxSaleQty"/> <deleteData createDataKey="createdProduct" stepKey="deleteProduct"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Go to Inventory configuration page --> diff --git a/app/code/Magento/CatalogInventory/Test/Mftf/Test/AssociatedProductToConfigurableOutOfStockTest.xml b/app/code/Magento/CatalogInventory/Test/Mftf/Test/AssociatedProductToConfigurableOutOfStockTest.xml index 07354d0b4c89f..d0e3819ccc3cc 100644 --- a/app/code/Magento/CatalogInventory/Test/Mftf/Test/AssociatedProductToConfigurableOutOfStockTest.xml +++ b/app/code/Magento/CatalogInventory/Test/Mftf/Test/AssociatedProductToConfigurableOutOfStockTest.xml @@ -135,7 +135,7 @@ <waitForLoadingMaskToDisappear stepKey="waitForShipLoadingMask"/> <click selector="{{AdminShipmentMainActionsSection.submitShipment}}" stepKey="submitShipment"/> <waitForPageLoad stepKey="waitShipmentCreated"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <magentoCLI stepKey="runCron" command="cron:run --group='index'"/> <!-- Wait till cron job runs for schedule updates --> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithSpecialPricesTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithSpecialPricesTest.xml index 453c64a32ce32..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 @@ </actionGroup> <!-- Admin logout --> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> <!-- Delete all created data --> <deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/> 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 @@ <argument name="catalogRuleName" value="{{InactiveCatalogRule.name}}"/> </actionGroup> <actionGroup ref="AdminDeleteCatalogRuleActionGroup" stepKey="deleteTheCatalogRule"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Create Inactive Catalog Price Rule --> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminDeleteCatalogPriceRuleEntityTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminDeleteCatalogPriceRuleEntityTest.xml index d5efaec971bba..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 @@ <see selector="{{AdminNewCatalogPriceRule.successMessage}}" userInput="You saved the rule." stepKey="seeSuccessMessage"/> </before> <after> - <actionGroup ref="logout" stepKey="logoutOfAdmin1"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutOfAdmin1"/> <deleteData createDataKey="createCustomer1" stepKey="deleteCustomer1"/> <deleteData createDataKey="createProduct1" stepKey="deleteSimpleProduct1"/> @@ -174,7 +174,7 @@ <see selector="{{AdminNewCatalogPriceRule.successMessage}}" userInput="You saved the rule." stepKey="seeSuccessMessage"/> </before> <after> - <actionGroup ref="logout" stepKey="logoutOfAdmin1"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutOfAdmin1"/> <deleteData createDataKey="createCustomer1" stepKey="deleteCustomer"/> <deleteData createDataKey="createCategory1" stepKey="deleteCategory1"/> 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 @@ <amOnPage url="{{AdminCatalogPriceRuleGridPage.url}}" stepKey="goToCatalogRuleGridPage"/> <waitForPageLoad stepKey="waitForCatalogRuleGridPageLoaded"/> <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearCatalogRuleGridFilters"/> - <actionGroup ref="logout" stepKey="amOnLogoutPage"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="amOnLogoutPage"/> </after> <!-- Create a catalog price rule --> 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 @@ <deleteData createDataKey="createSecondCategory" stepKey="deleteSecondCategory"/> <deleteData createDataKey="createSecondProductAttribute" stepKey="deleteSecondProductAttribute"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <magentoCLI command="indexer:reindex" stepKey="reindex"/> <magentoCLI command="cache:flush" stepKey="flushCache"/> </after> 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 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToCatalogPriceRulePage"> <argument name="menuUiId" value="{{AdminMenuMarketing.dataUiId}}"/> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogPriceRuleByProductAttributeTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogPriceRuleByProductAttributeTest.xml index c3cb4d6180f18..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,7 @@ </actionGroup> <click stepKey="resetFilters" selector="{{AdminSecondaryGridSection.resetFilters}}"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleAndConfigurableProductTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/ApplyCatalogRuleForSimpleAndConfigurableProductTest.xml index dad3063dae45f..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 @@ </actionGroup> <!-- Logout --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!-- Delete products and category --> <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> 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 @@ </actionGroup> <!-- Logout --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- 1. Begin creating a new catalog price rule --> <actionGroup ref="NewCatalogPriceRuleByUIWithConditionIsCategoryActionGroup" stepKey="newCatalogPriceRuleByUIWithConditionIsCategory"> 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 @@ </actionGroup> <!-- Logout --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- 1. Begin creating a new catalog price rule --> <actionGroup ref="NewCatalogPriceRuleByUIWithConditionIsCategoryActionGroup" stepKey="newCatalogPriceRuleByUIWithConditionIsCategory"> 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 @@ </actionGroup> <!-- Logout --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- 1. Begin creating a new catalog price rule --> <actionGroup ref="NewCatalogPriceRuleByUIWithConditionIsCategoryActionGroup" stepKey="newCatalogPriceRuleByUIWithConditionIsCategory"> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/CatalogPriceRuleAndCustomerGroupMembershipArePersistedUnderLongTermCookieTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/CatalogPriceRuleAndCustomerGroupMembershipArePersistedUnderLongTermCookieTest.xml index 102054c315f4c..8130bdaae6303 100644 --- a/app/code/Magento/CatalogRule/Test/Mftf/Test/CatalogPriceRuleAndCustomerGroupMembershipArePersistedUnderLongTermCookieTest.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/Test/CatalogPriceRuleAndCustomerGroupMembershipArePersistedUnderLongTermCookieTest.xml @@ -54,7 +54,7 @@ <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> <!-- Delete the rule --> <actionGroup ref="AdminCatalogPriceRuleDeleteAllActionGroup" stepKey="deleteAllCatalogPriceRule"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Go to category and check price--> diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/StorefrontInactiveCatalogRuleTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/StorefrontInactiveCatalogRuleTest.xml index 45b0c1bcaa5a0..17266b0c80d7a 100644 --- a/app/code/Magento/CatalogRule/Test/Mftf/Test/StorefrontInactiveCatalogRuleTest.xml +++ b/app/code/Magento/CatalogRule/Test/Mftf/Test/StorefrontInactiveCatalogRuleTest.xml @@ -42,7 +42,7 @@ <deleteData createDataKey="createProduct" stepKey="deleteSimpleProduct"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <actionGroup ref="AdminCatalogPriceRuleDeleteAllActionGroup" stepKey="deleteAllCatalogPriceRule"/> - <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> </after> <!-- Verify price is not discounted on category page --> diff --git a/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithAssignedSimpleProducts2Test.xml b/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithAssignedSimpleProducts2Test.xml index 80ff2a447052c..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,7 @@ <!-- Delete created price rules --> <actionGroup ref="AdminCatalogPriceRuleDeleteAllActionGroup" stepKey="deleteAllCatalogPriceRule"/> <!-- Admin log out --> - <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> diff --git a/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithAssignedSimpleProductsTest.xml b/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithAssignedSimpleProductsTest.xml index ea0d8e01d540f..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,7 @@ </actionGroup> <!-- Admin log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> diff --git a/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithOptions2Test.xml b/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithOptions2Test.xml index 2a5786b38107f..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,7 @@ <deleteData createDataKey="simpleCategory" stepKey="deleteCategory"/> <actionGroup ref="AdminCatalogPriceRuleDeleteAllActionGroup" stepKey="deleteAllCatalogPriceRule"/> - <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> diff --git a/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithOptionsTest.xml b/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithOptionsTest.xml index c077719dfa80b..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,7 @@ </actionGroup> <!-- Log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> 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 @@ <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> <!-- Log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Go to the search terms page and create new search term --> 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 @@ <after> <deleteData stepKey="deleteSimpleSubCategory" createDataKey="initialCategoryEntity"/> <deleteData stepKey="deleteSimpleProduct" createDataKey="simpleProduct"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Add new search term--> 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 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToMarketingSearchTermsPage"> <argument name="menuUiId" value="{{AdminMenuMarketing.dataUiId}}"/> 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 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToReportSearchTermsPage"> <argument name="menuUiId" value="{{AdminMenuReports.dataUiId}}"/> 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 @@ <deleteData stepKey="deleteSimpleProduct1" createDataKey="simpleProduct1"/> <deleteData stepKey="deleteSimpleProduct2" createDataKey="simpleProduct2"/> <deleteData createDataKey="createPriceAttribute" stepKey="deleteAttribute"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Update value for price attribute of Product 1--> <comment userInput="Update value for price attribute of Product 1" stepKey="comment1"/> 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 @@ <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> <createData entity="SetMinQueryLengthToDefault" stepKey="setMinimumQueryLengthToDefault"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="SetMinimalQueryLengthActionGroup" stepKey="setMinQueryLength"/> <comment userInput="Go to Storefront and search for product" stepKey="searchProdUsingMinQueryLength"/> 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 @@ <argument name="sku" value="{{_defaultProduct.sku}}"/> </actionGroup> <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearProductsGridFilters"/> - <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> </after> <amOnPage url="{{StorefrontHomePage.url}}" stepKey="goToFrontPage"/> <actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="searchStorefront"> @@ -465,7 +465,7 @@ <after> <deleteData stepKey="deleteGroupedProduct" createDataKey="createProduct"/> <deleteData stepKey="deleteSimpleProduct" createDataKey="simple1"/> - <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> </after> <amOnPage url="{{StorefrontHomePage.url}}" stepKey="goToFrontPage"/> <actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="searchStorefront"> @@ -517,7 +517,7 @@ <deleteData stepKey="deleteBundleProduct" createDataKey="createBundleProduct"/> <deleteData stepKey="deleteProduct" createDataKey="createProduct"/> <deleteData stepKey="deleteCategory" createDataKey="createCategory"/> - <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> </after> <amOnPage url="{{StorefrontHomePage.url}}" stepKey="goToFrontPage"/> <actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="searchStorefront"> @@ -586,7 +586,7 @@ <deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/> <deleteData createDataKey="simpleProduct2" stepKey="deleteSimpleProduct2"/> <deleteData stepKey="deleteCategory" createDataKey="createCategory"/> - <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> </after> <comment userInput="$simpleProduct1.name$" stepKey="asdf"/> <amOnPage url="{{StorefrontHomePage.url}}" stepKey="goToFrontPage"/> 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 @@ <after> <!-- Delete data --> <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> - <actionGroup ref="logout" stepKey="logoutAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutAdmin"/> </after> <!-- Perform reindex and flush cache --> 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 @@ <deleteData createDataKey="createProductAttribute" stepKey="deleteProductAttribute"/> <deleteData createDataKey="createAttributeSet" stepKey="deleteAttributeSet"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> </after> <amOnPage url="{{StorefrontHomePage.url}}" stepKey="goToHomePage"/> <actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="searchStorefront"> 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 @@ <comment userInput="Delete all search terms" stepKey="deleteAllSearchTermsComment"/> <actionGroup ref="AdminDeleteAllSearchTermsActionGroup" stepKey="deleteAllSearchTerms"/> - <actionGroup ref="logout" stepKey="logoutOfAdmin1"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutOfAdmin1"/> </after> <actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="quickSearchByProductName1"> 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 @@ <actionGroup ref="AdminDeleteCategoryByNameActionGroup" stepKey="deleteGraphQlCategory"> <argument name="categoryName" value="graphql"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Check category creation with restricted url key 'admin'--> <comment userInput="Check category creation with restricted url key 'admin'" stepKey="commentCheckAdminCategoryCreation"/> 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 @@ <deleteData createDataKey="createProduct" stepKey="deleteSimpleProduct"/> <deleteData createDataKey="category" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Open Created product--> 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 @@ <after> <actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteStoreView"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <deleteData createDataKey="subCategory" stepKey="deleteSubCategory"/> <deleteData createDataKey="defaultCategory" stepKey="deleteNewRootCategory"/> 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 @@ <title value="Storefront category is accessible when url suffix is set to null test"/> <description value="Check no crash occurs on Category page when catalog/seo/category_url_suffix is set to null"/> <features value="CatalogUrlRewrite"/> + <stories value="Url rewrites"/> <severity value="MAJOR"/> <group value="CatalogUrlRewrite"/> </annotations> 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 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +namespace Magento\CatalogUrlRewrite\Test\Unit\Observer; + +use Magento\Catalog\Model\Product; +use Magento\CatalogUrlRewrite\Model\ProductUrlRewriteGenerator; +use Magento\CatalogUrlRewrite\Observer\ProductProcessUrlRewriteRemovingObserver; +use Magento\Framework\Event; +use Magento\Framework\Event\Observer; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\UrlRewrite\Model\UrlPersistInterface; +use Magento\UrlRewrite\Service\V1\Data\UrlRewrite; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; + +/** + * Unit test for Magento\CatalogUrlRewrite\Observer\ProductProcessUrlRewriteRemovingObserver + */ +class ProductProcessUrlRewriteRemovingObserverTest extends TestCase +{ + /* + * Stub product ID + */ + private const STUB_PRODUCT_ID = 333; + + /** + * Testable Object + * + * @var ProductProcessUrlRewriteRemovingObserver + */ + private $observer; + + /** + * @var ObjectManager + */ + private $objectManager; + + /** + * @var Observer|MockObject + */ + private $observerMock; + + /** + * @var Event|MockObject + */ + private $eventMock; + + /** + * @var Product|MockObject + */ + private $productMock; + + /** + * @var UrlPersistInterface|MockObject + */ + private $urlPersistMock; + + /** + * @inheritdoc + */ + protected function setUp(): void + { + $this->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/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 @@ <deleteData createDataKey="createFirstProduct" stepKey="deleteFirstProduct"/> <deleteData createDataKey="createSecondProduct" stepKey="deleteSecondProduct"/> <deleteData createDataKey="createThirdProduct" stepKey="deleteThirdProduct"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> </test> </tests> 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 @@ <deleteData createDataKey="createFirstProduct" stepKey="deleteFirstProduct"/> <deleteData createDataKey="createSecondProduct" stepKey="deleteSecondProduct"/> <deleteData createDataKey="createThirdProduct" stepKey="deleteThirdProduct"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> </test> </tests> diff --git a/app/code/Magento/CatalogWidget/Test/Mftf/Test/StorefrontProductGridUIUpdatesOnDesktopTest.xml b/app/code/Magento/CatalogWidget/Test/Mftf/Test/StorefrontProductGridUIUpdatesOnDesktopTest.xml index f1753f4c0b649..74e1110c95636 100644 --- a/app/code/Magento/CatalogWidget/Test/Mftf/Test/StorefrontProductGridUIUpdatesOnDesktopTest.xml +++ b/app/code/Magento/CatalogWidget/Test/Mftf/Test/StorefrontProductGridUIUpdatesOnDesktopTest.xml @@ -56,7 +56,7 @@ <deleteData createDataKey="createFourthSimpleProduct" stepKey="deleteFourthSimpleProduct"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createCmsPage" stepKey="deleteCmsPage"/> - <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> </after> <actionGroup ref="StorefrontGoToCMSPageActionGroup" stepKey="navigateAndOpenCreatedCmsPage"> <argument name="identifier" value="$createCmsPage.identifier$"/> 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/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 @@ <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> <!-- Log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Add product to cart --> 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 @@ <!--Logout from customer account--> <amOnPage url="{{StorefrontCustomerLogoutPage.url}}" stepKey="logoutCustomerOne"/> <waitForPageLoad stepKey="waitLogoutCustomerOne"/> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> <deleteData createDataKey="createSimpleProduct" stepKey="deleteProduct"/> <deleteData createDataKey="createSimpleUsCustomer" stepKey="deleteCustomer"/> </after> @@ -147,7 +147,7 @@ </before> <after> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> <deleteData createDataKey="createSimpleProduct" stepKey="deleteProduct"/> </after> 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 @@ </actionGroup> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <deleteData createDataKey="simpleProduct" stepKey="deleteProduct"/> <deleteData createDataKey="defaultCategory" stepKey="deleteCategory"/> 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 @@ <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> <!-- Admin logout --> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> </after> <!-- Create store views --> 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 @@ </before> <after> <!-- Admin log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!-- Customer log out --> <actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="customerLogout"/> 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 @@ </before> <after> <!-- Admin log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!-- Customer log out --> <actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="customerLogout"/> 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 @@ </before> <after> <!-- Admin log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!-- Customer Log out --> <actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="customerLogout"/> 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 @@ </before> <after> <!-- Admin log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!-- Customer Log out --> <actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="customerLogout"/> 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 @@ <after> <deleteData createDataKey="product" stepKey="deleteProduct" /> <deleteData createDataKey="category" stepKey="deleteCategory" /> - <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> </after> <amOnPage url="$$product.name$$.html" stepKey="navigateToProductPage"/> 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 @@ <actionGroup ref="DeleteCartPriceRuleByName" stepKey="deleteCartPriceRule"> <argument name="ruleName" value="{{CatPriceRule.name}}"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="ApplyCartRuleOnStorefrontActionGroup" stepKey="applyCartRule"> 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 @@ <after> <magentoCLI stepKey="removeDownloadableDomain" command="downloadable:domains:remove example.com static.magento.com"/> <deleteData createDataKey="createDownloadableProduct" stepKey="deleteProduct"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Open Downloadable Product page --> 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 @@ <deleteData createDataKey="createCartPriceRule" stepKey="deleteCartPriceRule"/> <!-- Admin log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Go to Storefront as Guest and add simple product to cart --> 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 @@ <actionGroup ref="AdminDeleteCustomerActionGroup" stepKey="deleteCustomer"> <argument name="customerEmail" value="UKCustomer.email"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Open Product page in StoreFront and assert product and price range --> 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 @@ <actionGroup ref="AdminDeleteCustomerActionGroup" stepKey="deleteCustomer"> <argument name="customerEmail" value="UKCustomer.email"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Open Product page in StoreFront and assert product and price range --> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutWithSpecialPriceProductsTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCheckoutWithSpecialPriceProductsTest.xml index 3f286df8337de..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,7 @@ <deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/> <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteProductAttribute"/> <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> 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 @@ <actionGroup ref="StorefrontSignOutActionGroup" stepKey="customerLogout"/> <deleteData createDataKey="simpleProduct" stepKey="deleteProduct"/> <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Open Product page in StoreFront and assert product and price range --> 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 @@ <deleteData createDataKey="createCategory" stepKey="deleteSimpleCategory"/> <deleteData createDataKey="createCustomer" stepKey="deleteUsCustomer"/> <actionGroup ref="AdminClearCustomersFiltersActionGroup" stepKey="resetCustomerFilters"/> - <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> <actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="logoutCustomer"/> </after> @@ -144,7 +144,7 @@ <argument name="name" value="{{SimpleTaxCA.state}}-{{SimpleTaxCA.rate}}"/> <argument name="searchInput" value="{{AdminSecondaryGridSection.taxIdentifierSearch}}"/> </actionGroup> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> <deleteData createDataKey="simpleproduct1" stepKey="deleteProduct1"/> <deleteData createDataKey="simplecategory" stepKey="deleteCategory"/> <deleteData createDataKey="multiple_address_customer" stepKey="deleteCustomer"/> 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 @@ <actionGroup ref="StorefrontSignOutActionGroup" stepKey="customerLogout"/> <deleteData createDataKey="simpleProduct" stepKey="deleteProduct"/> <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Open Product page in StoreFront and assert product and price range --> 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 @@ <actionGroup ref="SelectCountriesWithRequiredRegionActionGroup" stepKey="setDefaultCountriesWithRequiredRegion"> <argument name="countries" value="DefaultCountriesWithRequiredRegions"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> 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 @@ </actionGroup> <!-- Logout admin --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Go to Storefront as Guest and create new account --> <actionGroup ref="SignUpNewUserFromStorefrontActionGroup" stepKey="createNewCustomerAccount"/> 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 @@ <deleteData createDataKey="simpleProduct1" stepKey="deleteProduct1"/> <deleteData createDataKey="createBundleProduct" stepKey="deleteBundleProduct"/> <deleteData createDataKey="createSubCategory" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Open Product page in StoreFront --> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteConfigurableProductFromMiniShoppingCartTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontDeleteConfigurableProductFromMiniShoppingCartTest.xml index d302289b27f19..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,7 @@ <deleteData createDataKey="createConfigProduct" stepKey="deleteProduct"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteProductAttribute"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> 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 @@ <after> <magentoCLI stepKey="removeDownloadableDomain" command="downloadable:domains:remove example.com static.magento.com"/> <deleteData createDataKey="createDownloadableProduct" stepKey="deleteProduct"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Open Downloadable Product page --> 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 @@ <deleteData createDataKey="simpleProduct8" stepKey="deleteProduct8"/> <deleteData createDataKey="simpleProduct9" stepKey="deleteProduct9"/> <deleteData createDataKey="simpleProduct10" stepKey="deleteProduct10"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Open Product1 page in StoreFront--> 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 @@ <after> <deleteData createDataKey="simpleProduct" stepKey="deleteSimpleProduct"/> <deleteData createDataKey="virtualProduct" stepKey="deleteVirtualproduct"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Add Simple Product to the cart --> 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 @@ </before> <after> <deleteData createDataKey="simpleProduct" stepKey="deleteProduct"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Add Simple Product to the cart --> 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 @@ <magentoCLI command="cache:flush" stepKey="flushCache"/> </before> <after> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> </after> @@ -114,7 +114,7 @@ <magentoCLI command="cache:flush" stepKey="flushCache"/> </before> <after> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> <magentoCLI stepKey="allowSpecificValue" command="config:set payment/checkmo/allowspecific 0" /> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutUsingFreeShippingAndTaxesTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontGuestCheckoutUsingFreeShippingAndTaxesTest.xml index e544cbb497f2d..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,7 @@ <deleteData createDataKey="createTaxRule" stepKey="deleteTaxRule1"/> <createData entity="DefaultShippingMethodsConfig" stepKey="defaultShippingMethodsConfig"/> <createData entity="DefaultMinimumOrderAmount" stepKey="defaultMinimumOrderAmount"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> 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 @@ <after> <deleteData createDataKey="virtualProduct" stepKey="deleteVirtualProduct"/> <deleteData createDataKey="createSalesRule" stepKey="deleteSalesRule"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Open Product page in StoreFront and assert product and price range --> diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontNotApplicableShippingMethodInReviewAndPaymentStepTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontNotApplicableShippingMethodInReviewAndPaymentStepTest.xml index cb3b8a1934e4c..d83550a82a87c 100644 --- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontNotApplicableShippingMethodInReviewAndPaymentStepTest.xml +++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontNotApplicableShippingMethodInReviewAndPaymentStepTest.xml @@ -83,7 +83,7 @@ <argument name="postcode" value=""/> <argument name="street" value=""/> </actionGroup> - <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> </after> <!-- Guest Customer Test Scenario --> 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 @@ <argument name="customStore" value="customStore"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Create store view --> 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 @@ <after> <magentoCLI command="config:set {{DisablePaymentBankTransferConfigData.path}} {{DisablePaymentBankTransferConfigData.value}}" stepKey="enableGuestCheckout"/> <deleteData createDataKey="simpleProduct" stepKey="deleteProduct"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Open Product page in StoreFront and assert product and price range --> 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 @@ <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> <!-- Logout admin --> - <actionGroup ref="logout" stepKey="logoutAsAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutAsAdmin"/> </after> <!-- Add simple product to cart as Guest --> <amOnPage url="{{StorefrontProductPage.url($$createProduct.custom_attributes[url_key]$$)}}" stepKey="goToProductPage"/> 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 @@ <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> <deleteData createDataKey="createSalesRule" stepKey="deleteSalesRule"/> <actionGroup ref="AdminOrdersGridClearFiltersActionGroup" stepKey="clearOrderFilters"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Open Downloadable Product page --> 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 @@ </before> <after> <deleteData createDataKey="simpleProduct" stepKey="deleteProduct"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Open Product page in StoreFront and assert product and price range --> 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 @@ <magentoCLI command="config:set {{DisablePaymentBankTransferConfigData.path}} {{DisablePaymentBankTransferConfigData.value}}" stepKey="disableBankTransferPayment"/> <deleteData createDataKey="simpleProduct" stepKey="deleteProduct"/> <deleteData createDataKey="createSalesRule" stepKey="deleteSalesRule"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Open Product page in StoreFront and assert product and price range --> 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 @@ <deleteData createDataKey="createSimpleProduct" stepKey="deleteProduct"/> <actionGroup ref="SetCustomerDataLifetimeActionGroup" stepKey="setDefaultCustomerDataLifetime"/> <magentoCLI command="indexer:reindex customer_grid" stepKey="reindexCustomerGrid"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Go to product page--> <amOnPage url="{{StorefrontProductPage.url($$createSimpleProduct.custom_attributes[url_key]$$)}}" stepKey="navigateToSimpleProductPage"/> 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 @@ <createData entity="DefaultShippingMethodsConfig" stepKey="defaultShippingMethodsConfig"/> <createData entity="DisableFreeShippingConfig" stepKey="disableFreeShippingConfig"/> <createData entity="DisablePaymentMethodsSettingConfig" stepKey="disablePaymentMethodsSettingConfig"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <deleteData createDataKey="simpleproduct" stepKey="deleteProduct"/> <deleteData createDataKey="simplecategory" stepKey="deleteCategory"/> </after> 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_index_index.xml b/app/code/Magento/Checkout/view/frontend/layout/checkout_index_index.xml index fed0c951eff9f..c33b784fcd20c 100644 --- a/app/code/Magento/Checkout/view/frontend/layout/checkout_index_index.xml +++ b/app/code/Magento/Checkout/view/frontend/layout/checkout_index_index.xml @@ -222,9 +222,6 @@ <item name="min_text_length" xsi:type="number">0</item> </item> </item> - <item name="country_id" xsi:type="array"> - <item name="sortOrder" xsi:type="string">115</item> - </item> <item name="telephone" xsi:type="array"> <item name="config" xsi:type="array"> <item name="tooltip" xsi:type="array"> 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 @@ <actionGroup ref="DeleteTermActionGroup" stepKey="deleteTerm"> <argument name="term" value="activeHtmlTerm"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="CreateNewTermActionGroup" stepKey="createTerm"> 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 @@ <actionGroup ref="DeleteTermActionGroup" stepKey="deleteTerm"> <argument name="term" value="activeTextTerm"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="CreateNewTermActionGroup" stepKey="createTerm"> 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 @@ <actionGroup ref="DeleteTermActionGroup" stepKey="deleteTerm"> <argument name="term" value="disabledTextTerm"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="CreateNewTermActionGroup" stepKey="createTerm"> 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 @@ <actionGroup ref="DeleteTermActionGroup" stepKey="deleteTerm"> <argument name="term" value="activeTextTerm"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="CreateNewTermActionGroup" stepKey="createTerm"> 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 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToStoresTermsAndConditionsPage"> <argument name="menuUiId" value="{{AdminMenuStores.dataUiId}}"/> 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/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 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminSaveAndDuplicateCMSPageWithSplitButtonActionGroup"> + <annotations> + <description>Clicks on the Save and Duplicate button.</description> + </annotations> + + <waitForElementVisible selector="{{CmsNewPagePageActionsSection.expandSplitButton}}" stepKey="waitForExpandSplitButtonToBeVisible"/> + <click selector="{{CmsNewPagePageActionsSection.expandSplitButton}}" stepKey="expandSplitBtn2" /> + <click selector="{{CmsNewPagePageActionsSection.saveAndDuplicate}}" stepKey="clickSaveAndDuplicate" /> + <waitForPageLoad stepKey="waitForPageLoadAfterClickingSaveAndDuplicate"/> + <see userInput="You saved the page." stepKey="seeSavedPageMsgOnForm"/> + <see userInput="You duplicated the page." stepKey="seeDuplicatedPageMsg"/> + </actionGroup> +</actionGroups> 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 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertAdminCmsPageSaveSplitButtonActionGroup"> + <annotations> + <description>Verify Save and Duplicate and Save and Close button.</description> + </annotations> + + <amOnPage url="{{CmsNewPagePage.url}}" stepKey="amOnPageCreationForm"/> + <waitForPageLoad stepKey="waitForPageLoad1"/> + <click selector="{{CmsNewPagePageActionsSection.expandSplitButton}}" stepKey="expandSplitBtn1" /> + <see selector="{{CmsNewPagePageActionsSection.saveAndDuplicate}}" userInput="Save & Duplicate" stepKey="seeSaveAndDuplicate"/> + <see selector="{{CmsNewPagePageActionsSection.saveAndClose}}" userInput="Save & Close" stepKey="seeSaveAndClose"/> + </actionGroup> +</actionGroups> 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 @@ <!-- Switch WYSIWYG editor to TinyMCE4--> <comment userInput="Reset editor as TinyMCE4" stepKey="chooseTinyMCE4AsEditor"/> <magentoCLI command="config:set cms/wysiwyg/editor mage/adminhtml/wysiwyg/tiny_mce/tinymce4Adapter" stepKey="enableTinyMCE4"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <amOnPage url="{{CmsNewPagePage.url}}" stepKey="navigateToPage2"/> <waitForPageLoad stepKey="wait5"/> 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 @@ <before> <createData entity="_defaultCmsPage" stepKey="createCMSPage" /> <createData entity="_defaultBlock" stepKey="createPreReqBlock" /> - <actionGroup ref="LoginActionGroup" stepKey="login"/> + <actionGroup ref="AdminLoginActionGroup" stepKey="login"/> <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> @@ -63,7 +63,7 @@ <deleteData createDataKey="createPreReqBlock" stepKey="deletePreReqBlock" /> <deleteData createDataKey="createCMSPage" stepKey="deletePreReqCMSPage" /> <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> </test> </tests> 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 @@ </annotations> <before> <createData entity="_defaultCmsPage" stepKey="createCMSPage" /> - <actionGroup ref="LoginActionGroup" stepKey="login"/> + <actionGroup ref="AdminLoginActionGroup" stepKey="login"/> <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> @@ -58,7 +58,7 @@ <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYGFirst"/> <deleteData createDataKey="createCMSPage" stepKey="deletePreReqCMSPage" /> <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> </test> </tests> 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 @@ <before> <createData entity="_defaultCmsPage" stepKey="createCMSPage" /> <createData entity="_defaultBlock" stepKey="createPreReqBlock" /> - <actionGroup ref="LoginActionGroup" stepKey="loginGetFromGeneralFile"/> + <actionGroup ref="AdminLoginActionGroup" stepKey="loginGetFromGeneralFile"/> <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> @@ -143,7 +143,7 @@ <deleteData createDataKey="createPreReqBlock" stepKey="deletePreReqBlock" /> <deleteData createDataKey="createCMSPage" stepKey="deletePreReqCMSPage" /> <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> </test> </tests> 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 @@ <testCaseId value="MAGETWO-83504"/> </annotations> <before> - <actionGroup ref="LoginActionGroup" stepKey="loginGetFromGeneralFile"/> + <actionGroup ref="AdminLoginActionGroup" stepKey="loginGetFromGeneralFile"/> <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> @@ -95,7 +95,7 @@ <dontSee userInput="{{customVariable.html}}" stepKey="dontSeeCustomVariableName" /> <after> <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> </test> </tests> 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 @@ <before> <createData entity="_defaultCmsPage" stepKey="createCMSPage" /> <createData entity="_defaultBlock" stepKey="createPreReqBlock" /> - <actionGroup ref="LoginActionGroup" stepKey="login"/> + <actionGroup ref="AdminLoginActionGroup" stepKey="login"/> <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> @@ -81,7 +81,7 @@ <deleteData createDataKey="createCMSPage" stepKey="deletePreReqCMSPage" /> <deleteData createDataKey="createPreReqBlock" stepKey="deletePreReqBlock" /> <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> </test> </tests> 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 @@ <testCaseId value="MAGETWO-83781"/> </annotations> <before> - <actionGroup ref="LoginActionGroup" stepKey="login"/> + <actionGroup ref="AdminLoginActionGroup" stepKey="login"/> <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> @@ -67,7 +67,7 @@ <see userInput="Home page" stepKey="seeHomepageWidget" /> <after> <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> </test> </tests> 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 @@ </annotations> <before> <createData entity="_defaultBlock" stepKey="createPreReqBlock" /> - <actionGroup ref="LoginActionGroup" stepKey="login"/> + <actionGroup ref="AdminLoginActionGroup" stepKey="login"/> <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> @@ -69,7 +69,7 @@ <after> <deleteData createDataKey="createPreReqBlock" stepKey="deletePreReqBlock" /> <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> </test> </tests> 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 @@ </annotations> <before> <createData entity="_defaultCategory" stepKey="createPreReqCategory"/> - <actionGroup ref="LoginActionGroup" stepKey="login"/> + <actionGroup ref="AdminLoginActionGroup" stepKey="login"/> <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> <actionGroup ref="ConfigAdminAccountSharingActionGroup" stepKey="allowAdminShareAccount"/> @@ -77,7 +77,7 @@ <deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCatalog" /> <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> <magentoCLI command="config:set catalog/seo/generate_category_product_rewrites 1" stepKey="enableGenerateUrlRewrite"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> </test> </tests> 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 @@ <createData entity="_defaultProduct" stepKey="createPreReqProduct"> <requiredEntity createDataKey="createPreReqCategory"/> </createData> - <actionGroup ref="LoginActionGroup" stepKey="login"/> + <actionGroup ref="AdminLoginActionGroup" stepKey="login"/> <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> @@ -84,7 +84,7 @@ <deleteData createDataKey="createPreReqProduct" stepKey="deletePreReqProduct" /> <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> <magentoCLI command="config:set catalog/seo/generate_category_product_rewrites 1" stepKey="enableGenerateUrlRewrite"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> </test> </tests> 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 @@ <createData entity="_defaultProduct" stepKey="createPreReqProduct2"> <requiredEntity createDataKey="createPreReqCategory"/> </createData> - <actionGroup ref="LoginActionGroup" stepKey="login"/> + <actionGroup ref="AdminLoginActionGroup" stepKey="login"/> <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> @@ -100,7 +100,7 @@ <deleteData createDataKey="createPreReqProduct1" stepKey="deletePreReqProduct1" /> <deleteData createDataKey="createPreReqProduct2" stepKey="deletePreReqProduct2" /> <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> </test> </tests> 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 @@ <createData entity="_defaultProduct" stepKey="createPreReqProduct"> <requiredEntity createDataKey="createPreReqCategory"/> </createData> - <actionGroup ref="LoginActionGroup" stepKey="login"/> + <actionGroup ref="AdminLoginActionGroup" stepKey="login"/> <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> @@ -83,7 +83,7 @@ <deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCatalog" /> <deleteData createDataKey="createPreReqProduct" stepKey="deletePreReqProduct" /> <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> </test> </tests> 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 @@ <createData entity="_defaultProduct" stepKey="createPreReqProduct"> <requiredEntity createDataKey="createPreReqCategory"/> </createData> - <actionGroup ref="LoginActionGroup" stepKey="login"/> + <actionGroup ref="AdminLoginActionGroup" stepKey="login"/> <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> @@ -73,7 +73,7 @@ <deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCatalog" /> <deleteData createDataKey="createPreReqProduct" stepKey="deletePreReqProduct" /> <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> </test> </tests> 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 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Go to New CMS Page page--> <actionGroup ref="AdminOpenCreateNewCMSPageActionGroup" stepKey="navigateToCreateNewPage"/> 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 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Go to New CMS Page page--> <actionGroup ref="AdminOpenCreateNewCMSPageActionGroup" stepKey="navigateToCreateNewPage"/> 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 @@ </before> <after> <magentoCLI command="config:set {{StorefrontSingleStoreModeDisabledConfigData.path}} {{StorefrontSingleStoreModeDisabledConfigData.value}}" stepKey="disableSingleStoreMode" /> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Go to New CMS Page page--> <actionGroup ref="AdminOpenCreateNewCMSPageActionGroup" stepKey="navigateToCreateNewPage"/> 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 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Go to New CMS Page page--> <actionGroup ref="AdminOpenCreateNewCMSPageActionGroup" stepKey="navigateToCreateNewPage"/> 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 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Go to New CMS Page page--> <actionGroup ref="AdminOpenCreateNewCMSPageActionGroup" stepKey="navigateToCreateNewPage"/> 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 @@ <test name="AdminCmsPageMassActionTest"> <annotations> <features value="CmsPage"/> + <stories value="Create CMS Page"/> <title value="Create two CMS Pages and perform mass disable action"/> <description value="Admin should be able to perform mass actions to CMS pages"/> <stories value="Admin Grid Mass Action" /> @@ -27,7 +28,7 @@ <after> <deleteData createDataKey="firstCMSPage" stepKey="deleteFirstCMSPage" /> <deleteData createDataKey="secondCMSPage" stepKey="deleteSecondCMSPage" /> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Go to Grid page--> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminConfigDefaultCMSPageLayoutFromConfigurationSettingTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminConfigDefaultCMSPageLayoutFromConfigurationSettingTest.xml index ee06b4ce86656..99990595fca95 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminConfigDefaultCMSPageLayoutFromConfigurationSettingTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminConfigDefaultCMSPageLayoutFromConfigurationSettingTest.xml @@ -23,7 +23,7 @@ </before> <after> <actionGroup ref="RestoreLayoutSetting" stepKey="sampleActionGroup"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <amOnPage url="{{WebConfigurationPage.url}}" stepKey="navigateToWebConfigurationPage"/> <waitForPageLoad stepKey="waitForPageLoad"/> 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 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToContentBlocksPage"> <argument name="menuUiId" value="{{AdminMenuContent.dataUiId}}"/> 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 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToContentPagesPage"> <argument name="menuUiId" value="{{AdminMenuContent.dataUiId}}"/> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsBlockTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsBlockTest.xml index 7e7d942140645..eb13bb71b5f6b 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsBlockTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsBlockTest.xml @@ -20,13 +20,13 @@ <group value="WYSIWYGDisabled"/> </annotations> <before> - <actionGroup ref="LoginActionGroup" stepKey="loginGetFromGeneralFile"/> + <actionGroup ref="AdminLoginActionGroup" stepKey="loginGetFromGeneralFile"/> </before> <after> <actionGroup ref="deleteBlock" stepKey="deleteCreatedBlock"> <argument name="Block" value="_defaultBlock"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Navigate to create cms block page and verify save split button --> <actionGroup ref="VerifyCmsBlockSaveSplitButtonActionGroup" stepKey="verifyCmsBlockSaveButton" /> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsPageTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsPageTest.xml index 82bcb295c2a9a..b2fca0ff99115 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsPageTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateCmsPageTest.xml @@ -20,10 +20,10 @@ <group value="WYSIWYGDisabled"/> </annotations> <before> - <actionGroup ref="LoginActionGroup" stepKey="loginGetFromGeneralFile"/> + <actionGroup ref="AdminLoginActionGroup" stepKey="loginGetFromGeneralFile"/> </before> <after> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> </after> <actionGroup ref="AdminNavigateToPageGridActionGroup" stepKey="navigateToCmsPageGrid" /> <actionGroup ref="CreateNewPageWithBasicValues" stepKey="createNewPageWithBasicValues" /> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateDuplicatedCmsPageTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateDuplicatedCmsPageTest.xml index 5c5fccf761aa1..1e2e47de8c17f 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateDuplicatedCmsPageTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminCreateDuplicatedCmsPageTest.xml @@ -20,30 +20,24 @@ <group value="WYSIWYGDisabled"/> </annotations> <before> - <actionGroup ref="LoginActionGroup" stepKey="loginGetFromGeneralFile"/> + <actionGroup ref="AdminLoginActionGroup" stepKey="loginGetFromGeneralFile"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> - <amOnPage url="{{CmsNewPagePage.url}}" stepKey="amOnPageCreationForm"/> - <waitForPageLoad stepKey="waitForPageLoad1"/> - <!--Verify Save&Duplicate button and Save&Close button--> - <click selector="{{CmsNewPagePageActionsSection.expandSplitButton}}" stepKey="expandSplitBtn1" /> - <see selector="{{CmsNewPagePageActionsSection.saveAndDuplicate}}" userInput="Save & Duplicate" stepKey="seeSaveAndDuplicate"/> - <see selector="{{CmsNewPagePageActionsSection.saveAndClose}}" userInput="Save & Close" stepKey="seeSaveAndClose"/> - <!--Create new CMS Page page--> - <actionGroup ref="FillOutCMSPageContent" stepKey="FillOutBlockContent"/> - <click selector="{{CmsNewPagePageActionsSection.expandSplitButton}}" stepKey="expandSplitBtn2" /> - <click selector="{{CmsNewPagePageActionsSection.saveAndDuplicate}}" stepKey="clickSaveAndDuplicate" /> - <waitForPageLoad stepKey="waitForPageLoad3"/> - <see userInput="You saved the page." stepKey="seeSavedPageMsgOnForm"/> - <see userInput="You duplicated the page." stepKey="seeDuplicatedPageMsg"/> + <!-- Navigate to create a CMS page and Verify Save&Duplicate - Save&Close button --> + <actionGroup ref="AssertAdminCmsPageSaveSplitButtonActionGroup" stepKey="verifyCmsPageSaveButton" /> + <!-- Filled out Content --> + <actionGroup ref="FillOutCMSPageContent" stepKey="FillOutPageContent"/> + <!-- Click save and duplicate action --> + <actionGroup ref="AdminSaveAndDuplicateCMSPageWithSplitButtonActionGroup" stepKey="clickSaveAndDuplicateButton"/> <!--Verify duplicated CMS Page--> <seeElement selector="{{BlockNewPageBasicFieldsSection.isActive('0')}}" stepKey="seeBlockNotEnable" /> <actionGroup ref="AssertCMSPageContentActionGroup" stepKey="assertContent"/> - <click selector="{{CmsNewPagePageActionsSection.expandSplitButton}}" stepKey="expandSplitBtn3" /> - <click selector="{{CmsNewPagePageActionsSection.saveAndClose}}" stepKey="clickSaveAndClose"/> - <see userInput="You saved the page." stepKey="seeSavedCMSPageMsgOnGrid"/> - <seeElement selector="div[data-role='grid-wrapper']" stepKey="seeGridPage" /> + <!-- Click Save Button --> + <actionGroup ref="SaveCmsPageActionGroup" stepKey="clickSaveCmsPageButton"/> + <actionGroup ref="DeletePageByUrlKeyActionGroup" stepKey="deleteCMSPage"> + <argument name="UrlKey" value="{{_duplicatedCMSPage.identifier}}"/> + </actionGroup> </test> </tests> 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 @@ <!--Create block--> <comment userInput="Create block" stepKey="commentCreateBlock"/> <createData entity="Sales25offBlock" stepKey="createBlock"/> - <actionGroup ref="LoginActionGroup" stepKey="login"/> + <actionGroup ref="AdminLoginActionGroup" stepKey="login"/> </before> <after> <!--Disable WYSIWYG options--> <comment userInput="Disable WYSIWYG options" stepKey="commentDisableWYSIWYG"/> <magentoCLI command="config:set cms/wysiwyg/enabled disabled" stepKey="disableWYSIWYG"/> <deleteData createDataKey="createBlock" stepKey="deleteBlock" /> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Open created block page and add image--> <comment userInput="Open create block page and add image" stepKey="commentOpenBlockPage"/> diff --git a/app/code/Magento/Cms/Test/Mftf/Test/AdminSaveAndCloseCmsBlockTest.xml b/app/code/Magento/Cms/Test/Mftf/Test/AdminSaveAndCloseCmsBlockTest.xml index 23f602d7b1005..e2800c2ac3094 100644 --- a/app/code/Magento/Cms/Test/Mftf/Test/AdminSaveAndCloseCmsBlockTest.xml +++ b/app/code/Magento/Cms/Test/Mftf/Test/AdminSaveAndCloseCmsBlockTest.xml @@ -28,7 +28,7 @@ <argument name="Block" value="_defaultBlock"/> </actionGroup> <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="resetGridFilters"/> - <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> </after> <!-- Navigate to create cms block page and verify save split button --> 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 @@ <deleteData createDataKey="product1" stepKey="deleteProduct1"/> <deleteData createDataKey="product2" stepKey="deleteProduct2"/> <deleteData createDataKey="createCMSPage" stepKey="deletePreReqCMSPage"/> - <actionGroup ref="logout" stepKey="logoutOfAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutOfAdmin"/> </after> <actionGroup ref="NavigateToCreatedCMSPageActionGroup" stepKey="navigateToCreatedCMSPage1"> <argument name="CMSPage" value="$$createCMSPage$$"/> 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 @@ <actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteStoreView"> <argument name="customStore" value="NewStoreViewData"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Create StoreView --> 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 @@ </annotations> <before> <createData entity="_defaultCmsPage" stepKey="createPreReqCMSPage" /> - <actionGroup ref="LoginActionGroup" stepKey="loginGetFromGeneralFile"/> + <actionGroup ref="AdminLoginActionGroup" stepKey="loginGetFromGeneralFile"/> <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> @@ -91,7 +91,7 @@ <waitForPageLoad stepKey="waitForGridReload"/> <deleteData createDataKey="createPreReqCMSPage" stepKey="deletePreReqCMSPage" /> <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> </test> </tests> 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 @@ <testCaseId value="MAGETWO-84182 "/> </annotations> <before> - <actionGroup ref="LoginActionGroup" stepKey="loginGetFromGeneralFile"/> + <actionGroup ref="AdminLoginActionGroup" stepKey="loginGetFromGeneralFile"/> <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> @@ -51,7 +51,7 @@ <see userInput="Hello World!" stepKey="seeContent" /> <after> <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> </test> </tests> 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/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 @@ </actionGroup> <actionGroup ref="AdminClearCustomersFiltersActionGroup" stepKey="clearFilters"/> <waitForPageLoad stepKey="WaitForPageToLoad"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Flush Magento Cache--> <magentoCLI stepKey="flushCache" command="cache:flush"/> 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 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <amOnPage url="{{CatalogConfigPage.url}}" stepKey="navigateToConfigurationPage" /> <waitForPageLoad stepKey="waitForPageLoad"/> 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 @@ <actionGroup ref="DeleteProductActionGroup" stepKey="deleteProduct1"> <argument name="productName" value="$$createConfigProductCreateConfigurableProduct.name$$"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Open edit product page--> 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 @@ </actionGroup> <!-- Log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Create configurable product --> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckConfigurableProductAttributeValueUniquenessTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckConfigurableProductAttributeValueUniquenessTest.xml index 4288684e53d27..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,7 @@ <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetProductGridColumnsInitial"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createProductAttribute" stepKey="deleteAttribute"/> - <actionGroup ref="logout" stepKey="logOut"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logOut"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckResultsOfColorAndOtherFiltersTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckResultsOfColorAndOtherFiltersTest.xml index 0b3d013660b6e..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,7 @@ <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearProductAttributesFilter"/> <actionGroup ref="AdminClearFiltersActionGroup" stepKey="clearProductsGridFilter"/> <!-- Log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckValidatorConfigurableProductTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckValidatorConfigurableProductTest.xml index 92a6dcad27b30..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,7 @@ <actionGroup ref="DeleteProductAttributeActionGroup" stepKey="deleteAttribute"> <argument name="ProductAttribute" value="productDropDownAttribute"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> 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 @@ <after> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> </after> <!-- Create a configurable product via the UI --> @@ -92,7 +92,7 @@ <after> <deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <amOnPage url="{{AdminProductEditPage.url($$createConfigProduct.id$$)}}" stepKey="goToEditPage"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductDeleteTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductDeleteTest.xml index 68afa17c4d539..eabeb1b6881a0 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductDeleteTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductDeleteTest.xml @@ -66,7 +66,7 @@ </before> <after> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> <deleteData createDataKey="createConfigChildProduct1" stepKey="deleteConfigChildProduct1"/> <deleteData createDataKey="createConfigChildProduct2" stepKey="deleteConfigChildProduct2"/> <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/> @@ -219,7 +219,7 @@ </before> <after> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> <deleteData createDataKey="createConfigChildProduct1" stepKey="deleteConfigChildProduct1"/> <deleteData createDataKey="createConfigChildProduct2" stepKey="deleteConfigChildProduct2"/> <deleteData createDataKey="createConfigChildProduct3" stepKey="deleteConfigChildProduct3"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductLongSkuTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductLongSkuTest.xml index fc1f6dad36345..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,7 @@ <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/> <!--Clean up category--> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductOutOfStockTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductOutOfStockTest.xml index 48a33bfd14d9c..2ab3a9e6e60c9 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductOutOfStockTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductOutOfStockTest.xml @@ -77,7 +77,7 @@ </before> <after> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/> <deleteData createDataKey="createConfigChildProduct1" stepKey="deleteConfigChildProduct1"/> @@ -203,7 +203,7 @@ </before> <after> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/> <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/> @@ -307,7 +307,7 @@ </before> <after> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/> <deleteData createDataKey="createConfigChildProduct2" stepKey="deleteConfigChildProduct2"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductSearchTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductSearchTest.xml index a73a7082502d8..7c20574868a66 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductSearchTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductSearchTest.xml @@ -68,7 +68,7 @@ </before> <after> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> <deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/> <deleteData createDataKey="createConfigChildProduct1" stepKey="deleteConfigChildProduct1"/> <deleteData createDataKey="createConfigChildProduct2" stepKey="deleteConfigChildProduct2"/> @@ -150,7 +150,7 @@ </before> <after> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> <deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/> <deleteData createDataKey="createConfigChildProduct1" stepKey="deleteConfigChildProduct1"/> <deleteData createDataKey="createConfigChildProduct2" stepKey="deleteConfigChildProduct2"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateAttributeTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateAttributeTest.xml index e95a73dcebba0..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 @@ </before> <after> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> <!-- Delete everything that was created in the before block --> <deleteData createDataKey="createCategory" stepKey="deleteCatagory" /> @@ -216,7 +216,7 @@ </before> <after> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> <!-- Delete everything that was created in the before block --> <deleteData createDataKey="createCategory" stepKey="deleteCatagory" /> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateTest.xml index 1eb1d8df6030c..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 @@ <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="goToProductList"/> <waitForPageLoad stepKey="waitForPageLoad"/> <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearProductsGridFilters"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Search for prefix of the 3 products we created via api --> @@ -286,7 +286,7 @@ <after> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> </after> <!-- Create a configurable product via the UI --> @@ -335,7 +335,7 @@ <after> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> </after> <!-- Create a configurable product via the UI --> 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 @@ </before> <after> <!-- Log out --> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> </after> <!-- Create a configurable product --> 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 @@ <deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCategory"/> <deleteData stepKey="deleteAttribute" createDataKey="createConfigProductAttribute"/> <magentoCLI command="cron:run --group=index" stepKey="runCron"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Create configurable product from downloadable product page--> <comment userInput="Create configurable product" stepKey="commentCreateProduct"/> 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 @@ </actionGroup> <!-- Log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Create configurable product --> 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 @@ <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <!-- Log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Create configurable product --> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithDisabledChildrenProductsTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithDisabledChildrenProductsTest.xml index d3db180cb7999..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,7 @@ <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <!-- Log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithImagesTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithImagesTest.xml index 37d5d515bb9e0..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,7 @@ <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <!-- Log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithThreeProductDisplayOutOfStockProductsTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithThreeProductDisplayOutOfStockProductsTest.xml index 299fbca412fac..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,7 @@ <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <!-- Log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithThreeProductDontDisplayOutOfStockProductsTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithThreeProductDontDisplayOutOfStockProductsTest.xml index 0aa0f22d6af2e..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,7 @@ <magentoCLI command="cron:run --group=index" stepKey="runCron"/> <!-- Log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithTierPriceForOneItemTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithTierPriceForOneItemTest.xml index a2cd949a77d13..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,7 @@ <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/> <!-- Log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> 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 @@ <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <!-- Log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Create configurable product --> 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 @@ </actionGroup> <!-- Log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Create configurable product --> 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 @@ </before> <after> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteConfigurableProductFilteredBySkuAndName"> <argument name="product" value="$$createConfigurableProduct$$"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminProductTypeSwitchingOnEditingTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminProductTypeSwitchingOnEditingTest.xml index f441579a6ef42..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,7 @@ <argument name="product" value="$$createProduct$$"/> </actionGroup> <actionGroup ref="AdminClearFiltersActionGroup" stepKey="clearProductFilters"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> @@ -150,7 +150,7 @@ <argument name="product" value="$$createProduct$$"/> </actionGroup> <actionGroup ref="AdminClearFiltersActionGroup" stepKey="clearProductFilters"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/ConfigurableProductPriceAdditionalStoreViewTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/ConfigurableProductPriceAdditionalStoreViewTest.xml index 7bb8661627b8c..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,7 @@ <actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteSecondWebsite"> <argument name="websiteName" value="Second Website"/> </actionGroup> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> </after> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/EndToEndB2CLoggedInUserTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/EndToEndB2CLoggedInUserTest.xml index 3d797e62c806a..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 @@ <requiredEntity createDataKey="createConfigProduct"/> </createData> <updateData entity="ApiSimpleProductUpdateDescription" stepKey="updateConfigProduct" createDataKey="createConfigProduct"/> + <!-- Reindex invalidated indices after product attribute has been created/deleted --> + <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> </before> <after> <!-- @TODO: Uncomment once MQE-679 is fixed --> 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 @@ <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Go To Created Product Page --> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/NoOptionAvailableToConfigureDisabledProductTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/NoOptionAvailableToConfigureDisabledProductTest.xml index 0e46027a69378..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,7 @@ <deleteData createDataKey="createConfigChildProduct3" stepKey="deleteConfigChildProduct3"/> <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/> <deleteData createDataKey="createCustomer" stepKey="deleteCreatedCustomer"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> 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 @@ <after> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/> - <actionGroup ref="logout" stepKey="amOnLogoutPage"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="amOnLogoutPage"/> </after> <amOnPage url="{{AdminCatalogProductPage.url}}" stepKey="GoToCatalogProductPage1"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductChildSearchTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductChildSearchTest.xml index a0f3689b9c170..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 @@ </before> <after> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> <deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/> <deleteData createDataKey="createConfigChildProduct1" stepKey="deleteConfigChildProduct1"/> <deleteData createDataKey="createConfigChildProduct2" stepKey="deleteConfigChildProduct2"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductDetailsTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductDetailsTest.xml index 5d5481938f404..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 @@ <argument name="sku" value="{{_defaultProduct.sku}}"/> </actionGroup> <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearProductsGridFilters"/> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> </after> <!-- Verify configurable product details in storefront product view --> @@ -80,7 +80,7 @@ <argument name="sku" value="{{_defaultProduct.sku}}"/> </actionGroup> <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearProductsGridFilters"/> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> </after> <!-- Verify configurable product options in storefront product view --> @@ -125,7 +125,7 @@ <argument name="sku" value="{{_defaultProduct.sku}}"/> </actionGroup> <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearProductsGridFilters"/> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> </after> <!-- Verify adding configurable product to cart after an option is selected in storefront product view --> @@ -167,7 +167,7 @@ <argument name="sku" value="{{_defaultProduct.sku}}"/> </actionGroup> <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearProductsGridFilters"/> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> </after> <!-- Verify not able to add configurable product to cart when no option is selected in storefront product view --> @@ -219,7 +219,7 @@ <deleteData createDataKey="createFirstAttribute" stepKey="deleteFirstAttribute"/> <deleteData createDataKey="createSecondAttribute" stepKey="deleteSecondAttribute"/> <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearProductsGridFilters"/> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> 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 @@ <actionGroup stepKey="deleteProduct" ref="DeleteProductBySkuActionGroup"> <argument name="sku" value="{{_defaultProduct.sku}}"/> </actionGroup> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> </after> <!-- Verify the storefront category grid view --> @@ -73,7 +73,7 @@ <after> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> </after> <!-- Verify storefront category list view --> @@ -111,7 +111,7 @@ <after> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> </after> <!-- Should be taken to product details page when adding to cart because an option needs to be selected --> 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 @@ <after> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> </after> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontShouldSeeOnlyConfigurableProductChildAssignedToSeparateCategoryTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontShouldSeeOnlyConfigurableProductChildAssignedToSeparateCategoryTest.xml index 324050608829a..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,7 @@ <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/> <deleteData createDataKey="createCategory" stepKey="deleteApiCategory"/> <deleteData createDataKey="secondCategory" stepKey="deleteSecondCategory"/> - <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontSortingByPriceForConfigurableWithCatalogRuleAppliedTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontSortingByPriceForConfigurableWithCatalogRuleAppliedTest.xml index ce5bad8c333a6..fcb9811a93dfa 100644 --- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontSortingByPriceForConfigurableWithCatalogRuleAppliedTest.xml +++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontSortingByPriceForConfigurableWithCatalogRuleAppliedTest.xml @@ -121,7 +121,7 @@ <argument name="option" value="No"/> </actionGroup> <actionGroup ref="AdminCatalogPriceRuleDeleteAllActionGroup" stepKey="deleteAllRules"/> - <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontVerifyConfigurableProductLayeredNavigationTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontVerifyConfigurableProductLayeredNavigationTest.xml index adaa302a23a52..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,7 @@ <deleteData createDataKey="createConfigChildProduct2" stepKey="deleteConfigChildProduct2"/> <deleteData createDataKey="createConfigChildProduct3" stepKey="deleteConfigChildProduct3"/> <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteAttribute"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> 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 @@ </actionGroup> <click selector="{{AdminProductAttributeGridSection.ResetFilter}}" stepKey="resetFiltersOnGridSecond"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Create attribute and options for product--> <comment userInput="Create attribute and options for product" stepKey="commentCreateAttributesAndOptions"/> diff --git a/app/code/Magento/ConfigurableProduct/Ui/DataProvider/Product/Form/Modifier/Data/AssociatedProducts.php b/app/code/Magento/ConfigurableProduct/Ui/DataProvider/Product/Form/Modifier/Data/AssociatedProducts.php index ec69baeb92cb9..034f68bdab9d4 100644 --- a/app/code/Magento/ConfigurableProduct/Ui/DataProvider/Product/Form/Modifier/Data/AssociatedProducts.php +++ b/app/code/Magento/ConfigurableProduct/Ui/DataProvider/Product/Form/Modifier/Data/AssociatedProducts.php @@ -314,7 +314,8 @@ protected function prepareVariations() 'canEdit' => 0, 'newProduct' => 0, 'attributes' => $this->getTextAttributes($variationOptions), - 'thumbnail_image' => $this->imageHelper->init($product, 'product_thumbnail_image')->getUrl(), + 'thumbnail_image' => $this->imageHelper->init($product, 'product_thumbnail_image') + ->getUrl(), '__disableTmpl' => true ]; $productIds[] = $product->getId(); diff --git a/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminCurrencyConverterAPIConfigurationTest.xml b/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminCurrencyConverterAPIConfigurationTest.xml index 6232f59bb839a..eb3ca4f977c65 100644 --- a/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminCurrencyConverterAPIConfigurationTest.xml +++ b/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminCurrencyConverterAPIConfigurationTest.xml @@ -40,7 +40,7 @@ <!--Delete created data--> <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Import rates from Currency Converter API--> <amOnPage url="{{AdminCurrencyRatesPage.url}}" stepKey="onCurrencyRatePage"/> diff --git a/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminDefaultCurrencySymbolsAreDisabledTest.xml b/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminDefaultCurrencySymbolsAreDisabledTest.xml index a04128c3d5ded..7e1cb41871d43 100644 --- a/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminDefaultCurrencySymbolsAreDisabledTest.xml +++ b/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminDefaultCurrencySymbolsAreDisabledTest.xml @@ -23,7 +23,7 @@ </before> <after> <magentoCLI command="config:set --scope={{SetAllowedCurrenciesConfigForUSD.scope}} --scope-code={{SetAllowedCurrenciesConfigForUSD.scope_code}} {{SetAllowedCurrenciesConfigForUSD.path}} {{SetAllowedCurrenciesConfigForUSD.value}},{{SetAllowedCurrenciesConfigForEUR.value}}" stepKey="setAllowedCurrencyWebsites_EUR_USD"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateToCurrencySymbolsPageActionGroup" stepKey="navigateToCurrencySymbolsPage"/> <actionGroup ref="AssertAdminCurrencySymbolIsDisabledActionGroup" stepKey="assertEURDisabledInput"> diff --git a/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminOrderRateDisplayWhenChooseThreeAllowedCurrenciesTest.xml b/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminOrderRateDisplayWhenChooseThreeAllowedCurrenciesTest.xml index 100aa39613b33..8f87246bcf018 100644 --- a/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminOrderRateDisplayWhenChooseThreeAllowedCurrenciesTest.xml +++ b/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminOrderRateDisplayWhenChooseThreeAllowedCurrenciesTest.xml @@ -32,7 +32,7 @@ <!--Delete created product--> <comment userInput="Delete created product" stepKey="commentDeleteCreatedProduct"/> <deleteData createDataKey="createNewProduct" stepKey="deleteNewProduct"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Set currency rates--> <amOnPage url="{{AdminCurrencyRatesPage.url}}" stepKey="gotToCurrencyRatesPageSecondTime"/> diff --git a/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminOrderRateDisplayedInOneLineTest.xml b/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminOrderRateDisplayedInOneLineTest.xml index 94c9bc67e34c4..8c61bd4434fff 100644 --- a/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminOrderRateDisplayedInOneLineTest.xml +++ b/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminOrderRateDisplayedInOneLineTest.xml @@ -46,7 +46,7 @@ <magentoCLI command="config:set --scope={{SetCurrencyUSDBaseConfig.scope}} --scope-code={{SetCurrencyUSDBaseConfig.scope_code}} {{SetCurrencyUSDBaseConfig.path}} {{SetCurrencyUSDBaseConfig.value}}" stepKey="setCurrencyBaseUSDWebsites"/> <magentoCLI command="config:set --scope={{SetDefaultCurrencyUSDConfig.scope}} --scope-code={{SetDefaultCurrencyUSDConfig.scope_code}} {{SetDefaultCurrencyUSDConfig.path}} {{SetDefaultCurrencyUSDConfig.value}}" stepKey="setCurrencyDefaultUSDWebsites"/> <magentoCLI command="config:set --scope={{SetAllowedCurrenciesConfigForUSD.scope}} --scope-code={{SetAllowedCurrenciesConfigForUSD.scope_code}} {{SetAllowedCurrenciesConfigForUSD.path}} {{SetAllowedCurrenciesConfigForUSD.value}}" stepKey="setAllowedCurrencyUSDWebsites"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Open created product on Storefront and place for order--> <amOnPage url="{{StorefrontProductPage.url($$createProduct.custom_attributes[url_key]$$)}}" stepKey="goToProductPage"/> diff --git a/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminStoresCurrencyRatesNavigateMenuTest.xml b/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminStoresCurrencyRatesNavigateMenuTest.xml index 4a33d40d2a35f..a5781698deed4 100644 --- a/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminStoresCurrencyRatesNavigateMenuTest.xml +++ b/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminStoresCurrencyRatesNavigateMenuTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToStoresCurrencyRatesPage"> <argument name="menuUiId" value="{{AdminMenuStores.dataUiId}}"/> diff --git a/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminStoresCurrencySymbolsNavigateMenuTest.xml b/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminStoresCurrencySymbolsNavigateMenuTest.xml index 978917772f2dd..65afd4e2e744a 100644 --- a/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminStoresCurrencySymbolsNavigateMenuTest.xml +++ b/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminStoresCurrencySymbolsNavigateMenuTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToStoresCurrencySymbolsPage"> <argument name="menuUiId" value="{{AdminMenuStores.dataUiId}}"/> diff --git a/app/code/Magento/Customer/Model/App/Action/ContextPlugin.php b/app/code/Magento/Customer/Model/App/Action/ContextPlugin.php index b8c83551ee381..5d926b47ca446 100644 --- a/app/code/Magento/Customer/Model/App/Action/ContextPlugin.php +++ b/app/code/Magento/Customer/Model/App/Action/ContextPlugin.php @@ -8,13 +8,12 @@ use Magento\Customer\Model\Context; use Magento\Customer\Model\GroupManagement; -use Magento\Framework\App\Action\AbstractAction; -use Magento\Framework\App\RequestInterface; use Magento\Customer\Model\Session; +use Magento\Framework\App\ActionInterface; use Magento\Framework\App\Http\Context as HttpContext; /** - * Class ContextPlugin + * Introduces Context information for ActionInterface of Customer Action */ class ContextPlugin { @@ -41,12 +40,11 @@ public function __construct(Session $customerSession, HttpContext $httpContext) /** * Set customer group and customer session id to HTTP context * - * @param AbstractAction $subject - * @param RequestInterface $request + * @param ActionInterface $subject * @return void * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function beforeDispatch(AbstractAction $subject, RequestInterface $request) + public function beforeExecute(ActionInterface $subject) { $this->httpContext->setValue( Context::CONTEXT_GROUP, diff --git a/app/code/Magento/Customer/Model/Indexer/Processor.php b/app/code/Magento/Customer/Model/Indexer/Processor.php new file mode 100644 index 0000000000000..6b44b674b405a --- /dev/null +++ b/app/code/Magento/Customer/Model/Indexer/Processor.php @@ -0,0 +1,16 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Customer\Model\Indexer; + +use Magento\Customer\Model\Customer; + +/** + * Customer indexer + */ +class Processor extends \Magento\Framework\Indexer\AbstractProcessor +{ + const INDEXER_ID = Customer::CUSTOMER_GRID_INDEXER_ID; +} diff --git a/app/code/Magento/Customer/Model/Plugin/CustomerNotification.php b/app/code/Magento/Customer/Model/Plugin/CustomerNotification.php index 577c97a19268a..db694ad3295ce 100644 --- a/app/code/Magento/Customer/Model/Plugin/CustomerNotification.php +++ b/app/code/Magento/Customer/Model/Plugin/CustomerNotification.php @@ -3,22 +3,23 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Customer\Model\Plugin; use Magento\Customer\Api\CustomerRepositoryInterface; use Magento\Customer\Model\Customer\NotificationStorage; use Magento\Customer\Model\Session; -use Magento\Framework\App\Action\AbstractAction; +use Magento\Framework\App\ActionInterface; use Magento\Framework\App\Area; +use Magento\Framework\App\HttpRequestInterface; +use Magento\Framework\App\ObjectManager; use Magento\Framework\App\RequestInterface; use Magento\Framework\App\State; use Magento\Framework\Exception\NoSuchEntityException; use Psr\Log\LoggerInterface; /** - * Plugin before \Magento\Framework\App\Action\AbstractAction::dispatch. - * - * Plugin to remove notifications from cache. + * Refresh the Customer session if `UpdateSession` notification registered */ class CustomerNotification { @@ -47,6 +48,11 @@ class CustomerNotification */ private $logger; + /** + * @var RequestInterface|\Magento\Framework\App\Request\Http + */ + private $request; + /** * Initialize dependencies. * @@ -55,39 +61,37 @@ class CustomerNotification * @param State $state * @param CustomerRepositoryInterface $customerRepository * @param LoggerInterface $logger + * @param RequestInterface|null $request */ public function __construct( Session $session, NotificationStorage $notificationStorage, State $state, CustomerRepositoryInterface $customerRepository, - LoggerInterface $logger + LoggerInterface $logger, + RequestInterface $request ) { $this->session = $session; $this->notificationStorage = $notificationStorage; $this->state = $state; $this->customerRepository = $customerRepository; $this->logger = $logger; + $this->request = $request; } /** - * Removes notifications from cache. + * Refresh the customer session on frontend post requests if an update session notification is registered. * - * @param AbstractAction $subject - * @param RequestInterface $request + * @param ActionInterface $subject * @return void + * @throws \Magento\Framework\Exception\LocalizedException * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function beforeDispatch(AbstractAction $subject, RequestInterface $request) + public function beforeExecute(ActionInterface $subject) { $customerId = $this->session->getCustomerId(); - if ($this->state->getAreaCode() == Area::AREA_FRONTEND && $request->isPost() - && $this->notificationStorage->isExists( - NotificationStorage::UPDATE_CUSTOMER_SESSION, - $customerId - ) - ) { + if ($this->isFrontendRequest() && $this->isPostRequest() && $this->isSessionUpdateRegisteredFor($customerId)) { try { $this->session->regenerateId(); $customer = $this->customerRepository->getById($customerId); @@ -99,4 +103,36 @@ public function beforeDispatch(AbstractAction $subject, RequestInterface $reques } } } + + /** + * Because RequestInterface has no isPost method the check is requied before calling it. + * + * @return bool + */ + private function isPostRequest(): bool + { + return $this->request instanceof HttpRequestInterface && $this->request->isPost(); + } + + /** + * Check if the current application area is frontend. + * + * @return bool + * @throws \Magento\Framework\Exception\LocalizedException + */ + private function isFrontendRequest(): bool + { + return $this->state->getAreaCode() === Area::AREA_FRONTEND; + } + + /** + * True if the session for the given customer ID needs to be refreshed. + * + * @param int $customerId + * @return bool + */ + private function isSessionUpdateRegisteredFor($customerId): bool + { + return $this->notificationStorage->isExists(NotificationStorage::UPDATE_CUSTOMER_SESSION, $customerId); + } } diff --git a/app/code/Magento/Customer/Model/Visitor.php b/app/code/Magento/Customer/Model/Visitor.php index 5fa1af69e9bdd..53745aa7a30c6 100644 --- a/app/code/Magento/Customer/Model/Visitor.php +++ b/app/code/Magento/Customer/Model/Visitor.php @@ -6,8 +6,23 @@ namespace Magento\Customer\Model; +use Magento\Customer\Api\Data\CustomerInterface; +use Magento\Framework\App\Config\ScopeConfigInterface; use Magento\Framework\App\ObjectManager; +use Magento\Framework\App\Request; use Magento\Framework\App\RequestSafetyInterface; +use Magento\Framework\Data\Collection\AbstractDb; +use Magento\Framework\Event\Observer as EventObserver; +use Magento\Framework\HTTP\Header; +use Magento\Framework\Indexer\IndexerRegistry; +use Magento\Framework\Model\AbstractModel; +use Magento\Framework\Model\Context as ModelContext; +use Magento\Framework\Model\ResourceModel\AbstractResource; +use Magento\Framework\Registry; +use Magento\Framework\Session\Config as SessionConfig; +use Magento\Framework\Session\SessionManagerInterface; +use Magento\Framework\Stdlib\DateTime; +use Magento\Store\Model\ScopeInterface; /** * Class Visitor @@ -17,15 +32,13 @@ * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @SuppressWarnings(PHPMD.CookieAndSessionMisuse) */ -class Visitor extends \Magento\Framework\Model\AbstractModel +class Visitor extends AbstractModel { const VISITOR_TYPE_CUSTOMER = 'c'; - const VISITOR_TYPE_VISITOR = 'v'; - const DEFAULT_ONLINE_MINUTES_INTERVAL = 15; - const XML_PATH_ONLINE_INTERVAL = 'customer/online_customers/online_minutes_interval'; + private const SECONDS_24_HOURS = 86400; /** * @var string[] @@ -33,12 +46,12 @@ class Visitor extends \Magento\Framework\Model\AbstractModel protected $ignoredUserAgents; /** - * @var \Magento\Framework\Session\SessionManagerInterface + * @var SessionManagerInterface */ protected $session; /** - * @var \Magento\Framework\HTTP\Header + * @var Header */ protected $httpHeader; @@ -57,17 +70,17 @@ class Visitor extends \Magento\Framework\Model\AbstractModel /** * Core store config * - * @var \Magento\Framework\App\Config\ScopeConfigInterface + * @var ScopeConfigInterface */ protected $scopeConfig; /** - * @var \Magento\Framework\Stdlib\DateTime + * @var DateTime */ protected $dateTime; /** - * @var \Magento\Framework\Indexer\IndexerRegistry + * @var IndexerRegistry */ protected $indexerRegistry; @@ -77,15 +90,15 @@ class Visitor extends \Magento\Framework\Model\AbstractModel private $requestSafety; /** - * @param \Magento\Framework\Model\Context $context - * @param \Magento\Framework\Registry $registry - * @param \Magento\Framework\Session\SessionManagerInterface $session - * @param \Magento\Framework\HTTP\Header $httpHeader - * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig - * @param \Magento\Framework\Stdlib\DateTime $dateTime - * @param \Magento\Framework\Indexer\IndexerRegistry $indexerRegistry - * @param \Magento\Framework\Model\ResourceModel\AbstractResource|null $resource - * @param \Magento\Framework\Data\Collection\AbstractDb|null $resourceCollection + * @param ModelContext $context + * @param Registry $registry + * @param SessionManagerInterface $session + * @param Header $httpHeader + * @param ScopeConfigInterface $scopeConfig + * @param DateTime $dateTime + * @param IndexerRegistry $indexerRegistry + * @param AbstractResource|null $resource + * @param AbstractDb|null $resourceCollection * @param array $ignoredUserAgents * @param array $ignores * @param array $data @@ -94,15 +107,15 @@ class Visitor extends \Magento\Framework\Model\AbstractModel * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( - \Magento\Framework\Model\Context $context, - \Magento\Framework\Registry $registry, - \Magento\Framework\Session\SessionManagerInterface $session, - \Magento\Framework\HTTP\Header $httpHeader, - \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig, - \Magento\Framework\Stdlib\DateTime $dateTime, - \Magento\Framework\Indexer\IndexerRegistry $indexerRegistry, - \Magento\Framework\Model\ResourceModel\AbstractResource $resource = null, - \Magento\Framework\Data\Collection\AbstractDb $resourceCollection = null, + ModelContext $context, + Registry $registry, + SessionManagerInterface $session, + Header $httpHeader, + ScopeConfigInterface $scopeConfig, + DateTime $dateTime, + IndexerRegistry $indexerRegistry, + AbstractResource $resource = null, + AbstractDb $resourceCollection = null, array $ignoredUserAgents = [], array $ignores = [], array $data = [], @@ -126,7 +139,7 @@ public function __construct( */ protected function _construct() { - $this->_init(\Magento\Customer\Model\ResourceModel\Visitor::class); + $this->_init(ResourceModel\Visitor::class); $userAgent = $this->httpHeader->getHttpUserAgent(); if ($this->ignoredUserAgents) { if (in_array($userAgent, $this->ignoredUserAgents)) { @@ -139,7 +152,7 @@ protected function _construct() * Skip request logging * * @param bool $skipRequestLogging - * @return \Magento\Customer\Model\Visitor + * @return Visitor */ public function setSkipRequestLogging($skipRequestLogging) { @@ -148,12 +161,10 @@ public function setSkipRequestLogging($skipRequestLogging) } /** - * Initialization visitor by request + * Initialization visitor by request. Used in event "controller_action_predispatch" * - * Used in event "controller_action_predispatch" - * - * @param \Magento\Framework\Event\Observer $observer - * @return \Magento\Customer\Model\Visitor + * @param EventObserver $observer + * @return Visitor */ public function initByRequest($observer) { @@ -168,7 +179,7 @@ public function initByRequest($observer) } } - $this->setLastVisitAt((new \DateTime())->format(\Magento\Framework\Stdlib\DateTime::DATETIME_PHP_FORMAT)); + $this->setLastVisitAt((new \DateTime())->format(DateTime::DATETIME_PHP_FORMAT)); // prevent saving Visitor for safe methods, e.g. GET request if ($this->requestSafety->isSafeMethod()) { @@ -189,8 +200,8 @@ public function initByRequest($observer) * * Used in event "controller_action_postdispatch" * - * @param \Magento\Framework\Event\Observer $observer - * @return \Magento\Customer\Model\Visitor + * @param EventObserver $observer + * @return Visitor */ public function saveByRequest($observer) { @@ -215,13 +226,13 @@ public function saveByRequest($observer) /** * Returns true if the module is required * - * @param \Magento\Framework\Event\Observer $observer + * @param EventObserver $observer * @return bool */ public function isModuleIgnored($observer) { if (is_array($this->ignores) && $observer) { - $curModule = $observer->getEvent()->getControllerAction()->getRequest()->getRouteName(); + $curModule = $this->requestSafety->getRouteName(); if (isset($this->ignores[$curModule])) { return true; } @@ -234,12 +245,12 @@ public function isModuleIgnored($observer) * * Used in event "customer_login" * - * @param \Magento\Framework\Event\Observer $observer - * @return \Magento\Customer\Model\Visitor + * @param EventObserver $observer + * @return Visitor */ public function bindCustomerLogin($observer) { - /** @var \Magento\Customer\Api\Data\CustomerInterface $customer */ + /** @var CustomerInterface $customer */ $customer = $observer->getEvent()->getCustomer(); if (!$this->getCustomerId()) { $this->setDoCustomerLogin(true); @@ -253,8 +264,8 @@ public function bindCustomerLogin($observer) * * Used in event "customer_logout" * - * @param \Magento\Framework\Event\Observer $observer - * @return \Magento\Customer\Model\Visitor + * @param EventObserver $observer + * @return Visitor * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function bindCustomerLogout($observer) @@ -268,8 +279,8 @@ public function bindCustomerLogout($observer) /** * Create binding of checkout quote * - * @param \Magento\Framework\Event\Observer $observer - * @return \Magento\Customer\Model\Visitor + * @param EventObserver $observer + * @return Visitor */ public function bindQuoteCreate($observer) { @@ -286,8 +297,8 @@ public function bindQuoteCreate($observer) /** * Destroy binding of checkout quote * - * @param \Magento\Framework\Event\Observer $observer - * @return \Magento\Customer\Model\Visitor + * @param EventObserver $observer + * @return Visitor */ public function bindQuoteDestroy($observer) { @@ -305,10 +316,10 @@ public function bindQuoteDestroy($observer) */ public function getCleanTime() { - return $this->scopeConfig->getValue( - \Magento\Framework\Session\Config::XML_PATH_COOKIE_LIFETIME, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE - ) + 86400; + return self::SECONDS_24_HOURS + $this->scopeConfig->getValue( + SessionConfig::XML_PATH_COOKIE_LIFETIME, + ScopeInterface::SCOPE_STORE + ); } /** @@ -331,7 +342,7 @@ public function getOnlineInterval() { $configValue = (int)$this->scopeConfig->getValue( static::XML_PATH_ONLINE_INTERVAL, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE + ScopeInterface::SCOPE_STORE ); return $configValue ?: static::DEFAULT_ONLINE_MINUTES_INTERVAL; } diff --git a/app/code/Magento/Customer/Setup/Patch/Data/UpdateCustomerAddressAttributesSortOrder.php b/app/code/Magento/Customer/Setup/Patch/Data/UpdateCustomerAddressAttributesSortOrder.php new file mode 100644 index 0000000000000..b35a21751ebea --- /dev/null +++ b/app/code/Magento/Customer/Setup/Patch/Data/UpdateCustomerAddressAttributesSortOrder.php @@ -0,0 +1,106 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Customer\Setup\Patch\Data; + +use Magento\Customer\Setup\CustomerSetup; +use Magento\Customer\Setup\CustomerSetupFactory; +use Magento\Framework\Setup\ModuleDataSetupInterface; +use Magento\Framework\Setup\Patch\DataPatchInterface; + +/** + * Update Customer Address Attributes to be displayed in following order: country, region, city, postcode + */ +class UpdateCustomerAddressAttributesSortOrder implements DataPatchInterface +{ + /** + * @var ModuleDataSetupInterface + */ + private $moduleDataSetup; + + /** + * @var CustomerSetupFactory + */ + private $customerSetupFactory; + + /** + * UpdateCustomerAddressAttributesSortOrder constructor. + * @param ModuleDataSetupInterface $moduleDataSetup + * @param CustomerSetupFactory $customerSetupFactory + */ + public function __construct( + ModuleDataSetupInterface $moduleDataSetup, + CustomerSetupFactory $customerSetupFactory + ) { + $this->moduleDataSetup = $moduleDataSetup; + $this->customerSetupFactory = $customerSetupFactory; + } + + /** + * @inheritDoc + */ + public function apply() + { + /** @var CustomerSetup $customerSetup */ + $customerSetup = $this->customerSetupFactory->create(['setup' => $this->moduleDataSetup]); + $this->updateCustomerAddressAttributesSortOrder($customerSetup); + + return $this; + } + + /** + * @inheritDoc + */ + public function getAliases() + { + return []; + } + + /** + * @inheritDoc + */ + public static function getDependencies() + { + return [ + DefaultCustomerGroupsAndAttributes::class, + ]; + } + + /** + * Update customer address attributes sort order + * + * @param CustomerSetup $customerSetup + * + * @return void + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ + private function updateCustomerAddressAttributesSortOrder($customerSetup) + { + $entityAttributes = [ + 'customer_address' => [ + 'country_id' => [ + 'sort_order' => 80, + 'position' => 80 + ], + 'region' => [ + 'sort_order' => 90, + 'position' => 90 + ], + 'region_id' => [ + 'sort_order' => 90, + 'position' => 90 + ], + 'city' => [ + 'sort_order' => 100, + 'position' => 100 + ], + ], + ]; + + $customerSetup->upgradeAttributes($entityAttributes); + } +} diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminClearCustomersFiltersActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminClearCustomersFiltersActionGroup.xml new file mode 100644 index 0000000000000..3ca41bb014d47 --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminClearCustomersFiltersActionGroup.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminClearCustomersFiltersActionGroup"> + <annotations> + <description>Goes to the Admin Customers grid page. Clicks on 'Clear Filters'.</description> + </annotations> + + <amOnPage url="{{AdminCustomerPage.url}}" stepKey="amOnCustomersPage"/> + <waitForPageLoad stepKey="WaitForPageToLoad"/> + <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clickOnButtonToRemoveFiltersIfPresent"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminCreateCustomerWithWebSiteAndGroupActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminCreateCustomerWithWebSiteAndGroupActionGroup.xml new file mode 100644 index 0000000000000..fb4c1980fe975 --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminCreateCustomerWithWebSiteAndGroupActionGroup.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminCreateCustomerWithWebSiteAndGroupActionGroup"> + <annotations> + <description>Goes to the Customer grid page. Click on 'Add New Customer'. Fills provided Customer Data. Fill provided Customer Address data. Assigns Product to Website and Store View. Clicks on Save.</description> + </annotations> + <arguments> + <argument name="customerData" defaultValue="Simple_US_Customer"/> + <argument name="website" type="string" defaultValue="{{_defaultWebsite.name}}"/> + <argument name="storeView" type="string" defaultValue="{{_defaultStore.name}}"/> + </arguments> + + <amOnPage url="{{AdminCustomerPage.url}}" stepKey="goToCustomersPage"/> + <click stepKey="addNewCustomer" selector="{{AdminCustomerGridMainActionsSection.addNewCustomer}}"/> + <selectOption stepKey="selectWebSite" selector="{{AdminCustomerAccountInformationSection.associateToWebsite}}" userInput="{{website}}"/> + <selectOption selector="{{AdminCustomerAccountInformationSection.group}}" userInput="{{customerData.group}}" stepKey="selectCustomerGroup"/> + <fillField stepKey="FillFirstName" selector="{{AdminCustomerAccountInformationSection.firstName}}" userInput="{{customerData.firstname}}"/> + <fillField stepKey="FillLastName" selector="{{AdminCustomerAccountInformationSection.lastName}}" userInput="{{customerData.lastname}}"/> + <fillField stepKey="FillEmail" selector="{{AdminCustomerAccountInformationSection.email}}" userInput="{{customerData.email}}"/> + <selectOption stepKey="selectStoreView" selector="{{AdminCustomerAccountInformationSection.storeView}}" userInput="{{storeView}}"/> + <waitForElement selector="{{AdminCustomerAccountInformationSection.storeView}}" stepKey="waitForCustomerStoreViewExpand"/> + <click stepKey="save" selector="{{AdminCustomerAccountInformationSection.saveCustomer}}"/> + <waitForPageLoad stepKey="waitForCustomersPage"/> + <see stepKey="seeSuccessMessage" userInput="You saved the customer."/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminCreateCustomerWithWebsiteAndStoreViewActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminCreateCustomerWithWebsiteAndStoreViewActionGroup.xml index 9741d4e4133bf..5757f79a7ac61 100644 --- a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminCreateCustomerWithWebsiteAndStoreViewActionGroup.xml +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminCreateCustomerWithWebsiteAndStoreViewActionGroup.xml @@ -47,28 +47,4 @@ <click stepKey="saveAddress" selector="{{AdminCustomerAddressesSection.saveAddress}}"/> <waitForPageLoad stepKey="waitForAddressSave"/> </actionGroup> - - <actionGroup name="AdminCreateCustomerWithWebSiteAndGroup"> - <annotations> - <description>Goes to the Customer grid page. Click on 'Add New Customer'. Fills provided Customer Data. Fill provided Customer Address data. Assigns Product to Website and Store View. Clicks on Save.</description> - </annotations> - <arguments> - <argument name="customerData" defaultValue="Simple_US_Customer"/> - <argument name="website" type="string" defaultValue="{{_defaultWebsite.name}}"/> - <argument name="storeView" type="string" defaultValue="{{_defaultStore.name}}"/> - </arguments> - - <amOnPage url="{{AdminCustomerPage.url}}" stepKey="goToCustomersPage"/> - <click stepKey="addNewCustomer" selector="{{AdminCustomerGridMainActionsSection.addNewCustomer}}"/> - <selectOption stepKey="selectWebSite" selector="{{AdminCustomerAccountInformationSection.associateToWebsite}}" userInput="{{website}}"/> - <selectOption selector="{{AdminCustomerAccountInformationSection.group}}" userInput="{{customerData.group}}" stepKey="selectCustomerGroup"/> - <fillField stepKey="FillFirstName" selector="{{AdminCustomerAccountInformationSection.firstName}}" userInput="{{customerData.firstname}}"/> - <fillField stepKey="FillLastName" selector="{{AdminCustomerAccountInformationSection.lastName}}" userInput="{{customerData.lastname}}"/> - <fillField stepKey="FillEmail" selector="{{AdminCustomerAccountInformationSection.email}}" userInput="{{customerData.email}}"/> - <selectOption stepKey="selectStoreView" selector="{{AdminCustomerAccountInformationSection.storeView}}" userInput="{{storeView}}"/> - <waitForElement selector="{{AdminCustomerAccountInformationSection.storeView}}" stepKey="waitForCustomerStoreViewExpand"/> - <click stepKey="save" selector="{{AdminCustomerAccountInformationSection.saveCustomer}}"/> - <waitForPageLoad stepKey="waitForCustomersPage"/> - <see stepKey="seeSuccessMessage" userInput="You saved the customer."/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminEditCustomerAddressNoZipNoStateActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminEditCustomerAddressNoZipNoStateActionGroup.xml index 4c3660ac605a6..2ccef6f72e23f 100644 --- a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminEditCustomerAddressNoZipNoStateActionGroup.xml +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminEditCustomerAddressNoZipNoStateActionGroup.xml @@ -8,7 +8,7 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="AdminEditCustomerAddressNoZipNoState" extends="AdminEditCustomerAddressesFrom"> + <actionGroup name="AdminEditCustomerAddressNoZipNoStateActionGroup" extends="AdminEditCustomerAddressesFromActionGroup"> <annotations> <description>EXTENDS: AdminEditCustomerAddressesFrom. Removes 'selectState' and 'fillZipCode'. Clicks on 'Set Default' for Billing/Shipping.</description> </annotations> diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminEditCustomerAddressSetDefaultShippingAndBillingActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminEditCustomerAddressSetDefaultShippingAndBillingActionGroup.xml index 3551375c0e76b..e39800f8d9dd9 100644 --- a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminEditCustomerAddressSetDefaultShippingAndBillingActionGroup.xml +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminEditCustomerAddressSetDefaultShippingAndBillingActionGroup.xml @@ -8,7 +8,7 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="AdminEditCustomerAddressSetDefaultShippingAndBilling" extends="AdminEditCustomerAddressesFrom"> + <actionGroup name="AdminEditCustomerAddressSetDefaultShippingAndBillingActionGroup" extends="AdminEditCustomerAddressesFromActionGroup"> <annotations> <description>EXTENDS: AdminEditCustomerAddressesFrom. Removes 'selectState' and 'fillZipCode'.</description> </annotations> diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminEditCustomerAddressesFromActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminEditCustomerAddressesFromActionGroup.xml index 8ac4779de7a9a..c2b41251c05b1 100644 --- a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminEditCustomerAddressesFromActionGroup.xml +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminEditCustomerAddressesFromActionGroup.xml @@ -9,7 +9,7 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <!-- Same as "EditCustomerAddressesFromAdminActionGroup" but taking country and state from input "customerAddress" --> - <actionGroup name="AdminEditCustomerAddressesFrom"> + <actionGroup name="AdminEditCustomerAddressesFromActionGroup"> <annotations> <description>Adds the provided Address to a Customer from the Admin Customers creation/edit page.</description> </annotations> @@ -34,38 +34,4 @@ <click selector="{{AdminEditCustomerAddressesSection.save}}" stepKey="saveAddress"/> <waitForPageLoad stepKey="waitForAddressSaved"/> </actionGroup> - - <actionGroup name="AdminEditCustomerAddressSetDefaultShippingAndBilling" extends="AdminEditCustomerAddressesFrom"> - <annotations> - <description>EXTENDS: AdminEditCustomerAddressesFrom. Clicks on 'Set Default' for Billing/Shipping.</description> - </annotations> - - <click selector="{{AdminEditCustomerAddressesSection.defaultBillingAddressButton}}" stepKey="setDefaultBilling" before="setDefaultShipping"/> - <click selector="{{AdminEditCustomerAddressesSection.defaultShippingAddressButton}}" stepKey="setDefaultShipping" before="fillPrefixName"/> - </actionGroup> - - <actionGroup name="AdminEditCustomerAddressNoZipNoState" extends="AdminEditCustomerAddressesFrom"> - <annotations> - <description>EXTENDS: AdminEditCustomerAddressesFrom. Removes 'selectState' and 'fillZipCode'. Clicks on 'Set Default' for Billing/Shipping.</description> - </annotations> - - <remove keyForRemoval="selectState"/> - <remove keyForRemoval="fillZipCode"/> - <click selector="{{AdminEditCustomerAddressesSection.defaultBillingAddressButton}}" stepKey="setDefaultBilling" before="setDefaultShipping"/> - <click selector="{{AdminEditCustomerAddressesSection.defaultShippingAddressButton}}" stepKey="setDefaultShipping" before="fillPrefixName"/> - </actionGroup> - - <actionGroup name="SelectDropdownCustomerAddressAttributeValueActionGroup"> - <annotations> - <description>Selects the provided Option in the provided Customer Address Attribute drop down menu. Clicks on Save.</description> - </annotations> - <arguments> - <argument name="customerAddressAttribute"/> - <argument name="optionValue" type="string"/> - </arguments> - - <selectOption selector="{{AdminEditCustomerAddressesSection.dropDownAttribute(customerAddressAttribute.code)}}" userInput="{{optionValue}}" stepKey="selectOptionValue"/> - <click selector="{{AdminEditCustomerAddressesSection.save}}" stepKey="saveAddress"/> - <waitForPageLoad stepKey="waitForAddressSaved"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AssertSignedUpNewsletterActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AssertSignedUpNewsletterActionGroup.xml new file mode 100644 index 0000000000000..deabec7d671d6 --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AssertSignedUpNewsletterActionGroup.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertSignedUpNewsletterActionGroup"> + <annotations> + <description>Validates that the provided Customer details are present and correct on the Storefront Customer Dashboard page.</description> + </annotations> + <arguments> + <argument name="customer" defaultValue="CustomerEntityOne"/> + <argument name="storeName" defaultValue="Main Website" type="string"/> + </arguments> + + <see stepKey="successMessage" userInput="Thank you for registering with {{storeName}} Store." selector="{{AdminCustomerMessagesSection.successMessage}}"/> + <see stepKey="seeFirstName" userInput="{{customer.firstname}}" selector="{{StorefrontCustomerDashboardAccountInformationSection.ContactInformation}}"/> + <see stepKey="seeLastName" userInput="{{customer.lastname}}" selector="{{StorefrontCustomerDashboardAccountInformationSection.ContactInformation}}"/> + <see stepKey="seeEmail" userInput="{{customer.email}}" selector="{{StorefrontCustomerDashboardAccountInformationSection.ContactInformation}}"/> + <seeInCurrentUrl url="{{StorefrontCustomerDashboardPage.url}}" stepKey="seeAssertInCurrentUrl"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/DeleteCustomerActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/DeleteCustomerActionGroup.xml index 81b8cabaa51ef..62f4c87545c6f 100644 --- a/app/code/Magento/Customer/Test/Mftf/ActionGroup/DeleteCustomerActionGroup.xml +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/DeleteCustomerActionGroup.xml @@ -30,29 +30,4 @@ <waitForElementVisible stepKey="waitForSuccessfullyDeletedMessage" selector="{{CustomersPageSection.deletedSuccessMessage}}" time="10"/> <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskDisappear"/> </actionGroup> - - <actionGroup name="DeleteCustomerByEmailActionGroup"> - <annotations> - <description>Goes to the Admin Customers grid page. Deletes a Customer based on the provided Email Address.</description> - </annotations> - <arguments> - <argument name="email" type="string"/> - </arguments> - - <amOnPage url="{{AdminCustomerPage.url}}" stepKey="navigateToCustomers"/> - <waitForPageLoad stepKey="waitForAdminCustomerPageLoad"/> - <click selector="{{AdminCustomerFiltersSection.filtersButton}}" stepKey="clickFilterButton"/> - <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="cleanFiltersIfTheySet"/> - <waitForPageLoad stepKey="waitForClearFilters"/> - <fillField selector="{{AdminCustomerFiltersSection.emailInput}}" userInput="{{email}}" stepKey="filterEmail"/> - <click selector="{{AdminCustomerFiltersSection.apply}}" stepKey="applyFilter"/> - <waitForPageLoad stepKey="waitForPageToLoad"/> - <click selector="{{AdminCustomerGridSection.selectFirstRow}}" stepKey="clickOnEditButton1"/> - <click selector="{{CustomersPageSection.actions}}" stepKey="clickActionsDropdown"/> - <click selector="{{CustomersPageSection.delete}}" stepKey="clickDelete"/> - <waitForElementVisible selector="{{CustomersPageSection.ok}}" stepKey="waitForOkToVisible"/> - <click selector="{{CustomersPageSection.ok}}" stepKey="clickOkConfirmationButton"/> - <waitForElementVisible stepKey="waitForSuccessfullyDeletedMessage" selector="{{CustomersPageSection.deletedSuccessMessage}}" time="10"/> - <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskDisappear"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/DeleteCustomerByEmailActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/DeleteCustomerByEmailActionGroup.xml new file mode 100644 index 0000000000000..5920596633f76 --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/DeleteCustomerByEmailActionGroup.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="DeleteCustomerByEmailActionGroup"> + <annotations> + <description>Goes to the Admin Customers grid page. Deletes a Customer based on the provided Email Address.</description> + </annotations> + <arguments> + <argument name="email" type="string"/> + </arguments> + + <amOnPage url="{{AdminCustomerPage.url}}" stepKey="navigateToCustomers"/> + <waitForPageLoad stepKey="waitForAdminCustomerPageLoad"/> + <click selector="{{AdminCustomerFiltersSection.filtersButton}}" stepKey="clickFilterButton"/> + <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="cleanFiltersIfTheySet"/> + <waitForPageLoad stepKey="waitForClearFilters"/> + <fillField selector="{{AdminCustomerFiltersSection.emailInput}}" userInput="{{email}}" stepKey="filterEmail"/> + <click selector="{{AdminCustomerFiltersSection.apply}}" stepKey="applyFilter"/> + <waitForPageLoad stepKey="waitForPageToLoad"/> + <click selector="{{AdminCustomerGridSection.selectFirstRow}}" stepKey="clickOnEditButton1"/> + <click selector="{{CustomersPageSection.actions}}" stepKey="clickActionsDropdown"/> + <click selector="{{CustomersPageSection.delete}}" stepKey="clickDelete"/> + <waitForElementVisible selector="{{CustomersPageSection.ok}}" stepKey="waitForOkToVisible"/> + <click selector="{{CustomersPageSection.ok}}" stepKey="clickOkConfirmationButton"/> + <waitForElementVisible stepKey="waitForSuccessfullyDeletedMessage" selector="{{CustomersPageSection.deletedSuccessMessage}}" time="30"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/DeleteCustomerFromAdminActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/DeleteCustomerFromAdminActionGroup.xml new file mode 100644 index 0000000000000..04083f688b75d --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/DeleteCustomerFromAdminActionGroup.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="DeleteCustomerFromAdminActionGroup"> + <annotations> + <description>Goes to the Admin Customers grid page. Deletes the provided Customer from the grid. Validates that the Success message is present and correct.</description> + </annotations> + <arguments> + <argument name="customer" defaultValue="CustomerEntityOne"/> + </arguments> + + <amOnPage url="{{AdminCustomerPage.url}}" stepKey="navigateToCustomers"/> + <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clickOnButtonToRemoveFiltersIfPresent"/> + <fillField selector="{{AdminDataGridHeaderSection.search}}" userInput="{{customer.email}}" stepKey="fillSearch"/> + <click selector="{{AdminDataGridHeaderSection.submitSearch}}" stepKey="clickSubmit"/> + <waitForAjaxLoad stepKey="waitForLoadAjax"/> + <click selector="{{AdminCustomerGridMainActionsSection.multicheck}}" stepKey="selectAll"/> + <click selector="{{AdminCustomerGridMainActionsSection.actions}}" stepKey="clickActions"/> + <click selector="{{AdminCustomerGridMainActionsSection.delete}}" stepKey="clickDelete"/> + <waitForAjaxLoad stepKey="waitForLoadConfirmation"/> + <click selector="{{AdminConfirmationModalSection.ok}}" stepKey="confirmDelete"/> + <see selector="{{AdminMessagesSection.success}}" userInput="A total of 1 record(s) were deleted" stepKey="seeSuccess"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/EnterCustomerAddressInfoActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/EnterCustomerAddressInfoActionGroup.xml new file mode 100644 index 0000000000000..c72010fe5c3bf --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/EnterCustomerAddressInfoActionGroup.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="EnterCustomerAddressInfoActionGroup"> + <annotations> + <description>Fills in the provided Customer details (First/Last Name, Company, Phone # and Address) on the Admin Customer creation/edit page. Clicks on the Save button.</description> + </annotations> + <arguments> + <argument name="Address"/> + </arguments> + + <amOnPage url="customer/address/new/" stepKey="goToAddressPage"/> + <waitForPageLoad stepKey="waitForAddressPage"/> + <fillField stepKey="fillFirstName" selector="{{StorefrontCustomerAddressSection.firstName}}" userInput="{{Address.firstname}}"/> + <fillField stepKey="fillLastName" selector="{{StorefrontCustomerAddressSection.lastName}}" userInput="{{Address.lastname}}"/> + <fillField stepKey="fillCompany" selector="{{StorefrontCustomerAddressSection.company}}" userInput="{{Address.company}}"/> + <fillField stepKey="fillPhoneNumber" selector="{{StorefrontCustomerAddressSection.phoneNumber}}" userInput="{{Address.telephone}}"/> + <fillField stepKey="fillStreetAddress1" selector="{{StorefrontCustomerAddressSection.streetAddress1}}" userInput="{{Address.street[0]}}"/> + <fillField stepKey="fillStreetAddress2" selector="{{StorefrontCustomerAddressSection.streetAddress2}}" userInput="{{Address.street[1]}}"/> + <fillField stepKey="fillCityName" selector="{{StorefrontCustomerAddressSection.city}}" userInput="{{Address.city}}"/> + <selectOption stepKey="selectCounty" selector="{{StorefrontCustomerAddressSection.country}}" userInput="{{Address.country_id}}"/> + <selectOption stepKey="selectState" selector="{{StorefrontCustomerAddressSection.stateProvince}}" userInput="{{Address.state}}"/> + <fillField stepKey="fillZip" selector="{{StorefrontCustomerAddressSection.zip}}" userInput="{{Address.postcode}}"/> + <click stepKey="saveAddress" selector="{{StorefrontCustomerAddressSection.saveAddress}}"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/EnterCustomerAddressInfoFillStateActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/EnterCustomerAddressInfoFillStateActionGroup.xml new file mode 100644 index 0000000000000..891b578e54e6b --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/EnterCustomerAddressInfoFillStateActionGroup.xml @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="EnterCustomerAddressInfoFillStateActionGroup" extends="EnterCustomerAddressInfoActionGroup"> + <annotations> + <description>EXTENDS: EnterCustomerAddressInfo. Fills the State field.</description> + </annotations> + + <fillField stepKey="selectState" selector="{{StorefrontCustomerAddressSection.stateProvinceFill}}" userInput="{{Address.state}}"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/OpenEditCustomerAddressFromAdminActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/OpenEditCustomerAddressFromAdminActionGroup.xml new file mode 100644 index 0000000000000..86ac1dc650bbc --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/OpenEditCustomerAddressFromAdminActionGroup.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="OpenEditCustomerAddressFromAdminActionGroup"> + <annotations> + <description>Filters the Admin Customers Addresses based on the provided Address. Clicks on Edit.</description> + </annotations> + <arguments> + <argument name="address"/> + </arguments> + + <click selector="{{AdminCustomerAccountInformationSection.addressesButton}}" stepKey="openAddressesTab"/> + <waitForElementVisible selector="{{AdminCustomerAddressFiltersSection.filtersButton}}" stepKey="waitForComponentLoad"/> + <click selector="{{AdminCustomerAddressFiltersSection.filtersButton}}" stepKey="openAddressesFilter"/> + <fillField userInput="{{address.firstname}}" selector="{{AdminCustomerAddressFiltersSection.firstnameInput}}" stepKey="fillFirstname"/> + <fillField userInput="{{address.lastname}}" selector="{{AdminCustomerAddressFiltersSection.lastnameInput}}" stepKey="fillLastname"/> + <fillField userInput="{{address.telephone}}" selector="{{AdminCustomerAddressFiltersSection.telephoneInput}}" stepKey="fillCountry"/> + <fillField userInput="{{address.postcode}}" selector="{{AdminCustomerAddressFiltersSection.postcodeInput}}" stepKey="fillPostcode"/> + <click selector="{{AdminCustomerAddressFiltersSection.applyFilter}}" stepKey="applyAddressesFilter"/> + <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskToDisappear"/> + <click selector="{{AdminCustomerAddressGridSection.firstRowSelectActionLink}}" stepKey="clickAction"/> + <click selector="{{AdminCustomerAddressGridSection.firstRowEditActionLink}}" stepKey="clickEdit"/> + <waitForPageLoad stepKey="waitForModalWindow"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/OpenEditCustomerFromAdminActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/OpenEditCustomerFromAdminActionGroup.xml index e338d1ae4bbd0..c9d5375d9b3d7 100644 --- a/app/code/Magento/Customer/Test/Mftf/ActionGroup/OpenEditCustomerFromAdminActionGroup.xml +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/OpenEditCustomerFromAdminActionGroup.xml @@ -26,57 +26,4 @@ <click selector="{{AdminCustomerGridSection.firstRowEditLink}}" stepKey="clickEdit"/> <waitForPageLoad stepKey="waitForPageLoad3"/> </actionGroup> - - <actionGroup name="OpenEditCustomerAddressFromAdminActionGroup"> - <annotations> - <description>Filters the Admin Customers Addresses based on the provided Address. Clicks on Edit.</description> - </annotations> - <arguments> - <argument name="address"/> - </arguments> - - <click selector="{{AdminCustomerAccountInformationSection.addressesButton}}" stepKey="openAddressesTab"/> - <waitForElementVisible selector="{{AdminCustomerAddressFiltersSection.filtersButton}}" stepKey="waitForComponentLoad"/> - <click selector="{{AdminCustomerAddressFiltersSection.filtersButton}}" stepKey="openAddressesFilter"/> - <fillField userInput="{{address.firstname}}" selector="{{AdminCustomerAddressFiltersSection.firstnameInput}}" stepKey="fillFirstname"/> - <fillField userInput="{{address.lastname}}" selector="{{AdminCustomerAddressFiltersSection.lastnameInput}}" stepKey="fillLastname"/> - <fillField userInput="{{address.telephone}}" selector="{{AdminCustomerAddressFiltersSection.telephoneInput}}" stepKey="fillCountry"/> - <fillField userInput="{{address.postcode}}" selector="{{AdminCustomerAddressFiltersSection.postcodeInput}}" stepKey="fillPostcode"/> - <click selector="{{AdminCustomerAddressFiltersSection.applyFilter}}" stepKey="applyAddressesFilter"/> - <waitForLoadingMaskToDisappear stepKey="waitForLoadingMaskToDisappear"/> - <click selector="{{AdminCustomerAddressGridSection.firstRowSelectActionLink}}" stepKey="clickAction"/> - <click selector="{{AdminCustomerAddressGridSection.firstRowEditActionLink}}" stepKey="clickEdit"/> - <waitForPageLoad stepKey="waitForModalWindow"/> - </actionGroup> - - <actionGroup name="DeleteCustomerFromAdminActionGroup"> - <annotations> - <description>Goes to the Admin Customers grid page. Deletes the provided Customer from the grid. Validates that the Success message is present and correct.</description> - </annotations> - <arguments> - <argument name="customer" defaultValue="CustomerEntityOne"/> - </arguments> - - <amOnPage url="{{AdminCustomerPage.url}}" stepKey="navigateToCustomers"/> - <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clickOnButtonToRemoveFiltersIfPresent"/> - <fillField selector="{{AdminDataGridHeaderSection.search}}" userInput="{{customer.email}}" stepKey="fillSearch"/> - <click selector="{{AdminDataGridHeaderSection.submitSearch}}" stepKey="clickSubmit"/> - <waitForAjaxLoad stepKey="waitForLoadAjax"/> - <click selector="{{AdminCustomerGridMainActionsSection.multicheck}}" stepKey="selectAll"/> - <click selector="{{AdminCustomerGridMainActionsSection.actions}}" stepKey="clickActions"/> - <click selector="{{AdminCustomerGridMainActionsSection.delete}}" stepKey="clickDelete"/> - <waitForAjaxLoad stepKey="waitForLoadConfirmation"/> - <click selector="{{AdminConfirmationModalSection.ok}}" stepKey="confirmDelete"/> - <see selector="{{AdminMessagesSection.success}}" userInput="A total of 1 record(s) were deleted" stepKey="seeSuccess"/> - </actionGroup> - - <actionGroup name="AdminClearCustomersFiltersActionGroup"> - <annotations> - <description>Goes to the Admin Customers grid page. Clicks on 'Clear Filters'.</description> - </annotations> - - <amOnPage url="{{AdminCustomerPage.url}}" stepKey="amOnCustomersPage"/> - <waitForPageLoad stepKey="WaitForPageToLoad"/> - <conditionalClick selector="{{AdminDataGridHeaderSection.clearFilters}}" dependentSelector="{{AdminDataGridHeaderSection.clearFilters}}" visible="true" stepKey="clickOnButtonToRemoveFiltersIfPresent"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/SaveRegistrationFormActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/SaveRegistrationFormActionGroup.xml new file mode 100644 index 0000000000000..babef0fdd60d9 --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/SaveRegistrationFormActionGroup.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SaveRegistrationFormActionGroup"> + <click stepKey="clickCreateAccountButton" selector="{{StorefrontCustomerCreateFormSection.createAccountButton}}"/> + <waitForPageLoad stepKey="waitForCreateAccountButtonToLoad" /> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/SelectDropdownCustomerAddressAttributeValueActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/SelectDropdownCustomerAddressAttributeValueActionGroup.xml new file mode 100644 index 0000000000000..5d0fb2e7b5c8d --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/SelectDropdownCustomerAddressAttributeValueActionGroup.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SelectDropdownCustomerAddressAttributeValueActionGroup"> + <annotations> + <description>Selects the provided Option in the provided Customer Address Attribute drop down menu. Clicks on Save.</description> + </annotations> + <arguments> + <argument name="customerAddressAttribute"/> + <argument name="optionValue" type="string"/> + </arguments> + + <selectOption selector="{{AdminEditCustomerAddressesSection.dropDownAttribute(customerAddressAttribute.code)}}" userInput="{{optionValue}}" stepKey="selectOptionValue"/> + <click selector="{{AdminEditCustomerAddressesSection.save}}" stepKey="saveAddress"/> + <waitForPageLoad stepKey="waitForAddressSaved"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/SignUpNewCustomerStorefrontActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/SignUpNewCustomerStorefrontActionGroup.xml new file mode 100644 index 0000000000000..f994bafda73e0 --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/SignUpNewCustomerStorefrontActionGroup.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="SignUpNewCustomerStorefrontActionGroup" extends="SignUpNewUserFromStorefrontActionGroup"> + <annotations> + <description>EXTENDS: SignUpNewUserFromStorefrontActionGroup. Adds a waitForPageLoad action to the Action Group. Removes the action for 'seeThankYouMessage'.</description> + </annotations> + + <waitForPageLoad stepKey="waitForRegistered" after="clickCreateAccountButton"/> + <remove keyForRemoval="seeThankYouMessage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/SignUpNewUserFromStorefrontActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/SignUpNewUserFromStorefrontActionGroup.xml index 3cb37a248aa30..56afa8854ce0d 100644 --- a/app/code/Magento/Customer/Test/Mftf/ActionGroup/SignUpNewUserFromStorefrontActionGroup.xml +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/SignUpNewUserFromStorefrontActionGroup.xml @@ -30,193 +30,4 @@ <see stepKey="seeLastName" userInput="{{Customer.lastname}}" selector="{{StorefrontCustomerDashboardAccountInformationSection.ContactInformation}}"/> <see stepKey="seeEmail" userInput="{{Customer.email}}" selector="{{StorefrontCustomerDashboardAccountInformationSection.ContactInformation}}"/> </actionGroup> - - <actionGroup name="StorefrontCreateCustomerSignedUpNewsletterActionGroup"> - <annotations> - <description>Goes to the Storefront. Clicks on 'Create Account'. Fills in the provided Customer details, including Newsletter Sign-Up. Clicks on 'Create Account' button.</description> - </annotations> - <arguments> - <argument name="customer" defaultValue="CustomerEntityOne"/> - </arguments> - - <amOnPage url="{{StorefrontHomePage.url}}" stepKey="amOnStorefrontPage"/> - <waitForPageLoad stepKey="waitForNavigateToCustomersPageLoad"/> - <click stepKey="clickOnCreateAccountLink" selector="{{StorefrontPanelHeaderSection.createAnAccountLink}}"/> - <fillField stepKey="fillFirstName" userInput="{{customer.firstname}}" selector="{{StorefrontCustomerCreateFormSection.firstnameField}}"/> - <fillField stepKey="fillLastName" userInput="{{customer.lastname}}" selector="{{StorefrontCustomerCreateFormSection.lastnameField}}"/> - <checkOption selector="{{StorefrontCustomerCreateFormSection.signUpForNewsletter}}" stepKey="checkSignUpForNewsletter"/> - <fillField stepKey="fillEmail" userInput="{{customer.email}}" selector="{{StorefrontCustomerCreateFormSection.emailField}}"/> - <fillField stepKey="fillPassword" userInput="{{customer.password}}" selector="{{StorefrontCustomerCreateFormSection.passwordField}}"/> - <fillField stepKey="fillConfirmPassword" userInput="{{customer.password}}" selector="{{StorefrontCustomerCreateFormSection.confirmPasswordField}}"/> - <click stepKey="clickCreateAccountButton" selector="{{StorefrontCustomerCreateFormSection.createAccountButton}}"/> - <waitForPageLoad stepKey="waitForCreateAccountButtonToLoad"/> - </actionGroup> - - <actionGroup name="StorefrontFillRegistrationFormActionGroup" extends="StorefrontCreateCustomerSignedUpNewsletterActionGroup"> - <remove keyForRemoval="checkSignUpForNewsletter"/> - <remove keyForRemoval="clickCreateAccountButton"/> - <remove keyForRemoval="waitForCreateAccountButtonToLoad"/> - </actionGroup> - - <actionGroup name="SaveRegistrationFormActionGroup"> - <click stepKey="clickCreateAccountButton" selector="{{StorefrontCustomerCreateFormSection.createAccountButton}}"/> - <waitForPageLoad stepKey="waitForCreateAccountButtonToLoad" /> - </actionGroup> - - <actionGroup name="AssertSignedUpNewsletterActionGroup"> - <annotations> - <description>Validates that the provided Customer details are present and correct on the Storefront Customer Dashboard page.</description> - </annotations> - <arguments> - <argument name="customer" defaultValue="CustomerEntityOne"/> - <argument name="storeName" defaultValue="Main Website" type="string"/> - </arguments> - - <see stepKey="successMessage" userInput="Thank you for registering with {{storeName}} Store." selector="{{AdminCustomerMessagesSection.successMessage}}"/> - <see stepKey="seeFirstName" userInput="{{customer.firstname}}" selector="{{StorefrontCustomerDashboardAccountInformationSection.ContactInformation}}"/> - <see stepKey="seeLastName" userInput="{{customer.lastname}}" selector="{{StorefrontCustomerDashboardAccountInformationSection.ContactInformation}}"/> - <see stepKey="seeEmail" userInput="{{customer.email}}" selector="{{StorefrontCustomerDashboardAccountInformationSection.ContactInformation}}"/> - <seeInCurrentUrl url="{{StorefrontCustomerDashboardPage.url}}" stepKey="seeAssertInCurrentUrl"/> - </actionGroup> - - <actionGroup name="EnterCustomerAddressInfo"> - <annotations> - <description>Fills in the provided Customer details (First/Last Name, Company, Phone # and Address) on the Admin Customer creation/edit page. Clicks on the Save button.</description> - </annotations> - <arguments> - <argument name="Address"/> - </arguments> - - <amOnPage url="customer/address/new/" stepKey="goToAddressPage"/> - <waitForPageLoad stepKey="waitForAddressPage"/> - <fillField stepKey="fillFirstName" selector="{{StorefrontCustomerAddressSection.firstName}}" userInput="{{Address.firstname}}"/> - <fillField stepKey="fillLastName" selector="{{StorefrontCustomerAddressSection.lastName}}" userInput="{{Address.lastname}}"/> - <fillField stepKey="fillCompany" selector="{{StorefrontCustomerAddressSection.company}}" userInput="{{Address.company}}"/> - <fillField stepKey="fillPhoneNumber" selector="{{StorefrontCustomerAddressSection.phoneNumber}}" userInput="{{Address.telephone}}"/> - <fillField stepKey="fillStreetAddress1" selector="{{StorefrontCustomerAddressSection.streetAddress1}}" userInput="{{Address.street[0]}}"/> - <fillField stepKey="fillStreetAddress2" selector="{{StorefrontCustomerAddressSection.streetAddress2}}" userInput="{{Address.street[1]}}"/> - <fillField stepKey="fillCityName" selector="{{StorefrontCustomerAddressSection.city}}" userInput="{{Address.city}}"/> - <selectOption stepKey="selectCounty" selector="{{StorefrontCustomerAddressSection.country}}" userInput="{{Address.country_id}}"/> - <selectOption stepKey="selectState" selector="{{StorefrontCustomerAddressSection.stateProvince}}" userInput="{{Address.state}}"/> - <fillField stepKey="fillZip" selector="{{StorefrontCustomerAddressSection.zip}}" userInput="{{Address.postcode}}"/> - <click stepKey="saveAddress" selector="{{StorefrontCustomerAddressSection.saveAddress}}"/> - </actionGroup> - - <!-- Fills State Field instead of selecting it--> - <actionGroup name="EnterCustomerAddressInfoFillState" extends="EnterCustomerAddressInfo"> - <annotations> - <description>EXTENDS: EnterCustomerAddressInfo. Fills the State field.</description> - </annotations> - - <fillField stepKey="selectState" selector="{{StorefrontCustomerAddressSection.stateProvinceFill}}" userInput="{{Address.state}}"/> - </actionGroup> - - <actionGroup name="VerifyCustomerBillingAddress"> - <annotations> - <description>Goes to the Storefront Customer Dashboard Address area. Validates that the provided Customer Billing Address is present and correct on the Storefront Customer Dashboard Address section.</description> - </annotations> - <arguments> - <argument name="address"/> - </arguments> - - <amOnPage url="{{StorefrontCustomerAddressesPage.url}}" stepKey="goToAddressPage"/> - <waitForPageLoad stepKey="waitForAddressPageLoad"/> - - <!--Verify customer default billing address--> - <see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.firstname}} {{address.lastname}}" stepKey="seeAssertCustomerDefaultBillingAddressFirstnameAndLastname"/> - <see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.company}}" stepKey="seeAssertCustomerDefaultBillingAddressCompany"/> - <see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.street[0]}}" stepKey="seeAssertCustomerDefaultBillingAddressStreet"/> - <see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.street[1]}}" stepKey="seeAssertCustomerDefaultBillingAddressStreet1"/> - <see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.city}}, {{address.postcode}}" stepKey="seeAssertCustomerDefaultBillingAddressCityAndPostcode"/> - <see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.country}}" stepKey="seeAssertCustomerDefaultBillingAddressCountry"/> - <see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.telephone}}" stepKey="seeAssertCustomerDefaultBillingAddressTelephone"/> - </actionGroup> - - <actionGroup name="VerifyCustomerShippingAddress"> - <annotations> - <description>Goes to the Storefront Customer Dashboard Address area. Validates that the provided Customer Shipping Address is present and correct.</description> - </annotations> - <arguments> - <argument name="address"/> - </arguments> - - <amOnPage url="{{StorefrontCustomerAddressesPage.url}}" stepKey="goToAddressPage"/> - <waitForPageLoad stepKey="waitForAddressPageLoad"/> - <!--Verify customer default shipping address--> - <see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.firstname}} {{address.lastname}}" stepKey="seeAssertCustomerDefaultShippingAddressFirstnameAndLastname"/> - <see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.company}}" stepKey="seeAssertCustomerDefaultShippingAddressCompany"/> - <see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.street[0]}}" stepKey="seeAssertCustomerDefaultShippingAddressStreet"/> - <see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.street[1]}}" stepKey="seeAssertCustomerDefaultShippingAddressStreet1"/> - <see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.city}}, {{address.postcode}}" stepKey="seeAssertCustomerDefaultShippingAddressCityAndPostcode"/> - <see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.country}}" stepKey="seeAssertCustomerDefaultShippingAddressCountry"/> - <see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.telephone}}" stepKey="seeAssertCustomerDefaultShippingAddressTelephone"/> - </actionGroup> - - <actionGroup name="VerifyCustomerBillingAddressWithState"> - <annotations> - <description>Goes to the Storefront Customer Dashboard Address area. Validates that the provided Customer Billing Address, including the State, is present and correct.</description> - </annotations> - <arguments> - <argument name="address"/> - </arguments> - - <amOnPage url="{{StorefrontCustomerAddressesPage.url}}" stepKey="goToAddressPage"/> - <waitForPageLoad stepKey="waitForAddressPageLoad"/> - - <!--Verify customer default billing address--> - <see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.firstname}} {{address.lastname}}" stepKey="seeAssertCustomerDefaultBillingAddressFirstnameAndLastname"/> - <see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.company}}" stepKey="seeAssertCustomerDefaultBillingAddressCompany"/> - <see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.street[0]}}" stepKey="seeAssertCustomerDefaultBillingAddressStreet"/> - <see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.street[1]}}" stepKey="seeAssertCustomerDefaultBillingAddressStreet1"/> - <see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.city}}, {{address.state}}, {{address.postcode}}" stepKey="seeAssertCustomerDefaultBillingAddressCityAndPostcode"/> - <see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.country}}" stepKey="seeAssertCustomerDefaultBillingAddressCountry"/> - <see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.telephone}}" stepKey="seeAssertCustomerDefaultBillingAddressTelephone"/> - </actionGroup> - - <actionGroup name="VerifyCustomerShippingAddressWithState"> - <annotations> - <description>Goes to the Storefront Customer Dashboard Address area. Validates that the provided Customer Shipping Address, including the State, is present and correct.</description> - </annotations> - <arguments> - <argument name="address"/> - </arguments> - - <amOnPage url="{{StorefrontCustomerAddressesPage.url}}" stepKey="goToAddressPage"/> - <waitForPageLoad stepKey="waitForAddressPageLoad"/> - - <!--Verify customer default shipping address--> - <see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.firstname}} {{address.lastname}}" stepKey="seeAssertCustomerDefaultShippingAddressFirstnameAndLastname"/> - <see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.company}}" stepKey="seeAssertCustomerDefaultShippingAddressCompany"/> - <see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.street[0]}}" stepKey="seeAssertCustomerDefaultShippingAddressStreet"/> - <see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.street[1]}}" stepKey="seeAssertCustomerDefaultShippingAddressStreet1"/> - <see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.city}}, {{address.state}}, {{address.postcode}}" stepKey="seeAssertCustomerDefaultShippingAddressCityAndPostcode"/> - <see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.country}}" stepKey="seeAssertCustomerDefaultShippingAddressCountry"/> - <see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.telephone}}" stepKey="seeAssertCustomerDefaultShippingAddressTelephone"/> - </actionGroup> - - <actionGroup name="VerifyCustomerNameOnFrontend"> - <annotations> - <description>Goes to the Storefront Customer Dashboard page. Validates that the Customer First/Last Name is present and correct.</description> - </annotations> - <arguments> - <argument name="customer"/> - </arguments> - - <!--Verify customer name on frontend--> - <amOnPage url="{{StorefrontCustomerEditPage.url}}" stepKey="goToAddressPage"/> - <waitForPageLoad stepKey="waitForAddressPageLoad"/> - <click selector="{{StorefrontCustomerSidebarSection.sidebarCurrentTab('Account Information')}}" stepKey="clickAccountInformationFromSidebarCurrentTab"/> - <waitForPageLoad stepKey="waitForAccountInformationTabToOpen"/> - <seeInField selector="{{StorefrontCustomerAccountInformationSection.firstName}}" userInput="{{customer.firstname}}" stepKey="seeAssertCustomerFirstName"/> - <seeInField selector="{{StorefrontCustomerAccountInformationSection.lastName}}" userInput="{{customer.lastname}}" stepKey="seeAssertCustomerLastName"/> - </actionGroup> - - <actionGroup name="SignUpNewCustomerStorefrontActionGroup" extends="SignUpNewUserFromStorefrontActionGroup"> - <annotations> - <description>EXTENDS: SignUpNewUserFromStorefrontActionGroup. Adds a waitForPageLoad action to the Action Group. Removes the action for 'seeThankYouMessage'.</description> - </annotations> - - <waitForPageLoad stepKey="waitForRegistered" after="clickCreateAccountButton"/> - <remove keyForRemoval="seeThankYouMessage"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontAddCustomerAddressActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontAddCustomerDefaultAddressActionGroup.xml similarity index 57% rename from app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontAddCustomerAddressActionGroup.xml rename to app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontAddCustomerDefaultAddressActionGroup.xml index dc21ce5f52d73..ce26d14bb95f7 100644 --- a/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontAddCustomerAddressActionGroup.xml +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontAddCustomerDefaultAddressActionGroup.xml @@ -8,28 +8,6 @@ <actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> - <actionGroup name="StorefrontAddNewCustomerAddressActionGroup"> - <annotations> - <description>Goes to the Storefront Customer Add New Address page. Fills in the provided Address details. Clicks on Save.</description> - </annotations> - <arguments> - <argument name="Address"/> - </arguments> - - <amOnPage url="customer/address/new/" stepKey="OpenCustomerAddNewAddress"/> - <fillField stepKey="fillFirstName" userInput="{{Address.firstname}}" selector="{{StorefrontCustomerAddressFormSection.firstName}}"/> - <fillField stepKey="fillLastName" userInput="{{Address.lastname}}" selector="{{StorefrontCustomerAddressFormSection.lastName}}"/> - <fillField stepKey="fillCompanyName" userInput="{{Address.company}}" selector="{{StorefrontCustomerAddressFormSection.company}}"/> - <fillField stepKey="fillPhoneNumber" userInput="{{Address.telephone}}" selector="{{StorefrontCustomerAddressFormSection.phoneNumber}}"/> - <fillField stepKey="fillStreetAddress" userInput="{{Address.street[0]}}" selector="{{StorefrontCustomerAddressFormSection.streetAddress}}"/> - <fillField stepKey="fillCity" userInput="{{Address.city}}" selector="{{StorefrontCustomerAddressFormSection.city}}"/> - <selectOption stepKey="selectState" userInput="{{Address.state}}" selector="{{StorefrontCustomerAddressFormSection.state}}"/> - <fillField stepKey="fillZip" userInput="{{Address.postcode}}" selector="{{StorefrontCustomerAddressFormSection.zip}}"/> - <selectOption stepKey="selectCountry" userInput="{{Address.country}}" selector="{{StorefrontCustomerAddressFormSection.country}}"/> - <click stepKey="saveCustomerAddress" selector="{{StorefrontCustomerAddressFormSection.saveAddress}}"/> - <see userInput="You saved the address." stepKey="verifyAddressAdded"/> - </actionGroup> - <actionGroup name="StorefrontAddCustomerDefaultAddressActionGroup"> <annotations> <description>Goes to the Storefront Customer Add New Default Address page. Fills in the provided Address details. Clicks on Save.</description> diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontAddNewCustomerAddressActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontAddNewCustomerAddressActionGroup.xml new file mode 100644 index 0000000000000..358930070bc1b --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontAddNewCustomerAddressActionGroup.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontAddNewCustomerAddressActionGroup"> + <annotations> + <description>Goes to the Storefront Customer Add New Address page. Fills in the provided Address details. Clicks on Save.</description> + </annotations> + <arguments> + <argument name="Address"/> + </arguments> + + <amOnPage url="customer/address/new/" stepKey="OpenCustomerAddNewAddress"/> + <fillField stepKey="fillFirstName" userInput="{{Address.firstname}}" selector="{{StorefrontCustomerAddressFormSection.firstName}}"/> + <fillField stepKey="fillLastName" userInput="{{Address.lastname}}" selector="{{StorefrontCustomerAddressFormSection.lastName}}"/> + <fillField stepKey="fillCompanyName" userInput="{{Address.company}}" selector="{{StorefrontCustomerAddressFormSection.company}}"/> + <fillField stepKey="fillPhoneNumber" userInput="{{Address.telephone}}" selector="{{StorefrontCustomerAddressFormSection.phoneNumber}}"/> + <fillField stepKey="fillStreetAddress" userInput="{{Address.street[0]}}" selector="{{StorefrontCustomerAddressFormSection.streetAddress}}"/> + <fillField stepKey="fillCity" userInput="{{Address.city}}" selector="{{StorefrontCustomerAddressFormSection.city}}"/> + <selectOption stepKey="selectState" userInput="{{Address.state}}" selector="{{StorefrontCustomerAddressFormSection.state}}"/> + <fillField stepKey="fillZip" userInput="{{Address.postcode}}" selector="{{StorefrontCustomerAddressFormSection.zip}}"/> + <selectOption stepKey="selectCountry" userInput="{{Address.country}}" selector="{{StorefrontCustomerAddressFormSection.country}}"/> + <click stepKey="saveCustomerAddress" selector="{{StorefrontCustomerAddressFormSection.saveAddress}}"/> + <see userInput="You saved the address." stepKey="verifyAddressAdded"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontCreateCustomerSignedUpNewsletterActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontCreateCustomerSignedUpNewsletterActionGroup.xml new file mode 100644 index 0000000000000..22a90fca78cb2 --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontCreateCustomerSignedUpNewsletterActionGroup.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontCreateCustomerSignedUpNewsletterActionGroup"> + <annotations> + <description>Goes to the Storefront. Clicks on 'Create Account'. Fills in the provided Customer details, including Newsletter Sign-Up. Clicks on 'Create Account' button.</description> + </annotations> + <arguments> + <argument name="customer" defaultValue="CustomerEntityOne"/> + </arguments> + + <amOnPage url="{{StorefrontHomePage.url}}" stepKey="amOnStorefrontPage"/> + <waitForPageLoad stepKey="waitForNavigateToCustomersPageLoad"/> + <click stepKey="clickOnCreateAccountLink" selector="{{StorefrontPanelHeaderSection.createAnAccountLink}}"/> + <fillField stepKey="fillFirstName" userInput="{{customer.firstname}}" selector="{{StorefrontCustomerCreateFormSection.firstnameField}}"/> + <fillField stepKey="fillLastName" userInput="{{customer.lastname}}" selector="{{StorefrontCustomerCreateFormSection.lastnameField}}"/> + <checkOption selector="{{StorefrontCustomerCreateFormSection.signUpForNewsletter}}" stepKey="checkSignUpForNewsletter"/> + <fillField stepKey="fillEmail" userInput="{{customer.email}}" selector="{{StorefrontCustomerCreateFormSection.emailField}}"/> + <fillField stepKey="fillPassword" userInput="{{customer.password}}" selector="{{StorefrontCustomerCreateFormSection.passwordField}}"/> + <fillField stepKey="fillConfirmPassword" userInput="{{customer.password}}" selector="{{StorefrontCustomerCreateFormSection.confirmPasswordField}}"/> + <click stepKey="clickCreateAccountButton" selector="{{StorefrontCustomerCreateFormSection.createAccountButton}}"/> + <waitForPageLoad stepKey="waitForCreateAccountButtonToLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontCustomerLogoutActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontCustomerLogoutActionGroup.xml index 98a7f4c8d1544..bbe5fcbbf4038 100644 --- a/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontCustomerLogoutActionGroup.xml +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontCustomerLogoutActionGroup.xml @@ -16,15 +16,4 @@ <amOnPage url="{{StorefrontCustomerLogoutPage.url}}" stepKey="storefrontSignOut"/> <waitForPageLoad stepKey="waitForSignOut"/> </actionGroup> - - <actionGroup name="StorefrontSignOutActionGroup"> - <annotations> - <description>Clicks on Customer Account. Clicks on 'Sign-Out'. Validates that the success message is present and correct. PLEASE NOTE: The Success Message is hardcoded.</description> - </annotations> - - <click selector="{{StoreFrontSignOutSection.customerAccount}}" stepKey="clickCustomerButton"/> - <click selector="{{StoreFrontSignOutSection.signOut}}" stepKey="clickToSignOut"/> - <waitForText selector="{{StorefrontCMSPageSection.mainTitle}}" userInput="You are signed out" stepKey="signOut"/> - <waitForText selector="{{StorefrontCMSPageSection.mainTitle}}" userInput="Home Page" stepKey="waitForHomePageLoad"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontFillRegistrationFormActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontFillRegistrationFormActionGroup.xml new file mode 100644 index 0000000000000..984d4f437aeb0 --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontFillRegistrationFormActionGroup.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontFillRegistrationFormActionGroup" extends="StorefrontCreateCustomerSignedUpNewsletterActionGroup"> + <remove keyForRemoval="checkSignUpForNewsletter"/> + <remove keyForRemoval="clickCreateAccountButton"/> + <remove keyForRemoval="waitForCreateAccountButtonToLoad"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontOpenCustomerAccountCreatePageActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontOpenCustomerAccountCreatePageActionGroup.xml index 31a988ac9da0d..b013b1db1c8e7 100644 --- a/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontOpenCustomerAccountCreatePageActionGroup.xml +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontOpenCustomerAccountCreatePageActionGroup.xml @@ -16,15 +16,4 @@ <amOnPage url="{{StorefrontCustomerCreatePage.url}}" stepKey="goToCustomerAccountCreatePage"/> <waitForPageLoad stepKey="waitForPageLoaded"/> </actionGroup> - - <actionGroup name="StorefrontOpenCustomerAccountCreatePageUsingStoreCodeInUrlActionGroup"> - <annotations> - <description>Goes to the Storefront Customer Create page using Store code in URL option.</description> - </annotations> - <arguments> - <argument name="storeView" type="string" defaultValue="{{customStore.code}}"/> - </arguments> - - <amOnPage url="{{StorefrontStoreHomePage.url(storeView)}}{{StorefrontCustomerCreatePage.url}}" stepKey="goToCustomerAccountCreatePage"/> - </actionGroup> </actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontOpenCustomerAccountCreatePageUsingStoreCodeInUrlActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontOpenCustomerAccountCreatePageUsingStoreCodeInUrlActionGroup.xml new file mode 100644 index 0000000000000..f095927c5be1b --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontOpenCustomerAccountCreatePageUsingStoreCodeInUrlActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontOpenCustomerAccountCreatePageUsingStoreCodeInUrlActionGroup"> + <annotations> + <description>Goes to the Storefront Customer Create page using Store code in URL option.</description> + </annotations> + <arguments> + <argument name="storeView" type="string" defaultValue="{{customStore.code}}"/> + </arguments> + + <amOnPage url="{{StorefrontStoreHomePage.url(storeView)}}{{StorefrontCustomerCreatePage.url}}" stepKey="goToCustomerAccountCreatePage"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontSignOutActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontSignOutActionGroup.xml new file mode 100644 index 0000000000000..61c5f9ef7c66e --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontSignOutActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="StorefrontSignOutActionGroup"> + <annotations> + <description>Clicks on Customer Account. Clicks on 'Sign-Out'. Validates that the success message is present and correct. PLEASE NOTE: The Success Message is hardcoded.</description> + </annotations> + + <click selector="{{StoreFrontSignOutSection.customerAccount}}" stepKey="clickCustomerButton"/> + <click selector="{{StoreFrontSignOutSection.signOut}}" stepKey="clickToSignOut"/> + <waitForPageLoad stepKey="waitForPageLoad"/> + <see userInput="You are signed out" stepKey="signOut"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/VerifyCustomerBillingAddressActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/VerifyCustomerBillingAddressActionGroup.xml new file mode 100644 index 0000000000000..c439f7529993c --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/VerifyCustomerBillingAddressActionGroup.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="VerifyCustomerBillingAddressActionGroup"> + <annotations> + <description>Goes to the Storefront Customer Dashboard Address area. Validates that the provided Customer Billing Address is present and correct on the Storefront Customer Dashboard Address section.</description> + </annotations> + <arguments> + <argument name="address"/> + </arguments> + + <amOnPage url="customer/address/index/" stepKey="goToAddressPage"/> + <waitForPageLoad stepKey="waitForAddressPageLoad"/> + + <!--Verify customer default billing address--> + <see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.firstname}} {{address.lastname}}" stepKey="seeAssertCustomerDefaultBillingAddressFirstnameAndLastname"/> + <see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.company}}" stepKey="seeAssertCustomerDefaultBillingAddressCompany"/> + <see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.street[0]}}" stepKey="seeAssertCustomerDefaultBillingAddressStreet"/> + <see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.street[1]}}" stepKey="seeAssertCustomerDefaultBillingAddressStreet1"/> + <see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.city}}, {{address.postcode}}" stepKey="seeAssertCustomerDefaultBillingAddressCityAndPostcode"/> + <see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.country}}" stepKey="seeAssertCustomerDefaultBillingAddressCountry"/> + <see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.telephone}}" stepKey="seeAssertCustomerDefaultBillingAddressTelephone"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/VerifyCustomerBillingAddressWithStateActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/VerifyCustomerBillingAddressWithStateActionGroup.xml new file mode 100644 index 0000000000000..7e46fcd7807db --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/VerifyCustomerBillingAddressWithStateActionGroup.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="VerifyCustomerBillingAddressWithStateActionGroup"> + <annotations> + <description>Goes to the Storefront Customer Dashboard Address area. Validates that the provided Customer Billing Address, including the State, is present and correct.</description> + </annotations> + <arguments> + <argument name="address"/> + </arguments> + + <amOnPage url="customer/address/index/" stepKey="goToAddressPage"/> + <waitForPageLoad stepKey="waitForAddressPageLoad"/> + + <!--Verify customer default billing address--> + <see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.firstname}} {{address.lastname}}" stepKey="seeAssertCustomerDefaultBillingAddressFirstnameAndLastname"/> + <see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.company}}" stepKey="seeAssertCustomerDefaultBillingAddressCompany"/> + <see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.street[0]}}" stepKey="seeAssertCustomerDefaultBillingAddressStreet"/> + <see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.street[1]}}" stepKey="seeAssertCustomerDefaultBillingAddressStreet1"/> + <see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.city}}, {{address.state}}, {{address.postcode}}" stepKey="seeAssertCustomerDefaultBillingAddressCityAndPostcode"/> + <see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.country}}" stepKey="seeAssertCustomerDefaultBillingAddressCountry"/> + <see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.telephone}}" stepKey="seeAssertCustomerDefaultBillingAddressTelephone"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/VerifyCustomerNameOnFrontendActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/VerifyCustomerNameOnFrontendActionGroup.xml new file mode 100644 index 0000000000000..49ee62e5e86d2 --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/VerifyCustomerNameOnFrontendActionGroup.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="VerifyCustomerNameOnFrontendActionGroup"> + <annotations> + <description>Goes to the Storefront Customer Dashboard page. Validates that the Customer First/Last Name is present and correct.</description> + </annotations> + <arguments> + <argument name="customer"/> + </arguments> + + <!--Verify customer name on frontend--> + <amOnPage url="customer/account/edit/" stepKey="goToAddressPage"/> + <waitForPageLoad stepKey="waitForAddressPageLoad"/> + <click selector="{{StorefrontCustomerSidebarSection.sidebarCurrentTab('Account Information')}}" stepKey="clickAccountInformationFromSidebarCurrentTab"/> + <waitForPageLoad stepKey="waitForAccountInformationTabToOpen"/> + <seeInField selector="{{StorefrontCustomerAccountInformationSection.firstName}}" userInput="{{customer.firstname}}" stepKey="seeAssertCustomerFirstName"/> + <seeInField selector="{{StorefrontCustomerAccountInformationSection.lastName}}" userInput="{{customer.lastname}}" stepKey="seeAssertCustomerLastName"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/VerifyCustomerShippingAddressActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/VerifyCustomerShippingAddressActionGroup.xml new file mode 100644 index 0000000000000..e6d07ef1afc63 --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/VerifyCustomerShippingAddressActionGroup.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="VerifyCustomerShippingAddressActionGroup"> + <annotations> + <description>Goes to the Storefront Customer Dashboard Address area. Validates that the provided Customer Shipping Address is present and correct.</description> + </annotations> + <arguments> + <argument name="address"/> + </arguments> + + <amOnPage url="customer/address/index/" stepKey="goToAddressPage"/> + <waitForPageLoad stepKey="waitForAddressPageLoad"/> + <!--Verify customer default shipping address--> + <see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.firstname}} {{address.lastname}}" stepKey="seeAssertCustomerDefaultShippingAddressFirstnameAndLastname"/> + <see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.company}}" stepKey="seeAssertCustomerDefaultShippingAddressCompany"/> + <see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.street[0]}}" stepKey="seeAssertCustomerDefaultShippingAddressStreet"/> + <see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.street[1]}}" stepKey="seeAssertCustomerDefaultShippingAddressStreet1"/> + <see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.city}}, {{address.postcode}}" stepKey="seeAssertCustomerDefaultShippingAddressCityAndPostcode"/> + <see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.country}}" stepKey="seeAssertCustomerDefaultShippingAddressCountry"/> + <see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.telephone}}" stepKey="seeAssertCustomerDefaultShippingAddressTelephone"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/VerifyCustomerShippingAddressWithStateActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/VerifyCustomerShippingAddressWithStateActionGroup.xml new file mode 100644 index 0000000000000..a90a05bead69c --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/VerifyCustomerShippingAddressWithStateActionGroup.xml @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="VerifyCustomerShippingAddressWithStateActionGroup"> + <annotations> + <description>Goes to the Storefront Customer Dashboard Address area. Validates that the provided Customer Shipping Address, including the State, is present and correct.</description> + </annotations> + <arguments> + <argument name="address"/> + </arguments> + + <amOnPage url="customer/address/index/" stepKey="goToAddressPage"/> + <waitForPageLoad stepKey="waitForAddressPageLoad"/> + + <!--Verify customer default shipping address--> + <see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.firstname}} {{address.lastname}}" stepKey="seeAssertCustomerDefaultShippingAddressFirstnameAndLastname"/> + <see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.company}}" stepKey="seeAssertCustomerDefaultShippingAddressCompany"/> + <see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.street[0]}}" stepKey="seeAssertCustomerDefaultShippingAddressStreet"/> + <see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.street[1]}}" stepKey="seeAssertCustomerDefaultShippingAddressStreet1"/> + <see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.city}}, {{address.state}}, {{address.postcode}}" stepKey="seeAssertCustomerDefaultShippingAddressCityAndPostcode"/> + <see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.country}}" stepKey="seeAssertCustomerDefaultShippingAddressCountry"/> + <see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.telephone}}" stepKey="seeAssertCustomerDefaultShippingAddressTelephone"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml new file mode 100644 index 0000000000000..5efcfc0e79b0d --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/_Deprecated_ActionGroup.xml @@ -0,0 +1,183 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<!-- +NOTICE: Action Groups in this file are DEPRECATED and SHOULD NOT BE USED anymore. + Please find the Comment with proper replacement for each of ActionGroups provided. +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminCreateCustomerWithWebSiteAndGroup" deprecated="Use `AdminCreateCustomerWithWebSiteAndGroupActionGroup` instead"> + <annotations> + <description>Goes to the Customer grid page. Click on 'Add New Customer'. Fills provided Customer Data. Fill provided Customer Address data. Assigns Product to Website and Store View. Clicks on Save.</description> + </annotations> + <arguments> + <argument name="customerData" defaultValue="Simple_US_Customer"/> + <argument name="website" type="string" defaultValue="{{_defaultWebsite.name}}"/> + <argument name="storeView" type="string" defaultValue="{{_defaultStore.name}}"/> + </arguments> + + <amOnPage url="{{AdminCustomerPage.url}}" stepKey="goToCustomersPage"/> + <click stepKey="addNewCustomer" selector="{{AdminCustomerGridMainActionsSection.addNewCustomer}}"/> + <selectOption stepKey="selectWebSite" selector="{{AdminCustomerAccountInformationSection.associateToWebsite}}" userInput="{{website}}"/> + <selectOption selector="{{AdminCustomerAccountInformationSection.group}}" userInput="{{customerData.group}}" stepKey="selectCustomerGroup"/> + <fillField stepKey="FillFirstName" selector="{{AdminCustomerAccountInformationSection.firstName}}" userInput="{{customerData.firstname}}"/> + <fillField stepKey="FillLastName" selector="{{AdminCustomerAccountInformationSection.lastName}}" userInput="{{customerData.lastname}}"/> + <fillField stepKey="FillEmail" selector="{{AdminCustomerAccountInformationSection.email}}" userInput="{{customerData.email}}"/> + <selectOption stepKey="selectStoreView" selector="{{AdminCustomerAccountInformationSection.storeView}}" userInput="{{storeView}}"/> + <waitForElement selector="{{AdminCustomerAccountInformationSection.storeView}}" stepKey="waitForCustomerStoreViewExpand"/> + <click stepKey="save" selector="{{AdminCustomerAccountInformationSection.saveCustomer}}"/> + <waitForPageLoad stepKey="waitForCustomersPage"/> + <see stepKey="seeSuccessMessage" userInput="You saved the customer."/> + </actionGroup> + + <actionGroup name="AdminEditCustomerAddressNoZipNoState" extends="AdminEditCustomerAddressesFrom" deprecated="Use `AdminEditCustomerAddressNoZipNoStateActionGroup` instead"> + <annotations> + <description>EXTENDS: AdminEditCustomerAddressesFrom. Removes 'selectState' and 'fillZipCode'. Clicks on 'Set Default' for Billing/Shipping.</description> + </annotations> + + <remove keyForRemoval="selectState"/> + <remove keyForRemoval="fillZipCode"/> + <click selector="{{AdminEditCustomerAddressesSection.defaultBillingAddressButton}}" stepKey="setDefaultBilling" before="setDefaultShipping"/> + <click selector="{{AdminEditCustomerAddressesSection.defaultShippingAddressButton}}" stepKey="setDefaultShipping" before="fillPrefixName"/> + </actionGroup> + + <actionGroup name="AdminEditCustomerAddressSetDefaultShippingAndBilling" extends="AdminEditCustomerAddressesFrom" deprecated="Use `AdminEditCustomerAddressSetDefaultShippingAndBillingActionGroup` instead"> + <annotations> + <description>EXTENDS: AdminEditCustomerAddressesFrom. Removes 'selectState' and 'fillZipCode'.</description> + </annotations> + + <click selector="{{AdminEditCustomerAddressesSection.defaultBillingAddressButton}}" stepKey="setDefaultBilling" before="setDefaultShipping"/> + <click selector="{{AdminEditCustomerAddressesSection.defaultShippingAddressButton}}" stepKey="setDefaultShipping" before="fillPrefixName"/> + </actionGroup> + + <actionGroup name="EnterCustomerAddressInfo" deprecated="Use `EnterCustomerAddressInfoActionGroup` instead"> + <annotations> + <description>Fills in the provided Customer details (First/Last Name, Company, Phone # and Address) on the Admin Customer creation/edit page. Clicks on the Save button.</description> + </annotations> + <arguments> + <argument name="Address"/> + </arguments> + + <amOnPage url="customer/address/new/" stepKey="goToAddressPage"/> + <waitForPageLoad stepKey="waitForAddressPage"/> + <fillField stepKey="fillFirstName" selector="{{StorefrontCustomerAddressSection.firstName}}" userInput="{{Address.firstname}}"/> + <fillField stepKey="fillLastName" selector="{{StorefrontCustomerAddressSection.lastName}}" userInput="{{Address.lastname}}"/> + <fillField stepKey="fillCompany" selector="{{StorefrontCustomerAddressSection.company}}" userInput="{{Address.company}}"/> + <fillField stepKey="fillPhoneNumber" selector="{{StorefrontCustomerAddressSection.phoneNumber}}" userInput="{{Address.telephone}}"/> + <fillField stepKey="fillStreetAddress1" selector="{{StorefrontCustomerAddressSection.streetAddress1}}" userInput="{{Address.street[0]}}"/> + <fillField stepKey="fillStreetAddress2" selector="{{StorefrontCustomerAddressSection.streetAddress2}}" userInput="{{Address.street[1]}}"/> + <fillField stepKey="fillCityName" selector="{{StorefrontCustomerAddressSection.city}}" userInput="{{Address.city}}"/> + <selectOption stepKey="selectCounty" selector="{{StorefrontCustomerAddressSection.country}}" userInput="{{Address.country_id}}"/> + <selectOption stepKey="selectState" selector="{{StorefrontCustomerAddressSection.stateProvince}}" userInput="{{Address.state}}"/> + <fillField stepKey="fillZip" selector="{{StorefrontCustomerAddressSection.zip}}" userInput="{{Address.postcode}}"/> + <click stepKey="saveAddress" selector="{{StorefrontCustomerAddressSection.saveAddress}}"/> + </actionGroup> + + <!-- Fills State Field instead of selecting it--> + <actionGroup name="EnterCustomerAddressInfoFillState" extends="EnterCustomerAddressInfo" deprecated="Use `CreateSystemBackupActionGroup` instead"> + <annotations> + <description>EXTENDS: EnterCustomerAddressInfo. Fills the State field.</description> + </annotations> + + <fillField stepKey="selectState" selector="{{StorefrontCustomerAddressSection.stateProvinceFill}}" userInput="{{Address.state}}"/> + </actionGroup> + + <actionGroup name="VerifyCustomerBillingAddress" deprecated="Use `VerifyCustomerBillingAddressActionGroup` instead"> + <annotations> + <description>Goes to the Storefront Customer Dashboard Address area. Validates that the provided Customer Billing Address is present and correct on the Storefront Customer Dashboard Address section.</description> + </annotations> + <arguments> + <argument name="address"/> + </arguments> + + <amOnPage url="customer/address/index/" stepKey="goToAddressPage"/> + <waitForPageLoad stepKey="waitForAddressPageLoad"/> + + <see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.firstname}} {{address.lastname}}" stepKey="seeAssertCustomerDefaultBillingAddressFirstnameAndLastname"/> + <see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.company}}" stepKey="seeAssertCustomerDefaultBillingAddressCompany"/> + <see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.street[0]}}" stepKey="seeAssertCustomerDefaultBillingAddressStreet"/> + <see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.street[1]}}" stepKey="seeAssertCustomerDefaultBillingAddressStreet1"/> + <see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.city}}, {{address.postcode}}" stepKey="seeAssertCustomerDefaultBillingAddressCityAndPostcode"/> + <see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.country}}" stepKey="seeAssertCustomerDefaultBillingAddressCountry"/> + <see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.telephone}}" stepKey="seeAssertCustomerDefaultBillingAddressTelephone"/> + </actionGroup> + + <actionGroup name="VerifyCustomerShippingAddress" deprecated="Use `VerifyCustomerShippingAddressActionGroup` instead"> + <annotations> + <description>Goes to the Storefront Customer Dashboard Address area. Validates that the provided Customer Shipping Address is present and correct.</description> + </annotations> + <arguments> + <argument name="address"/> + </arguments> + + <amOnPage url="customer/address/index/" stepKey="goToAddressPage"/> + <waitForPageLoad stepKey="waitForAddressPageLoad"/> + <see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.firstname}} {{address.lastname}}" stepKey="seeAssertCustomerDefaultShippingAddressFirstnameAndLastname"/> + <see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.company}}" stepKey="seeAssertCustomerDefaultShippingAddressCompany"/> + <see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.street[0]}}" stepKey="seeAssertCustomerDefaultShippingAddressStreet"/> + <see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.street[1]}}" stepKey="seeAssertCustomerDefaultShippingAddressStreet1"/> + <see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.city}}, {{address.postcode}}" stepKey="seeAssertCustomerDefaultShippingAddressCityAndPostcode"/> + <see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.country}}" stepKey="seeAssertCustomerDefaultShippingAddressCountry"/> + <see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.telephone}}" stepKey="seeAssertCustomerDefaultShippingAddressTelephone"/> + </actionGroup> + + <actionGroup name="VerifyCustomerBillingAddressWithState" deprecated="Use `VerifyCustomerBillingAddressWithStateActionGroup` instead"> + <annotations> + <description>Goes to the Storefront Customer Dashboard Address area. Validates that the provided Customer Billing Address, including the State, is present and correct.</description> + </annotations> + <arguments> + <argument name="address"/> + </arguments> + + <amOnPage url="customer/address/index/" stepKey="goToAddressPage"/> + <waitForPageLoad stepKey="waitForAddressPageLoad"/> + <see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.firstname}} {{address.lastname}}" stepKey="seeAssertCustomerDefaultBillingAddressFirstnameAndLastname"/> + <see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.company}}" stepKey="seeAssertCustomerDefaultBillingAddressCompany"/> + <see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.street[0]}}" stepKey="seeAssertCustomerDefaultBillingAddressStreet"/> + <see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.street[1]}}" stepKey="seeAssertCustomerDefaultBillingAddressStreet1"/> + <see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.city}}, {{address.state}}, {{address.postcode}}" stepKey="seeAssertCustomerDefaultBillingAddressCityAndPostcode"/> + <see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.country}}" stepKey="seeAssertCustomerDefaultBillingAddressCountry"/> + <see selector="{{StorefrontCustomerAddressesSection.defaultBillingAddress}}" userInput="{{address.telephone}}" stepKey="seeAssertCustomerDefaultBillingAddressTelephone"/> + </actionGroup> + + <actionGroup name="VerifyCustomerShippingAddressWithState" deprecated="Use `VerifyCustomerShippingAddressWithStateActionGroup` instead"> + <annotations> + <description>Goes to the Storefront Customer Dashboard Address area. Validates that the provided Customer Shipping Address, including the State, is present and correct.</description> + </annotations> + <arguments> + <argument name="address"/> + </arguments> + + <amOnPage url="customer/address/index/" stepKey="goToAddressPage"/> + <waitForPageLoad stepKey="waitForAddressPageLoad"/> + <see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.firstname}} {{address.lastname}}" stepKey="seeAssertCustomerDefaultShippingAddressFirstnameAndLastname"/> + <see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.company}}" stepKey="seeAssertCustomerDefaultShippingAddressCompany"/> + <see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.street[0]}}" stepKey="seeAssertCustomerDefaultShippingAddressStreet"/> + <see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.street[1]}}" stepKey="seeAssertCustomerDefaultShippingAddressStreet1"/> + <see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.city}}, {{address.state}}, {{address.postcode}}" stepKey="seeAssertCustomerDefaultShippingAddressCityAndPostcode"/> + <see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.country}}" stepKey="seeAssertCustomerDefaultShippingAddressCountry"/> + <see selector="{{StorefrontCustomerAddressesSection.defaultShippingAddress}}" userInput="{{address.telephone}}" stepKey="seeAssertCustomerDefaultShippingAddressTelephone"/> + </actionGroup> + + <actionGroup name="VerifyCustomerNameOnFrontend" deprecated="Use `VerifyCustomerNameOnFrontendActionGroup` instead"> + <annotations> + <description>Goes to the Storefront Customer Dashboard page. Validates that the Customer First/Last Name is present and correct.</description> + </annotations> + <arguments> + <argument name="customer"/> + </arguments> + + <amOnPage url="customer/account/edit/" stepKey="goToAddressPage"/> + <waitForPageLoad stepKey="waitForAddressPageLoad"/> + <click selector="{{StorefrontCustomerSidebarSection.sidebarCurrentTab('Account Information')}}" stepKey="clickAccountInformationFromSidebarCurrentTab"/> + <waitForPageLoad stepKey="waitForAccountInformationTabToOpen"/> + <seeInField selector="{{StorefrontCustomerAccountInformationSection.firstName}}" userInput="{{customer.firstname}}" stepKey="seeAssertCustomerFirstName"/> + <seeInField selector="{{StorefrontCustomerAccountInformationSection.lastName}}" userInput="{{customer.lastname}}" stepKey="seeAssertCustomerLastName"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminAddNewDefaultBillingShippingCustomerAddressTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminAddNewDefaultBillingShippingCustomerAddressTest.xml index fba7ebd2d4d5e..5600b6088cfe5 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminAddNewDefaultBillingShippingCustomerAddressTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminAddNewDefaultBillingShippingCustomerAddressTest.xml @@ -23,7 +23,7 @@ </before> <after> <deleteData createDataKey="customer" stepKey="deleteCustomer"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- - Step1. Login to admin and go to Customers > All Customers. diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminChangeCustomerGenderInCustomersGridTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminChangeCustomerGenderInCustomersGridTest.xml index 7ca9a6993f2fc..30c441796c435 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminChangeCustomerGenderInCustomersGridTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminChangeCustomerGenderInCustomersGridTest.xml @@ -30,7 +30,7 @@ <waitForPageLoad stepKey="waitForCustomersGrid"/> <actionGroup ref="AdminResetFilterInCustomerGrid" stepKey="resetFilter"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Open customers grid page, filter by created customer--> <actionGroup ref="AdminFilterCustomerByEmail" stepKey="filterCustomerGridByEmail"> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminChangeSingleCustomerGroupViaGridTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminChangeSingleCustomerGroupViaGridTest.xml index 2478334de3baf..908977da25d36 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminChangeSingleCustomerGroupViaGridTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminChangeSingleCustomerGroupViaGridTest.xml @@ -31,7 +31,7 @@ <deleteData createDataKey="createCustomerGroup" stepKey="deleteCustomerGroup"/> <actionGroup ref="NavigateToAllCustomerPage" stepKey="navigateToCustomersPage"/> <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearCustomersGridFilter"/> - <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> </after> <actionGroup ref="NavigateToAllCustomerPage" stepKey="navigateToCustomersPage"/> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCheckDefaultValueDisableAutoGroupChangeIsNoTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCheckDefaultValueDisableAutoGroupChangeIsNoTest.xml index be96765920bf5..aa23fc0670a88 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminCheckDefaultValueDisableAutoGroupChangeIsNoTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCheckDefaultValueDisableAutoGroupChangeIsNoTest.xml @@ -24,7 +24,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin1"/> </before> <after> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> </after> <actionGroup ref="AdminNavigateNewCustomerActionGroup" stepKey="navigateToNewCustomer"/> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCheckDefaultValueDisableAutoGroupChangeIsYesTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCheckDefaultValueDisableAutoGroupChangeIsYesTest.xml index 87cba0c10dbc1..d7c4fb2d68772 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminCheckDefaultValueDisableAutoGroupChangeIsYesTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCheckDefaultValueDisableAutoGroupChangeIsYesTest.xml @@ -26,7 +26,7 @@ <after> <magentoCLI command="config:set customer/create_account/viv_disable_auto_group_assign_default 0" stepKey="setConfigDefaultIsNo"/> <magentoCLI command="cache:flush" stepKey="flushCache"/> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> </after> <actionGroup ref="AdminNavigateNewCustomerActionGroup" stepKey="navigateToNewCustomer"/> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerGroupAlreadyExistsTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerGroupAlreadyExistsTest.xml index 6b1c1f29f97fc..dd065adc7f417 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerGroupAlreadyExistsTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerGroupAlreadyExistsTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Steps: 1. Log in to backend as admin user. 2. Navigate to Stores > Other Settings > Customer Groups. diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerRetailerWithoutAddressTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerRetailerWithoutAddressTest.xml index 36592ab38e91d..436d7838fc6b7 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerRetailerWithoutAddressTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerRetailerWithoutAddressTest.xml @@ -25,7 +25,7 @@ <actionGroup ref="DeleteCustomerByEmailActionGroup" stepKey="deleteCustomer"> <argument name="email" value="{{CustomerEntityOne.email}}"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Filter the customer From grid--> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerTest.xml index a11fb9d0eaa8f..2021b589790cf 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerTest.xml @@ -23,7 +23,7 @@ <magentoCLI command="indexer:reindex customer_grid" stepKey="reindexCustomerGrid"/> </before> <after> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> </after> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin1"/> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithCountryPolandTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithCountryPolandTest.xml index d2435a093046a..3482f150ebaad 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithCountryPolandTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithCountryPolandTest.xml @@ -24,7 +24,7 @@ </before> <after> <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Filter the created customer From grid--> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithCountryUSATest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithCountryUSATest.xml index a487571c43534..7d19f2fcf096b 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithCountryUSATest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithCountryUSATest.xml @@ -24,7 +24,7 @@ </before> <after> <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Filter the customer From grid--> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithCustomGroupTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithCustomGroupTest.xml index 872da149ed0b2..e16a01bc3222b 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithCustomGroupTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithCustomGroupTest.xml @@ -27,7 +27,7 @@ <argument name="email" value="{{CustomerEntityOne.email}}" /> </actionGroup> <deleteData createDataKey="customerGroup" stepKey="deleteCustomerGroup"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Open New Customer Page --> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithPrefixTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithPrefixTest.xml index 1b901a7b3e1cd..6b2655b5deaaf 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithPrefixTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithPrefixTest.xml @@ -25,7 +25,7 @@ <actionGroup ref="DeleteCustomerByEmailActionGroup" stepKey="deleteCustomer"> <argument name="email" value="{{CustomerEntityOne.email}}"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Open New Customer Page and create a customer with Prefix and Suffix--> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithoutAddressTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithoutAddressTest.xml index fe4bb3ee59e6e..7889f2be57a4c 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithoutAddressTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithoutAddressTest.xml @@ -25,7 +25,7 @@ <actionGroup ref="DeleteCustomerByEmailActionGroup" stepKey="deleteCustomer"> <argument name="email" value="{{CustomerEntityOne.email}}"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Open New Customer Page --> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateNewCustomerOnStorefrontSignupNewsletterTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateNewCustomerOnStorefrontSignupNewsletterTest.xml index 5d09f819bcbc0..3810da9d62427 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateNewCustomerOnStorefrontSignupNewsletterTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateNewCustomerOnStorefrontSignupNewsletterTest.xml @@ -26,7 +26,7 @@ <actionGroup ref="DeleteCustomerByEmailActionGroup" stepKey="deleteNewUser"> <argument name="email" value="{{CustomerEntityOne.email}}"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Create new customer on storefront and signup news letter--> @@ -51,4 +51,4 @@ <waitForPageLoad stepKey="waitForNewsletterTabToOpen"/> <seeCheckboxIsChecked selector="{{AdminEditCustomerNewsletterSection.subscribedStatus('1')}}" stepKey="seeAssertSubscribedToNewsletterCheckboxIsChecked"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateNewCustomerOnStorefrontTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateNewCustomerOnStorefrontTest.xml index fc65a271a8196..116ba3773efff 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateNewCustomerOnStorefrontTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateNewCustomerOnStorefrontTest.xml @@ -26,7 +26,7 @@ <actionGroup ref="DeleteCustomerByEmailActionGroup" stepKey="deleteNewUser"> <argument name="email" value="{{CustomerEntityOne.email}}"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Create new customer on storefront and perform the asserts--> @@ -37,4 +37,4 @@ <argument name="customer" value="CustomerEntityOne"/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateNewCustomerTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateNewCustomerTest.xml index de4ab9ffaa121..49d23c7787554 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateNewCustomerTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateNewCustomerTest.xml @@ -25,7 +25,7 @@ <actionGroup ref="DeleteCustomerByEmailActionGroup" stepKey="deleteCustomer"> <argument name="email" value="{{CustomerEntityOne.email}}"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Open New Customer Page --> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateRetailCustomerGroupTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateRetailCustomerGroupTest.xml index 6e08d98a53c56..e0c1c0012f5bc 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateRetailCustomerGroupTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateRetailCustomerGroupTest.xml @@ -27,7 +27,7 @@ <argument name="customerGroupName" value="{{CustomCustomerGroup.code}}"/> </actionGroup> <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearFilters"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Steps: 1. Log in to backend as admin user. 2. Navigate to Stores > Other Settings > Customer Groups. diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateTaxClassCustomerGroupTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateTaxClassCustomerGroupTest.xml index 4b539ec350435..d89b755492cec 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateTaxClassCustomerGroupTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateTaxClassCustomerGroupTest.xml @@ -33,7 +33,7 @@ </actionGroup> <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearFilters"/> <deleteData createDataKey="createCustomerTaxClass" stepKey="deleteCustomerTaxClass"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Steps: 1. Log in to backend as admin user. 2. Navigate to Stores > Other Settings > Customer Groups. diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCustomerSubscribeNewsletterPerWebsiteTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCustomerSubscribeNewsletterPerWebsiteTest.xml index 6c1a27c395917..06c0593ad00c4 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminCustomerSubscribeNewsletterPerWebsiteTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCustomerSubscribeNewsletterPerWebsiteTest.xml @@ -32,7 +32,7 @@ <actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteWebsite"> <argument name="websiteName" value="{{secondCustomWebsite.name}}"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <createData entity="CustomerAccountSharingDefault" stepKey="setConfigCustomerAccountDefault"/> </after> @@ -98,4 +98,4 @@ <argument name="storeView" value="SecondStoreUnique"/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCustomersAllCustomersNavigateMenuTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCustomersAllCustomersNavigateMenuTest.xml index 76e4407675e4c..d4551c0cd0af9 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminCustomersAllCustomersNavigateMenuTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCustomersAllCustomersNavigateMenuTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToAllCustomerPage"> <argument name="menuUiId" value="{{AdminMenuCustomers.dataUiId}}"/> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCustomersCustomerGroupsNavigateMenuTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCustomersCustomerGroupsNavigateMenuTest.xml index 13a4b1c714337..7c1a0722ef912 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminCustomersCustomerGroupsNavigateMenuTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCustomersCustomerGroupsNavigateMenuTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToCustomerGroupsPage"> <argument name="menuUiId" value="{{AdminMenuCustomers.dataUiId}}"/> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCustomersNowOnlineNavigateMenuTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCustomersNowOnlineNavigateMenuTest.xml index e9eb7803e01ea..828fc60f0b77f 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminCustomersNowOnlineNavigateMenuTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCustomersNowOnlineNavigateMenuTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToNowOnlinePage"> <argument name="menuUiId" value="{{AdminMenuCustomers.dataUiId}}"/> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridTest.xml index 4f501c27352bf..d4af9ab58a299 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridTest.xml @@ -25,7 +25,7 @@ </before> <after> <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- - Step1. Login to admin and go to Customers > All Customerts. diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridViaMassActionsTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridViaMassActionsTest.xml index a703c5a7c5d92..05926e7aefc92 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridViaMassActionsTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridViaMassActionsTest.xml @@ -25,7 +25,7 @@ </before> <after> <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- - Step1. Login to admin and go to Customers > All Customerts. diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerTest.xml index 7fef916fc458a..b5ade97dbb968 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerTest.xml @@ -25,7 +25,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="login"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Delete created customer --> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteDefaultBillingCustomerAddressTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteDefaultBillingCustomerAddressTest.xml index bb455677d5e94..54ea673f7249f 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteDefaultBillingCustomerAddressTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteDefaultBillingCustomerAddressTest.xml @@ -25,7 +25,7 @@ </before> <after> <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- - Step1. Login to admin and go to Customers > All Customers. diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminEditDefaultBillingShippingCustomerAddressTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminEditDefaultBillingShippingCustomerAddressTest.xml index df317c8bf7012..4f69a9bbfb695 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminEditDefaultBillingShippingCustomerAddressTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminEditDefaultBillingShippingCustomerAddressTest.xml @@ -23,7 +23,7 @@ </before> <after> <deleteData createDataKey="customer" stepKey="deleteCustomer"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- - Step1. Login to admin and go to Customers > All Customers. diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminExactMatchSearchInCustomerGridTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminExactMatchSearchInCustomerGridTest.xml index d278b6c52d330..1822f427ec389 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminExactMatchSearchInCustomerGridTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminExactMatchSearchInCustomerGridTest.xml @@ -30,7 +30,7 @@ <deleteData createDataKey="createSecondCustomer" stepKey="deleteSecondCustomer"/> <amOnPage url="{{AdminCustomerPage.url}}" stepKey="openCustomersGridPage"/> <actionGroup ref="AdminResetFilterInCustomerAddressGrid" stepKey="clearCustomerGridFilter"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Step 1: Go to Customers > All Customers--> <amOnPage url="{{AdminCustomerPage.url}}" stepKey="openCustomersGridPage"/> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminPanelIsFrozenIfStorefrontIsOpenedViaCustomerViewTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminPanelIsFrozenIfStorefrontIsOpenedViaCustomerViewTest.xml index 16125c6ddf250..0eeab8cb36c2e 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminPanelIsFrozenIfStorefrontIsOpenedViaCustomerViewTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminPanelIsFrozenIfStorefrontIsOpenedViaCustomerViewTest.xml @@ -28,7 +28,7 @@ <after> <deleteData createDataKey="createSimpleCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="navigateToNewOrderPage"> <argument name="customer" value="$simpleCustomer$"/> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminResetCustomerPasswordTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminResetCustomerPasswordTest.xml index fb67838e941b6..afe8dbef99916 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminResetCustomerPasswordTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminResetCustomerPasswordTest.xml @@ -23,7 +23,7 @@ </before> <after> <deleteData createDataKey="customer" stepKey="deleteCustomer"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <magentoCLI command="indexer:reindex" stepKey="reindex"/> <magentoCLI command="cache:flush" stepKey="flushCache"/> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminSearchCustomerAddressByKeywordTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminSearchCustomerAddressByKeywordTest.xml index 9f1c5e8cd923a..6be675140c555 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminSearchCustomerAddressByKeywordTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminSearchCustomerAddressByKeywordTest.xml @@ -25,7 +25,7 @@ </before> <after> <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- - Step1. Login to admin and go to Customers > All Customerts. @@ -44,4 +44,4 @@ <waitForPageLoad stepKey="waitForCustomerAddressesGridPageLoad"/> <seeNumberOfElements userInput="1" selector="{{AdminCustomerAddressesGridSection.rowsInGrid}}" stepKey="seeOnlyOneCustomerAddressesInGrid"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminSetCustomerDefaultBillingAddressTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminSetCustomerDefaultBillingAddressTest.xml index db8d4e1ee1eea..b0de96782f0f5 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminSetCustomerDefaultBillingAddressTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminSetCustomerDefaultBillingAddressTest.xml @@ -23,7 +23,7 @@ </before> <after> <deleteData createDataKey="customer" stepKey="deleteCustomer"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- - Step1. Login to admin and go to Customers > All Customers. diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminSetCustomerDefaultShippingAddressTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminSetCustomerDefaultShippingAddressTest.xml index 6e83218176904..dfeb868959d54 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminSetCustomerDefaultShippingAddressTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminSetCustomerDefaultShippingAddressTest.xml @@ -23,7 +23,7 @@ </before> <after> <deleteData createDataKey="customer" stepKey="deleteCustomer"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- - Step1. Login to admin and go to Customers > All Customers. diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminUpdateCustomerTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminUpdateCustomerTest.xml index f58f23dee4235..dc357976887d9 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminUpdateCustomerTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminUpdateCustomerTest.xml @@ -30,7 +30,7 @@ <amOnPage stepKey="goToCustomersGridPage" url="{{AdminCustomerPage.url}}"/> <waitForPageLoad stepKey="waitForCustomersGrid"/> <actionGroup stepKey="resetFilter" ref="AdminResetFilterInCustomerGrid"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <amOnPage url="{{AdminCustomerPage.url}}edit/id/$$customer.id$$/" stepKey="openCustomerEditPage"/> @@ -42,7 +42,7 @@ <argument name="email" value="updated$$customer.email$$"/> </actionGroup> <!--Update Customer Addresses --> - <actionGroup stepKey="editCustomerAddress" ref="AdminEditCustomerAddressSetDefaultShippingAndBilling"> + <actionGroup stepKey="editCustomerAddress" ref="AdminEditCustomerAddressSetDefaultShippingAndBillingActionGroup"> <argument name="customerAddress" value="CustomerAddressSimple"/> </actionGroup> <actionGroup stepKey="saveAndCheckSuccessMessage" ref="AdminSaveCustomerAndAssertSuccessMessage"/> @@ -115,7 +115,7 @@ <remove keyForRemoval="checkCustomerAccountInformation"/> <!--Update Customer Addresses With No Zip and No State --> - <actionGroup stepKey="editCustomerAddress" ref="AdminEditCustomerAddressNoZipNoState"> + <actionGroup stepKey="editCustomerAddress" ref="AdminEditCustomerAddressNoZipNoStateActionGroup"> <argument name="customerAddress" value="addressNoZipNoState"/> </actionGroup> @@ -170,7 +170,7 @@ <remove keyForRemoval="checkDefaultShipping"/> <!--Update Customer Addresses With Default Billing and Shipping Unchecked --> - <actionGroup stepKey="editCustomerAddress" ref="AdminEditCustomerAddressesFrom"> + <actionGroup stepKey="editCustomerAddress" ref="AdminEditCustomerAddressesFromActionGroup"> <argument name="customerAddress" value="CustomerAddressSimple"/> </actionGroup> @@ -221,7 +221,7 @@ </before> <after> <deleteData stepKey="deleteCustomer" createDataKey="customer"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <amOnPage url="{{AdminCustomerPage.url}}edit/id/$$customer.id$$/" stepKey="openCustomerEditPage"/> @@ -305,4 +305,4 @@ <argument name="text" value="{{UK_Not_Default_Address.street[0]}}"/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminVerifyCreateCustomerRequiredFieldsTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminVerifyCreateCustomerRequiredFieldsTest.xml index 7dab6eefde8ec..72661e4505322 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminVerifyCreateCustomerRequiredFieldsTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminVerifyCreateCustomerRequiredFieldsTest.xml @@ -22,7 +22,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginToAdminPanel"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Open New Customer Page --> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminVerifyCustomerAddressRequiredFieldsTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminVerifyCustomerAddressRequiredFieldsTest.xml index bfb47dc9e1911..41efec9d87b18 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminVerifyCustomerAddressRequiredFieldsTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminVerifyCustomerAddressRequiredFieldsTest.xml @@ -24,7 +24,7 @@ </before> <after> <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Open Created Customer --> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminVerifyCustomerAddressStateContainValuesOnceTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminVerifyCustomerAddressStateContainValuesOnceTest.xml index daab5fd2061fb..e9b0e1723c6ba 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminVerifyCustomerAddressStateContainValuesOnceTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminVerifyCustomerAddressStateContainValuesOnceTest.xml @@ -29,7 +29,7 @@ <argument name="customerEmail" value="Simple_US_Customer.email"/> </actionGroup> <actionGroup ref="AdminClearCustomersFiltersActionGroup" stepKey="clearFilters"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Go to Customers > All Customers.--> @@ -52,7 +52,7 @@ <seeNumberOfElements userInput="1" selector="{{AdminCustomerAddressesSection.regionId(US_Address_NY.state)}}" stepKey="seeOnlyOneRegionInSelectStateForFirstCustomer"/> <!--Go to Customers > All customers, Click Add new Customers, fill all necessary fields, Save--> - <actionGroup ref="AdminCreateCustomerWithWebSiteAndGroup" stepKey="createSimpleUSCustomerWithoutAddress"/> + <actionGroup ref="AdminCreateCustomerWithWebSiteAndGroupActionGroup" stepKey="createSimpleUSCustomerWithoutAddress"/> <!--Select new created customer, Click Edit mode--> <actionGroup ref="OpenEditCustomerFromAdminActionGroup" stepKey="openEditCustomerPageWithoutAddresses"> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AllowedCountriesRestrictionApplyOnBackendTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AllowedCountriesRestrictionApplyOnBackendTest.xml index 194c6e6164f8c..7cd69b4e17472 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AllowedCountriesRestrictionApplyOnBackendTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AllowedCountriesRestrictionApplyOnBackendTest.xml @@ -23,7 +23,7 @@ <createData entity="SimpleProduct" stepKey="createSimpleProduct"> <requiredEntity createDataKey="createCategory"/> </createData> - <actionGroup ref="LoginActionGroup" stepKey="login"/> + <actionGroup ref="AdminLoginActionGroup" stepKey="login"/> <!--Create new website,store and store view--> <comment userInput="Create new website,store and store view" stepKey="createWebsite"/> <amOnPage url="{{AdminSystemStorePage.url}}" stepKey="goToAdminSystemStorePage"/> @@ -59,7 +59,7 @@ </actionGroup> <actionGroup ref="SetWebsiteCountryOptionsToDefaultActionGroup" stepKey="setCountryOptionsToDefault"/> <createData entity="CustomerAccountSharingSystemValue" stepKey="setAccountSharingToSystemValue"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <magentoCLI command="indexer:reindex" stepKey="reindex"/> <magentoCLI command="cache:flush" stepKey="flushCache"/> </after> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/ChangeCustomerGroupTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/ChangeCustomerGroupTest.xml index 7de52875d4341..eb46a9d2b1ace 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/ChangeCustomerGroupTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/ChangeCustomerGroupTest.xml @@ -35,7 +35,7 @@ <argument name="customerGroupName" value="{{CustomerGroupChange.code}}"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminCreateCustomerGroupActionGroup" stepKey="createCustomerGroup"> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/DeleteCustomerGroupTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/DeleteCustomerGroupTest.xml index b19966e0102b6..b03478c5be684 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/DeleteCustomerGroupTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/DeleteCustomerGroupTest.xml @@ -29,7 +29,7 @@ </before> <after> <deleteData createDataKey="customer" stepKey="deleteCustomer"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Customer Group success delete message--> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/EndToEndB2CLoggedInUserTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/EndToEndB2CLoggedInUserTest.xml index bf8844b2cc7ab..501baca64318f 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/EndToEndB2CLoggedInUserTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/EndToEndB2CLoggedInUserTest.xml @@ -11,20 +11,22 @@ <test name="EndToEndB2CLoggedInUserTest"> <annotations> <features value="End to End scenarios"/> - <stories value="B2C logged in user - MAGETWO-72524"/> + <stories value="B2C logged in user - MC-25681"/> <group value="e2e"/> <title value="You should be able to pass End to End B2C Logged In User scenario"/> <description value="New user signup and browses catalog, searches for product, adds product to cart, adds product to wishlist, compares products, uses coupon code and checks out."/> <severity value="CRITICAL"/> - <testCaseId value="MAGETWO-87653"/> - <skip> - <issueId value="MC-17140"/> - </skip> + <testCaseId value="MC-25681"/> + <group value="SearchEngineMysql"/> </annotations> <before> <resetCookie userInput="PHPSESSID" stepKey="resetCookieForCart"/> </before> <after> + <actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="logoutCustomer"/> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + <actionGroup ref="DeleteCustomerFromAdminActionGroup" stepKey="deleteCustomerFromAdmin"/> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearProductsGridFilters"/> <actionGroup ref="logout" stepKey="adminLogout"/> </after> <!-- Step 0: User signs up an account --> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/SearchByEmailInCustomerGridTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/SearchByEmailInCustomerGridTest.xml index 5cce64495bbd2..0d9f17096b26e 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/SearchByEmailInCustomerGridTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/SearchByEmailInCustomerGridTest.xml @@ -28,7 +28,7 @@ <deleteData createDataKey="createSecondCustomer" stepKey="deleteSecondCustomer"/> <amOnPage url="{{AdminCustomerPage.url}}" stepKey="openCustomersGridPage"/> <actionGroup ref="AdminResetFilterInCustomerAddressGrid" stepKey="clearCustomerGridFilter"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Step 1: Go to Customers > All Customers--> <amOnPage url="{{AdminCustomerPage.url}}" stepKey="openCustomersGridPage"/> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontAddCustomerAddressTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontAddCustomerAddressTest.xml index e2c55eb3962f2..ac6612184e32c 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontAddCustomerAddressTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontAddCustomerAddressTest.xml @@ -24,7 +24,7 @@ </before> <after> <deleteData createDataKey="createCustomer" stepKey="DeleteCustomer"/> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> </after> <!--Log in to Storefront as Customer 1 --> @@ -101,7 +101,7 @@ </before> <after> <deleteData createDataKey="createCustomer" stepKey="DeleteCustomer"/> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> </after> <!--Log in to Storefront as Customer 1 --> @@ -118,4 +118,4 @@ <see userInput="{{US_Address_TX.postcode}}" selector="{{StorefrontCustomerAddressesSection.addressesList}}" stepKey="checkNewAddressesPostcodeOnDefaultShipping"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontCheckTaxAddingValidVATIdTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontCheckTaxAddingValidVATIdTest.xml index 4c35cdbdb7cbb..d154893f70588 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontCheckTaxAddingValidVATIdTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontCheckTaxAddingValidVATIdTest.xml @@ -72,7 +72,7 @@ </actionGroup> <!--Go to My account > Address book--> - <actionGroup ref="EnterCustomerAddressInfoFillState" stepKey="enterAddressInfo"> + <actionGroup ref="EnterCustomerAddressInfoFillStateActionGroup" stepKey="enterAddressInfo"> <argument name="Address" value="UK_Simple_Address"/> </actionGroup> @@ -143,7 +143,7 @@ </actionGroup> <!--Log Out--> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> </test> </tests> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontClearAllCompareProductsTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontClearAllCompareProductsTest.xml index 8651c9b4db62e..8e4f9edc085a4 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontClearAllCompareProductsTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontClearAllCompareProductsTest.xml @@ -111,7 +111,7 @@ <after> <magentoCLI stepKey="removeDownloadableDomain" command="downloadable:domains:remove static.magento.com"/> <!-- Logout --> - <actionGroup ref="logout" stepKey="logoutOfAdmin1"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutOfAdmin1"/> <!-- Delete Created Entities --> <deleteData createDataKey="createSimpleCustomer1" stepKey="deleteSimpleCustomer1"/> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontCreateCustomerTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontCreateCustomerTest.xml index 7d51f97f2463a..7899f4ac53132 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontCreateCustomerTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontCreateCustomerTest.xml @@ -20,11 +20,11 @@ <group value="create"/> </annotations> <after> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> </after> <actionGroup ref="SignUpNewUserFromStorefrontActionGroup" stepKey="SignUpNewUser"> <argument name="Customer" value="CustomerEntityOne"/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontDeleteCustomerAddressTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontDeleteCustomerAddressTest.xml index 7a96616885468..fb08a07a7c319 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontDeleteCustomerAddressTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontDeleteCustomerAddressTest.xml @@ -27,7 +27,7 @@ <fillField stepKey="fillEmail" userInput="$$createCustomer.email$$" selector="{{StorefrontCustomerSignInFormSection.emailField}}"/> <fillField stepKey="fillPassword" userInput="$$createCustomer.password$$" selector="{{StorefrontCustomerSignInFormSection.passwordField}}"/> <click stepKey="clickSignInAccountButton" selector="{{StorefrontCustomerSignInFormSection.signInAccountButton}}"/> - <actionGroup ref="EnterCustomerAddressInfo" stepKey="enterAddressInfo"> + <actionGroup ref="EnterCustomerAddressInfoActionGroup" stepKey="enterAddressInfo"> <argument name="Address" value="US_Address_NY"/> </actionGroup> <see userInput="You saved the address." stepKey="verifyAddressCreated"/> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontUpdateCustomerAddressBelgiumTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontUpdateCustomerAddressBelgiumTest.xml index d36d640c5ad17..f45935b698fb5 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontUpdateCustomerAddressBelgiumTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontUpdateCustomerAddressBelgiumTest.xml @@ -28,23 +28,23 @@ <actionGroup ref="DeleteCustomerByEmailActionGroup" stepKey="deleteNewUser"> <argument name="email" value="{{CustomerEntityOne.email}}"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Update customer address Belgium in storefront--> - <actionGroup ref="EnterCustomerAddressInfo" stepKey="enterAddress"> + <actionGroup ref="EnterCustomerAddressInfoActionGroup" stepKey="enterAddress"> <argument name="Address" value="updateCustomerBelgiumAddress"/> </actionGroup> <!--Verify customer address save success message--> <see selector="{{AdminCustomerMessagesSection.successMessage}}" userInput="You saved the address." stepKey="seeAssertCustomerAddressSuccessSaveMessage"/> <!--Verify customer default billing address--> - <actionGroup ref="VerifyCustomerBillingAddressWithState" stepKey="verifyBillingAddress"> + <actionGroup ref="VerifyCustomerBillingAddressWithStateActionGroup" stepKey="verifyBillingAddress"> <argument name="address" value="updateCustomerBelgiumAddress"/> </actionGroup> <!--Verify customer default shipping address--> - <actionGroup ref="VerifyCustomerShippingAddressWithState" stepKey="verifyShippingAddress"> + <actionGroup ref="VerifyCustomerShippingAddressWithStateActionGroup" stepKey="verifyShippingAddress"> <argument name="address" value="updateCustomerBelgiumAddress"/> </actionGroup> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontUpdateCustomerAddressChinaTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontUpdateCustomerAddressChinaTest.xml index 285de8d777b48..87390beaa50f9 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontUpdateCustomerAddressChinaTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontUpdateCustomerAddressChinaTest.xml @@ -28,23 +28,23 @@ <actionGroup ref="DeleteCustomerByEmailActionGroup" stepKey="deleteNewUser"> <argument name="email" value="{{CustomerEntityOne.email}}"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Update customer address in storefront--> - <actionGroup ref="EnterCustomerAddressInfo" stepKey="enterAddress"> + <actionGroup ref="EnterCustomerAddressInfoActionGroup" stepKey="enterAddress"> <argument name="Address" value="updateCustomerChinaAddress"/> </actionGroup> <!--Verify customer address save success message--> <see selector="{{AdminCustomerMessagesSection.successMessage}}" userInput="You saved the address." stepKey="seeAssertCustomerAddressSuccessSaveMessage"/> <!--Verify customer default billing address--> - <actionGroup ref="VerifyCustomerBillingAddressWithState" stepKey="verifyBillingAddress"> + <actionGroup ref="VerifyCustomerBillingAddressWithStateActionGroup" stepKey="verifyBillingAddress"> <argument name="address" value="updateCustomerChinaAddress"/> </actionGroup> <!--Verify customer default shipping address--> - <actionGroup ref="VerifyCustomerShippingAddressWithState" stepKey="verifyShippingAddress"> + <actionGroup ref="VerifyCustomerShippingAddressWithStateActionGroup" stepKey="verifyShippingAddress"> <argument name="address" value="updateCustomerChinaAddress"/> </actionGroup> </test> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontUpdateCustomerAddressFranceTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontUpdateCustomerAddressFranceTest.xml index dae456c96a679..2f6f4fb5e2dca 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontUpdateCustomerAddressFranceTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontUpdateCustomerAddressFranceTest.xml @@ -29,24 +29,24 @@ <actionGroup ref="DeleteCustomerByEmailActionGroup" stepKey="deleteNewUser"> <argument name="email" value="{{CustomerEntityOne.email}}"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Update customer address France in storefront--> - <actionGroup ref="EnterCustomerAddressInfo" stepKey="enterAddress"> + <actionGroup ref="EnterCustomerAddressInfoActionGroup" stepKey="enterAddress"> <argument name="Address" value="updateCustomerFranceAddress"/> </actionGroup> <!--Verify customer address save success message--> <see selector="{{AdminCustomerMessagesSection.successMessage}}" userInput="You saved the address." stepKey="seeAssertCustomerAddressSuccessSaveMessage"/> <!--Verify customer default billing address--> - <actionGroup ref="VerifyCustomerBillingAddressWithState" stepKey="verifyBillingAddress"> + <actionGroup ref="VerifyCustomerBillingAddressWithStateActionGroup" stepKey="verifyBillingAddress"> <argument name="address" value="updateCustomerFranceAddress"/> </actionGroup> <!--Verify customer default shipping address--> - <actionGroup ref="VerifyCustomerShippingAddressWithState" stepKey="verifyShippingAddress"> + <actionGroup ref="VerifyCustomerShippingAddressWithStateActionGroup" stepKey="verifyShippingAddress"> <argument name="address" value="updateCustomerFranceAddress"/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontUpdateCustomerAddressUKTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontUpdateCustomerAddressUKTest.xml index 7b6e695aa8dc4..d51bc1dcc9b18 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontUpdateCustomerAddressUKTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontUpdateCustomerAddressUKTest.xml @@ -29,29 +29,29 @@ <actionGroup ref="DeleteCustomerByEmailActionGroup" stepKey="deleteNewUser"> <argument name="email" value="{{CustomerEntityOne.email}}"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Update customer address UK in storefront--> - <actionGroup ref="EnterCustomerAddressInfo" stepKey="enterAddress"> + <actionGroup ref="EnterCustomerAddressInfoActionGroup" stepKey="enterAddress"> <argument name="Address" value="updateCustomerUKAddress"/> </actionGroup> <!--Verify customer address save success message--> <see selector="{{AdminCustomerMessagesSection.successMessage}}" userInput="You saved the address." stepKey="seeAssertCustomerAddressSuccessSaveMessage"/> <!--Verify customer default billing address--> - <actionGroup ref="VerifyCustomerBillingAddress" stepKey="verifyBillingAddress"> + <actionGroup ref="VerifyCustomerBillingAddressActionGroup" stepKey="verifyBillingAddress"> <argument name="address" value="updateCustomerUKAddress"/> </actionGroup> <!--Verify customer default shipping address--> - <actionGroup ref="VerifyCustomerShippingAddress" stepKey="verifyShippingAddress"> + <actionGroup ref="VerifyCustomerShippingAddressActionGroup" stepKey="verifyShippingAddress"> <argument name="address" value="updateCustomerUKAddress"/> </actionGroup> <!--Verify customer name on frontend--> - <actionGroup ref="VerifyCustomerNameOnFrontend" stepKey="verifyVerifyCustomerName"> + <actionGroup ref="VerifyCustomerNameOnFrontendActionGroup" stepKey="verifyVerifyCustomerName"> <argument name="customer" value="CustomerEntityOne"/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontVerifyNoXssInjectionOnUpdateCustomerInformationAddAddressTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontVerifyNoXssInjectionOnUpdateCustomerInformationAddAddressTest.xml index e11404db9a9a9..67aa050907f30 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontVerifyNoXssInjectionOnUpdateCustomerInformationAddAddressTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontVerifyNoXssInjectionOnUpdateCustomerInformationAddAddressTest.xml @@ -29,29 +29,29 @@ <actionGroup ref="DeleteCustomerByEmailActionGroup" stepKey="deleteNewUser"> <argument name="email" value="{{Colorado_US_Customer.email}}"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Update customer address in storefront--> - <actionGroup ref="EnterCustomerAddressInfo" stepKey="enterAddress"> + <actionGroup ref="EnterCustomerAddressInfoActionGroup" stepKey="enterAddress"> <argument name="Address" value="updateCustomerNoXSSInjection"/> </actionGroup> <!--Verify customer address save success message--> <see selector="{{AdminCustomerMessagesSection.successMessage}}" userInput="You saved the address." stepKey="seeAssertCustomerAddressSuccessSaveMessage"/> <!--Verify customer default billing address--> - <actionGroup ref="VerifyCustomerBillingAddressWithState" stepKey="verifyBillingAddress"> + <actionGroup ref="VerifyCustomerBillingAddressWithStateActionGroup" stepKey="verifyBillingAddress"> <argument name="address" value="updateCustomerNoXSSInjection"/> </actionGroup> <!--Verify customer default shipping address--> - <actionGroup ref="VerifyCustomerShippingAddressWithState" stepKey="verifyShippingAddress"> + <actionGroup ref="VerifyCustomerShippingAddressWithStateActionGroup" stepKey="verifyShippingAddress"> <argument name="address" value="updateCustomerNoXSSInjection"/> </actionGroup> <!--Verify customer name on frontend--> - <actionGroup ref="VerifyCustomerNameOnFrontend" stepKey="verifyVerifyCustomerName"> + <actionGroup ref="VerifyCustomerNameOnFrontendActionGroup" stepKey="verifyVerifyCustomerName"> <argument name="customer" value="Colorado_US_Customer"/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Customer/Test/Unit/Model/App/Action/ContextPluginTest.php b/app/code/Magento/Customer/Test/Unit/Model/App/Action/ContextPluginTest.php index 4b89fda7c7051..4e722a36b57da 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/App/Action/ContextPluginTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/App/Action/ContextPluginTest.php @@ -6,57 +6,56 @@ namespace Magento\Customer\Test\Unit\Model\App\Action; +use Magento\Customer\Model\App\Action\ContextPlugin; use Magento\Customer\Model\Context; +use Magento\Customer\Model\Session; +use Magento\Framework\App\Action\Action; +use Magento\Framework\App\Http\Context as HttpContext; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; /** - * Class ContextPluginTest + * Unit Tests to cover ContextPlugin for Action Context */ -class ContextPluginTest extends \PHPUnit\Framework\TestCase +class ContextPluginTest extends TestCase { + const STUB_CUSTOMER_GROUP = 'UAH'; + const STUB_CUSTOMER_NOT_LOGGED_IN = 0; /** - * @var \Magento\Customer\Model\App\Action\ContextPlugin + * @var ContextPlugin */ protected $plugin; /** - * @var \Magento\Customer\Model\Session|\PHPUnit_Framework_MockObject_MockObject + * @var Session|MockObject */ protected $customerSessionMock; /** - * @var \Magento\Framework\App\Http\Context $httpContext|\PHPUnit_Framework_MockObject_MockObject + * @var HttpContext|MockObject */ protected $httpContextMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var Action|MockObject */ protected $subjectMock; - /** - * @var \PHPUnit_Framework_MockObject_MockObject - */ - protected $requestMock; - /** * Set up */ protected function setUp() { - $this->customerSessionMock = $this->createMock(\Magento\Customer\Model\Session::class); - $this->httpContextMock = $this->createMock(\Magento\Framework\App\Http\Context::class); - $this->subjectMock = $this->createMock(\Magento\Framework\App\Action\Action::class); - $this->requestMock = $this->createMock(\Magento\Framework\App\RequestInterface::class); - $this->plugin = new \Magento\Customer\Model\App\Action\ContextPlugin( + $this->customerSessionMock = $this->createMock(Session::class); + $this->httpContextMock = $this->createMock(HttpContext::class); + $this->subjectMock = $this->createMock(Action::class); + $this->plugin = new ContextPlugin( $this->customerSessionMock, $this->httpContextMock ); } - /** - * Test aroundDispatch - */ - public function testBeforeDispatch() + public function testBeforeExecute() { $this->customerSessionMock->expects($this->once()) ->method('getCustomerGroupId') @@ -69,11 +68,11 @@ public function testBeforeDispatch() ->will( $this->returnValueMap( [ - [Context::CONTEXT_GROUP, 'UAH', $this->httpContextMock], - [Context::CONTEXT_AUTH, 0, $this->httpContextMock], + [Context::CONTEXT_GROUP, self::STUB_CUSTOMER_GROUP, $this->httpContextMock], + [Context::CONTEXT_AUTH, self::STUB_CUSTOMER_NOT_LOGGED_IN, $this->httpContextMock], ] ) ); - $this->plugin->beforeDispatch($this->subjectMock, $this->requestMock); + $this->plugin->beforeExecute($this->subjectMock); } } diff --git a/app/code/Magento/Customer/Test/Unit/Model/Plugin/CustomerNotificationTest.php b/app/code/Magento/Customer/Test/Unit/Model/Plugin/CustomerNotificationTest.php index c3c853bca1469..74a5a002c7845 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/Plugin/CustomerNotificationTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/Plugin/CustomerNotificationTest.php @@ -3,79 +3,87 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Customer\Test\Unit\Model\Plugin; -use Magento\Backend\App\AbstractAction; use Magento\Customer\Api\CustomerRepositoryInterface; use Magento\Customer\Api\Data\CustomerInterface; use Magento\Customer\Model\Customer\NotificationStorage; use Magento\Customer\Model\Plugin\CustomerNotification; use Magento\Customer\Model\Session; +use Magento\Framework\App\ActionInterface; use Magento\Framework\App\Area; +use Magento\Framework\App\HttpRequestInterface; use Magento\Framework\App\RequestInterface; use Magento\Framework\App\State; use Magento\Framework\Exception\NoSuchEntityException; +use PHPUnit\Framework\MockObject\MockObject; use Psr\Log\LoggerInterface; class CustomerNotificationTest extends \PHPUnit\Framework\TestCase { - /** @var Session|\PHPUnit_Framework_MockObject_MockObject */ + private const STUB_CUSTOMER_ID = 1; + + /** + * @var Session|MockObject + */ private $sessionMock; - /** @var NotificationStorage|\PHPUnit_Framework_MockObject_MockObject */ + /** + * @var NotificationStorage|MockObject + */ private $notificationStorageMock; - /** @var CustomerRepositoryInterface|\PHPUnit_Framework_MockObject_MockObject */ + /** + * @var CustomerRepositoryInterface|MockObject + */ private $customerRepositoryMock; - /** @var State|\PHPUnit_Framework_MockObject_MockObject */ + /** + * @var State|MockObject + */ private $appStateMock; - /** @var RequestInterface|\PHPUnit_Framework_MockObject_MockObject */ + /** + * @var RequestInterface|MockObject + */ private $requestMock; - /** @var AbstractAction|\PHPUnit_Framework_MockObject_MockObject */ - private $abstractActionMock; + /** + * @var ActionInterface|MockObject + */ + private $actionMock; - /** @var LoggerInterface */ + /** + * @var LoggerInterface|MockObject + */ private $loggerMock; - /** @var CustomerNotification */ + /** + * @var CustomerNotification + */ private $plugin; - /** @var int */ - private static $customerId = 1; - protected function setUp() { - $this->sessionMock = $this->getMockBuilder(Session::class) - ->disableOriginalConstructor() - ->setMethods(['getCustomerId', 'setCustomerData', 'setCustomerGroupId', 'regenerateId']) - ->getMock(); - $this->notificationStorageMock = $this->getMockBuilder(NotificationStorage::class) - ->disableOriginalConstructor() - ->setMethods(['isExists', 'remove']) - ->getMock(); - $this->customerRepositoryMock = $this->getMockBuilder(CustomerRepositoryInterface::class) - ->getMockForAbstractClass(); - $this->abstractActionMock = $this->getMockBuilder(AbstractAction::class) - ->disableOriginalConstructor() - ->getMockForAbstractClass(); - $this->requestMock = $this->getMockBuilder(RequestInterface::class) - ->setMethods(['isPost']) - ->getMockForAbstractClass(); - $this->appStateMock = $this->getMockBuilder(State::class) - ->disableOriginalConstructor() - ->setMethods(['getAreaCode']) + $this->sessionMock = $this->createMock(Session::class); + $this->sessionMock->method('getCustomerId')->willReturn(self::STUB_CUSTOMER_ID); + + $this->customerRepositoryMock = $this->createMock(CustomerRepositoryInterface::class); + $this->actionMock = $this->createMock(ActionInterface::class); + $this->requestMock = $this->getMockBuilder([RequestInterface::class, HttpRequestInterface::class]) ->getMock(); + $this->requestMock->method('isPost')->willReturn(true); + + $this->loggerMock = $this->createMock(LoggerInterface::class); - $this->loggerMock = $this->getMockForAbstractClass(LoggerInterface::class); + $this->appStateMock = $this->createMock(State::class); $this->appStateMock->method('getAreaCode')->willReturn(Area::AREA_FRONTEND); - $this->requestMock->method('isPost')->willReturn(true); - $this->sessionMock->method('getCustomerId')->willReturn(self::$customerId); + + $this->notificationStorageMock = $this->createMock(NotificationStorage::class); $this->notificationStorageMock->expects($this->any()) ->method('isExists') - ->with(NotificationStorage::UPDATE_CUSTOMER_SESSION, self::$customerId) + ->with(NotificationStorage::UPDATE_CUSTOMER_SESSION, self::STUB_CUSTOMER_ID) ->willReturn(true); $this->plugin = new CustomerNotification( @@ -83,41 +91,42 @@ protected function setUp() $this->notificationStorageMock, $this->appStateMock, $this->customerRepositoryMock, - $this->loggerMock + $this->loggerMock, + $this->requestMock ); } - public function testBeforeDispatch() + public function testBeforeExecute() { - $customerGroupId =1; + $customerGroupId = 1; - $customerMock = $this->getMockForAbstractClass(CustomerInterface::class); + $customerMock = $this->createMock(CustomerInterface::class); $customerMock->method('getGroupId')->willReturn($customerGroupId); - $customerMock->method('getId')->willReturn(self::$customerId); + $customerMock->method('getId')->willReturn(self::STUB_CUSTOMER_ID); $this->customerRepositoryMock->expects($this->once()) ->method('getById') - ->with(self::$customerId) + ->with(self::STUB_CUSTOMER_ID) ->willReturn($customerMock); $this->notificationStorageMock->expects($this->once()) ->method('remove') - ->with(NotificationStorage::UPDATE_CUSTOMER_SESSION, self::$customerId); + ->with(NotificationStorage::UPDATE_CUSTOMER_SESSION, self::STUB_CUSTOMER_ID); $this->sessionMock->expects($this->once())->method('setCustomerData')->with($customerMock); $this->sessionMock->expects($this->once())->method('setCustomerGroupId')->with($customerGroupId); $this->sessionMock->expects($this->once())->method('regenerateId'); - $this->plugin->beforeDispatch($this->abstractActionMock, $this->requestMock); + $this->plugin->beforeExecute($this->actionMock); } public function testBeforeDispatchWithNoCustomerFound() { $this->customerRepositoryMock->method('getById') - ->with(self::$customerId) + ->with(self::STUB_CUSTOMER_ID) ->willThrowException(new NoSuchEntityException()); $this->loggerMock->expects($this->once()) ->method('error'); - $this->plugin->beforeDispatch($this->abstractActionMock, $this->requestMock); + $this->plugin->beforeExecute($this->actionMock); } } diff --git a/app/code/Magento/Customer/Test/Unit/Model/VisitorTest.php b/app/code/Magento/Customer/Test/Unit/Model/VisitorTest.php index ec787b9d3c873..c9cd525d71c49 100644 --- a/app/code/Magento/Customer/Test/Unit/Model/VisitorTest.php +++ b/app/code/Magento/Customer/Test/Unit/Model/VisitorTest.php @@ -6,16 +6,24 @@ namespace Magento\Customer\Test\Unit\Model; +use Magento\Customer\Model\ResourceModel\Visitor as VisitorResourceModel; +use Magento\Customer\Model\Session; +use Magento\Customer\Model\Visitor as VisitorModel; +use Magento\Framework\App\Request\Http as HttpRequest; +use Magento\Framework\DataObject; +use Magento\Framework\Registry; +use Magento\Framework\Session\SessionManagerInterface; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; /** - * Class VisitorTest - * @package Magento\Customer\Model + * Unit Tests to cover Visitor Model */ -class VisitorTest extends \PHPUnit\Framework\TestCase +class VisitorTest extends TestCase { /** - * @var \Magento\Customer\Model\Visitor + * @var VisitorModel */ protected $visitor; @@ -25,31 +33,37 @@ class VisitorTest extends \PHPUnit\Framework\TestCase protected $objectManagerHelper; /** - * @var \Magento\Framework\Registry|\PHPUnit_Framework_MockObject_MockObject + * @var Registry|MockObject */ - protected $registry; + protected $registryMock; /** - * @var \Magento\Customer\Model\ResourceModel\Visitor|\PHPUnit_Framework_MockObject_MockObject + * @var VisitorResourceModel|MockObject */ - protected $resource; + protected $visitorResourceModelMock; /** - * @var \Magento\Framework\Session\SessionManagerInterface|\PHPUnit_Framework_MockObject_MockObject + * @var SessionManagerInterface|MockObject */ - protected $session; + protected $sessionMock; + + /** + * @var HttpRequest|MockObject + */ + private $httpRequestMock; protected function setUp() { - $this->registry = $this->createMock(\Magento\Framework\Registry::class); - $this->session = $this->getMockBuilder(\Magento\Customer\Model\Session::class) + $this->registryMock = $this->createMock(Registry::class); + $this->sessionMock = $this->getMockBuilder(Session::class) ->disableOriginalConstructor() ->setMethods(['getSessionId', 'getVisitorData', 'setVisitorData']) ->getMock(); + $this->httpRequestMock = $this->createMock(HttpRequest::class); $this->objectManagerHelper = new ObjectManagerHelper($this); - $this->resource = $this->getMockBuilder(\Magento\Customer\Model\ResourceModel\Visitor::class) + $this->visitorResourceModelMock = $this->getMockBuilder(VisitorResourceModel::class) ->setMethods([ 'beginTransaction', '__sleep', @@ -60,27 +74,28 @@ protected function setUp() 'commit', 'clean', ])->disableOriginalConstructor()->getMock(); - $this->resource->expects($this->any())->method('getIdFieldName')->willReturn('visitor_id'); - $this->resource->expects($this->any())->method('addCommitCallback')->willReturnSelf(); + $this->visitorResourceModelMock->expects($this->any())->method('getIdFieldName')->willReturn('visitor_id'); + $this->visitorResourceModelMock->expects($this->any())->method('addCommitCallback')->willReturnSelf(); $arguments = $this->objectManagerHelper->getConstructArguments( - \Magento\Customer\Model\Visitor::class, + VisitorModel::class, [ - 'registry' => $this->registry, - 'session' => $this->session, - 'resource' => $this->resource, + 'registry' => $this->registryMock, + 'session' => $this->sessionMock, + 'resource' => $this->visitorResourceModelMock, + 'request' => $this->httpRequestMock, ] ); - $this->visitor = $this->objectManagerHelper->getObject(\Magento\Customer\Model\Visitor::class, $arguments); + $this->visitor = $this->objectManagerHelper->getObject(VisitorModel::class, $arguments); } public function testInitByRequest() { $oldSessionId = 'asdfhasdfjhkj2198sadf8sdf897'; $newSessionId = 'bsdfhasdfjhkj2198sadf8sdf897'; - $this->session->expects($this->any())->method('getSessionId')->willReturn($newSessionId); - $this->session->expects($this->atLeastOnce())->method('getVisitorData') + $this->sessionMock->expects($this->any())->method('getSessionId')->willReturn($newSessionId); + $this->sessionMock->expects($this->atLeastOnce())->method('getVisitorData') ->willReturn(['session_id' => $oldSessionId]); $this->visitor->initByRequest(null); $this->assertEquals($newSessionId, $this->visitor->getSessionId()); @@ -88,33 +103,32 @@ public function testInitByRequest() public function testSaveByRequest() { - $this->session->expects($this->once())->method('setVisitorData')->will($this->returnSelf()); + $this->sessionMock->expects($this->once())->method('setVisitorData')->will($this->returnSelf()); $this->assertSame($this->visitor, $this->visitor->saveByRequest(null)); } public function testIsModuleIgnored() { $this->visitor = $this->objectManagerHelper->getObject( - \Magento\Customer\Model\Visitor::class, + VisitorModel::class, [ - 'registry' => $this->registry, - 'session' => $this->session, - 'resource' => $this->resource, + 'registry' => $this->registryMock, + 'session' => $this->sessionMock, + 'resource' => $this->visitorResourceModelMock, 'ignores' => ['test_route_name' => true], + 'requestSafety' => $this->httpRequestMock, ] ); - $request = new \Magento\Framework\DataObject(['route_name' => 'test_route_name']); - $action = new \Magento\Framework\DataObject(['request' => $request]); - $event = new \Magento\Framework\DataObject(['controller_action' => $action]); - $observer = new \Magento\Framework\DataObject(['event' => $event]); + $this->httpRequestMock->method('getRouteName')->willReturn('test_route_name'); + $observer = new DataObject(); $this->assertTrue($this->visitor->isModuleIgnored($observer)); } public function testBindCustomerLogin() { - $customer = new \Magento\Framework\DataObject(['id' => '1']); - $observer = new \Magento\Framework\DataObject([ - 'event' => new \Magento\Framework\DataObject(['customer' => $customer]), + $customer = new DataObject(['id' => '1']); + $observer = new DataObject([ + 'event' => new DataObject(['customer' => $customer]), ]); $this->visitor->bindCustomerLogin($observer); @@ -130,7 +144,7 @@ public function testBindCustomerLogin() public function testBindCustomerLogout() { - $observer = new \Magento\Framework\DataObject(); + $observer = new DataObject(); $this->visitor->setCustomerId('1'); $this->visitor->bindCustomerLogout($observer); @@ -143,9 +157,9 @@ public function testBindCustomerLogout() public function testBindQuoteCreate() { - $quote = new \Magento\Framework\DataObject(['id' => '1', 'is_checkout_cart' => true]); - $observer = new \Magento\Framework\DataObject([ - 'event' => new \Magento\Framework\DataObject(['quote' => $quote]), + $quote = new DataObject(['id' => '1', 'is_checkout_cart' => true]); + $observer = new DataObject([ + 'event' => new DataObject(['quote' => $quote]), ]); $this->visitor->bindQuoteCreate($observer); $this->assertTrue($this->visitor->getDoQuoteCreate()); @@ -153,9 +167,9 @@ public function testBindQuoteCreate() public function testBindQuoteDestroy() { - $quote = new \Magento\Framework\DataObject(['id' => '1']); - $observer = new \Magento\Framework\DataObject([ - 'event' => new \Magento\Framework\DataObject(['quote' => $quote]), + $quote = new DataObject(['id' => '1']); + $observer = new DataObject([ + 'event' => new DataObject(['quote' => $quote]), ]); $this->visitor->bindQuoteDestroy($observer); $this->assertTrue($this->visitor->getDoQuoteDestroy()); @@ -163,7 +177,10 @@ public function testBindQuoteDestroy() public function testClean() { - $this->resource->expects($this->once())->method('clean')->with($this->visitor)->willReturnSelf(); + $this->visitorResourceModelMock->expects($this->once()) + ->method('clean') + ->with($this->visitor) + ->willReturnSelf(); $this->visitor->clean(); } } diff --git a/app/code/Magento/Customer/etc/di.xml b/app/code/Magento/Customer/etc/di.xml index be219a81fd990..60a2da9d6dfa7 100644 --- a/app/code/Magento/Customer/etc/di.xml +++ b/app/code/Magento/Customer/etc/di.xml @@ -354,7 +354,7 @@ <type name="Magento\Directory\Model\AllowedCountries"> <plugin name="customerAllowedCountries" type="Magento\Customer\Model\Plugin\AllowedCountries"/> </type> - <type name="Magento\Framework\App\Action\AbstractAction"> + <type name="Magento\Framework\App\ActionInterface"> <plugin name="customerNotification" type="Magento\Customer\Model\Plugin\CustomerNotification"/> </type> <type name="Magento\PageCache\Observer\FlushFormKey"> diff --git a/app/code/Magento/Customer/etc/frontend/di.xml b/app/code/Magento/Customer/etc/frontend/di.xml index 3b9675178c052..a479d0d2af328 100644 --- a/app/code/Magento/Customer/etc/frontend/di.xml +++ b/app/code/Magento/Customer/etc/frontend/di.xml @@ -20,8 +20,8 @@ <plugin name="customer-session-depersonalize" type="Magento\Customer\Model\Layout\DepersonalizePlugin" sortOrder="10"/> </type> - <type name="Magento\Framework\App\Action\AbstractAction"> - <plugin name="customer-app-action-dispatchController-context-plugin" + <type name="Magento\Framework\App\ActionInterface"> + <plugin name="customer-app-action-executeController-context-plugin" type="Magento\Customer\Model\App\Action\ContextPlugin" sortOrder="10"/> </type> <preference for="Magento\Customer\CustomerData\SectionPoolInterface" diff --git a/app/code/Magento/Customer/view/adminhtml/ui_component/customer_address_form.xml b/app/code/Magento/Customer/view/adminhtml/ui_component/customer_address_form.xml index 3af0172b3fca8..517d8151b5f10 100644 --- a/app/code/Magento/Customer/view/adminhtml/ui_component/customer_address_form.xml +++ b/app/code/Magento/Customer/view/adminhtml/ui_component/customer_address_form.xml @@ -174,17 +174,7 @@ <label translate="true">Company</label> </settings> </field> - <field name="city" sortOrder="80" formElement="input"> - <settings> - <dataType>text</dataType> - <label translate="true">City</label> - <visible>true</visible> - <validation> - <rule name="required-entry" xsi:type="boolean">true</rule> - </validation> - </settings> - </field> - <field name="country_id" component="Magento_Customer/js/form/element/country" sortOrder="90" formElement="select"> + <field name="country_id" component="Magento_Customer/js/form/element/country" sortOrder="80" formElement="select"> <settings> <validation> <rule name="required-entry" xsi:type="boolean">true</rule> @@ -212,6 +202,16 @@ </select> </formElements> </field> + <field name="city" sortOrder="100" formElement="input"> + <settings> + <dataType>text</dataType> + <label translate="true">City</label> + <visible>true</visible> + <validation> + <rule name="required-entry" xsi:type="boolean">true</rule> + </validation> + </settings> + </field> <field name="postcode" component="Magento_Ui/js/form/element/post-code" sortOrder="120" formElement="input"> <settings> <dataType>text</dataType> diff --git a/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml b/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml index 1d940296f334a..e7519c7c3320b 100644 --- a/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml +++ b/app/code/Magento/Customer/view/frontend/templates/address/edit.phtml @@ -6,6 +6,7 @@ /** @var \Magento\Customer\Block\Address\Edit $block */ /** @var \Magento\Customer\ViewModel\Address $viewModel */ +/** @var \Magento\Framework\Escaper $escaper */ $viewModel = $block->getViewModel(); ?> <?php $_company = $block->getLayout()->createBlock(\Magento\Customer\Block\Widget\Company::class) ?> @@ -26,16 +27,16 @@ $viewModel = $block->getViewModel(); <?php $_streetValidationClassNotRequired = trim(str_replace('required-entry', '', $_streetValidationClass)); ?> <?php $_regionValidationClass = $viewModel->addressGetAttributeValidationClass('region'); ?> <form class="form-address-edit" - action="<?= $block->escapeUrl($block->getSaveUrl()) ?>" + action="<?= $escaper->escapeUrl($block->getSaveUrl()) ?>" method="post" id="form-validate" enctype="multipart/form-data" - data-hasrequired="<?= $block->escapeHtmlAttr(__('* Required Fields')) ?>"> + data-hasrequired="<?= $escaper->escapeHtmlAttr(__('* Required Fields')) ?>"> <fieldset class="fieldset"> - <legend class="legend"><span><?= $block->escapeHtml(__('Contact Information')) ?></span></legend><br> + <legend class="legend"><span><?= $escaper->escapeHtml(__('Contact Information')) ?></span></legend><br> <?= $block->getBlockHtml('formkey') ?> - <input type="hidden" name="success_url" value="<?= $block->escapeUrl($block->getSuccessUrl()) ?>"> - <input type="hidden" name="error_url" value="<?= $block->escapeUrl($block->getErrorUrl()) ?>"> + <input type="hidden" name="success_url" value="<?= $escaper->escapeUrl($block->getSuccessUrl()) ?>"> + <input type="hidden" name="error_url" value="<?= $escaper->escapeUrl($block->getErrorUrl()) ?>"> <?= $block->getNameBlockHtml() ?> <?php if ($_company->isEnabled()): ?> @@ -52,29 +53,29 @@ $viewModel = $block->getViewModel(); </fieldset> <fieldset class="fieldset"> - <legend class="legend"><span><?= $block->escapeHtml(__('Address')) ?></span></legend><br> + <legend class="legend"><span><?= $escaper->escapeHtml(__('Address')) ?></span></legend><br> <div class="field street required"> <label for="street_1" class="label"><span><?= /* @noEscape */ $_street ?></span></label> <div class="control"> <input type="text" name="street[]" - value="<?= $block->escapeHtmlAttr($block->getStreetLine(1)) ?>" + value="<?= $escaper->escapeHtmlAttr($block->getStreetLine(1)) ?>" title="<?= /* @noEscape */ $_street ?>" id="street_1" - class="input-text <?= $block->escapeHtmlAttr($_streetValidationClass) ?>"/> + class="input-text <?= $escaper->escapeHtmlAttr($_streetValidationClass) ?>"/> <div class="nested"> <?php for ($_i = 1, $_n = $viewModel->addressGetStreetLines(); $_i < $_n; $_i++): ?> <div class="field additional"> <label class="label" for="street_<?= /* @noEscape */ $_i + 1 ?>"> - <span><?= $block->escapeHtml(__('Street Address %1', $_i + 1)) ?></span> + <span><?= $escaper->escapeHtml(__('Street Address %1', $_i + 1)) ?></span> </label> <div class="control"> <input type="text" name="street[]" - value="<?= $block->escapeHtmlAttr($block->getStreetLine($_i + 1)) ?>" - title="<?= $block->escapeHtmlAttr(__('Street Address %1', $_i + 1)) ?>" + value="<?= $escaper->escapeHtmlAttr($block->getStreetLine($_i + 1)) ?>" + title="<?= $escaper->escapeHtmlAttr(__('Street Address %1', $_i + 1)) ?>" id="street_<?= /* @noEscape */ $_i + 1 ?>" class="input-text - <?= $block->escapeHtmlAttr($_streetValidationClassNotRequired) ?>"> + <?= $escaper->escapeHtmlAttr($_streetValidationClassNotRequired) ?>"> </div> </div> <?php endfor; ?> @@ -90,22 +91,19 @@ $viewModel = $block->getViewModel(); <div class="control"> <input type="text" name="vat_id" - value="<?= $block->escapeHtmlAttr($block->getAddress()->getVatId()) ?>" + value="<?= $escaper->escapeHtmlAttr($block->getAddress()->getVatId()) ?>" title="<?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('vat_id') ?>" - class="input-text <?= $block->escapeHtmlAttr($_vatidValidationClass) ?>" + class="input-text <?= $escaper->escapeHtmlAttr($_vatidValidationClass) ?>" id="vat_id"> </div> </div> <?php endif; ?> - <div class="field city required"> - <label class="label" for="city"><span><?= /* @noEscape */ $_city ?></span></label> + <div class="field country required"> + <label class="label" for="country"> + <span><?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('country_id') ?></span> + </label> <div class="control"> - <input type="text" - name="city" - value="<?= $block->escapeHtmlAttr($block->getAddress()->getCity()) ?>" - title="<?= $block->escapeHtmlAttr(__('City')) ?>" - class="input-text <?= $block->escapeHtmlAttr($_cityValidationClass) ?>" - id="city"> + <?= $block->getCountryHtmlSelect() ?> </div> </div> <div class="field region required"> @@ -117,18 +115,31 @@ $viewModel = $block->getViewModel(); title="<?= /* @noEscape */ $_region ?>" class="validate-select region_id" <?= /* @noEscape */ !$_displayAll ? ' disabled="disabled"' : '' ?>> - <option value=""><?= $block->escapeHtml(__($_selectRegion)) ?></option> + <option value=""><?= $escaper->escapeHtml(__($_selectRegion)) ?></option> </select> <input type="text" id="region" name="region" - value="<?= $block->escapeHtmlAttr($block->getRegion()) ?>" + value="<?= $escaper->escapeHtmlAttr($block->getRegion()) ?>" title="<?= /* @noEscape */ $_region ?>" class="input-text validate-not-number-first - <?= $block->escapeHtmlAttr($_regionValidationClass) ?>" + <?= $escaper->escapeHtmlAttr($_regionValidationClass) ?>" <?= !$_displayAll ? ' disabled="disabled"' : '' ?>/> </div> </div> + <div class="field city required"> + <label class="label" for="city"> + <span><?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('city') ?></span> + </label> + <div class="control"> + <input type="text" + name="city" + value="<?= $escaper->escapeHtmlAttr($block->getAddress()->getCity()) ?>" + title="<?= $escaper->escapeHtmlAttr(__('City')) ?>" + class="input-text <?= $escaper->escapeHtmlAttr($_cityValidationClass) ?>" + id="city"> + </div> + </div> <div class="field zip required"> <label class="label" for="zip"> <span><?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('postcode') ?></span> @@ -136,32 +147,26 @@ $viewModel = $block->getViewModel(); <div class="control"> <input type="text" name="postcode" - value="<?= $block->escapeHtmlAttr($block->getAddress()->getPostcode()) ?>" + value="<?= $escaper->escapeHtmlAttr($block->getAddress()->getPostcode()) ?>" title="<?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('postcode') ?>" id="zip" class="input-text validate-zip-international - <?= $block->escapeHtmlAttr($_postcodeValidationClass) ?>"> + <?= $escaper->escapeHtmlAttr($_postcodeValidationClass) ?>"> <div role="alert" class="message warning" style="display:none"> <span></span> </div> </div> </div> - <div class="field country required"> - <label class="label" for="country"><span><?= /* @noEscape */ $_country_id ?></span></label> - <div class="control"> - <?= $block->getCountryHtmlSelect() ?> - </div> - </div> <?php if ($block->isDefaultBilling()): ?> <div class="message info"> - <span><?= $block->escapeHtml(__("It's a default billing address.")) ?></span> + <span><?= $escaper->escapeHtml(__("It's a default billing address.")) ?></span> </div> <?php elseif ($block->canSetAsDefaultBilling()): ?> <div class="field choice set billing"> <input type="checkbox" id="primary_billing" name="default_billing" value="1" class="checkbox"> <label class="label" for="primary_billing"> - <span><?= $block->escapeHtml(__('Use as my default billing address')) ?></span> + <span><?= $escaper->escapeHtml(__('Use as my default billing address')) ?></span> </label> </div> <?php else: ?> @@ -170,13 +175,13 @@ $viewModel = $block->getViewModel(); <?php if ($block->isDefaultShipping()): ?> <div class="message info"> - <span><?= $block->escapeHtml(__("It's a default shipping address.")) ?></span> + <span><?= $escaper->escapeHtml(__("It's a default shipping address.")) ?></span> </div> <?php elseif ($block->canSetAsDefaultShipping()): ?> <div class="field choice set shipping"> <input type="checkbox" id="primary_shipping" name="default_shipping" value="1" class="checkbox"> <label class="label" for="primary_shipping"> - <span><?= $block->escapeHtml(__('Use as my default shipping address')) ?></span> + <span><?= $escaper->escapeHtml(__('Use as my default shipping address')) ?></span> </label> </div> <?php else: ?> @@ -188,13 +193,13 @@ $viewModel = $block->getViewModel(); <button type="submit" class="action save primary" data-action="save-address" - title="<?= $block->escapeHtmlAttr(__('Save Address')) ?>"> - <span><?= $block->escapeHtml(__('Save Address')) ?></span> + title="<?= $escaper->escapeHtmlAttr(__('Save Address')) ?>"> + <span><?= $escaper->escapeHtml(__('Save Address')) ?></span> </button> </div> <div class="secondary"> - <a class="action back" href="<?= $block->escapeUrl($block->getBackUrl()) ?>"> - <span><?= $block->escapeHtml(__('Go back')) ?></span> + <a class="action back" href="<?= $escaper->escapeUrl($block->getBackUrl()) ?>"> + <span><?= $escaper->escapeHtml(__('Go back')) ?></span> </a> </div> </div> @@ -203,7 +208,7 @@ $viewModel = $block->getViewModel(); { "#form-validate": { "addressValidation": { - "postCodes": <?= /* @noEscape */ $block->getPostCodeConfig()->getSerializedPostCodes(); ?> + "postCodes": <?= /* @noEscape */ $block->getPostCodeConfig()->getSerializedPostCodes() ?> } }, "#country": { diff --git a/app/code/Magento/Customer/view/frontend/templates/form/register.phtml b/app/code/Magento/Customer/view/frontend/templates/form/register.phtml index da0bb6e4cbc8b..6a267c9996908 100644 --- a/app/code/Magento/Customer/view/frontend/templates/form/register.phtml +++ b/app/code/Magento/Customer/view/frontend/templates/form/register.phtml @@ -3,78 +3,123 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundHelper +// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis + +use Magento\Customer\Helper\Address; /** @var \Magento\Customer\Block\Form\Register $block */ +/** @var \Magento\Framework\Escaper $escaper */ +$formData = $block->getFormData(); ?> +<?php $displayAll = $block->getConfig('general/region/display_all'); ?> <?= $block->getChildHtml('form_fields_before') ?> <?php /* Extensions placeholder */ ?> <?= $block->getChildHtml('customer.form.register.extra') ?> -<form class="form create account form-create-account" action="<?= $block->escapeUrl($block->getPostActionUrl()) ?>" method="post" id="form-validate" enctype="multipart/form-data" autocomplete="off"> - <?= /* @noEscape */ $block->getBlockHtml('formkey'); ?> +<form class="form create account form-create-account" + action="<?= $escaper->escapeUrl($block->getPostActionUrl()) ?>" + method="post" + id="form-validate" + enctype="multipart/form-data" + autocomplete="off"> + <?= /* @noEscape */ $block->getBlockHtml('formkey') ?> <fieldset class="fieldset create info"> - <legend class="legend"><span><?= $block->escapeHtml(__('Personal Information')) ?></span></legend><br> - <input type="hidden" name="success_url" value="<?= $block->escapeUrl($block->getSuccessUrl()) ?>"> - <input type="hidden" name="error_url" value="<?= $block->escapeUrl($block->getErrorUrl()) ?>"> - <?= $block->getLayout()->createBlock(\Magento\Customer\Block\Widget\Name::class)->setObject($block->getFormData())->setForceUseCustomerAttributes(true)->toHtml() ?> - <?php if ($block->isNewsletterEnabled()) : ?> + <legend class="legend"><span><?= $escaper->escapeHtml(__('Personal Information')) ?></span></legend><br> + <input type="hidden" name="success_url" value="<?= $escaper->escapeUrl($block->getSuccessUrl()) ?>"> + <input type="hidden" name="error_url" value="<?= $escaper->escapeUrl($block->getErrorUrl()) ?>"> + <?= $block->getLayout() + ->createBlock(\Magento\Customer\Block\Widget\Name::class) + ->setObject($formData) + ->setForceUseCustomerAttributes(true) + ->toHtml() ?> + <?php if ($block->isNewsletterEnabled()): ?> <div class="field choice newsletter"> - <input type="checkbox" name="is_subscribed" title="<?= $block->escapeHtmlAttr(__('Sign Up for Newsletter')) ?>" value="1" id="is_subscribed"<?php if ($block->getFormData()->getIsSubscribed()) : ?> checked="checked"<?php endif; ?> class="checkbox"> - <label for="is_subscribed" class="label"><span><?= $block->escapeHtml(__('Sign Up for Newsletter')) ?></span></label> + <input type="checkbox" + name="is_subscribed" + title="<?= $escaper->escapeHtmlAttr(__('Sign Up for Newsletter')) ?>" + value="1" + id="is_subscribed" + <?php if ($formData->getIsSubscribed()): ?>checked="checked"<?php endif; ?> + class="checkbox"> + <label for="is_subscribed" class="label"> + <span><?= $escaper->escapeHtml(__('Sign Up for Newsletter')) ?></span> + </label> </div> <?php /* Extensions placeholder */ ?> <?= $block->getChildHtml('customer.form.register.newsletter') ?> <?php endif ?> <?php $_dob = $block->getLayout()->createBlock(\Magento\Customer\Block\Widget\Dob::class) ?> - <?php if ($_dob->isEnabled()) : ?> - <?= $_dob->setDate($block->getFormData()->getDob())->toHtml() ?> + <?php if ($_dob->isEnabled()): ?> + <?= $_dob->setDate($formData->getDob())->toHtml() ?> <?php endif ?> <?php $_taxvat = $block->getLayout()->createBlock(\Magento\Customer\Block\Widget\Taxvat::class) ?> - <?php if ($_taxvat->isEnabled()) : ?> - <?= $_taxvat->setTaxvat($block->getFormData()->getTaxvat())->toHtml() ?> + <?php if ($_taxvat->isEnabled()): ?> + <?= $_taxvat->setTaxvat($formData->getTaxvat())->toHtml() ?> <?php endif ?> <?php $_gender = $block->getLayout()->createBlock(\Magento\Customer\Block\Widget\Gender::class) ?> - <?php if ($_gender->isEnabled()) : ?> - <?= $_gender->setGender($block->getFormData()->getGender())->toHtml() ?> + <?php if ($_gender->isEnabled()): ?> + <?= $_gender->setGender($formData->getGender())->toHtml() ?> <?php endif ?> </fieldset> - <?php if ($block->getShowAddressFields()) : ?> + <?php if ($block->getShowAddressFields()): ?> + <?php $cityValidationClass = $this->helper(Address::class)->getAttributeValidationClass('city'); ?> + <?php $postcodeValidationClass = $this->helper(Address::class)->getAttributeValidationClass('postcode'); ?> + <?php $regionValidationClass = $this->helper(Address::class)->getAttributeValidationClass('region'); ?> <fieldset class="fieldset address"> - <legend class="legend"><span><?= $block->escapeHtml(__('Address Information')) ?></span></legend><br> + <legend class="legend"><span><?= $escaper->escapeHtml(__('Address Information')) ?></span></legend><br> <input type="hidden" name="create_address" value="1" /> <?php $_company = $block->getLayout()->createBlock(\Magento\Customer\Block\Widget\Company::class) ?> - <?php if ($_company->isEnabled()) : ?> - <?= $_company->setCompany($block->getFormData()->getCompany())->toHtml() ?> + <?php if ($_company->isEnabled()): ?> + <?= $_company->setCompany($formData->getCompany())->toHtml() ?> <?php endif ?> <?php $_telephone = $block->getLayout()->createBlock(\Magento\Customer\Block\Widget\Telephone::class) ?> - <?php if ($_telephone->isEnabled()) : ?> - <?= $_telephone->setTelephone($block->getFormData()->getTelephone())->toHtml() ?> + <?php if ($_telephone->isEnabled()): ?> + <?= $_telephone->setTelephone($formData->getTelephone())->toHtml() ?> <?php endif ?> <?php $_fax = $block->getLayout()->createBlock(\Magento\Customer\Block\Widget\Fax::class) ?> - <?php if ($_fax->isEnabled()) : ?> - <?= $_fax->setFax($block->getFormData()->getFax())->toHtml() ?> + <?php if ($_fax->isEnabled()): ?> + <?= $_fax->setFax($formData->getFax())->toHtml() ?> <?php endif ?> - <?php $_streetValidationClass = $this->helper(\Magento\Customer\Helper\Address::class)->getAttributeValidationClass('street'); ?> + <?php + $_streetValidationClass = $this->helper(Address::class) + ->getAttributeValidationClass('street'); + ?> <div class="field street required"> - <label for="street_1" class="label"><span><?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('street') ?></span></label> + <label for="street_1" class="label"> + <span><?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('street') ?></span> + </label> <div class="control"> - <input type="text" name="street[]" value="<?= $block->escapeHtmlAttr($block->getFormData()->getStreet(0)) ?>" title="<?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('street') ?>" id="street_1" class="input-text <?= $block->escapeHtmlAttr($_streetValidationClass) ?>"> + <input type="text" + name="street[]" + value="<?= $escaper->escapeHtmlAttr($formData->getStreet(0)) ?>" + title="<?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('street') ?>" + id="street_1" + class="input-text <?= $escaper->escapeHtmlAttr($_streetValidationClass) ?>"> <div class="nested"> - <?php $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); ?> - <?php for ($_i = 2, $_n = $this->helper(\Magento\Customer\Helper\Address::class)->getStreetLines(); $_i <= $_n; $_i++) : ?> + <?php + $_streetValidationClass = trim(str_replace('required-entry', '', $_streetValidationClass)); + $streetLines = $this->helper(Address::class)->getStreetLines(); + ?> + <?php for ($_i = 2, $_n = $streetLines; $_i <= $_n; $_i++): ?> <div class="field additional"> <label class="label" for="street_<?= /* @noEscape */ $_i ?>"> - <span><?= $block->escapeHtml(__('Address')) ?></span> + <span><?= $escaper->escapeHtml(__('Address')) ?></span> </label> <div class="control"> - <input type="text" name="street[]" value="<?= $block->escapeHtml($block->getFormData()->getStreetLine($_i - 1)) ?>" title="<?= $block->escapeHtmlAttr(__('Street Address %1', $_i)) ?>" id="street_<?= /* @noEscape */ $_i ?>" class="input-text <?= $block->escapeHtmlAttr($_streetValidationClass) ?>"> + <input type="text" + name="street[]" + value="<?= $escaper->escapeHtml($formData->getStreetLine($_i - 1)) ?>" + title="<?= $escaper->escapeHtmlAttr(__('Street Address %1', $_i)) ?>" + id="street_<?= /* @noEscape */ $_i ?>" + class="input-text <?= $escaper->escapeHtmlAttr($_streetValidationClass) ?>"> </div> </div> <?php endfor; ?> @@ -82,38 +127,70 @@ </div> </div> - <div class="field required"> - <label for="city" class="label"><span><?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('city') ?></span></label> + <div class="field country required"> + <label for="country" class="label"> + <span><?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('country_id') ?></span> + </label> <div class="control"> - <input type="text" name="city" value="<?= $block->escapeHtmlAttr($block->getFormData()->getCity()) ?>" title="<?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('city') ?>" class="input-text <?= $block->escapeHtmlAttr($this->helper(\Magento\Customer\Helper\Address::class)->getAttributeValidationClass('city')) ?>" id="city"> + <?= $block->getCountryHtmlSelect() ?> </div> </div> <div class="field region required"> - <label for="region_id" class="label"><span><?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('region') ?></span></label> + <label for="region_id" class="label"> + <span><?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('region') ?></span> + </label> <div class="control"> - <select id="region_id" name="region_id" title="<?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('region') ?>" class="validate-select region_id" style="display:none;"> - <option value=""><?= $block->escapeHtml(__('Please select a region, state or province.')) ?></option> + <select id="region_id" + name="region_id" + title="<?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('region') ?>" + class="validate-select region_id" + style="display: none;"> + <option value=""> + <?= $escaper->escapeHtml(__('Please select a region, state or province.')) ?> + </option> </select> - <input type="text" id="region" name="region" value="<?= $block->escapeHtml($block->getRegion()) ?>" title="<?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('region') ?>" class="input-text <?= $block->escapeHtmlAttr($this->helper(\Magento\Customer\Helper\Address::class)->getAttributeValidationClass('region')) ?>" style="display:none;"> + <input type="text" + id="region" + name="region" + value="<?= $escaper->escapeHtml($block->getRegion()) ?>" + title="<?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('region') ?>" + class="input-text <?= $escaper->escapeHtmlAttr($regionValidationClass) ?>" + style="display:none;"> </div> </div> - <div class="field zip required"> - <label for="zip" class="label"><span><?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('postcode') ?></span></label> + <div class="field required"> + <label for="city" class="label"> + <span><?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('city') ?></span> + </label> <div class="control"> - <input type="text" name="postcode" value="<?= $block->escapeHtmlAttr($block->getFormData()->getPostcode()) ?>" title="<?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('postcode') ?>" id="zip" class="input-text validate-zip-international <?= $block->escapeHtmlAttr($this->helper(\Magento\Customer\Helper\Address::class)->getAttributeValidationClass('postcode')) ?>"> + <input type="text" + name="city" + value="<?= $escaper->escapeHtmlAttr($formData->getCity()) ?>" + title="<?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('city') ?>" + class="input-text <?= $escaper->escapeHtmlAttr($cityValidationClass) ?>" + id="city"> </div> </div> - <div class="field country required"> - <label for="country" class="label"><span><?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('country_id') ?></span></label> + <div class="field zip required"> + <label for="zip" class="label"> + <span><?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('postcode') ?></span> + </label> <div class="control"> - <?= $block->getCountryHtmlSelect() ?> + <input type="text" + name="postcode" + value="<?= $escaper->escapeHtmlAttr($formData->getPostcode()) ?>" + title="<?= /* @noEscape */ $block->getAttributeData()->getFrontendLabel('postcode') ?>" + id="zip" + class="input-text validate-zip-international + <?= $escaper->escapeHtmlAttr($postcodeValidationClass) ?>"> </div> </div> + <?php $addressAttributes = $block->getChildBlock('customer_form_address_user_attributes');?> - <?php if ($addressAttributes) : ?> + <?php if ($addressAttributes): ?> <?php $addressAttributes->setEntityType('customer_address'); ?> <?php $addressAttributes->setFieldIdFormat('address:%1$s')->setFieldNameFormat('address[%1$s]');?> <?php $block->restoreSessionData($addressAttributes->getMetadataForm(), 'address');?> @@ -124,29 +201,40 @@ </fieldset> <?php endif; ?> - <fieldset class="fieldset create account" data-hasrequired="<?= $block->escapeHtmlAttr(__('* Required Fields')) ?>"> - <legend class="legend"><span><?= $block->escapeHtml(__('Sign-in Information')) ?></span></legend><br> + <fieldset class="fieldset create account" + data-hasrequired="<?= $escaper->escapeHtmlAttr(__('* Required Fields')) ?>"> + <legend class="legend"><span><?= $escaper->escapeHtml(__('Sign-in Information')) ?></span></legend><br> <div class="field required"> - <label for="email_address" class="label"><span><?= $block->escapeHtml(__('Email')) ?></span></label> + <label for="email_address" class="label"><span><?= $escaper->escapeHtml(__('Email')) ?></span></label> <div class="control"> - <input type="email" name="email" autocomplete="email" id="email_address" value="<?= $block->escapeHtmlAttr($block->getFormData()->getEmail()) ?>" title="<?= $block->escapeHtmlAttr(__('Email')) ?>" class="input-text" data-mage-init='{"mage/trim-input":{}}' data-validate="{required:true, 'validate-email':true}"> + <input type="email" + name="email" + autocomplete="email" + id="email_address" + value="<?= $escaper->escapeHtmlAttr($formData->getEmail()) ?>" + title="<?= $escaper->escapeHtmlAttr(__('Email')) ?>" + class="input-text" + data-mage-init='{"mage/trim-input":{}}' + data-validate="{required:true, 'validate-email':true}"> </div> </div> <div class="field password required"> - <label for="password" class="label"><span><?= $block->escapeHtml(__('Password')) ?></span></label> + <label for="password" class="label"><span><?= $escaper->escapeHtml(__('Password')) ?></span></label> <div class="control"> <input type="password" name="password" id="password" - title="<?= $block->escapeHtmlAttr(__('Password')) ?>" + title="<?= $escaper->escapeHtmlAttr(__('Password')) ?>" class="input-text" - data-password-min-length="<?= $block->escapeHtmlAttr($block->getMinimumPasswordLength()) ?>" - data-password-min-character-sets="<?= $block->escapeHtmlAttr($block->getRequiredCharacterClassesNumber()) ?>" + data-password-min-length="<?= + $escaper->escapeHtmlAttr($block->getMinimumPasswordLength()) ?>" + data-password-min-character-sets="<?= + $escaper->escapeHtmlAttr($block->getRequiredCharacterClassesNumber()) ?>" data-validate="{required:true, 'validate-customer-password':true}" autocomplete="off"> <div id="password-strength-meter-container" data-role="password-strength-meter" aria-live="polite"> <div id="password-strength-meter" class="password-strength-meter"> - <?= $block->escapeHtml(__('Password Strength')) ?>: + <?= $escaper->escapeHtml(__('Password Strength')) ?>: <span id="password-strength-meter-label" data-role="password-strength-meter-label"> - <?= $block->escapeHtml(__('No Password')) ?> + <?= $escaper->escapeHtml(__('No Password')) ?> </span> </div> </div> @@ -154,19 +242,34 @@ </div> <div class="field confirmation required"> - <label for="password-confirmation" class="label"><span><?= $block->escapeHtml(__('Confirm Password')) ?></span></label> + <label for="password-confirmation" class="label"> + <span><?= $escaper->escapeHtml(__('Confirm Password')) ?></span> + </label> <div class="control"> - <input type="password" name="password_confirmation" title="<?= $block->escapeHtmlAttr(__('Confirm Password')) ?>" id="password-confirmation" class="input-text" data-validate="{required:true, equalTo:'#password'}" autocomplete="off"> + <input type="password" + name="password_confirmation" + title="<?= $escaper->escapeHtmlAttr(__('Confirm Password')) ?>" + id="password-confirmation" + class="input-text" + data-validate="{required:true, equalTo:'#password'}" + autocomplete="off"> </div> </div> <?= $block->getChildHtml('form_additional_info') ?> </fieldset> <div class="actions-toolbar"> <div class="primary"> - <button type="submit" class="action submit primary" title="<?= $block->escapeHtmlAttr(__('Create an Account')) ?>"><span><?= $block->escapeHtml(__('Create an Account')) ?></span></button> + <button type="submit" + class="action submit primary" + title="<?= $escaper->escapeHtmlAttr(__('Create an Account')) ?>"> + <span><?= $escaper->escapeHtml(__('Create an Account')) ?></span> + </button> </div> <div class="secondary"> - <a class="action back" href="<?= $block->escapeUrl($block->getBackUrl()) ?>"><span><?= $block->escapeHtml(__('Back')) ?></span></a> + <a class="action back" + href="<?= $escaper->escapeUrl($block->getBackUrl()) ?>"> + <span><?= $escaper->escapeHtml(__('Back')) ?></span> + </a> </div> </div> </form> @@ -180,7 +283,7 @@ require([ var ignore = <?= /* @noEscape */ $_dob->isEnabled() ? '\'input[id$="full"]\'' : 'null' ?>; dataForm.mage('validation', { - <?php if ($_dob->isEnabled()) : ?> + <?php if ($_dob->isEnabled()): ?> errorPlacement: function(error, element) { if (element.prop('id').search('full') !== -1) { var dobElement = $(element).parents('.customer-dob'), @@ -194,26 +297,28 @@ require([ } }, ignore: ':hidden:not(' + ignore + ')' - <?php else : ?> + <?php else: ?> ignore: ignore ? ':hidden:not(' + ignore + ')' : ':hidden' <?php endif ?> }).find('input:text').attr('autocomplete', 'off'); }); </script> -<?php if ($block->getShowAddressFields()) : ?> +<?php if ($block->getShowAddressFields()): ?> <script type="text/x-magento-init"> { "#country": { "regionUpdater": { - "optionalRegionAllowed": <?= /* @noEscape */ $block->getConfig('general/region/display_all') ? 'true' : 'false' ?>, + "optionalRegionAllowed": <?= /* @noEscape */ $displayAll ? 'true' : 'false' ?>, "regionListId": "#region_id", "regionInputId": "#region", "postcodeId": "#zip", "form": "#form-validate", - "regionJson": <?= /* @noEscape */ $this->helper(\Magento\Directory\Helper\Data::class)->getRegionJson() ?>, - "defaultRegion": "<?= (int) $block->getFormData()->getRegionId() ?>", - "countriesWithOptionalZip": <?= /* @noEscape */ $this->helper(\Magento\Directory\Helper\Data::class)->getCountriesWithOptionalZip(true) ?> + "regionJson": <?= /* @noEscape */ $this->helper(\Magento\Directory\Helper\Data::class) + ->getRegionJson() ?>, + "defaultRegion": "<?= (int) $formData->getRegionId() ?>", + "countriesWithOptionalZip": <?= /* @noEscape */ $this->helper(\Magento\Directory\Helper\Data::class) + ->getCountriesWithOptionalZip(true) ?> } } } diff --git a/app/code/Magento/CustomerImportExport/Model/Import/CustomerComposite.php b/app/code/Magento/CustomerImportExport/Model/Import/CustomerComposite.php index 0f4c5f82bfe1d..4a22dc83a1f31 100644 --- a/app/code/Magento/CustomerImportExport/Model/Import/CustomerComposite.php +++ b/app/code/Magento/CustomerImportExport/Model/Import/CustomerComposite.php @@ -6,6 +6,7 @@ namespace Magento\CustomerImportExport\Model\Import; use Magento\ImportExport\Model\Import\ErrorProcessing\ProcessingErrorAggregatorInterface; +use Magento\Customer\Model\Indexer\Processor; /** * Import entity customer combined model @@ -148,6 +149,11 @@ class CustomerComposite extends \Magento\ImportExport\Model\Import\AbstractEntit */ protected $masterAttributeCode = 'email'; + /** + * @var Processor + */ + private $indexerProcessor; + /** * @param \Magento\Framework\Stdlib\StringUtils $string * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig @@ -158,6 +164,7 @@ class CustomerComposite extends \Magento\ImportExport\Model\Import\AbstractEntit * @param \Magento\CustomerImportExport\Model\ResourceModel\Import\CustomerComposite\DataFactory $dataFactory * @param \Magento\CustomerImportExport\Model\Import\CustomerFactory $customerFactory * @param \Magento\CustomerImportExport\Model\Import\AddressFactory $addressFactory + * @param Processor $indexerProcessor * @param array $data * @throws \Magento\Framework\Exception\LocalizedException * @@ -173,6 +180,7 @@ public function __construct( \Magento\CustomerImportExport\Model\ResourceModel\Import\CustomerComposite\DataFactory $dataFactory, \Magento\CustomerImportExport\Model\Import\CustomerFactory $customerFactory, \Magento\CustomerImportExport\Model\Import\AddressFactory $addressFactory, + Processor $indexerProcessor, array $data = [] ) { parent::__construct($string, $scopeConfig, $importFactory, $resourceHelper, $resource, $errorAggregator, $data); @@ -230,6 +238,7 @@ public function __construct( } else { $this->_nextCustomerId = $resourceHelper->getNextAutoincrement($this->_customerEntity->getEntityTable()); } + $this->indexerProcessor = $indexerProcessor; } /** @@ -273,11 +282,12 @@ protected function _importData() $this->countItemsCreated += $this->_customerEntity->getCreatedItemsCount(); $this->countItemsUpdated += $this->_customerEntity->getUpdatedItemsCount(); $this->countItemsDeleted += $this->_customerEntity->getDeletedItemsCount(); - if ($this->getBehavior() != \Magento\ImportExport\Model\Import::BEHAVIOR_DELETE) { - return $result && $this->_addressEntity->setCustomerAttributes($this->_customerAttributes)->importData(); + $result = $result && $this->_addressEntity->setCustomerAttributes($this->_customerAttributes)->importData(); + } + if ($result) { + $this->indexerProcessor->markIndexerAsInvalid(); } - return $result; } diff --git a/app/code/Magento/CustomerImportExport/Test/Unit/Model/Import/CustomerCompositeTest.php b/app/code/Magento/CustomerImportExport/Test/Unit/Model/Import/CustomerCompositeTest.php index 1b900c2139588..7aff0f911c2b0 100644 --- a/app/code/Magento/CustomerImportExport/Test/Unit/Model/Import/CustomerCompositeTest.php +++ b/app/code/Magento/CustomerImportExport/Test/Unit/Model/Import/CustomerCompositeTest.php @@ -15,7 +15,7 @@ use Magento\ImportExport\Model\Import\Source\Csv; /** - * Customer composite test + * The test for Customer composite model * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ @@ -88,6 +88,12 @@ class CustomerCompositeTest extends \PHPUnit\Framework\TestCase */ protected $errorFactory; + /** + * @var \Magento\Customer\Model\Indexer\Processor + * |\PHPUnit\Framework\MockObject\MockObject + */ + private $indexerProcessor; + /** * Expected prepared data after method CustomerComposite::_prepareRowForDb * @@ -141,6 +147,7 @@ protected function setUp() ->getMock(); $this->_scopeConfigMock = $this->createMock(\Magento\Framework\App\Config\ScopeConfigInterface::class); + $this->indexerProcessor = $this->createMock(\Magento\Customer\Model\Indexer\Processor::class); } /** @@ -159,6 +166,7 @@ protected function _createModelMock($data) $this->_dataFactory, $this->_customerFactory, $this->_addressFactory, + $this->indexerProcessor, $data ); } diff --git a/app/code/Magento/Directory/Test/Mftf/Test/AdminScheduledImportSettingsHiddenTest.xml b/app/code/Magento/Directory/Test/Mftf/Test/AdminScheduledImportSettingsHiddenTest.xml index 853872dd907bd..51fd2facab3b0 100644 --- a/app/code/Magento/Directory/Test/Mftf/Test/AdminScheduledImportSettingsHiddenTest.xml +++ b/app/code/Magento/Directory/Test/Mftf/Test/AdminScheduledImportSettingsHiddenTest.xml @@ -12,7 +12,7 @@ <features value="Directory"/> <title value="Scheduled import settings hidden"/> <stories value="Fields visibility according to 'Enable' value"/> - <description value="Scheduled Import Settings' should hide fields when 'Enabled' is 'No'"/> + <description value="Scheduled Import Settings should hide fields when 'Enabled' is 'No'"/> <severity value="MINOR"/> </annotations> <before> @@ -21,7 +21,7 @@ </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <magentoCLI command="config:set currency/import/enabled 0" stepKey="disableCurrencyImport"/> </after> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateAndEditDownloadableProductSettingsTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateAndEditDownloadableProductSettingsTest.xml index ebd36dddc0b6c..a09f205b8c4d0 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateAndEditDownloadableProductSettingsTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateAndEditDownloadableProductSettingsTest.xml @@ -29,7 +29,7 @@ </actionGroup> <!-- Log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Create new downloadable product --> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductAndAssignItToCustomStoreTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductAndAssignItToCustomStoreTest.xml index e0a38e7db7552..9a1f1273a41fd 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductAndAssignItToCustomStoreTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductAndAssignItToCustomStoreTest.xml @@ -41,7 +41,7 @@ <actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteCreatedStoreView"/> <!-- Log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Create store view --> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithCustomOptionsTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithCustomOptionsTest.xml index 3651b322628c4..8e08ae813faed 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithCustomOptionsTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithCustomOptionsTest.xml @@ -38,7 +38,7 @@ </actionGroup> <!-- Log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Create Downloadable product --> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithDefaultSetLinksTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithDefaultSetLinksTest.xml index 18dedca393178..865f392f7c841 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithDefaultSetLinksTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithDefaultSetLinksTest.xml @@ -40,7 +40,7 @@ </actionGroup> <!-- Log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Create downloadable product --> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithGroupPriceTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithGroupPriceTest.xml index 64920432f2e01..7fcb70b169ab7 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithGroupPriceTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithGroupPriceTest.xml @@ -38,7 +38,7 @@ </actionGroup> <!-- Log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Create downloadable product --> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithLinkTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithLinkTest.xml index 3b315d030cc8c..94753a1e5e2b3 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithLinkTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithLinkTest.xml @@ -38,7 +38,7 @@ </actionGroup> <!-- Log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Create downloadable product --> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithManageStockTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithManageStockTest.xml index 5ab683034bad8..e9a6efc49b635 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithManageStockTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithManageStockTest.xml @@ -38,7 +38,7 @@ </actionGroup> <!-- Log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Create downloadable product --> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithOutOfStockStatusTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithOutOfStockStatusTest.xml index 3348603563ff1..16d88c16073cb 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithOutOfStockStatusTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithOutOfStockStatusTest.xml @@ -38,7 +38,7 @@ </actionGroup> <!-- Log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Create Downloadable product --> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithSpecialPriceTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithSpecialPriceTest.xml index 0ac14680cff46..307eb43273dbd 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithSpecialPriceTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithSpecialPriceTest.xml @@ -38,7 +38,7 @@ </actionGroup> <!-- Log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Create downloadable product --> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithoutFillingQuantityAndStockTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithoutFillingQuantityAndStockTest.xml index c80c42bc53ed9..092129dc1ba1e 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithoutFillingQuantityAndStockTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithoutFillingQuantityAndStockTest.xml @@ -38,7 +38,7 @@ </actionGroup> <!-- Log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Create downloadable product --> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithoutTaxClassIdTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithoutTaxClassIdTest.xml index 27a27f22c87ff..63796a197e586 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithoutTaxClassIdTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminCreateDownloadableProductWithoutTaxClassIdTest.xml @@ -38,7 +38,7 @@ </actionGroup> <!-- Log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Create downloadable product --> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminDeleteDownloadableProductTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminDeleteDownloadableProductTest.xml index 0d93bac16569f..3d01168613ecc 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminDeleteDownloadableProductTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminDeleteDownloadableProductTest.xml @@ -34,7 +34,7 @@ <after> <magentoCLI stepKey="removeDownloadableDomain" command="downloadable:domains:remove example.com static.magento.com"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteDownloadableProductFilteredBySkuAndName"> <argument name="product" value="$$createDownloadableProduct$$"/> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminProductTypeSwitchingOnEditingTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminProductTypeSwitchingOnEditingTest.xml index 4a13a3f60e385..f2b6dc9e8a809 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/AdminProductTypeSwitchingOnEditingTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/AdminProductTypeSwitchingOnEditingTest.xml @@ -50,7 +50,7 @@ <!--Delete product--> <comment userInput="Delete product" stepKey="commentDeleteProduct"/> <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Change product type to Downloadable--> <comment userInput="Change product type to Downloadable" stepKey="commentCreateDownloadable"/> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/EditDownloadableProductWithSeparateLinksFromCartTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/EditDownloadableProductWithSeparateLinksFromCartTest.xml index 6535bf11d43c4..3d9229a4b0854 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/EditDownloadableProductWithSeparateLinksFromCartTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/EditDownloadableProductWithSeparateLinksFromCartTest.xml @@ -76,7 +76,7 @@ </actionGroup> <!-- Log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Step 1: Navigate to store front Product page as guest --> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/ManualSelectAllDownloadableLinksDownloadableProductTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/ManualSelectAllDownloadableLinksDownloadableProductTest.xml index 3ab64be9ad2ca..7eea3926f450c 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/ManualSelectAllDownloadableLinksDownloadableProductTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/ManualSelectAllDownloadableLinksDownloadableProductTest.xml @@ -76,7 +76,7 @@ </actionGroup> <!-- Log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Step 1: Navigate to store front Product page as guest --> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/SelectAllDownloadableLinksDownloadableProductTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/SelectAllDownloadableLinksDownloadableProductTest.xml index 3f77eff56193d..2ce0272852711 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/SelectAllDownloadableLinksDownloadableProductTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/SelectAllDownloadableLinksDownloadableProductTest.xml @@ -76,7 +76,7 @@ </actionGroup> <!-- Log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Step 1: Navigate to store front Product page as guest --> diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/VerifyDisableDownloadableProductSamplesAreNotAccessibleTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/VerifyDisableDownloadableProductSamplesAreNotAccessibleTest.xml index b0f7edaeaa3a9..b641a2541ff98 100644 --- a/app/code/Magento/Downloadable/Test/Mftf/Test/VerifyDisableDownloadableProductSamplesAreNotAccessibleTest.xml +++ b/app/code/Magento/Downloadable/Test/Mftf/Test/VerifyDisableDownloadableProductSamplesAreNotAccessibleTest.xml @@ -53,7 +53,7 @@ <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <!-- Admin logout --> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> </after> <!-- Open Downloadable product from precondition on Storefront --> diff --git a/app/code/Magento/Eav/Model/Config.php b/app/code/Magento/Eav/Model/Config.php index 765403567b6d9..718ef1a748590 100644 --- a/app/code/Magento/Eav/Model/Config.php +++ b/app/code/Magento/Eav/Model/Config.php @@ -157,12 +157,12 @@ class Config /** * @param \Magento\Framework\App\CacheInterface $cache - * @param \Magento\Eav\Model\Entity\TypeFactory $entityTypeFactory - * @param \Magento\Eav\Model\ResourceModel\Entity\Type\CollectionFactory $entityTypeCollectionFactory + * @param Entity\TypeFactory $entityTypeFactory + * @param ResourceModel\Entity\Type\CollectionFactory $entityTypeCollectionFactory * @param \Magento\Framework\App\Cache\StateInterface $cacheState * @param \Magento\Framework\Validator\UniversalFactory $universalFactory - * @param SerializerInterface $serializer - * @param ScopeConfigInterface $scopeConfig + * @param SerializerInterface|null $serializer + * @param ScopeConfigInterface|null $scopeConfig * @param array $attributesForPreload * @codeCoverageIgnore */ @@ -374,7 +374,9 @@ protected function _initEntityTypes() } \Magento\Framework\Profiler::start('EAV: ' . __METHOD__, ['group' => 'EAV', 'method' => __METHOD__]); - if ($this->isCacheEnabled() && ($cache = $this->_cache->load(self::ENTITIES_CACHE_ID))) { + if ($this->isCacheEnabled() && + ($cache = $this->_cache->load(self::ENTITIES_CACHE_ID)) + ) { $this->_entityTypeData = $this->serializer->unserialize($cache); foreach ($this->_entityTypeData as $typeCode => $data) { $typeId = $data['entity_type_id']; diff --git a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Datetime.php b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Datetime.php index ba6f6c6ea2aaa..6099d329571e8 100644 --- a/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Datetime.php +++ b/app/code/Magento/Eav/Model/Entity/Attribute/Backend/Datetime.php @@ -7,6 +7,8 @@ namespace Magento\Eav\Model\Entity\Attribute\Backend; /** + * Prepare date for save in DB + * * @api * @since 100.0.2 */ @@ -61,8 +63,8 @@ public function beforeSave($object) /** * Prepare date for save in DB * - * string format used from input fields (all date input fields need apply locale settings) - * int value can be declared in code (this meen whot we use valid date) + * String format is used in input fields (all date input fields need apply locale settings) + * int (Unix) format can be used in other parts of the code * * @param string|int|\DateTimeInterface $date * @return string @@ -72,7 +74,7 @@ public function formatDate($date) if (empty($date)) { return null; } - // unix timestamp given - simply instantiate date object + // Unix timestamp given - simply instantiate date object if (is_scalar($date) && preg_match('/^[0-9]+$/', $date)) { $date = (new \DateTime())->setTimestamp($date); } elseif (!($date instanceof \DateTimeInterface)) { diff --git a/app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute/Set.php b/app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute/Set.php index 4e1762730a8d9..64c76cdbf2627 100644 --- a/app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute/Set.php +++ b/app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute/Set.php @@ -6,6 +6,9 @@ namespace Magento\Eav\Model\ResourceModel\Entity\Attribute; +/** + * Basic implementation for attribute sets + */ class Set extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb { /** @@ -24,8 +27,6 @@ class Set extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb protected $eavConfig; /** - * Constructor - * * @param \Magento\Framework\Model\ResourceModel\Db\Context $context * @param GroupFactory $attrGroupFactory * @param \Magento\Eav\Model\Config $eavConfig @@ -54,7 +55,7 @@ protected function _construct() } /** - * Perform actions after object save + * Perform actions after object save. * * @param \Magento\Framework\Model\AbstractModel $object * @return $this diff --git a/app/code/Magento/Eav/etc/di.xml b/app/code/Magento/Eav/etc/di.xml index a09dc28399858..21f248f1b1094 100644 --- a/app/code/Magento/Eav/etc/di.xml +++ b/app/code/Magento/Eav/etc/di.xml @@ -209,4 +209,14 @@ </argument> </arguments> </type> + <virtualType name="configured_eav_cache" type="Magento\Framework\App\Cache"> + <arguments> + <argument name="cacheIdentifier" xsi:type="string">eav</argument> + </arguments> + </virtualType> + <type name="Magento\Eav\Model\Config"> + <arguments> + <argument name="cache" xsi:type="object">configured_eav_cache</argument> + </arguments> + </type> </config> diff --git a/app/code/Magento/Elasticsearch/Test/Mftf/Test/ProductQuickSearchUsingElasticSearchTest.xml b/app/code/Magento/Elasticsearch/Test/Mftf/Test/ProductQuickSearchUsingElasticSearchTest.xml index fb28e6dd4d9df..9fcc1909ab42c 100644 --- a/app/code/Magento/Elasticsearch/Test/Mftf/Test/ProductQuickSearchUsingElasticSearchTest.xml +++ b/app/code/Magento/Elasticsearch/Test/Mftf/Test/ProductQuickSearchUsingElasticSearchTest.xml @@ -32,7 +32,7 @@ <actionGroup ref="UpdateIndexerOnSaveActionGroup" stepKey="resetIndexerBackToOriginalState"> <argument name="indexerName" value="catalogsearch_fulltext"/> </actionGroup> - <actionGroup ref="logout" stepKey="logoutOfAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutOfAdmin"/> </after> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> @@ -42,7 +42,7 @@ <actionGroup ref="UpdateIndexerByScheduleActionGroup" stepKey="updateAnIndexerBySchedule"> <argument name="indexerName" value="catalogsearch_fulltext"/> </actionGroup> - <actionGroup ref="logout" stepKey="logoutOfAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutOfAdmin"/> <!--Navigate to storefront and do a quick search for the product --> <comment userInput="Navigate to Storefront to check if quick search works" stepKey="commentCheckQuickSearch" /> <amOnPage url="{{StorefrontHomePage.url}}" stepKey="goToHomePage"/> diff --git a/app/code/Magento/Elasticsearch/Test/Mftf/Test/StorefrontCheckAdvancedSearchOnElasticSearchTest.xml b/app/code/Magento/Elasticsearch/Test/Mftf/Test/StorefrontCheckAdvancedSearchOnElasticSearchTest.xml index 2d803dd4968d1..7380ec085e0f3 100644 --- a/app/code/Magento/Elasticsearch/Test/Mftf/Test/StorefrontCheckAdvancedSearchOnElasticSearchTest.xml +++ b/app/code/Magento/Elasticsearch/Test/Mftf/Test/StorefrontCheckAdvancedSearchOnElasticSearchTest.xml @@ -53,7 +53,7 @@ <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> - <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> </after> <!-- Navigate to Frontend --> diff --git a/app/code/Magento/Elasticsearch6/Test/Mftf/Test/StorefrontElasticSearchForChineseLocaleTest.xml b/app/code/Magento/Elasticsearch6/Test/Mftf/Test/StorefrontElasticSearchForChineseLocaleTest.xml index fd18a0f4e1e5e..71e0401a1c30a 100644 --- a/app/code/Magento/Elasticsearch6/Test/Mftf/Test/StorefrontElasticSearchForChineseLocaleTest.xml +++ b/app/code/Magento/Elasticsearch6/Test/Mftf/Test/StorefrontElasticSearchForChineseLocaleTest.xml @@ -38,7 +38,7 @@ <magentoCLI command="config:set {{SetDefaultSearchEngineConfig.path}} {{SetDefaultSearchEngineConfig.value}}" stepKey="resetSearchEnginePreviousState"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createProduct" stepKey="deleteSimpleProduct"/> - <actionGroup ref="logout" stepKey="logoutOfAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutOfAdmin"/> </after> <!-- Search for product by name --> <actionGroup ref="StorefrontCheckQuickSearchStringActionGroup" stepKey="quickSearchByProductName"> diff --git a/app/code/Magento/Elasticsearch6/Test/Mftf/Test/StorefrontElasticsearch6SearchInvalidValueTest.xml b/app/code/Magento/Elasticsearch6/Test/Mftf/Test/StorefrontElasticsearch6SearchInvalidValueTest.xml index 050ce1263d10d..622b78fce01b9 100644 --- a/app/code/Magento/Elasticsearch6/Test/Mftf/Test/StorefrontElasticsearch6SearchInvalidValueTest.xml +++ b/app/code/Magento/Elasticsearch6/Test/Mftf/Test/StorefrontElasticsearch6SearchInvalidValueTest.xml @@ -50,7 +50,7 @@ <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetFiltersIfExist"/> <magentoCLI command="indexer:reindex catalogsearch_fulltext" stepKey="reindex"/> <magentoCLI command="cache:flush config" stepKey="flushCache"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Create new searchable product attribute--> <amOnPage url="{{AdminProductAttributeGridPage.url}}" stepKey="goToProductAttributes"/> diff --git a/app/code/Magento/Email/Test/Mftf/ActionGroup/AdminUploadTransactionEmailsImageActionGroup.xml b/app/code/Magento/Email/Test/Mftf/ActionGroup/AdminUploadTransactionEmailsImageActionGroup.xml new file mode 100644 index 0000000000000..a34736a71163e --- /dev/null +++ b/app/code/Magento/Email/Test/Mftf/ActionGroup/AdminUploadTransactionEmailsImageActionGroup.xml @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminUploadTransactionEmailsImageActionGroup"> + <annotations> + <description>Upload logo image for email</description> + </annotations> + <arguments> + <argument name="image" type="string" defaultValue="{{MagentoLogo.file}}"/> + <argument name="width" type="string" defaultValue="200"/> + <argument name="height" type="string" defaultValue="100"/> + </arguments> + + <conditionalClick selector="{{AdminDesignConfigSection.transactionalEmailSectionHeader}}" dependentSelector="{{AdminDesignConfigSection.transactionalEmailSectionBody}}" visible="false" stepKey="openTransactionalEmailSection"/> + <waitForElementVisible selector="{{AdminDesignConfigSection.logoImageAlt}}" stepKey="waitVisibleUploadLogo"/> + <attachFile selector="{{AdminDesignConfigSection.logoUpload}}" userInput="{{image}}" stepKey="attachLogo"/> + <waitForElementVisible selector="{{AdminDesignConfigSection.logoPreview}}" stepKey="waitingForLogoToUpload"/> + <seeElement selector="{{AdminDesignConfigSection.logoPreview}}" stepKey="logoPreviewIsVisible"/> + <fillField selector="{{AdminDesignConfigSection.logoImageAlt}}" userInput="{{image}}" stepKey="fillFieldImageAlt"/> + <fillField selector="{{AdminDesignConfigSection.logoImageWidth}}" userInput="{{width}}" stepKey="fillFieldImageWidth"/> + <fillField selector="{{AdminDesignConfigSection.logoImageHeight}}" userInput="{{height}}" stepKey="fillFieldImageHeight"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Email/Test/Mftf/Test/AdminEmailTemplatePreviewTest.xml b/app/code/Magento/Email/Test/Mftf/Test/AdminEmailTemplatePreviewTest.xml index ca73de1f88fcc..92f4b79b09be2 100644 --- a/app/code/Magento/Email/Test/Mftf/Test/AdminEmailTemplatePreviewTest.xml +++ b/app/code/Magento/Email/Test/Mftf/Test/AdminEmailTemplatePreviewTest.xml @@ -30,7 +30,7 @@ <actionGroup ref="DeleteEmailTemplateActionGroup" stepKey="deleteTemplate"/> <click selector="{{AdminDataGridHeaderSection.clearFilters}}" stepKey="clearFilters"/> <!--Logout from Admin Area--> - <actionGroup ref="logout" stepKey="logoutOfAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutOfAdmin"/> </after> <actionGroup ref="CreateCustomTemplateActionGroup" stepKey="createTemplate"/> diff --git a/app/code/Magento/Email/Test/Mftf/Test/AdminMarketingEmailTemplatesNavigateMenuTest.xml b/app/code/Magento/Email/Test/Mftf/Test/AdminMarketingEmailTemplatesNavigateMenuTest.xml index d512fc263ef2c..28e77ee399737 100644 --- a/app/code/Magento/Email/Test/Mftf/Test/AdminMarketingEmailTemplatesNavigateMenuTest.xml +++ b/app/code/Magento/Email/Test/Mftf/Test/AdminMarketingEmailTemplatesNavigateMenuTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToMarketingEmailTemplatesPage"> <argument name="menuUiId" value="{{AdminMenuMarketing.dataUiId}}"/> diff --git a/app/code/Magento/Email/Test/Mftf/Test/TransactionalEmailsLogoUploadTest.xml b/app/code/Magento/Email/Test/Mftf/Test/TransactionalEmailsLogoUploadTest.xml index 9e1d9c5c3cdbb..89b07e4be44e9 100644 --- a/app/code/Magento/Email/Test/Mftf/Test/TransactionalEmailsLogoUploadTest.xml +++ b/app/code/Magento/Email/Test/Mftf/Test/TransactionalEmailsLogoUploadTest.xml @@ -11,33 +11,44 @@ <test name="TransactionalEmailsLogoUploadTest"> <annotations> <features value="Email"/> - <stories value="Email"/> - <title value="MC-13908: Uploading a Transactional Emails logo"/> + <stories value="Transactional Emails logo"/> + <title value="Uploading a Transactional Emails logo"/> <description value="Transactional Emails Logo should be able to be uploaded in the admin and previewed"/> <severity value="CRITICAL"/> - <testCaseId value="MC-13908"/> - <group value="LogoUpload"/> - <skip> - <issueId value="MC-18496"/> - </skip> + <testCaseId value="MC-27620"/> + <useCaseId value="MC-10932"/> + <group value="theme"/> + <group value="email"/> </annotations> - <!--Login to Admin Area--> <before> - <actionGroup ref="LoginAsAdmin" stepKey="loginToAdminArea"/> + <!--Login to Admin Area--> + <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/> </before> - <!--Logout from Admin Area--> <after> - <actionGroup ref="logout" stepKey="logoutOfAdmin"/> + <!-- Clear filter on Design Config Page --> + <amOnPage url="{{DesignConfigPage.url}}" stepKey="navigateToDesignConfigPage" /> + <waitForPageLoad stepKey="waitForPageLoadToViewDesignConfigPage"/> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearFilter"/> + <!--Logout from Admin Area--> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutOfAdmin"/> </after> <!--Navigate to content->Design->Config page--> <amOnPage url="{{DesignConfigPage.url}}" stepKey="navigateToDesignConfigPage" /> - <waitForPageLoad stepKey="waitForPageloadToViewDesignConfigPage"/> - <click selector="{{AdminDesignConfigSection.scopeRow('3')}}" stepKey="editStoreView"/> + <waitForPageLoad stepKey="waitForPageLoadToViewDesignConfigPage"/> + <actionGroup ref="AdminGridFilterSearchResultsBySelectActionGroup" stepKey="filterThemeDesignConfiguration"> + <argument name="attributeSelector" value="store_id"/> + <argument name="attributeValue" value="{{_defaultStore.name}}"/> + </actionGroup> + <click selector="{{AdminDesignConfigSection.scopeRow('1')}}" stepKey="editStoreView"/> <waitForPageLoad stepKey="waitForPageLoadToOpenStoreViewEditPage"/> - <!--Click Upload logo in Transactional Emails and upload the image and preview it--> - <click selector="{{AdminDesignConfigSection.logoWrapperOpen}}" stepKey="openTab" /> - <attachFile selector="{{AdminDesignConfigSection.logoUpload}}" userInput="{{MagentoLogo.file}}" stepKey="attachLogo"/> - <wait time="5" stepKey="waitingForLogoToUpload" /> - <seeElement selector="{{AdminDesignConfigSection.logoPreview}}" stepKey="LogoPreviewIsVisible"/> + <!-- Upload Image --> + <actionGroup ref="AdminUploadTransactionEmailsImageActionGroup" stepKey="uploadImage"> + <argument name="width" value="200"/> + <argument name="height" value="100"/> + </actionGroup> + <!--Save Design Configuration --> + <actionGroup ref="ClickSaveButtonActionGroup" stepKey="saveDesignConfiguration"> + <argument name="message" value="You saved the configuration."/> + </actionGroup> </test> </tests> diff --git a/app/code/Magento/EncryptionKey/Test/Mftf/Test/AdminEncryptionKeyAutoGenerateKeyTest.xml b/app/code/Magento/EncryptionKey/Test/Mftf/Test/AdminEncryptionKeyAutoGenerateKeyTest.xml index ded57f4aad019..04430661a62a4 100644 --- a/app/code/Magento/EncryptionKey/Test/Mftf/Test/AdminEncryptionKeyAutoGenerateKeyTest.xml +++ b/app/code/Magento/EncryptionKey/Test/Mftf/Test/AdminEncryptionKeyAutoGenerateKeyTest.xml @@ -25,7 +25,7 @@ <after> <!--Logout from Admin Area--> - <actionGroup ref="logout" stepKey="logoutOfAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutOfAdmin"/> </after> <actionGroup ref="AdminEncryptionKeyNavigateToChangePageActionGroup" stepKey="navigateToPage"/> diff --git a/app/code/Magento/EncryptionKey/Test/Mftf/Test/AdminEncryptionKeyManualGenerateKeyTest.xml b/app/code/Magento/EncryptionKey/Test/Mftf/Test/AdminEncryptionKeyManualGenerateKeyTest.xml index f3a9849969263..0674fd12ebead 100644 --- a/app/code/Magento/EncryptionKey/Test/Mftf/Test/AdminEncryptionKeyManualGenerateKeyTest.xml +++ b/app/code/Magento/EncryptionKey/Test/Mftf/Test/AdminEncryptionKeyManualGenerateKeyTest.xml @@ -25,7 +25,7 @@ <after> <!--Logout from Admin Area--> - <actionGroup ref="logout" stepKey="logoutOfAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutOfAdmin"/> </after> <actionGroup ref="AdminEncryptionKeyNavigateToChangePageActionGroup" stepKey="navigateToPage"/> diff --git a/app/code/Magento/Fedex/Test/Mftf/Test/AdminCreatingShippingLabelTest.xml b/app/code/Magento/Fedex/Test/Mftf/Test/AdminCreatingShippingLabelTest.xml index 016c609ae7762..c0b602e772b54 100644 --- a/app/code/Magento/Fedex/Test/Mftf/Test/AdminCreatingShippingLabelTest.xml +++ b/app/code/Magento/Fedex/Test/Mftf/Test/AdminCreatingShippingLabelTest.xml @@ -75,7 +75,7 @@ <!--Delete created data--> <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Add country of manufacture to product--> <amOnPage url="{{AdminProductEditPage.url($$createProduct.id$$)}}" stepKey="amOnEditPage"/> diff --git a/app/code/Magento/GoogleAdwords/Test/Mftf/Test/AdminValidateConversionIdConfigTest.xml b/app/code/Magento/GoogleAdwords/Test/Mftf/Test/AdminValidateConversionIdConfigTest.xml index 7c0214a8654c8..bc1983344ce88 100644 --- a/app/code/Magento/GoogleAdwords/Test/Mftf/Test/AdminValidateConversionIdConfigTest.xml +++ b/app/code/Magento/GoogleAdwords/Test/Mftf/Test/AdminValidateConversionIdConfigTest.xml @@ -19,7 +19,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateToGoogleAdwordsConfigurationActionGroup" stepKey="goToConfigPage"/> <actionGroup ref="AdminExpandConfigSectionActionGroup" stepKey="expandingGoogleAdwordsSection"> diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminAssociateGroupedProductToWebsitesTest.xml b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminAssociateGroupedProductToWebsitesTest.xml index 41096c416d05e..d23013a6157c9 100644 --- a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminAssociateGroupedProductToWebsitesTest.xml +++ b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminAssociateGroupedProductToWebsitesTest.xml @@ -72,7 +72,7 @@ <actionGroup ref="NavigateToAndResetProductGridToDefaultViewActionGroup" stepKey="resetProductGridFilter"/> <!-- Admin logout --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Open product page and assign grouped project to second website --> diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminCreateAndEditGroupedProductSettingsTest.xml b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminCreateAndEditGroupedProductSettingsTest.xml index e3b76dafdd100..c6228e674aa34 100644 --- a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminCreateAndEditGroupedProductSettingsTest.xml +++ b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminCreateAndEditGroupedProductSettingsTest.xml @@ -43,7 +43,7 @@ <deleteData createDataKey="createProduct" stepKey="deleteSimpleProduct"/> <!-- Log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Create new grouped product --> diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminDeleteGroupedProductTest.xml b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminDeleteGroupedProductTest.xml index f7b9357f1b34a..ebcdc0623cd75 100644 --- a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminDeleteGroupedProductTest.xml +++ b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminDeleteGroupedProductTest.xml @@ -31,7 +31,7 @@ </before> <after> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="DeleteProductUsingProductGridActionGroup" stepKey="deleteGroupedProductFilteredBySkuAndName"> <argument name="product" value="$$createGroupedProduct$$"/> diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminGroupedProductsListTest.xml b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminGroupedProductsListTest.xml index d80e68e37c44c..151a987ea89cc 100644 --- a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminGroupedProductsListTest.xml +++ b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminGroupedProductsListTest.xml @@ -33,7 +33,7 @@ <deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/> <deleteData createDataKey="simpleProduct2" stepKey="deleteSimpleProduct2"/> <deleteData createDataKey="category1" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Create product --> diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminSortingAssociatedProductsTest.xml b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminSortingAssociatedProductsTest.xml index bac294d59ce51..dd4619c5c2ce1 100644 --- a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminSortingAssociatedProductsTest.xml +++ b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminSortingAssociatedProductsTest.xml @@ -123,7 +123,7 @@ <deleteData createDataKey="product22" stepKey="deleteProduct22"/> <deleteData createDataKey="product23" stepKey="deleteProduct23"/> <deleteData createDataKey="category" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Create grouped Product--> diff --git a/app/code/Magento/ImportExport/Test/Mftf/Test/AdminCheckThatSomeAttributesChangedValueToEmptyAfterImportTest.xml b/app/code/Magento/ImportExport/Test/Mftf/Test/AdminCheckThatSomeAttributesChangedValueToEmptyAfterImportTest.xml index f5e8c91c31950..9ccdb313b88e6 100644 --- a/app/code/Magento/ImportExport/Test/Mftf/Test/AdminCheckThatSomeAttributesChangedValueToEmptyAfterImportTest.xml +++ b/app/code/Magento/ImportExport/Test/Mftf/Test/AdminCheckThatSomeAttributesChangedValueToEmptyAfterImportTest.xml @@ -41,7 +41,7 @@ <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <!--Delete attribute--> <deleteData createDataKey="productAttribute" stepKey="deleteProductAttribute"/> - <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> diff --git a/app/code/Magento/ImportExport/Test/Mftf/Test/AdminExportPageNavigateMenuTest.xml b/app/code/Magento/ImportExport/Test/Mftf/Test/AdminExportPageNavigateMenuTest.xml index e8fb12ca521c2..eba744e551037 100644 --- a/app/code/Magento/ImportExport/Test/Mftf/Test/AdminExportPageNavigateMenuTest.xml +++ b/app/code/Magento/ImportExport/Test/Mftf/Test/AdminExportPageNavigateMenuTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToExportPage"> <argument name="menuUiId" value="{{AdminMenuSystem.dataUiId}}"/> diff --git a/app/code/Magento/ImportExport/Test/Mftf/Test/AdminExportPagerGridTest.xml b/app/code/Magento/ImportExport/Test/Mftf/Test/AdminExportPagerGridTest.xml index b203a4d11a2d2..b52d8ec729fc0 100644 --- a/app/code/Magento/ImportExport/Test/Mftf/Test/AdminExportPagerGridTest.xml +++ b/app/code/Magento/ImportExport/Test/Mftf/Test/AdminExportPagerGridTest.xml @@ -21,7 +21,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateToExportPageActionGroup" stepKey="navigateToExportPage"/> <actionGroup ref="AdminAssertVisiblePagerActionGroup" stepKey="seeGridPager"/> diff --git a/app/code/Magento/ImportExport/Test/Mftf/Test/AdminImagesFileDirectoryCorrectExplanationTest.xml b/app/code/Magento/ImportExport/Test/Mftf/Test/AdminImagesFileDirectoryCorrectExplanationTest.xml index 989c405324f06..92f93736f237a 100644 --- a/app/code/Magento/ImportExport/Test/Mftf/Test/AdminImagesFileDirectoryCorrectExplanationTest.xml +++ b/app/code/Magento/ImportExport/Test/Mftf/Test/AdminImagesFileDirectoryCorrectExplanationTest.xml @@ -21,7 +21,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> </after> <amOnPage url="{{AdminImportIndexPage.url}}" stepKey="goToImportIndexPage"/> <waitForPageLoad stepKey="adminImportMainSectionLoad"/> diff --git a/app/code/Magento/ImportExport/Test/Mftf/Test/AdminImportCSVWithSpecialCharactersTest.xml b/app/code/Magento/ImportExport/Test/Mftf/Test/AdminImportCSVWithSpecialCharactersTest.xml index 38c1a09dc534c..91d1209f1f1b8 100644 --- a/app/code/Magento/ImportExport/Test/Mftf/Test/AdminImportCSVWithSpecialCharactersTest.xml +++ b/app/code/Magento/ImportExport/Test/Mftf/Test/AdminImportCSVWithSpecialCharactersTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> </after> <actionGroup ref="AdminCheckDataForImportProductActionGroup" stepKey="adminImportProducts"> <argument name="behavior" value="Add/Update"/> diff --git a/app/code/Magento/ImportExport/Test/Mftf/Test/AdminImportProductsWithAddUpdateBehaviorTest.xml b/app/code/Magento/ImportExport/Test/Mftf/Test/AdminImportProductsWithAddUpdateBehaviorTest.xml index 796732d572290..3eebb9def9c7a 100644 --- a/app/code/Magento/ImportExport/Test/Mftf/Test/AdminImportProductsWithAddUpdateBehaviorTest.xml +++ b/app/code/Magento/ImportExport/Test/Mftf/Test/AdminImportProductsWithAddUpdateBehaviorTest.xml @@ -65,7 +65,7 @@ </actionGroup> <!-- Logout --> - <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> </after> <!-- Import products with add/update behavior --> diff --git a/app/code/Magento/ImportExport/Test/Mftf/Test/AdminImportProductsWithDeleteBehaviorTest.xml b/app/code/Magento/ImportExport/Test/Mftf/Test/AdminImportProductsWithDeleteBehaviorTest.xml index 7ec48a3a7e8fd..9934ac2e0c8c2 100644 --- a/app/code/Magento/ImportExport/Test/Mftf/Test/AdminImportProductsWithDeleteBehaviorTest.xml +++ b/app/code/Magento/ImportExport/Test/Mftf/Test/AdminImportProductsWithDeleteBehaviorTest.xml @@ -38,7 +38,7 @@ </before> <after> <actionGroup ref="AdminClearFiltersActionGroup" stepKey="clearProductFilters"/> - <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> </after> <amOnPage url="{{AdminImportIndexPage.url}}" stepKey="goToImportIndexPage"/> <selectOption selector="{{AdminImportMainSection.entityType}}" userInput="Products" stepKey="selectProductsOption"/> diff --git a/app/code/Magento/ImportExport/Test/Mftf/Test/AdminImportProductsWithErrorEntriesTest.xml b/app/code/Magento/ImportExport/Test/Mftf/Test/AdminImportProductsWithErrorEntriesTest.xml index e3065f005218b..1d3a45b79dc74 100644 --- a/app/code/Magento/ImportExport/Test/Mftf/Test/AdminImportProductsWithErrorEntriesTest.xml +++ b/app/code/Magento/ImportExport/Test/Mftf/Test/AdminImportProductsWithErrorEntriesTest.xml @@ -27,7 +27,7 @@ <!--Delete all imported products--> <actionGroup ref="DeleteProductsIfTheyExistActionGroup" stepKey="deleteAllProducts"/> <!--Logout from Admin page--> - <actionGroup ref="logout" stepKey="logoutFromAdminPage"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdminPage"/> </after> <!--Import products with "Skip error entries"--> diff --git a/app/code/Magento/ImportExport/Test/Mftf/Test/AdminProductImportCSVFileCorrectDifferentFilesTest.xml b/app/code/Magento/ImportExport/Test/Mftf/Test/AdminProductImportCSVFileCorrectDifferentFilesTest.xml index 56c1c43bc28d2..593282b9bb867 100644 --- a/app/code/Magento/ImportExport/Test/Mftf/Test/AdminProductImportCSVFileCorrectDifferentFilesTest.xml +++ b/app/code/Magento/ImportExport/Test/Mftf/Test/AdminProductImportCSVFileCorrectDifferentFilesTest.xml @@ -25,7 +25,7 @@ </before> <after> <!--Logout from Admin--> - <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> </after> <!--Check data products with add/update behavior--> <actionGroup ref="AdminCheckDataForImportProductActionGroup" stepKey="adminImportProducts"> diff --git a/app/code/Magento/ImportExport/Test/Mftf/Test/AdminProductVisibilityDifferentStoreViewsAfterImportTest.xml b/app/code/Magento/ImportExport/Test/Mftf/Test/AdminProductVisibilityDifferentStoreViewsAfterImportTest.xml index f0d721075fdfd..de3b52c3c3a98 100644 --- a/app/code/Magento/ImportExport/Test/Mftf/Test/AdminProductVisibilityDifferentStoreViewsAfterImportTest.xml +++ b/app/code/Magento/ImportExport/Test/Mftf/Test/AdminProductVisibilityDifferentStoreViewsAfterImportTest.xml @@ -46,7 +46,7 @@ <actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteChineseStoreView"> <argument name="customStore" value="storeViewChinese"/> </actionGroup> - <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> </after> <!--Import products from file--> <actionGroup ref="AdminImportProductsActionGroup" stepKey="importProducts"> diff --git a/app/code/Magento/ImportExport/Test/Mftf/Test/AdminSystemImportNavigateMenuTest.xml b/app/code/Magento/ImportExport/Test/Mftf/Test/AdminSystemImportNavigateMenuTest.xml index 9913933d857a8..249f3b28f7a56 100644 --- a/app/code/Magento/ImportExport/Test/Mftf/Test/AdminSystemImportNavigateMenuTest.xml +++ b/app/code/Magento/ImportExport/Test/Mftf/Test/AdminSystemImportNavigateMenuTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToImportPage"> <argument name="menuUiId" value="{{AdminMenuSystem.dataUiId}}"/> diff --git a/app/code/Magento/ImportExport/Test/Mftf/Test/AdminURLKeyWorksWhenUpdatingProductThroughImportingCSVTest.xml b/app/code/Magento/ImportExport/Test/Mftf/Test/AdminURLKeyWorksWhenUpdatingProductThroughImportingCSVTest.xml index 8d56d9d8dad9d..4d4e87f9387cc 100644 --- a/app/code/Magento/ImportExport/Test/Mftf/Test/AdminURLKeyWorksWhenUpdatingProductThroughImportingCSVTest.xml +++ b/app/code/Magento/ImportExport/Test/Mftf/Test/AdminURLKeyWorksWhenUpdatingProductThroughImportingCSVTest.xml @@ -31,7 +31,7 @@ <!--Delete created data--> <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> </after> <!--Import product from CSV file--> <actionGroup ref="AdminImportProductsActionGroup" stepKey="importProduct"> diff --git a/app/code/Magento/Indexer/Test/Mftf/Test/AdminSystemIndexManagementNavigateMenuTest.xml b/app/code/Magento/Indexer/Test/Mftf/Test/AdminSystemIndexManagementNavigateMenuTest.xml index 140c93f7f2b48..cbe5161e40ee8 100644 --- a/app/code/Magento/Indexer/Test/Mftf/Test/AdminSystemIndexManagementNavigateMenuTest.xml +++ b/app/code/Magento/Indexer/Test/Mftf/Test/AdminSystemIndexManagementNavigateMenuTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToIndexManagementPage"> <argument name="menuUiId" value="{{AdminMenuSystem.dataUiId}}"/> diff --git a/app/code/Magento/Integration/Test/Mftf/Test/AdminCreateIntegrationEntityWithDuplicatedNameTest.xml b/app/code/Magento/Integration/Test/Mftf/Test/AdminCreateIntegrationEntityWithDuplicatedNameTest.xml index b23436d474ed8..60598fdd27612 100644 --- a/app/code/Magento/Integration/Test/Mftf/Test/AdminCreateIntegrationEntityWithDuplicatedNameTest.xml +++ b/app/code/Magento/Integration/Test/Mftf/Test/AdminCreateIntegrationEntityWithDuplicatedNameTest.xml @@ -23,9 +23,9 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> - + <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToIntegrationsPage"> <argument name="menuUiId" value="{{AdminMenuSystem.dataUiId}}"/> <argument name="submenuUiId" value="{{AdminMenuSystemExtensionsIntegrations.dataUiId}}"/> diff --git a/app/code/Magento/Integration/Test/Mftf/Test/AdminDeleteIntegrationEntityTest.xml b/app/code/Magento/Integration/Test/Mftf/Test/AdminDeleteIntegrationEntityTest.xml index 966be94d9e404..d1850fdc989fb 100644 --- a/app/code/Magento/Integration/Test/Mftf/Test/AdminDeleteIntegrationEntityTest.xml +++ b/app/code/Magento/Integration/Test/Mftf/Test/AdminDeleteIntegrationEntityTest.xml @@ -38,7 +38,7 @@ <actionGroup ref="AdminSubmitNewIntegrationFormActionGroup" stepKey="submitTheForm"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- TEST BODY --> diff --git a/app/code/Magento/Integration/Test/Mftf/Test/AdminSystemIntegrationsNavigateMenuTest.xml b/app/code/Magento/Integration/Test/Mftf/Test/AdminSystemIntegrationsNavigateMenuTest.xml index 3bd149d222c0e..483afc62c9808 100644 --- a/app/code/Magento/Integration/Test/Mftf/Test/AdminSystemIntegrationsNavigateMenuTest.xml +++ b/app/code/Magento/Integration/Test/Mftf/Test/AdminSystemIntegrationsNavigateMenuTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToIntegrationsPage"> <argument name="menuUiId" value="{{AdminMenuSystem.dataUiId}}"/> diff --git a/app/code/Magento/LayeredNavigation/Test/Mftf/Test/AdminSpecifyLayerNavigationConfigurationTest.xml b/app/code/Magento/LayeredNavigation/Test/Mftf/Test/AdminSpecifyLayerNavigationConfigurationTest.xml index fd8763891af93..80280178e4593 100644 --- a/app/code/Magento/LayeredNavigation/Test/Mftf/Test/AdminSpecifyLayerNavigationConfigurationTest.xml +++ b/app/code/Magento/LayeredNavigation/Test/Mftf/Test/AdminSpecifyLayerNavigationConfigurationTest.xml @@ -20,11 +20,11 @@ </annotations> <before> - <actionGroup ref="LoginActionGroup" stepKey="login"/> + <actionGroup ref="AdminLoginActionGroup" stepKey="login"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Configure Layered Navigation in Stores -> Configuration -> Catalog -> Layered Navigation --> diff --git a/app/code/Magento/LayeredNavigation/Test/Mftf/Test/ShopByButtonInMobile.xml b/app/code/Magento/LayeredNavigation/Test/Mftf/Test/ShopByButtonInMobile.xml index d2b462d0467a2..76a9cc8f920a1 100644 --- a/app/code/Magento/LayeredNavigation/Test/Mftf/Test/ShopByButtonInMobile.xml +++ b/app/code/Magento/LayeredNavigation/Test/Mftf/Test/ShopByButtonInMobile.xml @@ -35,7 +35,7 @@ <deleteData createDataKey="attribute" stepKey="deleteAttribute"/> <deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/> <deleteData createDataKey="simpleProduct2" stepKey="deleteSimpleProduct2"/> - <actionGroup ref="logout" stepKey="logoutOfAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutOfAdmin"/> <resizeWindow width="1280" height="1024" stepKey="resizeWindowToDesktop"/> </after> <!-- Go to default attribute set edit page and add the product attribute to the set --> diff --git a/app/code/Magento/MediaGallery/Test/Unit/Plugin/Product/Gallery/ProcessorTest.php b/app/code/Magento/MediaGallery/Test/Unit/Plugin/Product/Gallery/ProcessorTest.php new file mode 100644 index 0000000000000..94c3aaf5c2f19 --- /dev/null +++ b/app/code/Magento/MediaGallery/Test/Unit/Plugin/Product/Gallery/ProcessorTest.php @@ -0,0 +1,133 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +namespace Magento\MediaGallery\Test\Unit\Plugin\Product\Gallery; + +use Magento\Catalog\Model\Product; +use Magento\Catalog\Model\Product\Gallery\Processor as ProcessorSubject; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; +use Magento\MediaGallery\Plugin\Product\Gallery\Processor; +use Magento\MediaGalleryApi\Model\Asset\Command\DeleteByPathInterface; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; +use Psr\Log\LoggerInterface; + +/** + * Unit test for \Magento\MediaGallery\Plugin\Product\Gallery\Processor + */ +class ProcessorTest extends TestCase +{ + private const STUB_FILE_NAME = 'file'; + + /** + * @var DeleteByPathInterface|MockObject + */ + private $deleteMediaAssetByPathMock; + + /** + * @var LoggerInterface|MockObject + */ + private $loggerMock; + + /** + * @var ProcessorSubject|MockObject + */ + private $processorSubjectMock; + + /** + * @var Product|MockObject + */ + private $productMock; + + /** + * @var Processor + */ + private $plugin; + + /** + * @inheritDoc + */ + protected function setUp() + { + $this->processorSubjectMock = $this->createMock(ProcessorSubject::class); + $this->productMock = $this->createMock(Product::class); + + $this->deleteMediaAssetByPathMock = $this->getMockBuilder(DeleteByPathInterface::class) + ->disableOriginalConstructor() + ->setMethods(['execute']) + ->getMockForAbstractClass(); + $this->loggerMock = $this->getMockBuilder(LoggerInterface::class) + ->disableOriginalConstructor() + ->setMethods(['critical']) + ->getMockForAbstractClass(); + + $this->plugin = (new ObjectManagerHelper($this))->getObject( + Processor::class, + [ + 'deleteMediaAssetByPath' => $this->deleteMediaAssetByPathMock, + 'logger' => $this->loggerMock + ] + ); + } + + /** + * Successful test case. + */ + public function testAfterRemoveImageExpectsExecuteCalled() + { + $this->deleteMediaAssetByPathMock->expects($this->once()) + ->method('execute') + ->with(self::STUB_FILE_NAME); + $this->loggerMock->expects($this->never())->method('critical'); + + $actualResult = $this->plugin->afterRemoveImage( + $this->processorSubjectMock, + $this->processorSubjectMock, + $this->productMock, + self::STUB_FILE_NAME + ); + $this->assertSame($this->processorSubjectMock, $actualResult); + } + + /** + * Test case when passed File argument is not a string. + */ + public function testAfterRemoveImageWithIncorrectFile() + { + $this->deleteMediaAssetByPathMock->expects($this->never())->method('execute'); + $this->loggerMock->expects($this->never())->method('critical'); + + $actualResult = $this->plugin->afterRemoveImage( + $this->processorSubjectMock, + $this->processorSubjectMock, + $this->productMock, + ['non-string-argument' => self::STUB_FILE_NAME] + ); + $this->assertSame($this->processorSubjectMock, $actualResult); + } + + /** + * Test case when an Exception is thrown. + */ + public function testAfterRemoveImageExpectsExecuteWillThrowException() + { + $this->deleteMediaAssetByPathMock->expects($this->once()) + ->method('execute') + ->with(self::STUB_FILE_NAME) + ->willThrowException(new \Exception('Some Exception')); + $this->loggerMock->expects($this->once())->method('critical'); + + $actualResult = $this->plugin->afterRemoveImage( + $this->processorSubjectMock, + $this->processorSubjectMock, + $this->productMock, + self::STUB_FILE_NAME + ); + $this->assertSame($this->processorSubjectMock, $actualResult); + } +} diff --git a/app/code/Magento/MediaStorage/Console/Command/ImagesResizeCommand.php b/app/code/Magento/MediaStorage/Console/Command/ImagesResizeCommand.php index d592a004e111a..526774a3e6bcd 100644 --- a/app/code/Magento/MediaStorage/Console/Command/ImagesResizeCommand.php +++ b/app/code/Magento/MediaStorage/Console/Command/ImagesResizeCommand.php @@ -86,8 +86,7 @@ protected function configure() $this->setName('catalog:images:resize') ->setDescription( 'Creates resized product images ' . - '(Not relevant when image resizing is offloaded from Magento. ' . - 'See https://docs.magento.com/m2/ee/user_guide/configuration/general/web.html#url-options )' + '(Deprecated: see https://docs.magento.com/m2/ee/user_guide/configuration/general/web.html#url-options' ) ->setDefinition($this->getOptionsList()); } diff --git a/app/code/Magento/MediaStorage/Service/ImageResize.php b/app/code/Magento/MediaStorage/Service/ImageResize.php index d061ddbd3dc46..145fcd1b85f4f 100644 --- a/app/code/Magento/MediaStorage/Service/ImageResize.php +++ b/app/code/Magento/MediaStorage/Service/ImageResize.php @@ -19,6 +19,7 @@ use Magento\Framework\Image\Factory as ImageFactory; use Magento\Catalog\Model\Product\Media\ConfigInterface as MediaConfig; use Magento\Framework\App\State; +use Magento\Framework\Storage\StorageProvider; use Magento\Framework\View\ConfigInterface as ViewConfig; use \Magento\Catalog\Model\ResourceModel\Product\Image as ProductImage; use Magento\Store\Model\StoreManagerInterface; @@ -99,6 +100,11 @@ class ImageResize */ private $storeManager; + /** + * @var StorageProvider + */ + private $storageProvider; + /** * @param State $appState * @param MediaConfig $imageConfig @@ -112,6 +118,7 @@ class ImageResize * @param Filesystem $filesystem * @param Database $fileStorageDatabase * @param StoreManagerInterface $storeManager + * @param StorageProvider $storageProvider * @throws \Magento\Framework\Exception\FileSystemException * @internal param ProductImage $gallery * @SuppressWarnings(PHPMD.ExcessiveParameterList) @@ -128,7 +135,8 @@ public function __construct( Collection $themeCollection, Filesystem $filesystem, Database $fileStorageDatabase = null, - StoreManagerInterface $storeManager = null + StoreManagerInterface $storeManager = null, + StorageProvider $storageProvider = null ) { $this->appState = $appState; $this->imageConfig = $imageConfig; @@ -144,6 +152,7 @@ public function __construct( $this->fileStorageDatabase = $fileStorageDatabase ?: ObjectManager::getInstance()->get(Database::class); $this->storeManager = $storeManager ?? ObjectManager::getInstance()->get(StoreManagerInterface::class); + $this->storageProvider = $storageProvider ?? ObjectManager::getInstance()->get(StorageProvider::class); } /** @@ -337,10 +346,15 @@ private function resize(array $imageParams, string $originalImagePath, string $o $image->save($imageAsset->getPath()); + $mediastoragefilename = $this->mediaDirectory->getRelativePath($imageAsset->getPath()); if ($this->fileStorageDatabase->checkDbUsage()) { - $mediastoragefilename = $this->mediaDirectory->getRelativePath($imageAsset->getPath()); $this->fileStorageDatabase->saveFile($mediastoragefilename); } + + $this->storageProvider->get('media')->put( + $mediastoragefilename, + $this->mediaDirectory->readFile($mediastoragefilename) + ); } /** diff --git a/app/code/Magento/MediaStorage/Test/Unit/Service/ImageResizeTest.php b/app/code/Magento/MediaStorage/Test/Unit/Service/ImageResizeTest.php index f0e1efa7806e4..74913b444e63a 100644 --- a/app/code/Magento/MediaStorage/Test/Unit/Service/ImageResizeTest.php +++ b/app/code/Magento/MediaStorage/Test/Unit/Service/ImageResizeTest.php @@ -6,25 +6,27 @@ namespace Magento\MediaStorage\Test\Unit\Service; use Magento\Catalog\Model\Product\Image\ParamsBuilder; -use Magento\Catalog\Model\View\Asset\ImageFactory as AssetImageFactory; +use Magento\Catalog\Model\Product\Media\ConfigInterface as MediaConfig; +use Magento\Catalog\Model\ResourceModel\Product\Image as ProductImage; use Magento\Catalog\Model\View\Asset\Image as AssetImage; +use Magento\Catalog\Model\View\Asset\ImageFactory as AssetImageFactory; +use Magento\Framework\App\Filesystem\DirectoryList; +use Magento\Framework\App\State; +use Magento\Framework\Config\View; use Magento\Framework\DataObject; use Magento\Framework\Filesystem; -use Magento\Framework\Image\Factory as ImageFactory; use Magento\Framework\Image; -use Magento\Catalog\Model\Product\Media\ConfigInterface as MediaConfig; -use Magento\Framework\App\State; +use Magento\Framework\Image\Factory as ImageFactory; +use Magento\Framework\Storage\StorageInterface; use Magento\Framework\View\ConfigInterface as ViewConfig; -use Magento\Framework\Config\View; -use Magento\Catalog\Model\ResourceModel\Product\Image as ProductImage; +use Magento\MediaStorage\Helper\File\Storage\Database; +use Magento\MediaStorage\Service\ImageResize; use Magento\Store\Model\StoreManagerInterface; use Magento\Theme\Model\Config\Customization as ThemeCustomizationConfig; use Magento\Theme\Model\ResourceModel\Theme\Collection; -use Magento\MediaStorage\Helper\File\Storage\Database; -use Magento\Framework\App\Filesystem\DirectoryList; /** - * Class ImageResizeTest + * Class ImageResizeTest test for \Magento\MediaStorage\Service\ImageResize * * @SuppressWarnings(PHPMD.TooManyFields) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) @@ -32,7 +34,7 @@ class ImageResizeTest extends \PHPUnit\Framework\TestCase { /** - * @var \Magento\MediaStorage\Service\ImageResize + * @var ImageResize */ protected $service; @@ -120,11 +122,17 @@ class ImageResizeTest extends \PHPUnit\Framework\TestCase * @var string */ private $testfilepath; + /** * @var \PHPUnit\Framework\MockObject\MockObject|StoreManagerInterface */ private $storeManager; + /** + * @var StorageInterface|\PHPUnit_Framework_MockObject_MockObject + */ + private $storage; + /** * @inheritDoc * @SuppressWarnings(PHPMD.ExcessiveMethodLength) @@ -149,10 +157,16 @@ protected function setUp() $this->filesystemMock = $this->createMock(Filesystem::class); $this->databaseMock = $this->createMock(Database::class); $this->storeManager = $this->getMockForAbstractClass(StoreManagerInterface::class); + $storageProvider = $this->createMock(\Magento\Framework\Storage\StorageProvider::class); + $this->storage = $this->getMockForAbstractClass(StorageInterface::class); + $storageProvider->expects($this->any()) + ->method('get') + ->with('media') + ->willReturn($this->storage); $this->mediaDirectoryMock = $this->getMockBuilder(Filesystem::class) ->disableOriginalConstructor() - ->setMethods(['getAbsolutePath','isFile','getRelativePath']) + ->setMethods(['getAbsolutePath','isFile','getRelativePath', 'readFile']) ->getMock(); $this->filesystemMock->expects($this->any()) @@ -201,8 +215,7 @@ protected function setUp() $this->viewMock->expects($this->any()) ->method('getMediaEntities') ->willReturn( - ['product_small_image' => - [ + ['product_small_image' => [ 'type' => 'small_image', 'width' => 75, 'height' => 75 @@ -223,7 +236,7 @@ protected function setUp() ->method('getStores') ->willReturn([$store]); - $this->service = new \Magento\MediaStorage\Service\ImageResize( + $this->service = new ImageResize( $this->appStateMock, $this->imageConfigMock, $this->productImageMock, @@ -235,7 +248,8 @@ protected function setUp() $this->themeCollectionMock, $this->filesystemMock, $this->databaseMock, - $this->storeManager + $this->storeManager, + $storageProvider ); } @@ -278,6 +292,14 @@ function () { ->method('saveFile') ->with($this->testfilepath); + $this->mediaDirectoryMock->expects($this->any()) + ->method('readFile') + ->with($this->testfilepath) + ->willReturn('image data'); + $this->storage->expects($this->once()) + ->method('put') + ->with($this->testfilepath, 'image data'); + $generator = $this->service->resizeFromThemes(['test-theme']); while ($generator->valid()) { $generator->next(); @@ -316,6 +338,14 @@ public function testResizeFromImageNameMediaStorageDatabase() ->method('saveFile') ->with($this->testfilepath); + $this->mediaDirectoryMock->expects($this->any()) + ->method('readFile') + ->with($this->testfilepath) + ->willReturn('image data'); + $this->storage->expects($this->once()) + ->method('put') + ->with($this->testfilepath, 'image data'); + $this->service->resizeFromImageName($this->testfilename); } } diff --git a/app/code/Magento/MediaStorage/etc/di.xml b/app/code/Magento/MediaStorage/etc/di.xml index 5cdcbb3b2b9a9..061c3be1bbe4a 100644 --- a/app/code/Magento/MediaStorage/etc/di.xml +++ b/app/code/Magento/MediaStorage/etc/di.xml @@ -31,4 +31,11 @@ <argument name="imageResizeScheduler" xsi:type="object">Magento\MediaStorage\Service\ImageResizeScheduler\Proxy</argument> </arguments> </type> + <type name="Magento\Framework\Storage\StorageProvider"> + <arguments> + <argument name="storage" xsi:type="array"> + <item name="media" xsi:type="string">pub/media</item> + </argument> + </arguments> + </type> </config> diff --git a/app/code/Magento/Msrp/Test/Mftf/Test/StorefrontProductWithMapAssignedConfigProductIsCorrectTest.xml b/app/code/Magento/Msrp/Test/Mftf/Test/StorefrontProductWithMapAssignedConfigProductIsCorrectTest.xml index 29f14185a0518..cfc841cbeb0f6 100644 --- a/app/code/Magento/Msrp/Test/Mftf/Test/StorefrontProductWithMapAssignedConfigProductIsCorrectTest.xml +++ b/app/code/Magento/Msrp/Test/Mftf/Test/StorefrontProductWithMapAssignedConfigProductIsCorrectTest.xml @@ -104,7 +104,7 @@ <!--Disable Minimum advertised Price--> <createData entity="MsrpDisableMAP" stepKey="disableMAP"/> - <actionGroup ref="logout" stepKey="logoutOfAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutOfAdmin"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> diff --git a/app/code/Magento/Multishipping/Model/Cart/CartTotalRepositoryPlugin.php b/app/code/Magento/Multishipping/Model/Cart/CartTotalRepositoryPlugin.php index 732bdee314f7c..bb225a5c46228 100644 --- a/app/code/Magento/Multishipping/Model/Cart/CartTotalRepositoryPlugin.php +++ b/app/code/Magento/Multishipping/Model/Cart/CartTotalRepositoryPlugin.php @@ -33,21 +33,21 @@ public function __construct( } /** - * Overwrite the CartTotalRepository quoteTotal and update the shipping price + * Check multishipping update shipping price after get cart total * - * @param CartTotalRepository $subject - * @param Totals $quoteTotals - * @param String $cartId - * @return Totals - * @throws \Magento\Framework\Exception\NoSuchEntityException + * @param CartTotalRepository $subject + * @param Totals $quoteTotals + * @param int $cartId + * @return Totals + * @throws \Magento\Framework\Exception\NoSuchEntityException * @SuppressWarnings(PHPMD.UnusedLocalVariable) * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function afterGet( CartTotalRepository $subject, Totals $quoteTotals, - String $cartId - ) { + $cartId + ) : Totals { $quote = $this->quoteRepository->getActive($cartId); if ($quote->getIsMultiShipping()) { $shippingMethod = $quote->getShippingAddress()->getShippingMethod(); diff --git a/app/code/Magento/Multishipping/Test/Mftf/Test/StoreFrontCheckingWithMultishipmentTest.xml b/app/code/Magento/Multishipping/Test/Mftf/Test/StoreFrontCheckingWithMultishipmentTest.xml index cfec857329b3d..a054649c5365c 100644 --- a/app/code/Magento/Multishipping/Test/Mftf/Test/StoreFrontCheckingWithMultishipmentTest.xml +++ b/app/code/Magento/Multishipping/Test/Mftf/Test/StoreFrontCheckingWithMultishipmentTest.xml @@ -58,7 +58,7 @@ <deleteData stepKey="deleteProduct2" createDataKey="product2"/> <deleteData stepKey="deleteCustomer" createDataKey="customer"/> <createData entity="FreeShippinMethodDefault" stepKey="disableFreeShipping"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> </test> </tests> diff --git a/app/code/Magento/Multishipping/Test/Mftf/Test/StoreFrontCheckingWithSingleShipmentTest.xml b/app/code/Magento/Multishipping/Test/Mftf/Test/StoreFrontCheckingWithSingleShipmentTest.xml index dcf0770e5421e..de52d20542ce8 100644 --- a/app/code/Magento/Multishipping/Test/Mftf/Test/StoreFrontCheckingWithSingleShipmentTest.xml +++ b/app/code/Magento/Multishipping/Test/Mftf/Test/StoreFrontCheckingWithSingleShipmentTest.xml @@ -58,7 +58,7 @@ <deleteData stepKey="deleteProduct2" createDataKey="product2"/> <deleteData stepKey="deleteCustomer" createDataKey="customer"/> <createData entity="FreeShippinMethodDefault" stepKey="disableFreeShipping"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> </test> </tests> diff --git a/app/code/Magento/Multishipping/Test/Mftf/Test/StoreFrontMinicartWithMultishipmentTest.xml b/app/code/Magento/Multishipping/Test/Mftf/Test/StoreFrontMinicartWithMultishipmentTest.xml index e826d8e03ffbc..90cc8b3952dde 100644 --- a/app/code/Magento/Multishipping/Test/Mftf/Test/StoreFrontMinicartWithMultishipmentTest.xml +++ b/app/code/Magento/Multishipping/Test/Mftf/Test/StoreFrontMinicartWithMultishipmentTest.xml @@ -44,7 +44,7 @@ <deleteData stepKey="deleteProduct2" createDataKey="product2"/> <deleteData stepKey="deleteCustomer" createDataKey="customer"/> <createData entity="FreeShippinMethodDefault" stepKey="disableFreeShipping"/> - <actionGroup ref="logout" stepKey="logoutAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutAdmin"/> </after> <amOnPage url="$$product1.name$$.html" stepKey="goToProduct1"/> diff --git a/app/code/Magento/Multishipping/Test/Mftf/Test/StoreFrontMyAccountWithMultishipmentTest.xml b/app/code/Magento/Multishipping/Test/Mftf/Test/StoreFrontMyAccountWithMultishipmentTest.xml index d8b6a35a4885c..8f27fa35bde02 100644 --- a/app/code/Magento/Multishipping/Test/Mftf/Test/StoreFrontMyAccountWithMultishipmentTest.xml +++ b/app/code/Magento/Multishipping/Test/Mftf/Test/StoreFrontMyAccountWithMultishipmentTest.xml @@ -50,7 +50,7 @@ <deleteData createDataKey="customer" stepKey="deleteCustomer"/> <magentoCLI command="config:set {{DisableFreeShippingMethod.path}} {{DisableFreeShippingMethod.value}}" stepKey="disableFreeShipping"/> <actionGroup ref="AdminOrdersGridClearFiltersActionGroup" stepKey="clearAllFilters"/> - <actionGroup ref="logout" stepKey="logoutAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutAdmin"/> </after> <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addSimpleProduct1ToCart"> <argument name="product" value="$$product1$$"/> diff --git a/app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontCheckoutWithMultipleAddressesTest.xml b/app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontCheckoutWithMultipleAddressesTest.xml index dc786f9cbc5db..5890ab49b2587 100644 --- a/app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontCheckoutWithMultipleAddressesTest.xml +++ b/app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontCheckoutWithMultipleAddressesTest.xml @@ -36,7 +36,7 @@ </before> <after> <!-- Delete created data --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <deleteData createDataKey="firstProduct" stepKey="deleteFirstProduct"/> <deleteData createDataKey="secondProduct" stepKey="deleteSecondProduct"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> diff --git a/app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontOrderWithMultishippingTest.xml b/app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontOrderWithMultishippingTest.xml index ef63d55ccfe35..9a3d622b2e264 100644 --- a/app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontOrderWithMultishippingTest.xml +++ b/app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontOrderWithMultishippingTest.xml @@ -46,7 +46,7 @@ <magentoCLI command="config:set {{DisableMultiShippingCheckoutMultiple.path}} {{DisableMultiShippingCheckoutMultiple.value}}" stepKey="withdrawShippingToMultipleAddresses"/> <magentoCLI command="config:set {{DisableFreeShippingMethod.path}} {{DisableFreeShippingMethod.value}}" stepKey="disableFreeShipping"/> <actionGroup ref="AdminOrdersGridClearFiltersActionGroup" stepKey="clearAllOrdersGridFilters"/> - <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> </after> <actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addSimpleProduct1ToCart"> diff --git a/app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontProcessMultishippingCheckoutWhenCartPageIsOpenedInAnotherTabTest.xml b/app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontProcessMultishippingCheckoutWhenCartPageIsOpenedInAnotherTabTest.xml index f25ac203c3fa5..81b536746616e 100644 --- a/app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontProcessMultishippingCheckoutWhenCartPageIsOpenedInAnotherTabTest.xml +++ b/app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontProcessMultishippingCheckoutWhenCartPageIsOpenedInAnotherTabTest.xml @@ -36,7 +36,7 @@ </before> <after> <!-- Delete created data --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <deleteData createDataKey="createFirstProduct" stepKey="deleteFirstProduct"/> <deleteData createDataKey="createSecondProduct" stepKey="deleteSecondProduct"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> diff --git a/app/code/Magento/Multishipping/Test/Unit/Model/Cart/CartTotalRepositoryPluginTest.php b/app/code/Magento/Multishipping/Test/Unit/Model/Cart/CartTotalRepositoryPluginTest.php index 73b0b9ef3ca7a..8362699efbd45 100644 --- a/app/code/Magento/Multishipping/Test/Unit/Model/Cart/CartTotalRepositoryPluginTest.php +++ b/app/code/Magento/Multishipping/Test/Unit/Model/Cart/CartTotalRepositoryPluginTest.php @@ -6,76 +6,145 @@ namespace Magento\Multishipping\Test\Unit\Model\Cart; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\Quote\Api\CartRepositoryInterface; +use Magento\Quote\Model\Cart\CartTotalRepository; +use Magento\Quote\Model\Cart\Totals as QuoteTotals; +use Magento\Quote\Model\Quote\Address as QuoteAddress; +use Magento\Quote\Model\Quote\Address\Rate as QuoteAddressRate; +use Magento\Multishipping\Model\Cart\CartTotalRepositoryPlugin; +use Magento\Store\Model\Store; +use PHPUnit\Framework\MockObject\MockObject; + class CartTotalRepositoryPluginTest extends \PHPUnit\Framework\TestCase { /** - * @var \Magento\Multishipping\Model\Cart\CartTotalRepositoryPlugin + * Stub cart id + */ + private const STUB_CART_ID = 10; + + /** + * Stub shipping method + */ + private const STUB_SHIPPING_METHOD = 'flatrate_flatrate'; + + /** + * Stub shipping price + */ + private const STUB_SHIPPING_PRICE = '10.00'; + + /** + * @var CartTotalRepositoryPlugin */ private $modelRepository; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var CartTotalRepository|MockObject + */ + private $quoteTotalRepositoryMock; + + /** + * @var CartRepositoryInterface|MockObject */ private $quoteRepositoryMock; - protected function setUp() - { - $this->quoteRepositoryMock = $this->createMock(\Magento\Quote\Api\CartRepositoryInterface::class); - $this->modelRepository = new \Magento\Multishipping\Model\Cart\CartTotalRepositoryPlugin( - $this->quoteRepositoryMock - ); - } + /** + * @var QuoteTotals|MockObject + */ + private $quoteTotalsMock; /** - * Test quotTotal from cartRepository after get($cartId) function is called + * @var QuoteAddress|MockObject */ - public function testAfterGet() + private $shippingAddressMock; + + /** + * @var QuoteAddressRate|MockObject + */ + private $shippingRateMock; + + /** + * @var Store|MockObject + */ + private $storeMock; + + protected function setUp() { - $cartId = "10"; - $shippingMethod = 'flatrate_flatrate'; - $shippingPrice = '10.00'; - $quoteMock = $this->createPartialMock( - \Magento\Quote\Model\Cart\Totals::class, + $objectManager = new ObjectManager($this); + $this->quoteTotalsMock = $this->createPartialMock( + QuoteTotals::class, [ - 'getStore', - 'getShippingAddress', - 'getIsMultiShipping' + 'getStore', + 'getShippingAddress', + 'getIsMultiShipping' ] ); - $this->quoteRepositoryMock->expects($this->once())->method('getActive')->with($cartId)->willReturn($quoteMock); - $quoteMock->expects($this->once())->method('getIsMultiShipping')->willReturn(true); - $shippingAddressMock = $this->createPartialMock( - \Magento\Quote\Model\Quote\Address::class, + $this->shippingAddressMock = $this->createPartialMock( + QuoteAddress::class, [ - 'getShippingMethod', - 'getShippingRateByCode', - 'getShippingAmount' + 'getShippingMethod', + 'getShippingRateByCode', + 'getShippingAmount' ] ); - $quoteMock->expects($this->any())->method('getShippingAddress')->willReturn($shippingAddressMock); - - $shippingAddressMock->expects($this->once())->method('getShippingMethod')->willReturn($shippingMethod); - $shippingAddressMock->expects($this->any())->method('getShippingAmount')->willReturn($shippingPrice); - $shippingRateMock = $this->createPartialMock( - \Magento\Quote\Model\Quote\Address\Rate::class, + $this->shippingRateMock = $this->createPartialMock( + QuoteAddressRate::class, [ - 'getPrice' + 'getPrice' ] ); - $shippingAddressMock->expects($this->once())->method('getShippingRateByCode')->willReturn($shippingRateMock); - - $shippingRateMock->expects($this->once())->method('getPrice')->willReturn($shippingPrice); - - $storeMock = $this->getMockBuilder(\Magento\Store\Model\Store::class) + $this->storeMock = $this->getMockBuilder(Store::class) ->disableOriginalConstructor() ->getMock(); - $quoteMock->expects($this->any())->method('getStore')->willReturn($storeMock); - $storeMock->expects($this->any())->method('getBaseCurrency')->willReturnSelf(); + $this->quoteRepositoryMock = $this->createMock(CartRepositoryInterface::class); + $this->quoteTotalRepositoryMock = $this->createMock(CartTotalRepository::class); + $this->modelRepository = $objectManager->getObject(CartTotalRepositoryPlugin::class, [ + 'quoteRepository' => $this->quoteRepositoryMock + ]); + } + + /** + * Test quoteTotal from cartRepository after get($cartId) function is called + */ + public function testAfterGetQuoteTotalAddedShippingPrice() + { + $this->quoteRepositoryMock->expects($this->once()) + ->method('getActive') + ->with(self::STUB_CART_ID) + ->willReturn($this->quoteTotalsMock); + $this->quoteTotalsMock->expects($this->once()) + ->method('getIsMultiShipping') + ->willReturn(true); + $this->quoteTotalsMock->expects($this->any()) + ->method('getShippingAddress') + ->willReturn($this->shippingAddressMock); + + $this->shippingAddressMock->expects($this->once()) + ->method('getShippingMethod') + ->willReturn(self::STUB_SHIPPING_METHOD); + $this->shippingAddressMock->expects($this->any()) + ->method('getShippingAmount') + ->willReturn(self::STUB_SHIPPING_PRICE); + + $this->shippingAddressMock->expects($this->once()) + ->method('getShippingRateByCode') + ->willReturn($this->shippingRateMock); + + $this->shippingRateMock->expects($this->once()) + ->method('getPrice') + ->willReturn(self::STUB_SHIPPING_PRICE); + + $this->quoteTotalsMock->expects($this->any()) + ->method('getStore') + ->willReturn($this->storeMock); + $this->storeMock->expects($this->any()) + ->method('getBaseCurrency') + ->willReturnSelf(); $this->modelRepository->afterGet( - $this->createMock(\Magento\Quote\Model\Cart\CartTotalRepository::class), - $quoteMock, - $cartId + $this->quoteTotalRepositoryMock, + $this->quoteTotalsMock, + self::STUB_CART_ID ); } } diff --git a/app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_customer_address.xml b/app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_customer_address.xml index fee3cb790a522..449f5feeafd9c 100644 --- a/app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_customer_address.xml +++ b/app/code/Magento/Multishipping/view/frontend/layout/multishipping_checkout_customer_address.xml @@ -13,6 +13,7 @@ <arguments> <argument name="attribute_data" xsi:type="object">Magento\Customer\Block\DataProviders\AddressAttributeData</argument> <argument name="post_code_config" xsi:type="object">Magento\Customer\Block\DataProviders\PostCodesPatternsAttributeData</argument> + <argument name="view_model" xsi:type="object">Magento\Customer\ViewModel\Address</argument> </arguments> </block> </referenceContainer> diff --git a/app/code/Magento/NewRelicReporting/Test/Mftf/Test/AdminCheckNewRelicSystemConfigDependencyTest.xml b/app/code/Magento/NewRelicReporting/Test/Mftf/Test/AdminCheckNewRelicSystemConfigDependencyTest.xml index c343f93de2c58..5b4b92559f355 100644 --- a/app/code/Magento/NewRelicReporting/Test/Mftf/Test/AdminCheckNewRelicSystemConfigDependencyTest.xml +++ b/app/code/Magento/NewRelicReporting/Test/Mftf/Test/AdminCheckNewRelicSystemConfigDependencyTest.xml @@ -25,7 +25,7 @@ </actionGroup> </before> <after> - <actionGroup ref="logout" stepKey="logoutOfAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutOfAdmin"/> </after> <actionGroup ref="AssertAdminNewRelicConfigFieldIsNotVisibleActionGroup" stepKey="checkingIfApiUrlIsNotVisible"> <argument name="config" value="{{AdminNewRelicConfigSystemSection.apiUrl}}"/> diff --git a/app/code/Magento/Newsletter/Block/Adminhtml/Subscriber.php b/app/code/Magento/Newsletter/Block/Adminhtml/Subscriber.php index 4d5165db68736..d05657c727192 100644 --- a/app/code/Magento/Newsletter/Block/Adminhtml/Subscriber.php +++ b/app/code/Magento/Newsletter/Block/Adminhtml/Subscriber.php @@ -11,13 +11,18 @@ */ namespace Magento\Newsletter\Block\Adminhtml; +use Magento\Backend\Block\Template; +use Magento\Backend\Block\Template\Context; use Magento\Newsletter\Model\ResourceModel\Queue\Collection; +use Magento\Newsletter\Model\ResourceModel\Queue\CollectionFactory; /** + * Newsletter Subscriber block + * * @api * @since 100.0.2 */ -class Subscriber extends \Magento\Backend\Block\Template +class Subscriber extends Template { /** * Queue collection @@ -32,34 +37,24 @@ class Subscriber extends \Magento\Backend\Block\Template protected $_template = 'Magento_Newsletter::subscriber/list.phtml'; /** - * @var \Magento\Newsletter\Model\ResourceModel\Queue\CollectionFactory + * @var CollectionFactory */ protected $_collectionFactory; /** - * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Newsletter\Model\ResourceModel\Queue\CollectionFactory $collectionFactory + * @param Context $context + * @param CollectionFactory $collectionFactory * @param array $data */ public function __construct( - \Magento\Backend\Block\Template\Context $context, - \Magento\Newsletter\Model\ResourceModel\Queue\CollectionFactory $collectionFactory, + Context $context, + CollectionFactory $collectionFactory, array $data = [] ) { $this->_collectionFactory = $collectionFactory; parent::__construct($context, $data); } - /** - * Prepares block to render - * - * @return $this - */ - protected function _beforeToHtml() - { - return parent::_beforeToHtml(); - } - /** * Return queue collection with loaded neversent queues * @@ -68,7 +63,7 @@ protected function _beforeToHtml() public function getQueueCollection() { if ($this->_queueCollection === null) { - /** @var $this->_queueCollection \Magento\Newsletter\Model\ResourceModel\Queue\Collection */ + /** @var $this->_queueCollection Collection */ $this->_queueCollection = $this ->_collectionFactory ->create() diff --git a/app/code/Magento/Newsletter/Model/Plugin/CustomerPlugin.php b/app/code/Magento/Newsletter/Model/Plugin/CustomerPlugin.php index f89201688b7fa..6bdaa40019f8a 100644 --- a/app/code/Magento/Newsletter/Model/Plugin/CustomerPlugin.php +++ b/app/code/Magento/Newsletter/Model/Plugin/CustomerPlugin.php @@ -17,6 +17,7 @@ use Magento\Newsletter\Model\SubscriptionManagerInterface; use Magento\Store\Model\Store; use Magento\Store\Model\StoreManagerInterface; +use Magento\Framework\Api\SearchResults; use Psr\Log\LoggerInterface; /** @@ -233,6 +234,27 @@ public function afterGetById(CustomerRepositoryInterface $subject, CustomerInter return $customer; } + /** + * Add subscription status to customer list + * + * @param CustomerRepositoryInterface $subject + * @param SearchResults $searchResults + * @return SearchResults + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function afterGetList(CustomerRepositoryInterface $subject, SearchResults $searchResults): SearchResults + { + foreach ($searchResults->getItems() as $customer) { + /** @var CustomerExtensionInterface $extensionAttributes */ + $extensionAttributes = $customer->getExtensionAttributes(); + + $isSubscribed = (int) $extensionAttributes->getIsSubscribed() === Subscriber::STATUS_SUBSCRIBED ?: false; + $extensionAttributes->setIsSubscribed($isSubscribed); + } + + return $searchResults; + } + /** * Set Is Subscribed extension attribute * diff --git a/app/code/Magento/Newsletter/Test/Mftf/Test/AdminAddImageToWYSIWYGNewsletterTest.xml b/app/code/Magento/Newsletter/Test/Mftf/Test/AdminAddImageToWYSIWYGNewsletterTest.xml index 4992a36c0b3cb..a763f43d9e4d1 100644 --- a/app/code/Magento/Newsletter/Test/Mftf/Test/AdminAddImageToWYSIWYGNewsletterTest.xml +++ b/app/code/Magento/Newsletter/Test/Mftf/Test/AdminAddImageToWYSIWYGNewsletterTest.xml @@ -18,7 +18,7 @@ <testCaseId value="MAGETWO-84377"/> </annotations> <before> - <actionGroup ref="LoginActionGroup" stepKey="login"/> + <actionGroup ref="AdminLoginActionGroup" stepKey="login"/> <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> @@ -58,7 +58,7 @@ <closeTab stepKey="closeTab"/> <after> <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> </test> </tests> diff --git a/app/code/Magento/Newsletter/Test/Mftf/Test/AdminAddVariableToWYSIWYGNewsletterTest.xml b/app/code/Magento/Newsletter/Test/Mftf/Test/AdminAddVariableToWYSIWYGNewsletterTest.xml index 958340671ac43..ff2e2a84a612e 100644 --- a/app/code/Magento/Newsletter/Test/Mftf/Test/AdminAddVariableToWYSIWYGNewsletterTest.xml +++ b/app/code/Magento/Newsletter/Test/Mftf/Test/AdminAddVariableToWYSIWYGNewsletterTest.xml @@ -18,7 +18,7 @@ <severity value="AVERAGE"/> </annotations> <before> - <actionGroup ref="LoginActionGroup" stepKey="loginGetFromGeneralFile"/> + <actionGroup ref="AdminLoginActionGroup" stepKey="loginGetFromGeneralFile"/> <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> @@ -100,7 +100,7 @@ <closeTab stepKey="closeTab"/> <after> <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> </test> </tests> diff --git a/app/code/Magento/Newsletter/Test/Mftf/Test/AdminAddWidgetToWYSIWYGNewsletterTest.xml b/app/code/Magento/Newsletter/Test/Mftf/Test/AdminAddWidgetToWYSIWYGNewsletterTest.xml index 29c125a52c9e2..73880f283677d 100644 --- a/app/code/Magento/Newsletter/Test/Mftf/Test/AdminAddWidgetToWYSIWYGNewsletterTest.xml +++ b/app/code/Magento/Newsletter/Test/Mftf/Test/AdminAddWidgetToWYSIWYGNewsletterTest.xml @@ -18,7 +18,7 @@ <testCaseId value="MC-6070"/> </annotations> <before> - <actionGroup ref="LoginActionGroup" stepKey="login"/> + <actionGroup ref="AdminLoginActionGroup" stepKey="login"/> <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> @@ -55,7 +55,7 @@ <closeTab stepKey="closeTab"/> <after> <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> </test> </tests> diff --git a/app/code/Magento/Newsletter/Test/Mftf/Test/AdminMarketingNewsletterQueueNavigateMenuTest.xml b/app/code/Magento/Newsletter/Test/Mftf/Test/AdminMarketingNewsletterQueueNavigateMenuTest.xml index 31da588250a0a..c094117870712 100644 --- a/app/code/Magento/Newsletter/Test/Mftf/Test/AdminMarketingNewsletterQueueNavigateMenuTest.xml +++ b/app/code/Magento/Newsletter/Test/Mftf/Test/AdminMarketingNewsletterQueueNavigateMenuTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToNewsletterQueuePage"> <argument name="menuUiId" value="{{AdminMenuMarketing.dataUiId}}"/> diff --git a/app/code/Magento/Newsletter/Test/Mftf/Test/AdminMarketingNewsletterSubscribersNavigateMenuTest.xml b/app/code/Magento/Newsletter/Test/Mftf/Test/AdminMarketingNewsletterSubscribersNavigateMenuTest.xml index 8ced2690322f8..a5046b6fa4b71 100644 --- a/app/code/Magento/Newsletter/Test/Mftf/Test/AdminMarketingNewsletterSubscribersNavigateMenuTest.xml +++ b/app/code/Magento/Newsletter/Test/Mftf/Test/AdminMarketingNewsletterSubscribersNavigateMenuTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToNewsletterSubscribersPage"> <argument name="menuUiId" value="{{AdminMenuMarketing.dataUiId}}"/> diff --git a/app/code/Magento/Newsletter/Test/Mftf/Test/AdminMarketingNewsletterTemplateNavigateMenuTest.xml b/app/code/Magento/Newsletter/Test/Mftf/Test/AdminMarketingNewsletterTemplateNavigateMenuTest.xml index ca994aa1d6269..4c12765ebc2a0 100644 --- a/app/code/Magento/Newsletter/Test/Mftf/Test/AdminMarketingNewsletterTemplateNavigateMenuTest.xml +++ b/app/code/Magento/Newsletter/Test/Mftf/Test/AdminMarketingNewsletterTemplateNavigateMenuTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToNewsletterTemplatePage"> <argument name="menuUiId" value="{{AdminMenuMarketing.dataUiId}}"/> diff --git a/app/code/Magento/Newsletter/Test/Mftf/Test/AdminNameEmptyForGuestTest.xml b/app/code/Magento/Newsletter/Test/Mftf/Test/AdminNameEmptyForGuestTest.xml index 07c7cc050d5cf..a90a035b25726 100644 --- a/app/code/Magento/Newsletter/Test/Mftf/Test/AdminNameEmptyForGuestTest.xml +++ b/app/code/Magento/Newsletter/Test/Mftf/Test/AdminNameEmptyForGuestTest.xml @@ -11,6 +11,7 @@ <test name="AdminNameEmptyForGuestTest"> <annotations> <features value="Newsletter"/> + <stories value="Newsletter Subscribers grid"/> <group value="Newsletter"/> <title value="Empty name for Guest Customer"/> <description value="'Customer First Name' and 'Customer Last Name' should be empty for Guest Customer in Newsletter Subscribers Grid"/> @@ -18,11 +19,11 @@ </annotations> <before> - <actionGroup ref="LoginActionGroup" stepKey="loginAsAdmin"/> + <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> </after> <amOnPage url="{{StorefrontHomePage.url}}" stepKey="amOnStorefrontPage"/> diff --git a/app/code/Magento/Newsletter/Test/Mftf/Test/AdminReportsNewsletterProblemReportsNavigateMenuTest.xml b/app/code/Magento/Newsletter/Test/Mftf/Test/AdminReportsNewsletterProblemReportsNavigateMenuTest.xml index 3891b90536a17..9765a65cd60db 100644 --- a/app/code/Magento/Newsletter/Test/Mftf/Test/AdminReportsNewsletterProblemReportsNavigateMenuTest.xml +++ b/app/code/Magento/Newsletter/Test/Mftf/Test/AdminReportsNewsletterProblemReportsNavigateMenuTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToNewsletterProblemsReportPage"> <argument name="menuUiId" value="{{AdminMenuReports.dataUiId}}"/> diff --git a/app/code/Magento/Newsletter/Test/Mftf/Test/VerifySubscribedNewsletterDisplayedTest.xml b/app/code/Magento/Newsletter/Test/Mftf/Test/VerifySubscribedNewsletterDisplayedTest.xml index 200eb0e49f5b2..a568fb1799ac2 100644 --- a/app/code/Magento/Newsletter/Test/Mftf/Test/VerifySubscribedNewsletterDisplayedTest.xml +++ b/app/code/Magento/Newsletter/Test/Mftf/Test/VerifySubscribedNewsletterDisplayedTest.xml @@ -21,7 +21,7 @@ <before> <!--Log in to Magento as admin.--> - <actionGroup ref="LoginActionGroup" stepKey="loginAsAdmin"/> + <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/> <actionGroup ref="AdminCreateWebsiteActionGroup" stepKey="createWebsite"> <argument name="newWebsiteName" value="Second"/> <argument name="websiteCode" value="Base2"/> @@ -49,7 +49,7 @@ </actionGroup> <magentoCLI command="indexer:reindex" stepKey="reindex"/> <magentoCLI command="cache:flush" stepKey="flushCache"/> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> </after> <!--Go to store front (default) and click Create an Account.--> diff --git a/app/code/Magento/Newsletter/Test/Mftf/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnNewsletterTest.xml b/app/code/Magento/Newsletter/Test/Mftf/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnNewsletterTest.xml index 0c20357127e6d..3a247402c111d 100644 --- a/app/code/Magento/Newsletter/Test/Mftf/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnNewsletterTest.xml +++ b/app/code/Magento/Newsletter/Test/Mftf/Test/VerifyTinyMCEv4IsNativeWYSIWYGOnNewsletterTest.xml @@ -18,7 +18,7 @@ <testCaseId value="MAGETWO-84683"/> </annotations> <before> - <actionGroup ref="LoginActionGroup" stepKey="loginGetFromGeneralFile"/> + <actionGroup ref="AdminLoginActionGroup" stepKey="loginGetFromGeneralFile"/> <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> </before> @@ -49,7 +49,7 @@ <closeTab stepKey="closeTab"/> <after> <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> </test> </tests> diff --git a/app/code/Magento/Newsletter/etc/extension_attributes.xml b/app/code/Magento/Newsletter/etc/extension_attributes.xml index 50f46af5c033b..09925024e97d5 100644 --- a/app/code/Magento/Newsletter/etc/extension_attributes.xml +++ b/app/code/Magento/Newsletter/etc/extension_attributes.xml @@ -8,6 +8,10 @@ <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd"> <extension_attributes for="Magento\Customer\Api\Data\CustomerInterface"> - <attribute code="is_subscribed" type="boolean" /> + <attribute code="is_subscribed" type="boolean" > + <join reference_table="newsletter_subscriber" reference_field="customer_id" join_on_field="entity_id"> + <field>subscriber_status</field> + </join> + </attribute> </extension_attributes> </config> diff --git a/app/code/Magento/OfflinePayments/Observer/BeforeOrderPaymentSaveObserver.php b/app/code/Magento/OfflinePayments/Observer/BeforeOrderPaymentSaveObserver.php index d7cad6b62e993..234bec96d46d1 100644 --- a/app/code/Magento/OfflinePayments/Observer/BeforeOrderPaymentSaveObserver.php +++ b/app/code/Magento/OfflinePayments/Observer/BeforeOrderPaymentSaveObserver.php @@ -3,9 +3,11 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace Magento\OfflinePayments\Observer; +use Magento\Framework\Event\Observer; use Magento\Framework\Event\ObserverInterface; use Magento\OfflinePayments\Model\Banktransfer; use Magento\OfflinePayments\Model\Cashondelivery; @@ -19,10 +21,10 @@ class BeforeOrderPaymentSaveObserver implements ObserverInterface /** * Sets current instructions for bank transfer account * - * @param \Magento\Framework\Event\Observer $observer + * @param Observer $observer * @return void */ - public function execute(\Magento\Framework\Event\Observer $observer) + public function execute(Observer $observer) { /** @var \Magento\Sales\Model\Order\Payment $payment */ $payment = $observer->getEvent()->getPayment(); @@ -34,15 +36,22 @@ public function execute(\Magento\Framework\Event\Observer $observer) && empty($payment->getAdditionalInformation('instructions'))) { $payment->setAdditionalInformation( 'instructions', - $payment->getMethodInstance()->getInstructions() + $payment->getMethodInstance()->getConfigData( + 'instructions', + $payment->getOrder()->getStoreId() + ) ); } elseif ($payment->getMethod() === Checkmo::PAYMENT_METHOD_CHECKMO_CODE) { $methodInstance = $payment->getMethodInstance(); - if (!empty($methodInstance->getPayableTo())) { - $payment->setAdditionalInformation('payable_to', $methodInstance->getPayableTo()); + $storeId = $payment->getOrder()->getStoreId(); + + $payableTo = $methodInstance->getConfigData('payable_to', $storeId); + if (!empty($payableTo)) { + $payment->setAdditionalInformation('payable_to', $payableTo); } - if (!empty($methodInstance->getMailingAddress())) { - $payment->setAdditionalInformation('mailing_address', $methodInstance->getMailingAddress()); + $mailingAddress = $methodInstance->getConfigData('mailing_address', $storeId); + if (!empty($mailingAddress)) { + $payment->setAdditionalInformation('mailing_address', $mailingAddress); } } } diff --git a/app/code/Magento/OfflinePayments/Test/Unit/Observer/BeforeOrderPaymentSaveObserverTest.php b/app/code/Magento/OfflinePayments/Test/Unit/Observer/BeforeOrderPaymentSaveObserverTest.php index 0b482a805175a..18f57269b616b 100644 --- a/app/code/Magento/OfflinePayments/Test/Unit/Observer/BeforeOrderPaymentSaveObserverTest.php +++ b/app/code/Magento/OfflinePayments/Test/Unit/Observer/BeforeOrderPaymentSaveObserverTest.php @@ -10,32 +10,44 @@ use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; use Magento\OfflinePayments\Model\Banktransfer; use Magento\OfflinePayments\Model\Cashondelivery; +use Magento\OfflinePayments\Model\Checkmo; use Magento\OfflinePayments\Observer\BeforeOrderPaymentSaveObserver; +use Magento\Sales\Model\Order; use Magento\Sales\Model\Order\Payment; -use PHPUnit_Framework_MockObject_MockObject as MockObject; -use Magento\OfflinePayments\Model\Checkmo; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; -class BeforeOrderPaymentSaveObserverTest extends \PHPUnit\Framework\TestCase +/** + * Test class for \Magento\OfflinePayments\Observer\BeforeOrderPaymentSaveObserver + */ +class BeforeOrderPaymentSaveObserverTest extends TestCase { + private const STORE_ID = 1; + /** * @var BeforeOrderPaymentSaveObserver */ - protected $_model; + private $model; /** * @var Payment|MockObject */ - private $payment; + private $paymentMock; /** * @var Event|MockObject */ - private $event; + private $eventMock; /** * @var Observer|MockObject */ - private $observer; + private $observerMock; + + /** + * @var Order|MockObject + */ + private $orderMock; /** * @inheritdoc @@ -43,40 +55,50 @@ class BeforeOrderPaymentSaveObserverTest extends \PHPUnit\Framework\TestCase protected function setUp() { $objectManagerHelper = new ObjectManager($this); - $this->payment = $this->getMockBuilder(Payment::class) + $this->paymentMock = $this->getMockBuilder(Payment::class) ->disableOriginalConstructor() ->getMock(); - $this->event = $this->getMockBuilder(Event::class) + $this->eventMock = $this->getMockBuilder(Event::class) ->disableOriginalConstructor() ->setMethods(['getPayment']) ->getMock(); - $this->event->expects(self::once()) + $this->eventMock->expects(self::once()) ->method('getPayment') - ->willReturn($this->payment); + ->willReturn($this->paymentMock); - $this->observer = $this->getMockBuilder(Observer::class) + $this->observerMock = $this->getMockBuilder(Observer::class) ->disableOriginalConstructor() ->getMock(); - $this->observer->expects(self::once()) + $this->observerMock->expects(self::once()) ->method('getEvent') - ->willReturn($this->event); + ->willReturn($this->eventMock); + + $this->orderMock = $this->getMockBuilder(Order::class) + ->disableOriginalConstructor() + ->getMock(); + $this->orderMock->method('getStoreId') + ->willReturn(static::STORE_ID); - $this->_model = $objectManagerHelper->getObject(BeforeOrderPaymentSaveObserver::class); + $this->paymentMock->method('getOrder') + ->willReturn($this->orderMock); + + $this->model = $objectManagerHelper->getObject(BeforeOrderPaymentSaveObserver::class); } /** + * Checks a case when payment method is either bank transfer or cash on delivery * @param string $methodCode * @dataProvider dataProviderBeforeOrderPaymentSaveWithInstructions */ public function testBeforeOrderPaymentSaveWithInstructions($methodCode) { - $this->payment->expects(self::once()) + $this->paymentMock->expects(self::once()) ->method('getMethod') ->willReturn($methodCode); - $this->payment->expects(self::once()) + $this->paymentMock->expects(self::once()) ->method('setAdditionalInformation') ->with('instructions', 'payment configuration'); $method = $this->getMockBuilder(Banktransfer::class) @@ -84,13 +106,14 @@ public function testBeforeOrderPaymentSaveWithInstructions($methodCode) ->getMock(); $method->expects(self::once()) - ->method('getInstructions') + ->method('getConfigData') + ->with('instructions', static::STORE_ID) ->willReturn('payment configuration'); - $this->payment->expects(self::once()) + $this->paymentMock->expects(self::once()) ->method('getMethodInstance') ->willReturn($method); - $this->_model->execute($this->observer); + $this->model->execute($this->observerMock); } /** @@ -106,33 +129,37 @@ public function dataProviderBeforeOrderPaymentSaveWithInstructions() ]; } + /** + * Checks a case when payment method is Check Money + */ public function testBeforeOrderPaymentSaveWithCheckmo() { - $this->payment->expects(self::exactly(2)) + $this->paymentMock->expects(self::exactly(2)) ->method('getMethod') ->willReturn(Checkmo::PAYMENT_METHOD_CHECKMO_CODE); - $this->payment->expects(self::exactly(2)) + $this->paymentMock->expects(self::exactly(2)) ->method('setAdditionalInformation') ->willReturnMap( [ - ['payable_to', 'payable to', $this->payment], - ['mailing_address', 'mailing address', $this->payment], + ['payable_to', 'payable to', $this->paymentMock], + ['mailing_address', 'mailing address', $this->paymentMock], ] ); $method = $this->getMockBuilder(Checkmo::class) ->disableOriginalConstructor() ->getMock(); - $method->expects(self::exactly(2)) - ->method('getPayableTo') - ->willReturn('payable to'); - $method->expects(self::exactly(2)) - ->method('getMailingAddress') - ->willReturn('mailing address'); - $this->payment->expects(self::once()) + $method->method('getConfigData') + ->willReturnMap( + [ + ['payable_to', static::STORE_ID, 'payable to'], + ['mailing_address', static::STORE_ID, 'mailing address'] + ] + ); + $this->paymentMock->expects(self::once()) ->method('getMethodInstance') ->willReturn($method); - $this->_model->execute($this->observer); + $this->model->execute($this->observerMock); } /** @@ -141,36 +168,40 @@ public function testBeforeOrderPaymentSaveWithCheckmo() */ public function testBeforeOrderPaymentSaveWithCheckmoWithoutConfig() { - $this->payment->expects(self::exactly(2)) + $this->paymentMock->expects(self::exactly(2)) ->method('getMethod') ->willReturn(Checkmo::PAYMENT_METHOD_CHECKMO_CODE); - $this->payment->expects(self::never()) + $this->paymentMock->expects(self::never()) ->method('setAdditionalInformation'); $method = $this->getMockBuilder(Checkmo::class) ->disableOriginalConstructor() ->getMock(); - $method->expects(self::once()) - ->method('getPayableTo') - ->willReturn(null); - $method->expects(self::once()) - ->method('getMailingAddress') - ->willReturn(null); - $this->payment->expects(self::once()) + $method->method('getConfigData') + ->willReturnMap( + [ + ['payable_to', static::STORE_ID, null], + ['mailing_address', static::STORE_ID, null] + ] + ); + $this->paymentMock->expects(self::once()) ->method('getMethodInstance') ->willReturn($method); - $this->_model->execute($this->observer); + $this->model->execute($this->observerMock); } + /** + * Checks a case with payment method not handled by observer + */ public function testBeforeOrderPaymentSaveWithOthers() { - $this->payment->expects(self::exactly(2)) + $this->paymentMock->expects(self::exactly(2)) ->method('getMethod') ->willReturn('somepaymentmethod'); - $this->payment->expects(self::never()) + $this->paymentMock->expects(self::never()) ->method('setAdditionalInformation'); - $this->_model->execute($this->observer); + $this->model->execute($this->observerMock); } /** @@ -179,17 +210,16 @@ public function testBeforeOrderPaymentSaveWithOthers() */ public function testBeforeOrderPaymentSaveWithInstructionsAlreadySet($methodCode) { - $this->payment - ->method('getMethod') + $this->paymentMock->method('getMethod') ->willReturn($methodCode); - $this->payment->expects(self::once()) + $this->paymentMock->expects(self::once()) ->method('getAdditionalInformation') ->willReturn('Test'); - $this->payment->expects(self::never()) + $this->paymentMock->expects(self::never()) ->method('setAdditionalInformation'); - $this->_model->execute($this->observer); + $this->model->execute($this->observerMock); } } diff --git a/app/code/Magento/PageCache/Test/Mftf/Test/AdminFrontendAreaSessionMustNotAffectAdminAreaTest.xml b/app/code/Magento/PageCache/Test/Mftf/Test/AdminFrontendAreaSessionMustNotAffectAdminAreaTest.xml index 375211e5f2f51..c94eed9dc6a57 100644 --- a/app/code/Magento/PageCache/Test/Mftf/Test/AdminFrontendAreaSessionMustNotAffectAdminAreaTest.xml +++ b/app/code/Magento/PageCache/Test/Mftf/Test/AdminFrontendAreaSessionMustNotAffectAdminAreaTest.xml @@ -40,7 +40,7 @@ </createData> <magentoCLI command="cache:clean" arguments="full_page" stepKey="clearCache"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="logoutCustomer"/> <resetCookie userInput="PHPSESSID" stepKey="resetSessionCookie"/> </before> @@ -54,7 +54,7 @@ <deleteData createDataKey="createCategoryB" stepKey="deleteCategoryB"/> <deleteData createDataKey="createCategoryA" stepKey="deleteCategoryA"/> - <actionGroup ref="logout" stepKey="logoutAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutAdmin"/> </after> <!-- 1. Login as admin --> diff --git a/app/code/Magento/Paypal/Test/Mftf/Test/AdminCheckDefaultValueOfPayPalCustomizeButtonTest.xml b/app/code/Magento/Paypal/Test/Mftf/Test/AdminCheckDefaultValueOfPayPalCustomizeButtonTest.xml index 5c10bc9536fcf..3a3ae03d63bf3 100644 --- a/app/code/Magento/Paypal/Test/Mftf/Test/AdminCheckDefaultValueOfPayPalCustomizeButtonTest.xml +++ b/app/code/Magento/Paypal/Test/Mftf/Test/AdminCheckDefaultValueOfPayPalCustomizeButtonTest.xml @@ -22,11 +22,11 @@ </skip> </annotations> <before> - <actionGroup ref="LoginActionGroup" stepKey="login"/> + <actionGroup ref="AdminLoginActionGroup" stepKey="login"/> <actionGroup ref="ConfigPayPalExpressCheckout" stepKey="ConfigPayPalExpressCheckout"/> </before> <after> - <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> </after> <amOnPage url="{{AdminConfigPaymentMethodsPage.url}}" stepKey="navigateToPaymentConfigurationPage"/> <waitForPageLoad stepKey="waitForPageLoad1"/> diff --git a/app/code/Magento/Paypal/Test/Mftf/Test/AdminConfigPaymentsConflictResolutionForPayPal.xml b/app/code/Magento/Paypal/Test/Mftf/Test/AdminConfigPaymentsConflictResolutionForPayPal.xml index e918a417dcfde..3e1a825861b5e 100644 --- a/app/code/Magento/Paypal/Test/Mftf/Test/AdminConfigPaymentsConflictResolutionForPayPal.xml +++ b/app/code/Magento/Paypal/Test/Mftf/Test/AdminConfigPaymentsConflictResolutionForPayPal.xml @@ -29,7 +29,7 @@ <magentoCLI command="config:set payment/paypal_express/active 0" stepKey="disablePayPalExpress"/> <magentoCLI command="config:set payment/wps_express/active 0" stepKey="disableWPSExpress"/> <magentoCLI command="config:set payment/hosted_pro/active 0" stepKey="disableHostedProExpress"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Change Merchant Country --> <comment userInput="Change Merchant Country" stepKey="changeMerchantCountryComment"/> diff --git a/app/code/Magento/Paypal/Test/Mftf/Test/AdminConfigPaymentsSectionState.xml b/app/code/Magento/Paypal/Test/Mftf/Test/AdminConfigPaymentsSectionState.xml index 934449dfd136c..ba5e701ceea66 100644 --- a/app/code/Magento/Paypal/Test/Mftf/Test/AdminConfigPaymentsSectionState.xml +++ b/app/code/Magento/Paypal/Test/Mftf/Test/AdminConfigPaymentsSectionState.xml @@ -18,7 +18,7 @@ <testCaseId value="MAGETWO-92043"/> </annotations> <after> - <actionGroup ref="logout" stepKey="amOnLogoutPage"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="amOnLogoutPage"/> </after> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin1"/> diff --git a/app/code/Magento/Paypal/Test/Mftf/Test/AdminOnePayPalSolutionsEnabledAtTheSameTimeTest.xml b/app/code/Magento/Paypal/Test/Mftf/Test/AdminOnePayPalSolutionsEnabledAtTheSameTimeTest.xml index fd0e74f38287d..ede251ddee647 100644 --- a/app/code/Magento/Paypal/Test/Mftf/Test/AdminOnePayPalSolutionsEnabledAtTheSameTimeTest.xml +++ b/app/code/Magento/Paypal/Test/Mftf/Test/AdminOnePayPalSolutionsEnabledAtTheSameTimeTest.xml @@ -32,7 +32,7 @@ <magentoCLI command="config:set payment/wps_express/active 1" stepKey="enableWPSExpress"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <magentoCLI command="config:set payment/wps_express/active 0" stepKey="disableWPSExpress"/> <magentoCLI command="config:set payment/paypal_express/active 0" stepKey="disableExpressCheckout"/> </after> diff --git a/app/code/Magento/Paypal/Test/Mftf/Test/AdminReportsPayPalSettlementNavigateMenuTest.xml b/app/code/Magento/Paypal/Test/Mftf/Test/AdminReportsPayPalSettlementNavigateMenuTest.xml index 03f0167230e9f..d2cdec73551d0 100644 --- a/app/code/Magento/Paypal/Test/Mftf/Test/AdminReportsPayPalSettlementNavigateMenuTest.xml +++ b/app/code/Magento/Paypal/Test/Mftf/Test/AdminReportsPayPalSettlementNavigateMenuTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToPayPalSettlementPage"> <argument name="menuUiId" value="{{AdminMenuReports.dataUiId}}"/> diff --git a/app/code/Magento/Paypal/Test/Mftf/Test/AdminSalesBillingAgreementsNavigateMenuTest.xml b/app/code/Magento/Paypal/Test/Mftf/Test/AdminSalesBillingAgreementsNavigateMenuTest.xml index 8c3735fcbd253..2f0013c43fd9e 100644 --- a/app/code/Magento/Paypal/Test/Mftf/Test/AdminSalesBillingAgreementsNavigateMenuTest.xml +++ b/app/code/Magento/Paypal/Test/Mftf/Test/AdminSalesBillingAgreementsNavigateMenuTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToBillingAgreementsPage"> <argument name="menuUiId" value="{{AdminMenuSales.dataUiId}}"/> diff --git a/app/code/Magento/Paypal/Test/Mftf/Test/StorefrontCheckCreditButtonConfigurationTest.xml b/app/code/Magento/Paypal/Test/Mftf/Test/StorefrontCheckCreditButtonConfigurationTest.xml index 78a27106bf406..c8089085b7ee5 100644 --- a/app/code/Magento/Paypal/Test/Mftf/Test/StorefrontCheckCreditButtonConfigurationTest.xml +++ b/app/code/Magento/Paypal/Test/Mftf/Test/StorefrontCheckCreditButtonConfigurationTest.xml @@ -28,7 +28,7 @@ </createData> <!-- Create Customer --> <createData entity="Simple_US_Customer" stepKey="createCustomer"/> - <actionGroup ref="LoginActionGroup" stepKey="login"/> + <actionGroup ref="AdminLoginActionGroup" stepKey="login"/> <!--Config PayPal Express Checkout--> <comment userInput="config PayPal Express Checkout" stepKey="commemtConfigPayPalExpressCheckout"/> <actionGroup ref="ConfigPayPalExpressCheckout" stepKey="ConfigPayPalExpressCheckout"/> @@ -37,7 +37,7 @@ <deleteData stepKey="deleteCategory" createDataKey="createPreReqCategory"/> <deleteData stepKey="deleteProduct" createDataKey="createPreReqProduct"/> <deleteData stepKey="deleteCustomer" createDataKey="createCustomer"/> - <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> </after> <amOnPage url="{{AdminConfigPaymentMethodsPage.url}}" stepKey="navigateToPaymentConfigurationPage"/> <waitForPageLoad stepKey="waitForPageLoad1"/> diff --git a/app/code/Magento/Paypal/Test/Mftf/Test/StorefrontPaypalSmartButtonInCheckoutPageTest.xml b/app/code/Magento/Paypal/Test/Mftf/Test/StorefrontPaypalSmartButtonInCheckoutPageTest.xml index fea1cf3966b99..b95d645787fed 100644 --- a/app/code/Magento/Paypal/Test/Mftf/Test/StorefrontPaypalSmartButtonInCheckoutPageTest.xml +++ b/app/code/Magento/Paypal/Test/Mftf/Test/StorefrontPaypalSmartButtonInCheckoutPageTest.xml @@ -37,7 +37,7 @@ <createData entity="PaypalConfig" stepKey="createPaypalExpressConfig"/> <!-- Login --> - <actionGroup ref="LoginActionGroup" stepKey="login"/> + <actionGroup ref="AdminLoginActionGroup" stepKey="login"/> </before> <after> <!-- Cleanup Paypal configurations --> @@ -55,7 +55,7 @@ <deleteData stepKey="deleteCustomer" createDataKey="createCustomer"/> <!-- Logout --> - <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> </after> <!--Login to storefront as previously created customer--> diff --git a/app/code/Magento/Persistent/Test/Mftf/Test/CheckShoppingCartBehaviorAfterSessionExpiredTest.xml b/app/code/Magento/Persistent/Test/Mftf/Test/CheckShoppingCartBehaviorAfterSessionExpiredTest.xml index 6d35319172823..a2488d564001c 100644 --- a/app/code/Magento/Persistent/Test/Mftf/Test/CheckShoppingCartBehaviorAfterSessionExpiredTest.xml +++ b/app/code/Magento/Persistent/Test/Mftf/Test/CheckShoppingCartBehaviorAfterSessionExpiredTest.xml @@ -31,7 +31,7 @@ <argument name="Customer" value="Simple_US_Customer_NY"/> </actionGroup> <!--Add shipping information--> - <actionGroup ref="EnterCustomerAddressInfo" stepKey="enterAddressInfo"> + <actionGroup ref="EnterCustomerAddressInfoActionGroup" stepKey="enterAddressInfo"> <argument name="Address" value="US_Address_NY"/> </actionGroup> </before> diff --git a/app/code/Magento/Persistent/Test/Mftf/Test/ShippingQuotePersistedForGuestTest.xml b/app/code/Magento/Persistent/Test/Mftf/Test/ShippingQuotePersistedForGuestTest.xml index e81694e044f52..eebadbeaa0eec 100644 --- a/app/code/Magento/Persistent/Test/Mftf/Test/ShippingQuotePersistedForGuestTest.xml +++ b/app/code/Magento/Persistent/Test/Mftf/Test/ShippingQuotePersistedForGuestTest.xml @@ -37,7 +37,7 @@ <createData entity="PersistentConfigDefault" stepKey="setDefaultPersistentState"/> <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Step 1: Login as a Customer with remember me checked--> <actionGroup ref="CustomerLoginOnStorefrontWithRememberMeCheckedActionGroup" stepKey="loginToStorefrontAccountWithRememberMeChecked"> diff --git a/app/code/Magento/Persistent/Test/Mftf/Test/StorefrontVerifyShoppingCartPersistenceUnderLongTermCookieTest.xml b/app/code/Magento/Persistent/Test/Mftf/Test/StorefrontVerifyShoppingCartPersistenceUnderLongTermCookieTest.xml index 35f4fd88f2b09..2aa43e9ef828d 100644 --- a/app/code/Magento/Persistent/Test/Mftf/Test/StorefrontVerifyShoppingCartPersistenceUnderLongTermCookieTest.xml +++ b/app/code/Magento/Persistent/Test/Mftf/Test/StorefrontVerifyShoppingCartPersistenceUnderLongTermCookieTest.xml @@ -45,7 +45,7 @@ <actionGroup ref="AdminDeleteCustomerActionGroup" stepKey="deleteJohnDoeCustomer"> <argument name="customerEmail" value="Simple_Customer_Without_Address.email"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- 1. Go to storefront and click the Create an Account link--> diff --git a/app/code/Magento/Persistent/Test/Mftf/Test/StorefrontVerifyThatInformationAboutViewingComparisonWishlistIsPersistedUnderLongTermCookieTest.xml b/app/code/Magento/Persistent/Test/Mftf/Test/StorefrontVerifyThatInformationAboutViewingComparisonWishlistIsPersistedUnderLongTermCookieTest.xml index 1b3a996b34e24..1f84200f856d9 100644 --- a/app/code/Magento/Persistent/Test/Mftf/Test/StorefrontVerifyThatInformationAboutViewingComparisonWishlistIsPersistedUnderLongTermCookieTest.xml +++ b/app/code/Magento/Persistent/Test/Mftf/Test/StorefrontVerifyThatInformationAboutViewingComparisonWishlistIsPersistedUnderLongTermCookieTest.xml @@ -60,7 +60,7 @@ <actionGroup ref="AdminDeleteWidgetActionGroup" stepKey="deleteRecentlyViewedProductsWidget"> <argument name="widget" value="RecentlyViewedProductsWidget"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Login to storefront from customer--> diff --git a/app/code/Magento/ProductVideo/Test/Mftf/Test/AdminValidateUrlOnGetVideoInformationTest.xml b/app/code/Magento/ProductVideo/Test/Mftf/Test/AdminValidateUrlOnGetVideoInformationTest.xml index 03fb71ac039a7..183bd64d97678 100644 --- a/app/code/Magento/ProductVideo/Test/Mftf/Test/AdminValidateUrlOnGetVideoInformationTest.xml +++ b/app/code/Magento/ProductVideo/Test/Mftf/Test/AdminValidateUrlOnGetVideoInformationTest.xml @@ -22,7 +22,7 @@ </before> <after> <createData entity="DefaultProductVideoConfig" stepKey="setStoreDefaultConfig"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="navigateToProductIndexPage"/> <actionGroup ref="GoToCreateProductPageActionGroup" stepKey="goToCreateProduct"> diff --git a/app/code/Magento/ProductVideo/Test/Mftf/Test/YoutubeVideoWindowOnProductPageTest.xml b/app/code/Magento/ProductVideo/Test/Mftf/Test/YoutubeVideoWindowOnProductPageTest.xml index 13d396b4faf45..ee03e811ae579 100644 --- a/app/code/Magento/ProductVideo/Test/Mftf/Test/YoutubeVideoWindowOnProductPageTest.xml +++ b/app/code/Magento/ProductVideo/Test/Mftf/Test/YoutubeVideoWindowOnProductPageTest.xml @@ -85,7 +85,7 @@ <!-- Set product video configuration to default --> <createData entity="DefaultProductVideoConfig" stepKey="setStoreDefaultConfig" before="logout"/> <!--Log Out--> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> </test> </tests> diff --git a/app/code/Magento/Reports/Block/Adminhtml/Product/Lowstock/Grid.php b/app/code/Magento/Reports/Block/Adminhtml/Product/Lowstock/Grid.php index 5460dab3a7ff8..a7a79ff05640d 100644 --- a/app/code/Magento/Reports/Block/Adminhtml/Product/Lowstock/Grid.php +++ b/app/code/Magento/Reports/Block/Adminhtml/Product/Lowstock/Grid.php @@ -3,8 +3,17 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\Reports\Block\Adminhtml\Product\Lowstock; +use Magento\Backend\Block\Template\Context; +use Magento\Backend\Helper\Data; +use Magento\Catalog\Model\Product\Attribute\Source\Status; +use Magento\Framework\Data\Collection as DataCollection; +use Magento\Reports\Model\ResourceModel\Product\Lowstock\Collection; +use Magento\Reports\Model\ResourceModel\Product\Lowstock\CollectionFactory; + /** * Adminhtml low stock products report grid block * @@ -15,20 +24,20 @@ class Grid extends \Magento\Backend\Block\Widget\Grid { /** - * @var \Magento\Reports\Model\ResourceModel\Product\Lowstock\CollectionFactory + * @var CollectionFactory */ protected $_lowstocksFactory; /** - * @param \Magento\Backend\Block\Template\Context $context - * @param \Magento\Backend\Helper\Data $backendHelper - * @param \Magento\Reports\Model\ResourceModel\Product\Lowstock\CollectionFactory $lowstocksFactory + * @param Context $context + * @param Data $backendHelper + * @param CollectionFactory $lowstocksFactory * @param array $data */ public function __construct( - \Magento\Backend\Block\Template\Context $context, - \Magento\Backend\Helper\Data $backendHelper, - \Magento\Reports\Model\ResourceModel\Product\Lowstock\CollectionFactory $lowstocksFactory, + Context $context, + Data $backendHelper, + CollectionFactory $lowstocksFactory, array $data = [] ) { $this->_lowstocksFactory = $lowstocksFactory; @@ -36,6 +45,8 @@ public function __construct( } /** + * @inheritDoc + * * @return \Magento\Backend\Block\Widget\Grid */ protected function _prepareCollection() @@ -56,7 +67,7 @@ protected function _prepareCollection() $storeId = null; } - /** @var $collection \Magento\Reports\Model\ResourceModel\Product\Lowstock\Collection */ + /** @var $collection Collection */ $collection = $this->_lowstocksFactory->create()->addAttributeToSelect( '*' )->filterByIsQtyProductTypes()->joinInventoryItem( @@ -67,7 +78,10 @@ protected function _prepareCollection() $storeId )->setOrder( 'qty', - \Magento\Framework\Data\Collection::SORT_ORDER_ASC + DataCollection::SORT_ORDER_ASC + )->addAttributeToFilter( + 'status', + Status::STATUS_ENABLED ); if ($storeId) { diff --git a/app/code/Magento/Reports/Test/Mftf/ActionGroup/AdminLowStockReportFilterProductActionGroup.xml b/app/code/Magento/Reports/Test/Mftf/ActionGroup/AdminLowStockReportFilterProductActionGroup.xml new file mode 100644 index 0000000000000..e77502497d83a --- /dev/null +++ b/app/code/Magento/Reports/Test/Mftf/ActionGroup/AdminLowStockReportFilterProductActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminLowStockReportFilterProductActionGroup"> + <annotations> + <description>Filter in "Low Stock" report with by product SKU.</description> + </annotations> + <arguments> + <argument name="sku" type="string" defaultValue="{{_defaultProduct.sku}}"/> + </arguments> + + <fillField selector="{{LowStockReportFilterSection.productSku}}" userInput="{{sku}}" stepKey="fillSkuFilterField" /> + <click selector="{{LowStockReportFilterSection.searchButton}}" stepKey="clickSearch"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsAbandonedCartsNavigateMenuTest.xml b/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsAbandonedCartsNavigateMenuTest.xml index 342955e0684b3..b044b7a9b1f79 100644 --- a/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsAbandonedCartsNavigateMenuTest.xml +++ b/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsAbandonedCartsNavigateMenuTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToAbandonedCartsPage"> <argument name="menuUiId" value="{{AdminMenuReports.dataUiId}}"/> diff --git a/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsBestsellersNavigateMenuTest.xml b/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsBestsellersNavigateMenuTest.xml index 259f2cde2786a..2c78a9568325b 100644 --- a/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsBestsellersNavigateMenuTest.xml +++ b/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsBestsellersNavigateMenuTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToReportsBestsellersPage"> <argument name="menuUiId" value="{{AdminMenuReports.dataUiId}}"/> diff --git a/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsCouponsNavigateMenuTest.xml b/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsCouponsNavigateMenuTest.xml index 321f3078bc63f..ff3372285b211 100644 --- a/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsCouponsNavigateMenuTest.xml +++ b/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsCouponsNavigateMenuTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToReportsCouponsPage"> <argument name="menuUiId" value="{{AdminMenuReports.dataUiId}}"/> diff --git a/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsDownloadsNavigateMenuTest.xml b/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsDownloadsNavigateMenuTest.xml index 584c1af6683aa..05ee0a8032fb5 100644 --- a/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsDownloadsNavigateMenuTest.xml +++ b/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsDownloadsNavigateMenuTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToReportsDownloadsPage"> <argument name="menuUiId" value="{{AdminMenuReports.dataUiId}}"/> diff --git a/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsInvoicedNavigateMenuTest.xml b/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsInvoicedNavigateMenuTest.xml index 34aec0620cad9..f28ffc700c34a 100644 --- a/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsInvoicedNavigateMenuTest.xml +++ b/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsInvoicedNavigateMenuTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToReportsInvoicedPage"> <argument name="menuUiId" value="{{AdminMenuReports.dataUiId}}"/> diff --git a/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsLowStockDisableProductTest.xml b/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsLowStockDisableProductTest.xml new file mode 100644 index 0000000000000..841ba89b643bf --- /dev/null +++ b/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsLowStockDisableProductTest.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminReportsLowStockDisableProductTest"> + <annotations> + <features value="Reports"/> + <group value="reports"/> + <title value="The disabled product doesn't present on 'Low Stock' report."/> + <description value="A product must don't presents on 'Low Stock' report if the product is disabled."/> + </annotations> + <before> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + + <!-- Created disabled simple product with stock quantity zero --> + <createData entity="SimpleProductDisabledStockQuantityZero" stepKey="createProduct"/> + </before> + <after> + <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> + <actionGroup ref="logout" stepKey="logout"/> + </after> + + <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToReportsLowStockPage"> + <argument name="menuUiId" value="{{AdminMenuReports.dataUiId}}"/> + <argument name="submenuUiId" value="{{AdminMenuReportsProductsLowStock.dataUiId}}"/> + </actionGroup> + <actionGroup ref="AdminLowStockReportFilterProductActionGroup" stepKey="assertProductInReport"> + <argument name="sku" value="{{SimpleProductDisabledStockQuantityZero.sku}}"/> + </actionGroup> + + <!-- Verify doesn't present in the report --> + <dontSeeElement selector="{{LowStockProductGridSection.productSku}}" stepKey="assertSelector"/> + </test> +</tests> diff --git a/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsLowStockNavigateMenuTest.xml b/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsLowStockNavigateMenuTest.xml index 5d91d65a3a457..986101a8c0db8 100644 --- a/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsLowStockNavigateMenuTest.xml +++ b/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsLowStockNavigateMenuTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToReportsLowStockPage"> <argument name="menuUiId" value="{{AdminMenuReports.dataUiId}}"/> diff --git a/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsNewNavigateMenuTest.xml b/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsNewNavigateMenuTest.xml index aeb35ba65a380..dd97d092041ca 100644 --- a/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsNewNavigateMenuTest.xml +++ b/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsNewNavigateMenuTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToReportsNewPage"> <argument name="menuUiId" value="{{AdminMenuReports.dataUiId}}"/> diff --git a/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsOrderCountNavigateMenuTest.xml b/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsOrderCountNavigateMenuTest.xml index 1bfbc654746e6..638cc30279966 100644 --- a/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsOrderCountNavigateMenuTest.xml +++ b/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsOrderCountNavigateMenuTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToReportsOrderCountPage"> <argument name="menuUiId" value="{{AdminMenuReports.dataUiId}}"/> diff --git a/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsOrderTotalNavigateMenuTest.xml b/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsOrderTotalNavigateMenuTest.xml index 88c94b53f5233..c1c8256e3d331 100644 --- a/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsOrderTotalNavigateMenuTest.xml +++ b/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsOrderTotalNavigateMenuTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToReportsOrderTotalPage"> <argument name="menuUiId" value="{{AdminMenuReports.dataUiId}}"/> diff --git a/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsOrderedGroupedBySkuTest.xml b/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsOrderedGroupedBySkuTest.xml index d507d6b38f74b..52c0e49ee9291 100644 --- a/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsOrderedGroupedBySkuTest.xml +++ b/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsOrderedGroupedBySkuTest.xml @@ -31,7 +31,7 @@ <actionGroup ref="DeleteProductAttributeByLabelActionGroup" stepKey="deleteAttributeSet"> <argument name="ProductAttribute" value="colorProductAttribute"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Add first configurable product to order--> diff --git a/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsOrderedNavigateMenuTest.xml b/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsOrderedNavigateMenuTest.xml index e81239539a5b5..9053fb35150b6 100644 --- a/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsOrderedNavigateMenuTest.xml +++ b/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsOrderedNavigateMenuTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToReportsOrderedPage"> <argument name="menuUiId" value="{{AdminMenuReports.dataUiId}}"/> diff --git a/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsOrdersNavigateMenuTest.xml b/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsOrdersNavigateMenuTest.xml index 13fc8e7353139..77fd6c46196af 100644 --- a/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsOrdersNavigateMenuTest.xml +++ b/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsOrdersNavigateMenuTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToReportsOrdersPage"> <argument name="menuUiId" value="{{AdminMenuReports.dataUiId}}"/> diff --git a/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsProductsInCartNavigateMenuTest.xml b/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsProductsInCartNavigateMenuTest.xml index 03877f8e58ecc..00b93b0a93180 100644 --- a/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsProductsInCartNavigateMenuTest.xml +++ b/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsProductsInCartNavigateMenuTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToReportsProductsInCartPage"> <argument name="menuUiId" value="{{AdminMenuReports.dataUiId}}"/> diff --git a/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsRefreshStatisticsNavigateMenuTest.xml b/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsRefreshStatisticsNavigateMenuTest.xml index d05fc091357df..94290b918969d 100644 --- a/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsRefreshStatisticsNavigateMenuTest.xml +++ b/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsRefreshStatisticsNavigateMenuTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToReportsRefreshStatisticsPage"> <argument name="menuUiId" value="{{AdminMenuReports.dataUiId}}"/> diff --git a/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsTaxNavigateMenuTest.xml b/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsTaxNavigateMenuTest.xml index 11a065c933a3b..6b34f51c39d88 100644 --- a/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsTaxNavigateMenuTest.xml +++ b/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsTaxNavigateMenuTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToReportsTaxPage"> <argument name="menuUiId" value="{{AdminMenuReports.dataUiId}}"/> diff --git a/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsViewsNavigateMenuTest.xml b/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsViewsNavigateMenuTest.xml index 9154b96c71e38..ff259cc5870ff 100644 --- a/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsViewsNavigateMenuTest.xml +++ b/app/code/Magento/Reports/Test/Mftf/Test/AdminReportsViewsNavigateMenuTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToReportsViewsPage"> <argument name="menuUiId" value="{{AdminMenuReports.dataUiId}}"/> diff --git a/app/code/Magento/Reports/Test/Mftf/Test/CancelOrdersInOrderSalesReportTest.xml b/app/code/Magento/Reports/Test/Mftf/Test/CancelOrdersInOrderSalesReportTest.xml index 324b56757c516..0435ab6b7be49 100644 --- a/app/code/Magento/Reports/Test/Mftf/Test/CancelOrdersInOrderSalesReportTest.xml +++ b/app/code/Magento/Reports/Test/Mftf/Test/CancelOrdersInOrderSalesReportTest.xml @@ -37,7 +37,7 @@ <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createSimpleProduct" stepKey="deleteProduct"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> diff --git a/app/code/Magento/Reports/Test/Unit/Observer/CatalogProductCompareClearObserverTest.php b/app/code/Magento/Reports/Test/Unit/Observer/CatalogProductCompareClearObserverTest.php new file mode 100644 index 0000000000000..018ab943ef9ed --- /dev/null +++ b/app/code/Magento/Reports/Test/Unit/Observer/CatalogProductCompareClearObserverTest.php @@ -0,0 +1,143 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +namespace Magento\Reports\Test\Unit\Observer; + +use Magento\Framework\Event\Observer; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\Reports\Model\Event; +use Magento\Reports\Model\Product\Index\Compared; +use Magento\Reports\Model\Product\Index\ComparedFactory; +use Magento\Reports\Model\ReportStatus; +use Magento\Reports\Observer\CatalogProductCompareClearObserver; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; + +/** + * Unit test for Magento\Reports\Test\Unit\Observer\CatalogProductCompareClearObserver + */ +class CatalogProductCompareClearObserverTest extends TestCase +{ + /** + * Testable Object + * + * @var CatalogProductCompareClearObserver + */ + private $observer; + + /** + * @var ObjectManager + */ + private $objectManager; + + /** + * @var Observer|MockObject + */ + private $observerMock; + + /** + * @var ReportStatus|MockObject + */ + private $reportStatusMock; + + /** + * @var ComparedFactory|MockObject + */ + private $productCompFactoryMock; + + /** + * @var Compared|MockObject + */ + private $productCompModelMock; + + /** + * @var Event|MockObject + */ + private $reportEventMock; + + /** + * @inheritDoc + */ + protected function setUp(): void + { + $this->objectManager = new ObjectManager($this); + $this->observerMock = $this->createMock(Observer::class); + + $this->reportStatusMock = $this->getMockBuilder(ReportStatus::class) + ->disableOriginalConstructor() + ->setMethods(['isReportEnabled']) + ->getMock(); + + $this->reportEventMock = $this->getMockBuilder(Event::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->productCompFactoryMock = $this->getMockBuilder(ComparedFactory::class) + ->disableOriginalConstructor() + ->setMethods(['create']) + ->getMock(); + + $this->productCompModelMock = $this->getMockBuilder(Compared::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->observer = $this->objectManager->getObject( + CatalogProductCompareClearObserver::class, + [ + 'reportStatus' => $this->reportStatusMock, + 'productCompFactory' => $this->productCompFactoryMock + ] + ); + } + + /** + * Test for execute(), covers test case for remove all products from compare products + */ + public function testExecuteRemoveProducts(): void + { + $this->reportStatusMock + ->expects($this->once()) + ->method('isReportEnabled') + ->with(Event::EVENT_PRODUCT_VIEW) + ->willReturn(true); + + $this->productCompFactoryMock + ->expects($this->once()) + ->method('create') + ->willReturn($this->productCompModelMock); + + $this->productCompModelMock + ->expects($this->once()) + ->method('calculate') + ->willReturnSelf(); + + $this->observer->execute($this->observerMock); + } + + /** + * Test for execute(), covers test case for remove all products from compare products with report disabled + */ + public function testExecuteRemoveProductsWithReportDisable(): void + { + $this->reportStatusMock + ->expects($this->once()) + ->method('isReportEnabled') + ->with(Event::EVENT_PRODUCT_VIEW) + ->willReturn(false); + + $this->productCompFactoryMock + ->expects($this->never()) + ->method('create'); + + $this->productCompModelMock + ->expects($this->never()) + ->method('calculate'); + + $this->observer->execute($this->observerMock); + } +} diff --git a/app/code/Magento/Review/Controller/Adminhtml/Product/Pending.php b/app/code/Magento/Review/Controller/Adminhtml/Product/Pending.php index 385b7e12bf32a..6e5e64b25985c 100644 --- a/app/code/Magento/Review/Controller/Adminhtml/Product/Pending.php +++ b/app/code/Magento/Review/Controller/Adminhtml/Product/Pending.php @@ -31,6 +31,7 @@ public function execute() } /** @var \Magento\Backend\Model\View\Result\Page $resultPage */ $resultPage = $this->resultFactory->create(ResultFactory::TYPE_PAGE); + $resultPage->setActiveMenu('Magento_Review::catalog_reviews_ratings_pending'); $resultPage->getConfig()->getTitle()->prepend(__('Customer Reviews')); $resultPage->getConfig()->getTitle()->prepend(__('Pending Reviews')); $this->coreRegistry->register('usePendingFilter', true); diff --git a/app/code/Magento/Review/Model/ResourceModel/Review/Summary.php b/app/code/Magento/Review/Model/ResourceModel/Review/Summary.php index f18bc2094930a..e7597f7c313e4 100644 --- a/app/code/Magento/Review/Model/ResourceModel/Review/Summary.php +++ b/app/code/Magento/Review/Model/ResourceModel/Review/Summary.php @@ -79,14 +79,14 @@ public function reAggregate($summary) * Append review summary fields to product collection * * @param \Magento\Catalog\Model\ResourceModel\Product\Collection $productCollection - * @param string $storeId + * @param int $storeId * @param string $entityCode * @return Summary * @throws \Magento\Framework\Exception\LocalizedException */ public function appendSummaryFieldsToCollection( \Magento\Catalog\Model\ResourceModel\Product\Collection $productCollection, - string $storeId, + int $storeId, string $entityCode ) { if (!$productCollection->isLoaded()) { diff --git a/app/code/Magento/Review/Observer/CatalogProductListCollectionAppendSummaryFieldsObserver.php b/app/code/Magento/Review/Observer/CatalogProductListCollectionAppendSummaryFieldsObserver.php index bb69284b5f0b8..4ee5a5e559fab 100644 --- a/app/code/Magento/Review/Observer/CatalogProductListCollectionAppendSummaryFieldsObserver.php +++ b/app/code/Magento/Review/Observer/CatalogProductListCollectionAppendSummaryFieldsObserver.php @@ -53,7 +53,7 @@ public function execute(EventObserver $observer) $productCollection = $observer->getEvent()->getCollection(); $this->sumResourceFactory->create()->appendSummaryFieldsToCollection( $productCollection, - $this->storeManager->getStore()->getId(), + (int)$this->storeManager->getStore()->getId(), \Magento\Review\Model\Review::ENTITY_PRODUCT_CODE ); diff --git a/app/code/Magento/Review/Test/Mftf/ActionGroup/AdminAssertClassElementRelativeIdActionGroup.xml b/app/code/Magento/Review/Test/Mftf/ActionGroup/AdminAssertClassElementRelativeIdActionGroup.xml new file mode 100644 index 0000000000000..63013ea79b834 --- /dev/null +++ b/app/code/Magento/Review/Test/Mftf/ActionGroup/AdminAssertClassElementRelativeIdActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminAssertClassElementRelativeIdActionGroup"> + <arguments> + <argument name="elementId" type="string" defaultValue="{{AdminMenuSection.marketing}}"/> + <argument name="expectClass" type="string" defaultValue="{{AdminMenuUserContentPendingReviews.activeClass}}" /> + </arguments> + + <grabAttributeFrom selector="{{elementId}}" userInput="class" stepKey="grabClass"/> + <assertContains stepKey="assertClass"> + <actualResult type="string">{$grabClass}</actualResult> + <expectedResult type="string">{{expectClass}}</expectedResult> + </assertContains> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Review/Test/Mftf/Data/AdminMenuData.xml b/app/code/Magento/Review/Test/Mftf/Data/AdminMenuData.xml index 89882707f5ebd..faff1e1f42932 100644 --- a/app/code/Magento/Review/Test/Mftf/Data/AdminMenuData.xml +++ b/app/code/Magento/Review/Test/Mftf/Data/AdminMenuData.xml @@ -13,6 +13,12 @@ <data key="title">Reviews</data> <data key="dataUiId">magento-review-catalog-reviews-ratings-reviews-all</data> </entity> + <entity name="AdminMenuUserContentPendingReviews"> + <data key="pageTitle">Pending Reviews</data> + <data key="title">Pending Reviews</data> + <data key="dataUiId">magento-review-catalog-reviews-ratings-pending</data> + <data key="dataActiveClass">_active</data> + </entity> <entity name="AdminMenuReportsReviewsByCustomers"> <data key="pageTitle">Customer Reviews Report</data> <data key="title">By Customers</data> diff --git a/app/code/Magento/Review/Test/Mftf/Test/AdminMarketingPendingReviewsNavigateMenuActiveTest.xml b/app/code/Magento/Review/Test/Mftf/Test/AdminMarketingPendingReviewsNavigateMenuActiveTest.xml new file mode 100644 index 0000000000000..f1bba674ac5eb --- /dev/null +++ b/app/code/Magento/Review/Test/Mftf/Test/AdminMarketingPendingReviewsNavigateMenuActiveTest.xml @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminMarketingPendingReviewsNavigateMenuActiveTest"> + <annotations> + <features value="Pending Reviews"/> + <stories value="Menu Navigation"/> + <title value="Admin marketing pending reviews navigate menu"/> + <description value="Admin able see navigate head menu Marketing is active, when open page Marketing > Pending Reviews"/> + <group value="menu"/> + </annotations> + <before> + <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> + </before> + <after> + <actionGroup ref="logout" stepKey="logout"/> + </after> + <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToReportsViewsPage"> + <argument name="menuUiId" value="{{AdminMenuMarketing.dataUiId}}"/> + <argument name="submenuUiId" value="{{AdminMenuUserContentPendingReviews.dataUiId}}"/> + </actionGroup> + <actionGroup ref="AdminAssertPageTitleActionGroup" stepKey="seePageTitle"> + <argument name="title" value="{{AdminMenuUserContentPendingReviews.pageTitle}}"/> + </actionGroup> + <actionGroup ref="AdminAssertClassElementRelativeIdActionGroup" stepKey="assertClass"> + <argument name="elementId" value="{{AdminMenuSection.marketing}}"/> + <argument name="expectClass" value="{{AdminMenuUserContentPendingReviews.dataActiveClass}}"/> + </actionGroup> + </test> +</tests> diff --git a/app/code/Magento/Review/Test/Mftf/Test/AdminMarketingReviewsNavigateMenuTest.xml b/app/code/Magento/Review/Test/Mftf/Test/AdminMarketingReviewsNavigateMenuTest.xml index fade220d22100..5f0bf53012126 100644 --- a/app/code/Magento/Review/Test/Mftf/Test/AdminMarketingReviewsNavigateMenuTest.xml +++ b/app/code/Magento/Review/Test/Mftf/Test/AdminMarketingReviewsNavigateMenuTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToReportsViewsPage"> <argument name="menuUiId" value="{{AdminMenuMarketing.dataUiId}}"/> diff --git a/app/code/Magento/Review/Test/Mftf/Test/AdminReportsByCustomersNavigateMenuTest.xml b/app/code/Magento/Review/Test/Mftf/Test/AdminReportsByCustomersNavigateMenuTest.xml index 58492424e76f7..bc8b5655ad537 100644 --- a/app/code/Magento/Review/Test/Mftf/Test/AdminReportsByCustomersNavigateMenuTest.xml +++ b/app/code/Magento/Review/Test/Mftf/Test/AdminReportsByCustomersNavigateMenuTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToReportsByCustomersPage"> <argument name="menuUiId" value="{{AdminMenuReports.dataUiId}}"/> diff --git a/app/code/Magento/Review/Test/Mftf/Test/AdminReportsByProductsNavigateMenuTest.xml b/app/code/Magento/Review/Test/Mftf/Test/AdminReportsByProductsNavigateMenuTest.xml index e848aa4f22023..cab50343efb54 100644 --- a/app/code/Magento/Review/Test/Mftf/Test/AdminReportsByProductsNavigateMenuTest.xml +++ b/app/code/Magento/Review/Test/Mftf/Test/AdminReportsByProductsNavigateMenuTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToReportsByProductsPage"> <argument name="menuUiId" value="{{AdminMenuReports.dataUiId}}"/> diff --git a/app/code/Magento/Review/Test/Mftf/Test/AdminStoresRatingNavigateMenuTest.xml b/app/code/Magento/Review/Test/Mftf/Test/AdminStoresRatingNavigateMenuTest.xml index 511ed5439dc3d..ad211a2ee0ec8 100644 --- a/app/code/Magento/Review/Test/Mftf/Test/AdminStoresRatingNavigateMenuTest.xml +++ b/app/code/Magento/Review/Test/Mftf/Test/AdminStoresRatingNavigateMenuTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToStoresRatingPage"> <argument name="menuUiId" value="{{AdminMenuStores.dataUiId}}"/> diff --git a/app/code/Magento/Review/Test/Mftf/Test/AdminVerifyNewRatingFormSingleStoreModeNoTest.xml b/app/code/Magento/Review/Test/Mftf/Test/AdminVerifyNewRatingFormSingleStoreModeNoTest.xml index 77789dd172bdd..f6e80119610c0 100644 --- a/app/code/Magento/Review/Test/Mftf/Test/AdminVerifyNewRatingFormSingleStoreModeNoTest.xml +++ b/app/code/Magento/Review/Test/Mftf/Test/AdminVerifyNewRatingFormSingleStoreModeNoTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateToNewRatingFormActionGroup" stepKey="navigateToNewRatingPage" /> <actionGroup ref="AdminAssertStoreViewRatingTitleWhenSingleStoreModeIsNoActionGroup" stepKey="verifyForm" /> diff --git a/app/code/Magento/Review/Test/Mftf/Test/AdminVerifyNewRatingFormSingleStoreModeYesTest.xml b/app/code/Magento/Review/Test/Mftf/Test/AdminVerifyNewRatingFormSingleStoreModeYesTest.xml index e5368e9192c98..5c4a455dde9ae 100644 --- a/app/code/Magento/Review/Test/Mftf/Test/AdminVerifyNewRatingFormSingleStoreModeYesTest.xml +++ b/app/code/Magento/Review/Test/Mftf/Test/AdminVerifyNewRatingFormSingleStoreModeYesTest.xml @@ -24,7 +24,7 @@ </before> <after> <magentoCLI command="config:set general/single_store_mode/enabled 0" stepKey="enabledSingleStoreMode"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateToNewRatingFormActionGroup" stepKey="navigateToNewRatingPage" /> <actionGroup ref="AdminAssertStoreViewRatingTitleWhenSingleStoreModeIsYesActionGroup" stepKey="verifyForm" /> diff --git a/app/code/Magento/Review/Test/Mftf/Test/StorefrontNoJavascriptErrorOnAddYourReviewClickTest.xml b/app/code/Magento/Review/Test/Mftf/Test/StorefrontNoJavascriptErrorOnAddYourReviewClickTest.xml index c981d70938e11..c76c30b47ac51 100644 --- a/app/code/Magento/Review/Test/Mftf/Test/StorefrontNoJavascriptErrorOnAddYourReviewClickTest.xml +++ b/app/code/Magento/Review/Test/Mftf/Test/StorefrontNoJavascriptErrorOnAddYourReviewClickTest.xml @@ -39,7 +39,7 @@ <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createAttributeSet" stepKey="deleteAttributeSet"/> <deleteData createDataKey="createProductAttribute" stepKey="deleteProductAttribute"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <amOnPage url="{{StorefrontProductPage.url($$createProduct.name$$)}}" stepKey="goToProductPage"/> diff --git a/app/code/Magento/Review/Test/Unit/Observer/CatalogProductListCollectionAppendSummaryFieldsObserverTest.php b/app/code/Magento/Review/Test/Unit/Observer/CatalogProductListCollectionAppendSummaryFieldsObserverTest.php index 894463de93227..e67b1c815b28f 100644 --- a/app/code/Magento/Review/Test/Unit/Observer/CatalogProductListCollectionAppendSummaryFieldsObserverTest.php +++ b/app/code/Magento/Review/Test/Unit/Observer/CatalogProductListCollectionAppendSummaryFieldsObserverTest.php @@ -23,7 +23,7 @@ */ class CatalogProductListCollectionAppendSummaryFieldsObserverTest extends TestCase { - private const STORE_ID = '1'; + private const STORE_ID = 1; /** * @var Event|MockObject diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminAssertProductQtyInGridActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminAssertProductQtyInGridActionGroup.xml index cffda5665549e..48cbd803470aa 100644 --- a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminAssertProductQtyInGridActionGroup.xml +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminAssertProductQtyInGridActionGroup.xml @@ -10,7 +10,7 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="AdminAssertProductQtyInGridActionGroup"> <annotations> - <description>Goes tot he Admin Catalog Product grid page. Filters the grid based on the provided Product SKU. Validates that the provided Product Qty is present.</description> + <description>Goes to the Admin Catalog Product grid page. Filters the grid based on the provided Product SKU. Validates that the provided Product Qty is present.</description> </annotations> <arguments> <argument name="productSku" type="string"/> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AssertAdminItemOrderedErrorActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AssertAdminItemOrderedErrorActionGroup.xml new file mode 100644 index 0000000000000..a2f35b9c5fca8 --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AssertAdminItemOrderedErrorActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertAdminItemOrderedErrorActionGroup"> + <annotations> + <description>Assert that item in "Item Ordered" grid has an error/notice</description> + </annotations> + <arguments> + <argument name="productName" defaultValue="{{_defaultProduct.name}}" type="string"/> + <argument name="messageType" defaultValue="error" type="string"/> + <argument name="message" defaultValue="The requested qty is not available" type="string"/> + </arguments> + <see userInput="{{message}}" selector="{{AdminOrderFormItemsOrderedSection.productMessage(productName, messageType)}}" stepKey="assertItemErrorVisible"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AssertAdminItemOrderedErrorNotVisibleActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AssertAdminItemOrderedErrorNotVisibleActionGroup.xml new file mode 100644 index 0000000000000..83bac652d7dff --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AssertAdminItemOrderedErrorNotVisibleActionGroup.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AssertAdminItemOrderedErrorNotVisibleActionGroup"> + <annotations> + <description>Assert that item in "Item Ordered" grid does not have an error/notice</description> + </annotations> + <arguments> + <argument name="productName" defaultValue="{{_defaultProduct.name}}" type="string"/> + <argument name="messageType" defaultValue="error" type="string"/> + <argument name="message" defaultValue="The requested qty is not available" type="string"/> + </arguments> + <dontSee userInput="{{message}}" selector="{{AdminOrderFormItemsOrderedSection.productMessage(productName, messageType)}}" stepKey="assertItemErrorNotVisible"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/NavigateToNewOrderPageExistingCustomerActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/NavigateToNewOrderPageExistingCustomerActionGroup.xml index a8f9d61ad6803..220d47e0495f9 100644 --- a/app/code/Magento/Sales/Test/Mftf/ActionGroup/NavigateToNewOrderPageExistingCustomerActionGroup.xml +++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/NavigateToNewOrderPageExistingCustomerActionGroup.xml @@ -10,7 +10,7 @@ xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> <actionGroup name="NavigateToNewOrderPageExistingCustomerActionGroup"> <annotations> - <description>Goes tot he Admin Orders grid page. Clicks on 'Create New Order'. Filters the grid for the provided Customer. Clicks on the Customer. Selects the provided Store View, if present. Validates that the Page Title is present and correct.</description> + <description>Goes to the Admin Orders grid page. Clicks on 'Create New Order'. Filters the grid for the provided Customer. Clicks on the Customer. Selects the provided Store View, if present. Validates that the Page Title is present and correct.</description> </annotations> <arguments> <argument name="customer"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Section/AdminOrderFormItemsOrderedSection.xml b/app/code/Magento/Sales/Test/Mftf/Section/AdminOrderFormItemsOrderedSection.xml index e3417e7c662b9..4437f6e6775f2 100644 --- a/app/code/Magento/Sales/Test/Mftf/Section/AdminOrderFormItemsOrderedSection.xml +++ b/app/code/Magento/Sales/Test/Mftf/Section/AdminOrderFormItemsOrderedSection.xml @@ -18,5 +18,6 @@ <element name="configureSelectAttribute" type="select" selector="select[id*=attribute]"/> <element name="itemsSKU" type="text" selector="(//div[contains(@class, 'product-sku-block')])[{{productNumber}}]" parameterized="true"/> <element name="moveProduct" type="select" selector="//td[contains(.,'{{productName}}')]/../..//td//select" parameterized="true"/> + <element name="productMessage" type="text" selector="//section[@id = 'order-items']//span[text()='{{productName}}']/ancestor::tr/..//div[contains(@class, 'message-{{messageType}}')]" parameterized="true"/> </section> </sections> diff --git a/app/code/Magento/Sales/Test/Mftf/Section/StorefrontOrderDetailsSection.xml b/app/code/Magento/Sales/Test/Mftf/Section/StorefrontOrderDetailsSection.xml index d262dfa9b010c..d1c94965640c5 100644 --- a/app/code/Magento/Sales/Test/Mftf/Section/StorefrontOrderDetailsSection.xml +++ b/app/code/Magento/Sales/Test/Mftf/Section/StorefrontOrderDetailsSection.xml @@ -9,6 +9,7 @@ <sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> <section name="StorefrontOrderDetailsSection"> + <element name="orderDateTagElement" type="block" selector=".order-date date"/> <element name="orderDetailsBlock" type="block" selector=".block-order-details-view"/> <element name="billingAddressBlock" type="block" selector=".box-order-billing-address > .box-content > address"/> <element name="discountSalesRule" type="text" selector="tr.discount span.price"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AddConfigurableProductToOrderFromShoppingCartTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AddConfigurableProductToOrderFromShoppingCartTest.xml index df3a1a2b91219..9b03f566a5c57 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AddConfigurableProductToOrderFromShoppingCartTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AddConfigurableProductToOrderFromShoppingCartTest.xml @@ -57,7 +57,7 @@ </before> <after> <!-- Admin log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!-- Customer log out --> <actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="customerLogout"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AddSimpleProductToOrderFromShoppingCartTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AddSimpleProductToOrderFromShoppingCartTest.xml index 589da3e49dc89..1485613f4e4c2 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AddSimpleProductToOrderFromShoppingCartTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AddSimpleProductToOrderFromShoppingCartTest.xml @@ -28,7 +28,7 @@ </before> <after> <!-- Admin log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!-- Customer log out --> <actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="customerLogout"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminAddSelectedProductToOrderTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminAddSelectedProductToOrderTest.xml new file mode 100644 index 0000000000000..ca74eca88308a --- /dev/null +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminAddSelectedProductToOrderTest.xml @@ -0,0 +1,78 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminAddSelectedProductToOrderTest"> + <annotations> + <features value="CatalogInventory"/> + <stories value="Admin create order"/> + <title value="Add selected products to order in Admin when requested qty more than available"/> + <description value="Trying to add selected products to order in Admin when requested qty more than available"/> + <useCaseId value="MC-29184"/> + <testCaseId value="MC-31589"/> + <severity value="MAJOR"/> + <group value="sales"/> + <group value="catalogInventory"/> + </annotations> + <before> + <createData entity="Simple_US_Customer" stepKey="simpleCustomer"/> + <createData entity="SimpleProduct2" stepKey="simpleProduct"/> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + </before> + <after> + <deleteData createDataKey="simpleCustomer" stepKey="deleteSimpleCustomer"/> + <deleteData createDataKey="simpleProduct" stepKey="deleteSimpleProduct"/> + <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + </after> + + <!-- Initiate create new order --> + <actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="navigateToNewOrderPageWithExistingCustomer"> + <argument name="customer" value="$simpleCustomer$"/> + </actionGroup> + <!-- Add to order maximum available quantity - 1 --> + <executeJS function="return {{SimpleProduct2.quantity}} - 1" stepKey="maxQtyMinusOne"/> + <actionGroup ref="AddSimpleProductToOrderActionGroup" stepKey="addProductToOrderWithMaxQtyMinusOne"> + <argument name="product" value="$simpleProduct$"/> + <argument name="productQty" value="{$maxQtyMinusOne}"/> + </actionGroup> + <!-- Check that there is no error or notice --> + <actionGroup ref="AssertAdminItemOrderedErrorNotVisibleActionGroup" stepKey="assertNoticeAbsent"> + <argument name="productName" value="$simpleProduct.name$"/> + <argument name="messageType" value="notice"/> + </actionGroup> + <actionGroup ref="AssertAdminItemOrderedErrorNotVisibleActionGroup" stepKey="assertErrorAbsent"> + <argument name="productName" value="$simpleProduct.name$"/> + <argument name="messageType" value="error"/> + </actionGroup> + <!-- Add to order maximum available quantity --> + <actionGroup ref="AddSimpleProductToOrderActionGroup" stepKey="addProductToOrder"> + <argument name="product" value="$simpleProduct$"/> + <argument name="productQty" value="1"/> + </actionGroup> + <!-- Check that there is no error or notice --> + <actionGroup ref="AssertAdminItemOrderedErrorNotVisibleActionGroup" stepKey="assertNoticeAbsentAgain"> + <argument name="productName" value="$simpleProduct.name$"/> + <argument name="messageType" value="notice"/> + </actionGroup> + <actionGroup ref="AssertAdminItemOrderedErrorNotVisibleActionGroup" stepKey="assertErrorAbsentAgain"> + <argument name="productName" value="$simpleProduct.name$"/> + <argument name="messageType" value="error"/> + </actionGroup> + <!-- Add to order one more quantity --> + <actionGroup ref="AddSimpleProductToOrderActionGroup" stepKey="addProductToOrderAgain"> + <argument name="product" value="$simpleProduct$"/> + <argument name="productQty" value="1"/> + </actionGroup> + <!-- Check that error remains --> + <actionGroup ref="AssertAdminItemOrderedErrorActionGroup" stepKey="assertProductErrorRemains"> + <argument name="productName" value="$simpleProduct.name$"/> + <argument name="messageType" value="notice"/> + </actionGroup> + </test> +</tests> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminAvailabilityCreditMemoWithNoPaymentTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminAvailabilityCreditMemoWithNoPaymentTest.xml index ec518c79a0808..9b12f1c951991 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminAvailabilityCreditMemoWithNoPaymentTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminAvailabilityCreditMemoWithNoPaymentTest.xml @@ -38,7 +38,7 @@ <argument name="customerEmail" value="Simple_US_Customer.email"/> </actionGroup> <magentoCLI command="cache:flush" stepKey="flushCache"/> - <actionGroup ref="logout" stepKey="logOut"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logOut"/> </after> <!--Proceed to Admin panel > SALES > Orders. Created order should be in Processing status--> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithBankTransferPaymentMethodTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithBankTransferPaymentMethodTest.xml index 726b4a99cdec9..4646f6cf2e5a0 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithBankTransferPaymentMethodTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithBankTransferPaymentMethodTest.xml @@ -40,7 +40,7 @@ <magentoCLI command="config:set {{DisablePaymentBankTransferConfigData.path}} {{DisablePaymentBankTransferConfigData.value}}" stepKey="disableBankTransferPayment"/> <deleteData createDataKey="simpleCustomer" stepKey="deleteSimpleCustomer"/> <deleteData createDataKey="simpleProduct" stepKey="deleteSimpleProduct"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Create new customer order--> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithCashOnDeliveryPaymentMethodTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithCashOnDeliveryPaymentMethodTest.xml index eb46621a458ab..7f162ca4e2a6a 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithCashOnDeliveryPaymentMethodTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithCashOnDeliveryPaymentMethodTest.xml @@ -40,7 +40,7 @@ <magentoCLI command="config:set {{DisableCashOnDeliveryConfigData.path}} {{DisableCashOnDeliveryConfigData.value}}" stepKey="disableCashOnDeliveryPayment"/> <deleteData createDataKey="simpleCustomer" stepKey="deleteSimpleCustomer"/> <deleteData createDataKey="simpleProduct" stepKey="deleteSimpleProduct"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Create new customer order --> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithCheckMoneyOrderPaymentMethodTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithCheckMoneyOrderPaymentMethodTest.xml index 5883d044e95a0..d08754a8a4127 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithCheckMoneyOrderPaymentMethodTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithCheckMoneyOrderPaymentMethodTest.xml @@ -107,7 +107,7 @@ <deleteData createDataKey="createConfigProduct" stepKey="deleteConfigurableProduct"/> <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteProductAttribute"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithProductQtyWithoutStockDecreaseTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithProductQtyWithoutStockDecreaseTest.xml index a8076bfb9f681..d64af533b04e0 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithProductQtyWithoutStockDecreaseTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithProductQtyWithoutStockDecreaseTest.xml @@ -43,7 +43,7 @@ <deleteData createDataKey="simpleCustomer" stepKey="deleteSimpleCustomer"/> <deleteData createDataKey="simpleProduct" stepKey="deleteSimpleProduct"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Create new customer order--> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithPurchaseOrderPaymentMethodTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithPurchaseOrderPaymentMethodTest.xml index c85a3fffc2c69..ce653b11f854b 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithPurchaseOrderPaymentMethodTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithPurchaseOrderPaymentMethodTest.xml @@ -42,7 +42,7 @@ <magentoCLI command="config:set {{DisablePurchaseOrderConfigData.path}} {{DisablePurchaseOrderConfigData.value}}" stepKey="disablePurchaseOrderPayment"/> <deleteData createDataKey="simpleCustomer" stepKey="deleteSimpleCustomer"/> <deleteData createDataKey="simpleProduct" stepKey="deleteSimpleProduct"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Create new customer order--> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithZeroSubtotalCheckoutTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithZeroSubtotalCheckoutTest.xml index a8014466c5773..095bd9af2c1b1 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithZeroSubtotalCheckoutTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithZeroSubtotalCheckoutTest.xml @@ -45,7 +45,7 @@ <deleteData createDataKey="createSalesRule" stepKey="deleteSalesRule"/> <deleteData createDataKey="simpleCustomer" stepKey="deleteSimpleCustomer"/> <deleteData createDataKey="simpleProduct" stepKey="deleteSimpleProduct"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Create new customer order--> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminChangeCustomerGroupInNewOrder.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminChangeCustomerGroupInNewOrder.xml index e19002d5ecb4c..cabb6edec2f52 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminChangeCustomerGroupInNewOrder.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminChangeCustomerGroupInNewOrder.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="login"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="NavigateToNewOrderPageNewCustomerActionGroup" stepKey="openNewOrder"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCheckingCreditMemoUpdateTotalsTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCheckingCreditMemoUpdateTotalsTest.xml index 251d29df43dd1..34a415ccf03ad 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCheckingCreditMemoUpdateTotalsTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCheckingCreditMemoUpdateTotalsTest.xml @@ -32,7 +32,7 @@ <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> <!--Delete customer--> <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="CreateOrderActionGroup" stepKey="createOrder"> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCheckingDateAfterChangeInterfaceLocaleTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCheckingDateAfterChangeInterfaceLocaleTest.xml index ad3b6cf45d5bb..979e2cef3ff28 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCheckingDateAfterChangeInterfaceLocaleTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCheckingDateAfterChangeInterfaceLocaleTest.xml @@ -40,7 +40,7 @@ <!--Clear filters--> <actionGroup ref="AdminOrdersGridClearFiltersActionGroup" stepKey="clearOrderFilters"/> <!--Logout from Admin page--> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Create order--> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCorrectnessInvoicedItemInBundleProductTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCorrectnessInvoicedItemInBundleProductTest.xml index e499f72004986..e55cdfeb284b4 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCorrectnessInvoicedItemInBundleProductTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCorrectnessInvoicedItemInBundleProductTest.xml @@ -48,7 +48,7 @@ <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> <deleteData createDataKey="createBundleProduct" stepKey="deleteBundleProduct"/> - <actionGroup ref="logout" stepKey="logOut"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logOut"/> </after> <!--Complete Bundle product creation--> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoBankTransferPaymentTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoBankTransferPaymentTest.xml index 4b582a09deacf..de92d80546733 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoBankTransferPaymentTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoBankTransferPaymentTest.xml @@ -39,7 +39,7 @@ <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Create Order --> <actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="navigateToNewOrderPage"> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoConfigurableProductTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoConfigurableProductTest.xml index 766839a50a862..9c3aea8bc912e 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoConfigurableProductTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoConfigurableProductTest.xml @@ -14,17 +14,12 @@ <title value="Create Credit Memo for Offline Payment Methods"/> <description value="Create CreditMemo return to stock only one unit of configurable product"/> <severity value="CRITICAL"/> - <testCaseId value="MC-15865"/> + <testCaseId value="MC-28444"/> <group value="sales"/> <group value="mtf_migrated"/> </annotations> <before> - <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> - - <!-- Create Data --> <createData entity="Simple_US_Customer" stepKey="createCustomer"/> - - <!-- Create the category --> <createData entity="ApiCategory" stepKey="createCategory"/> <!-- Create the configurable product and add it to the category --> @@ -88,6 +83,7 @@ <!-- Enable payment method one of "Check/Money Order" and shipping method one of "Flat Rate" --> <magentoCLI command="config:set {{enabledCheckMoneyOrder.label}} {{enabledCheckMoneyOrder.value}}" stepKey="enableCheckMoneyOrder"/> <createData entity="FlatRateShippingMethodConfig" stepKey="enableFlatRate"/> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> </before> <after> <!-- Delete data --> @@ -97,8 +93,9 @@ <deleteData createDataKey="createConfigChildProduct2" stepKey="deleteConfigChildProduct2"/> <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/> <deleteData createDataKey="createCategory" stepKey="deleteApiCategory"/> - <actionGroup ref="logout" stepKey="logout"/> - + <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> + <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearProductGridFilters"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> </after> @@ -109,9 +106,9 @@ <!--Add configurable product to order--> <actionGroup ref="AddConfigurableProductToOrderFromAdminActionGroup" stepKey="addConfigurableProductToOrder"> - <argument name="product" value="$$createConfigProduct$$"/> - <argument name="attribute" value="$$createConfigProductAttribute$$"/> - <argument name="option" value="$$getConfigAttributeOption1$$"/> + <argument name="product" value="$createConfigProduct$"/> + <argument name="attribute" value="$createConfigProductAttribute$"/> + <argument name="option" value="$getConfigAttributeOption1$"/> </actionGroup> <actionGroup ref="FillOrderCustomerInformationActionGroup" stepKey="fillCustomerInfo"> @@ -121,19 +118,16 @@ <actionGroup ref="OrderSelectFlatRateShippingActionGroup" stepKey="selectFlatRate"/> <click selector="{{OrdersGridSection.submitOrder}}" stepKey="submitOrder"/> <waitForPageLoad stepKey="waitForSubmitOrderPage"/> - <see stepKey="seeSuccessMessageForOrder" userInput="You created the order."/> + <waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitForSuccessMessageForOrderAppears"/> + <see selector="{{AdminMessagesSection.success}}" userInput="You created the order." stepKey="seeSuccessMessageForOrder"/> <!-- Create Invoice --> <actionGroup ref="StartCreateInvoiceFromOrderPageActionGroup" stepKey="startInvoice"/> - <click selector="{{AdminInvoiceMainActionsSection.submitInvoice}}" stepKey="clickSubmitInvoice"/> - <waitForElementVisible selector="{{AdminMessagesSection.success}}" stepKey="waitForMessageAppears"/> - <see selector="{{AdminMessagesSection.success}}" userInput="The invoice has been created." stepKey="seeInvoiceCreateSuccess"/> + <actionGroup ref="SubmitInvoiceActionGroup" stepKey="clickSubmitInvoice"/> <!-- Go to Sales > Orders > find out placed order and open --> - <grabTextFrom selector="|Order # (\d+)|" stepKey="grabOrderId" /> - <assertNotEmpty actual="$grabOrderId" stepKey="assertOrderIdIsNotEmpty" after="grabOrderId"/> - <actionGroup ref="OpenOrderByIdActionGroup" stepKey="openOrder"> - <argument name="orderId" value="{$grabOrderId}"/> + <actionGroup ref="AdminOpenOrderByEntityIdActionGroup" stepKey="openOrder"> + <argument name="entityId" value="{$grabOrderIdClickSubmitInvoice}"/> </actionGroup> <!-- Click 'Credit Memo' button and fill data from dataset: partial refund --> @@ -143,11 +137,7 @@ </actionGroup> <!-- On order's page click 'Refund offline' button --> - <click selector="{{AdminCreditMemoTotalSection.submitRefundOffline}}" stepKey="clickRefundOffline"/> - <waitForPageLoad stepKey="waitForResultPage"/> - - <!-- Perform all assertions: assert refund success create message --> - <see selector="{{AdminIndexManagementSection.successMessage}}" userInput="You created the credit memo." stepKey="assertRefundSuccessCreateMessage"/> + <actionGroup ref="SubmitCreditMemoActionGroup" stepKey="clickRefundOffline"/> <!-- Assert product Qty decreased after CreditMemo --> <actionGroup ref="AdminAssertProductQtyInGridActionGroup" stepKey="assertQtyDecreased"> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoPartialRefundTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoPartialRefundTest.xml index 2b6008c93084e..2cacfe934427c 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoPartialRefundTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoPartialRefundTest.xml @@ -37,7 +37,7 @@ <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Create Order --> <actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="navigateToNewOrderPage"> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoWithCashOnDeliveryTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoWithCashOnDeliveryTest.xml index 452c54d188c57..e9954de55afbc 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoWithCashOnDeliveryTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoWithCashOnDeliveryTest.xml @@ -39,7 +39,7 @@ <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Create Order --> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoWithPurchaseOrderTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoWithPurchaseOrderTest.xml index 231ff78d7d8fb..2d5b2d3c66906 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoWithPurchaseOrderTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateCreditMemoWithPurchaseOrderTest.xml @@ -39,7 +39,7 @@ <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Create Order --> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml index 73c126bb7794f..9a635df80f108 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateInvoiceTest.xml @@ -25,7 +25,7 @@ </createData> </before> <after> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> <deleteData createDataKey="createCategory" stepKey="deleteProduct1"/> <deleteData createDataKey="createProduct" stepKey="deleteCategory1"/> </after> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderAddProductCheckboxTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderAddProductCheckboxTest.xml index 8fe49558cf091..072522452e7b9 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderAddProductCheckboxTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderAddProductCheckboxTest.xml @@ -42,7 +42,7 @@ <seeCheckboxIsChecked selector="{{AdminOrderFormItemsSection.rowCheck('1')}}" stepKey="verifyProductChecked"/> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> <deleteData createDataKey="createSimpleCustomer" stepKey="deleteSimpleCustomer"/> </after> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderAndCheckTheReorderTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderAndCheckTheReorderTest.xml index 338765d650d13..a7112776bf157 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderAndCheckTheReorderTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderAndCheckTheReorderTest.xml @@ -52,7 +52,7 @@ <actionGroup ref="StorefrontCustomerReorderButtonNotVisibleActionGroup" stepKey="checkReorderButton"/> <after> <actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="customerLogout"/> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> <magentoCLI command="config:set payment/cashondelivery/active 0" stepKey="disableCashOnDeliveryMethod"/> <deleteData createDataKey="simpleCustomer" stepKey="deleteSimpleCustomer"/> <deleteData createDataKey="simpleProduct" stepKey="deleteSimpleProduct"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderForCustomerWithTwoAddressesTaxableAndNonTaxableTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderForCustomerWithTwoAddressesTaxableAndNonTaxableTest.xml index 8177bbaa6e1d7..b687e63fbc328 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderForCustomerWithTwoAddressesTaxableAndNonTaxableTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderForCustomerWithTwoAddressesTaxableAndNonTaxableTest.xml @@ -71,7 +71,7 @@ <!--Delete tax rule--> <deleteData createDataKey="createTaxRule" stepKey="deleteTaxRule"/> <!--Logout--> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!--Disable free shipping method --> <magentoCLI command="config:set {{DisableFreeShippingConfigData.path}} {{DisableFreeShippingConfigData.value}}" stepKey="disableFreeShipping"/> </after> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderStatusDuplicatingCodeTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderStatusDuplicatingCodeTest.xml index 40a731410a899..bbb0489b6c9a4 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderStatusDuplicatingCodeTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderStatusDuplicatingCodeTest.xml @@ -22,7 +22,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Go to new order status page --> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderStatusDuplicatingLabelTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderStatusDuplicatingLabelTest.xml index d1381bbb1efb0..23bf293f67a81 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderStatusDuplicatingLabelTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderStatusDuplicatingLabelTest.xml @@ -22,7 +22,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Go to new order status page --> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderStatusTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderStatusTest.xml index c2daaac84dd42..03acf2194c64d 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderStatusTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderStatusTest.xml @@ -22,7 +22,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Go to new order status page --> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithBundleProductTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithBundleProductTest.xml index 1749fcd6c218e..f439d792c9330 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithBundleProductTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithBundleProductTest.xml @@ -101,7 +101,7 @@ <actionGroup ref="VerifyCreatedOrderInformationActionGroup" stepKey="verifyCreatedOrderInformation"/> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <deleteData createDataKey="product" stepKey="delete"/> <deleteData createDataKey="simpleCustomer" stepKey="deleteSimpleCustomer"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithDateTimeOptionUITest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithDateTimeOptionUITest.xml index 1fa01e0efa156..677969fd00d91 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithDateTimeOptionUITest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithDateTimeOptionUITest.xml @@ -14,6 +14,7 @@ <title value="Admin create order with date time option UI test"/> <description value="Check asterisk rendered correctly for Product with custom option (datetime) at backend"/> <features value="Sales"/> + <stories value="Create order in Admin"/> <severity value="MINOR"/> <group value="Sales"/> </annotations> @@ -28,7 +29,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <deleteData createDataKey="createProduct" stepKey="deleteSimpleProduct"/> <deleteData createDataKey="createCustomer" stepKey="deleteSimpleCustomer"/> </after> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithSelectedShoppingCartItemsTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithSelectedShoppingCartItemsTest.xml index 58a680ea61c87..60ade9ebe01e7 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithSelectedShoppingCartItemsTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithSelectedShoppingCartItemsTest.xml @@ -97,7 +97,7 @@ <deleteData createDataKey="simpleCustomer" stepKey="deleteSimpleCustomer"/> <!--Logout--> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> </test> </tests> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithSimpleProductCustomOptionFileTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithSimpleProductCustomOptionFileTest.xml index 200ac6e62ac15..b694363960def 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithSimpleProductCustomOptionFileTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithSimpleProductCustomOptionFileTest.xml @@ -29,7 +29,7 @@ <deleteData createDataKey="simpleProduct" stepKey="deleteSimpleProduct"/> <deleteData createDataKey="category" stepKey="deleteCategory"/> <deleteData createDataKey="customer" stepKey="deleteCustomer" /> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Add option to product.--> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithSimpleProductTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithSimpleProductTest.xml index 76f916d55ee92..cc709dc6e16eb 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithSimpleProductTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderWithSimpleProductTest.xml @@ -50,7 +50,7 @@ <argument name="stockStatus" value="Out of Stock"/> </actionGroup> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <magentoCLI command="config:set payment/cashondelivery/active 0" stepKey="disableCashOnDeliveryMethod"/> <deleteData createDataKey="simpleCustomer" stepKey="deleteSimpleCustomer"/> <deleteData createDataKey="simpleProduct" stepKey="deleteSimpleProduct"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminFreeShippingNotAvailableIfMinimumOrderAmountNotMatchOrderTotalTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminFreeShippingNotAvailableIfMinimumOrderAmountNotMatchOrderTotalTest.xml index 9ff6f3bdac985..01a27a6191d74 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminFreeShippingNotAvailableIfMinimumOrderAmountNotMatchOrderTotalTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminFreeShippingNotAvailableIfMinimumOrderAmountNotMatchOrderTotalTest.xml @@ -37,7 +37,7 @@ <createData entity="FlatRateShippingMethodConfig" stepKey="enableFlatRate"/> <createData entity="FreeShippinMethodDefault" stepKey="disableFreeShippingMethod"/> <createData entity="setFreeShippingSubtotalToDefault" stepKey="setFreeShippingSubtotalToDefault"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <magentoCLI command="cache:flush" stepKey="flushCache2"/> </after> <!--Create new order with existing customer--> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminHoldCreatedOrderTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminHoldCreatedOrderTest.xml index 5dc5dbf3ab79d..a5cbb15faf2d7 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminHoldCreatedOrderTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminHoldCreatedOrderTest.xml @@ -40,7 +40,7 @@ <deleteData createDataKey="simpleCustomer" stepKey="deleteSimpleCustomer"/> <deleteData createDataKey="simpleProduct" stepKey="deleteSimpleProduct"/> <deleteData createDataKey="simpleProduct1" stepKey="deleteSimpleProduct1"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Create new customer order--> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersCancelCompleteAndClosedTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersCancelCompleteAndClosedTest.xml index ec624a80f1613..803e24b3423aa 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersCancelCompleteAndClosedTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersCancelCompleteAndClosedTest.xml @@ -33,7 +33,7 @@ <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Create first order --> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersCancelProcessingAndClosedTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersCancelProcessingAndClosedTest.xml index 5e524bcf6e05c..c230dc41f0d2e 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersCancelProcessingAndClosedTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersCancelProcessingAndClosedTest.xml @@ -33,7 +33,7 @@ <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Create first order --> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersHoldOnCompleteTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersHoldOnCompleteTest.xml index 179e1aa35a4e9..14b61af59eaed 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersHoldOnCompleteTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersHoldOnCompleteTest.xml @@ -33,7 +33,7 @@ <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Create order --> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersHoldOnPendingAndProcessingTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersHoldOnPendingAndProcessingTest.xml index ec0ec8ca222da..5ac803cb666b4 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersHoldOnPendingAndProcessingTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersHoldOnPendingAndProcessingTest.xml @@ -33,7 +33,7 @@ <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Create first order --> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersReleasePendingOrderTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersReleasePendingOrderTest.xml index 6c97c4add6313..4b8df455d545d 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersReleasePendingOrderTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersReleasePendingOrderTest.xml @@ -33,7 +33,7 @@ <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Create order --> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersUpdateCancelPendingOrderTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersUpdateCancelPendingOrderTest.xml index d7c9664b8bce2..84d5426bd44e3 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersUpdateCancelPendingOrderTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersUpdateCancelPendingOrderTest.xml @@ -32,7 +32,7 @@ <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Create order --> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminOrdersReleaseInUnholdStatusTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminOrdersReleaseInUnholdStatusTest.xml index 009f86256a910..83998990c70ed 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminOrdersReleaseInUnholdStatusTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminOrdersReleaseInUnholdStatusTest.xml @@ -33,7 +33,7 @@ <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Create order --> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminProductInTheShoppingCartCouldBeReachedByAdminDuringOrderCreationWithMultiWebsiteConfigTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminProductInTheShoppingCartCouldBeReachedByAdminDuringOrderCreationWithMultiWebsiteConfigTest.xml index d30074a240546..4f0d777ad0f21 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminProductInTheShoppingCartCouldBeReachedByAdminDuringOrderCreationWithMultiWebsiteConfigTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminProductInTheShoppingCartCouldBeReachedByAdminDuringOrderCreationWithMultiWebsiteConfigTest.xml @@ -53,7 +53,7 @@ <actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteWebsite"> <argument name="websiteName" value="{{customWebsite.name}}"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Create customer account for Second Website--> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceRuleDiscountTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceRuleDiscountTest.xml index ccdf90cc648c5..b535e1836ed24 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceRuleDiscountTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceRuleDiscountTest.xml @@ -45,7 +45,7 @@ <after> <deleteData createDataKey="createSimpleProductApi" stepKey="deleteSimpleProductApi"/> <actionGroup ref="AdminCatalogPriceRuleDeleteAllActionGroup" stepKey="deleteAllCatalogPriceRule"/> - <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> </after> <!--Open order by Id--> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminSalesCreditMemosNavigateMenuTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminSalesCreditMemosNavigateMenuTest.xml index af7cc1822d215..424b931314b01 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminSalesCreditMemosNavigateMenuTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminSalesCreditMemosNavigateMenuTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToSalesCreditMemosPage"> <argument name="menuUiId" value="{{AdminMenuSales.dataUiId}}"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminSalesInvoicesNavigateMenuTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminSalesInvoicesNavigateMenuTest.xml index 5a38a66d1f4b2..89d4cc4c7371f 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminSalesInvoicesNavigateMenuTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminSalesInvoicesNavigateMenuTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToSalesInvoicesPage"> <argument name="menuUiId" value="{{AdminMenuSales.dataUiId}}"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminSalesOrdersNavigateMenuTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminSalesOrdersNavigateMenuTest.xml index 8099254923a2c..6d765537494ed 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminSalesOrdersNavigateMenuTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminSalesOrdersNavigateMenuTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToSalesOrderPage"> <argument name="menuUiId" value="{{AdminMenuSales.dataUiId}}"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminSalesShipmentsNavigateMenuTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminSalesShipmentsNavigateMenuTest.xml index 5717c6c90fc17..05f15ad76b07c 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminSalesShipmentsNavigateMenuTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminSalesShipmentsNavigateMenuTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToSalesShipmentsPage"> <argument name="menuUiId" value="{{AdminMenuSales.dataUiId}}"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminSalesTransactionsNavigateMenuTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminSalesTransactionsNavigateMenuTest.xml index 68933be92efe6..17f0bad87037e 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminSalesTransactionsNavigateMenuTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminSalesTransactionsNavigateMenuTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToSalesTransactionsPage"> <argument name="menuUiId" value="{{AdminMenuSales.dataUiId}}"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminSaveInAddressBookCheckboxStateTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminSaveInAddressBookCheckboxStateTest.xml index f2341278becba..ac0af3f5b80db 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminSaveInAddressBookCheckboxStateTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminSaveInAddressBookCheckboxStateTest.xml @@ -27,7 +27,7 @@ <createData entity="ApiSimpleProduct" stepKey="createSimpleProduct"> <requiredEntity createDataKey="createCategory"/> </createData> - <actionGroup ref="LoginActionGroup" stepKey="login"/> + <actionGroup ref="AdminLoginActionGroup" stepKey="login"/> </before> <after> <!-- Delete created data and log out --> @@ -35,7 +35,7 @@ <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="logOut"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logOut"/> </after> <!-- Create new order and choose an existing customer --> <comment userInput="Create new order and choose an existing customer" stepKey="createOrderAndAddCustomer"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminStoresOrderStatusNavigateMenuTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminStoresOrderStatusNavigateMenuTest.xml index d55cde1449033..7884926946178 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminStoresOrderStatusNavigateMenuTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminStoresOrderStatusNavigateMenuTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToStoresOrderStatusPage"> <argument name="menuUiId" value="{{AdminMenuStores.dataUiId}}"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminSubmitConfigurableProductOrderTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminSubmitConfigurableProductOrderTest.xml index dc269ff7a2f98..cfdbd39838ecb 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminSubmitConfigurableProductOrderTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminSubmitConfigurableProductOrderTest.xml @@ -122,7 +122,7 @@ <actionGroup ref="VerifyCreatedOrderInformationActionGroup" stepKey="verifyCreatedOrderInformation"/> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <deleteData createDataKey="simpleCustomer" stepKey="deleteSimpleCustomer"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminSubmitsOrderPaymentMethodValidationTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminSubmitsOrderPaymentMethodValidationTest.xml index b2d424ca5d7d3..5981c49345aa0 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminSubmitsOrderPaymentMethodValidationTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminSubmitsOrderPaymentMethodValidationTest.xml @@ -29,7 +29,7 @@ <magentoCLI stepKey="allowSpecificValue" command="config:set payment/cashondelivery/active 0" /> <deleteData createDataKey="createSimpleProduct" stepKey="deleteProduct"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> </after> <!--Create order via Admin--> <comment userInput="Admin creates order" stepKey="adminCreateOrderComment"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminSubmitsOrderWithAndWithoutEmailTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminSubmitsOrderWithAndWithoutEmailTest.xml index f2d0fffe9b4cf..b9e2d475f9ff6 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminSubmitsOrderWithAndWithoutEmailTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminSubmitsOrderWithAndWithoutEmailTest.xml @@ -26,7 +26,7 @@ <after> <deleteData createDataKey="createSimpleProduct" stepKey="deleteProduct"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> </after> <!--Create order via Admin--> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminSubmitsOrderWithAndWithoutFieldsValidationTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminSubmitsOrderWithAndWithoutFieldsValidationTest.xml index 4dbd80a351ee7..d44cb829bc205 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminSubmitsOrderWithAndWithoutFieldsValidationTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminSubmitsOrderWithAndWithoutFieldsValidationTest.xml @@ -25,7 +25,7 @@ <after> <deleteData createDataKey="createSimpleProduct" stepKey="deleteProduct"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> </after> <!--Create order via Admin--> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminUnassignCustomOrderStatusTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminUnassignCustomOrderStatusTest.xml index 5f7a7c7606619..bd43937e6f24e 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AdminUnassignCustomOrderStatusTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminUnassignCustomOrderStatusTest.xml @@ -21,7 +21,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Go to new order status page--> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AssignCustomOrderStatusNotVisibleOnStorefrontTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AssignCustomOrderStatusNotVisibleOnStorefrontTest.xml index ac377a0d31606..af07d50bcc8c7 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AssignCustomOrderStatusNotVisibleOnStorefrontTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AssignCustomOrderStatusNotVisibleOnStorefrontTest.xml @@ -43,7 +43,7 @@ <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> <!-- Log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Create order status --> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/CheckXSSVulnerabilityDuringOrderCreationTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/CheckXSSVulnerabilityDuringOrderCreationTest.xml index 6eb9e37a3ab79..dbe012f17176d 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/CheckXSSVulnerabilityDuringOrderCreationTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/CheckXSSVulnerabilityDuringOrderCreationTest.xml @@ -27,7 +27,7 @@ <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> <!-- Log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Add product to the shopping cart --> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/CreateInvoiceAndCheckInvoiceOrderTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/CreateInvoiceAndCheckInvoiceOrderTest.xml index 0b065e0da54f0..6cfb2fa5ee911 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/CreateInvoiceAndCheckInvoiceOrderTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/CreateInvoiceAndCheckInvoiceOrderTest.xml @@ -47,7 +47,7 @@ <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> <!-- Log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Create order --> @@ -143,6 +143,7 @@ <!-- Assert invoiced amount on frontend --> <click selector="{{StorefrontCustomerOrderSection.viewOrder}}" stepKey="clickViewOrder"/> + <dontSeeElement selector="{{StorefrontOrderDetailsSection.orderDateTagElement}}" stepKey="dontSeeDateTag"/> <click selector="{{StorefrontOrderInvoicesSection.invoiceTab}}" stepKey="clickInvoiceTabOnStorefront"/> <see selector="{{StorefrontOrderInvoicesSection.grandTotalPrice}}" userInput="$110.00" stepKey="seePrice"/> </test> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/CreateInvoiceWithCashOnDeliveryPaymentMethodTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/CreateInvoiceWithCashOnDeliveryPaymentMethodTest.xml index 295d388ced96e..3ae4007ac211d 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/CreateInvoiceWithCashOnDeliveryPaymentMethodTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/CreateInvoiceWithCashOnDeliveryPaymentMethodTest.xml @@ -47,7 +47,7 @@ <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> <!-- Log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Create order --> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/CreateInvoiceWithShipmentAndCheckInvoicedOrderTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/CreateInvoiceWithShipmentAndCheckInvoicedOrderTest.xml index 2ccecf34a5a0c..540af6958d54c 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/CreateInvoiceWithShipmentAndCheckInvoicedOrderTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/CreateInvoiceWithShipmentAndCheckInvoicedOrderTest.xml @@ -45,7 +45,7 @@ <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> <!-- Log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Create order--> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/CreateInvoiceWithZeroSubtotalCheckoutTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/CreateInvoiceWithZeroSubtotalCheckoutTest.xml index 944a1ed75cebd..8fd751f96914e 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/CreateInvoiceWithZeroSubtotalCheckoutTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/CreateInvoiceWithZeroSubtotalCheckoutTest.xml @@ -58,7 +58,7 @@ <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> <!-- Log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Create order --> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/CreateOrderFromEditCustomerPageTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/CreateOrderFromEditCustomerPageTest.xml index 5d017cc0caab8..e0ede2ebe55b8 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/CreateOrderFromEditCustomerPageTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/CreateOrderFromEditCustomerPageTest.xml @@ -89,7 +89,7 @@ <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <amOnPage url="{{AdminCustomerPage.url}}" stepKey="openCustomerIndexPage"/> <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearCustomerGridFilter"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/CreditMemoTotalAfterShippingDiscountTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/CreditMemoTotalAfterShippingDiscountTest.xml index 8ca8dbf21a3a2..8c80c1e9ee6d3 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/CreditMemoTotalAfterShippingDiscountTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/CreditMemoTotalAfterShippingDiscountTest.xml @@ -23,7 +23,7 @@ <createData entity="_defaultProduct" stepKey="createProduct"> <requiredEntity createDataKey="createCategory"/> </createData> - <actionGroup ref="LoginActionGroup" stepKey="loginAsAdmin"/> + <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/> <actionGroup ref="AdminOrdersGridClearFiltersActionGroup" stepKey="clearOrderFilters"/> <actionGroup ref="SetTaxClassForShippingActionGroup" stepKey="setShippingTaxClass"/> </before> @@ -33,7 +33,7 @@ <argument name="ruleName" value="{{ApiSalesRule.name}}"/> </actionGroup> <actionGroup ref="AdminOrdersGridClearFiltersActionGroup" stepKey="clearOrderFilters"/> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> <deleteData createDataKey="createCategory" stepKey="deleteProduct1"/> <deleteData createDataKey="createProduct" stepKey="deleteCategory1"/> </after> @@ -58,7 +58,7 @@ <click selector="{{AdminCartPriceRulesFormSection.save}}" stepKey="clickSaveButton"/> <see selector="{{AdminCartPriceRulesSection.messages}}" userInput="You saved the rule." stepKey="seeSuccessMessage"/> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> <!-- Place an order from Storefront as a Guest --> <amOnPage url="{{StorefrontCategoryPage.url($$createCategory.name$$)}}" stepKey="onCategoryPage"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/MoveConfigurableProductsInComparedOnOrderPageTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/MoveConfigurableProductsInComparedOnOrderPageTest.xml index 27b0952781250..a214979bef885 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/MoveConfigurableProductsInComparedOnOrderPageTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/MoveConfigurableProductsInComparedOnOrderPageTest.xml @@ -86,7 +86,7 @@ </before> <after> <!-- Admin logout --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!-- Logout customer --> <actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="logoutCustomer"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/MoveLastOrderedConfigurableProductOnOrderPageTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/MoveLastOrderedConfigurableProductOnOrderPageTest.xml index 65c631b95f5c2..6b6718c67cb4c 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/MoveLastOrderedConfigurableProductOnOrderPageTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/MoveLastOrderedConfigurableProductOnOrderPageTest.xml @@ -60,7 +60,7 @@ </before> <after> <!-- Delete created data --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> <deleteData createDataKey="createConfigChildProduct" stepKey="deleteConfigChildProduct"/> <deleteData createDataKey="createConfigProduct" stepKey="deleteConfigProduct"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/MoveLastOrderedSimpleProductOnOrderPageTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/MoveLastOrderedSimpleProductOnOrderPageTest.xml index f13a934276e35..5355dba260060 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/MoveLastOrderedSimpleProductOnOrderPageTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/MoveLastOrderedSimpleProductOnOrderPageTest.xml @@ -33,7 +33,7 @@ <!-- Delete created data --> <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> - <actionGroup ref="logout" stepKey="logOut"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logOut"/> </after> <!-- Create order --> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/MoveRecentlyViewedBundleFixedProductOnOrderPageTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/MoveRecentlyViewedBundleFixedProductOnOrderPageTest.xml index 0a39e8a0ac852..bf78012926a7b 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/MoveRecentlyViewedBundleFixedProductOnOrderPageTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/MoveRecentlyViewedBundleFixedProductOnOrderPageTest.xml @@ -61,7 +61,7 @@ </before> <after> <!-- Admin logout --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!-- Customer logout --> <actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="customerLogout"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/MoveRecentlyViewedConfigurableProductOnOrderPageTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/MoveRecentlyViewedConfigurableProductOnOrderPageTest.xml index c7c08914fea4b..eae4de730f116 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/MoveRecentlyViewedConfigurableProductOnOrderPageTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/MoveRecentlyViewedConfigurableProductOnOrderPageTest.xml @@ -62,7 +62,7 @@ </before> <after> <!-- Admin logout --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!-- Customer logout --> <actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="customerLogout"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/MoveSimpleProductsInComparedOnOrderPageTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/MoveSimpleProductsInComparedOnOrderPageTest.xml index 3c01878b59e59..9790f03abed5a 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/MoveSimpleProductsInComparedOnOrderPageTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/MoveSimpleProductsInComparedOnOrderPageTest.xml @@ -33,7 +33,7 @@ </before> <after> <!-- Admin logout --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!-- Logout customer --> <actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="logoutCustomer"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/StorefrontOrderPagerDisplayedTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/StorefrontOrderPagerDisplayedTest.xml index aef3e884c4712..f68a36b29af4f 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/StorefrontOrderPagerDisplayedTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/StorefrontOrderPagerDisplayedTest.xml @@ -120,7 +120,7 @@ <!-- Delete Customer --> <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Login to Storefront as Customer --> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/StorefrontOrderPagerIsAbsentTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/StorefrontOrderPagerIsAbsentTest.xml index 3ff8a7791d88b..9319022a96b20 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/StorefrontOrderPagerIsAbsentTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/StorefrontOrderPagerIsAbsentTest.xml @@ -113,7 +113,7 @@ <!-- Delete Customer --> <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Login to Storefront as Customer --> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/StorefrontPrintOrderGuestTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/StorefrontPrintOrderGuestTest.xml index 4369fa8a94101..2f5ffbb96e8d7 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/StorefrontPrintOrderGuestTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/StorefrontPrintOrderGuestTest.xml @@ -225,7 +225,7 @@ <deleteData createDataKey="createCartPriceRule" stepKey="deleteCartPriceRule"/> <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> diff --git a/app/code/Magento/Sales/view/frontend/templates/order/order_date.phtml b/app/code/Magento/Sales/view/frontend/templates/order/order_date.phtml index 80a0ea02499cc..3e2b653e8b3bd 100644 --- a/app/code/Magento/Sales/view/frontend/templates/order/order_date.phtml +++ b/app/code/Magento/Sales/view/frontend/templates/order/order_date.phtml @@ -5,5 +5,11 @@ */ ?> <div class="order-date"> - <?= $block->escapeHtml(__('<span class="label">Order Date:</span> %1', '<date>' . $block->formatDate($block->getOrder()->getCreatedAt(), \IntlDateFormatter::LONG) . '</date>'), ['span', 'date']) ?> + <?= $block->escapeHtml( + __( + '<span class="label">Order Date:</span> %1', + '<span>' . $block->formatDate($block->getOrder()->getCreatedAt(), \IntlDateFormatter::LONG) . '</span>' + ), + ['span'] + )?> </div> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCartRulesAppliedForProductInCartTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCartRulesAppliedForProductInCartTest.xml index 916416dcd9141..49dcc47e14779 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCartRulesAppliedForProductInCartTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCartRulesAppliedForProductInCartTest.xml @@ -46,7 +46,7 @@ </actionGroup> <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearFilters1"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Start creating a bundle product--> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateBuyXGetYFreeTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateBuyXGetYFreeTest.xml index addb65a68fad3..3f063b5869129 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateBuyXGetYFreeTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateBuyXGetYFreeTest.xml @@ -30,7 +30,7 @@ <argument name="ruleName" value="{{_defaultCoupon.code}}"/> </actionGroup> <deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCategory"/> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> </after> <!-- Create a cart price rule of type Buy X get Y free --> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleAndVerifyRuleConditionAndFreeShippingIsAppliedTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleAndVerifyRuleConditionAndFreeShippingIsAppliedTest.xml index 0d23e0e035432..54a6f7a16bb23 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleAndVerifyRuleConditionAndFreeShippingIsAppliedTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleAndVerifyRuleConditionAndFreeShippingIsAppliedTest.xml @@ -27,7 +27,7 @@ <actionGroup ref="DeleteCartPriceRuleByName" stepKey="deleteCreatedCartPriceRule"> <argument name="ruleName" value="{{CartPriceRuleConditionAndFreeShippingApplied.name}}"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Create cart price rule as per data and verify AssertCartPriceRuleSuccessSaveMessage--> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleAndVerifyRuleConditionIsNotAppliedTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleAndVerifyRuleConditionIsNotAppliedTest.xml index b41e139536223..0e1a4d7c186aa 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleAndVerifyRuleConditionIsNotAppliedTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleAndVerifyRuleConditionIsNotAppliedTest.xml @@ -29,7 +29,7 @@ <actionGroup ref="DeleteCartPriceRuleByName" stepKey="deleteCreatedCartPriceRule"> <argument name="ruleName" value="{{CartPriceRuleConditionNotApplied.name}}"/> </actionGroup> - <actionGroup ref="logout" stepKey="logoutAsAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutAsAdmin"/> </after> <!--Create cart price rule as per data and verify AssertCartPriceRuleSuccessSaveMessage--> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleEmptyFromDateTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleEmptyFromDateTest.xml index f0075a92a2b82..64443c717ac33 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleEmptyFromDateTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleEmptyFromDateTest.xml @@ -34,7 +34,7 @@ </actionGroup> <deleteData createDataKey="category" stepKey="deleteCategory"/> <deleteData createDataKey="product" stepKey="deleteProduct"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Set timezone--> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForCouponCodeTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForCouponCodeTest.xml index 6242c1f3d1baf..f33eb187e4cc8 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForCouponCodeTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForCouponCodeTest.xml @@ -30,7 +30,7 @@ <argument name="ruleName" value="{{_defaultCoupon.code}}"/> </actionGroup> <deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Create a cart price rule based on a coupon code --> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForGeneratedCouponTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForGeneratedCouponTest.xml index 78943a0648b51..4b793dbf8583f 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForGeneratedCouponTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForGeneratedCouponTest.xml @@ -30,7 +30,7 @@ <argument name="ruleName" value="{{_defaultCoupon.code}}"/> </actionGroup> <deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCategory"/> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> </after> <!-- Create a cart price rule --> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForMatchingSubtotalAndVerifyRuleConditionIsAppliedTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForMatchingSubtotalAndVerifyRuleConditionIsAppliedTest.xml index 385c9e35da393..7365f3b7a3425 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForMatchingSubtotalAndVerifyRuleConditionIsAppliedTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleForMatchingSubtotalAndVerifyRuleConditionIsAppliedTest.xml @@ -27,7 +27,7 @@ <actionGroup ref="DeleteCartPriceRuleByName" stepKey="deleteCreatedCartPriceRule"> <argument name="ruleName" value="{{CartPriceRuleConditionAppliedForSubtotal.name}}"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Create cart price rule as per data and verify AssertCartPriceRuleSuccessSaveMessage--> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingCategoryAndVerifyRuleConditionIsAppliedTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingCategoryAndVerifyRuleConditionIsAppliedTest.xml index a56e332ce1a85..81c30d197759d 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingCategoryAndVerifyRuleConditionIsAppliedTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingCategoryAndVerifyRuleConditionIsAppliedTest.xml @@ -34,7 +34,7 @@ <actionGroup ref="DeleteCartPriceRuleByName" stepKey="deleteCreatedCartPriceRule"> <argument name="ruleName" value="{{CartPriceRuleConditionAppliedForCategory.name}}"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Create cart price rule as per data and verify AssertCartPriceRuleSuccessSaveMessage--> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingTotalWeightAndVerifyRuleConditionIsAppliedTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingTotalWeightAndVerifyRuleConditionIsAppliedTest.xml index 0541ee2dd4eba..2685e004ba1e0 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingTotalWeightAndVerifyRuleConditionIsAppliedTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateCartPriceRuleWithMatchingTotalWeightAndVerifyRuleConditionIsAppliedTest.xml @@ -27,7 +27,7 @@ <actionGroup ref="DeleteCartPriceRuleByName" stepKey="deleteCreatedCartPriceRule"> <argument name="ruleName" value="{{CartPriceRuleConditionAppliedForWeight.name}}"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Create cart price rule as per data and verify AssertCartPriceRuleSuccessSaveMessage--> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateFixedAmountDiscountTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateFixedAmountDiscountTest.xml index c65a5a865e779..f6d61f62c1f54 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateFixedAmountDiscountTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateFixedAmountDiscountTest.xml @@ -30,7 +30,7 @@ <argument name="ruleName" value="{{_defaultCoupon.code}}"/> </actionGroup> <deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCategory"/> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> </after> <!-- Create a cart price rule for $10 Fixed amount discount --> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateFixedAmountWholeCartDiscountTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateFixedAmountWholeCartDiscountTest.xml index 69ba7aef393b5..cb3e6c517e1ec 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateFixedAmountWholeCartDiscountTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateFixedAmountWholeCartDiscountTest.xml @@ -30,7 +30,7 @@ <argument name="ruleName" value="{{SimpleSalesRule.name}}"/> </actionGroup> <deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCategory"/> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> </after> <!-- Create a cart price rule for Fixed amount discount for whole cart --> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateInvalidRuleTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateInvalidRuleTest.xml index 620112e323ff5..3bbacf912e5d6 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateInvalidRuleTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreateInvalidRuleTest.xml @@ -23,7 +23,7 @@ </before> <after> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> </after> <amOnPage url="{{AdminCartPriceRulesPage.url}}" stepKey="amOnCartPriceList"/> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreatePercentOfProductPriceTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreatePercentOfProductPriceTest.xml index 2c4df39426720..38986dc32f8d2 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreatePercentOfProductPriceTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminCreatePercentOfProductPriceTest.xml @@ -32,7 +32,7 @@ <argument name="ruleName" value="{{_defaultCoupon.code}}"/> </actionGroup> <deleteData createDataKey="createPreReqCategory" stepKey="deletePreReqCategory"/> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> </after> <!-- Create a cart price rule for 50 percent of product price --> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminDeleteActiveSalesRuleWithComplexConditionsAndVerifyDeleteMessageTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminDeleteActiveSalesRuleWithComplexConditionsAndVerifyDeleteMessageTest.xml index 9a71210aac1c6..aed9d71c306ae 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminDeleteActiveSalesRuleWithComplexConditionsAndVerifyDeleteMessageTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminDeleteActiveSalesRuleWithComplexConditionsAndVerifyDeleteMessageTest.xml @@ -62,7 +62,7 @@ <actionGroup ref="AssertCartPriceRuleSuccessSaveMessageActionGroup" stepKey="assertVerifyCartPriceRuleSuccessSaveMessage"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Delete active cart price rule--> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminDeleteActiveSalesRuleWithPercentPriceAndVerifyDeleteMessageTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminDeleteActiveSalesRuleWithPercentPriceAndVerifyDeleteMessageTest.xml index 34b8363e8b5ce..fc9a92765c2d0 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminDeleteActiveSalesRuleWithPercentPriceAndVerifyDeleteMessageTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminDeleteActiveSalesRuleWithPercentPriceAndVerifyDeleteMessageTest.xml @@ -28,7 +28,7 @@ </actionGroup> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Delete active cart price rule--> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminDeleteInactiveSalesRuleAndVerifyDeleteMessageTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminDeleteInactiveSalesRuleAndVerifyDeleteMessageTest.xml index 39a5d0f6a7131..6de5f127a296c 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminDeleteInactiveSalesRuleAndVerifyDeleteMessageTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminDeleteInactiveSalesRuleAndVerifyDeleteMessageTest.xml @@ -30,7 +30,7 @@ </before> <after> <deleteData createDataKey="initialSimpleProduct" stepKey="deleteProduct"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Delete inactive cart price rule--> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminMarketingCartPriceRulesNavigateMenuTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminMarketingCartPriceRulesNavigateMenuTest.xml index f281b0abf87a0..58d7ea7c1bad8 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/AdminMarketingCartPriceRulesNavigateMenuTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/AdminMarketingCartPriceRulesNavigateMenuTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToMarketingCartPriceRulesPage"> <argument name="menuUiId" value="{{AdminMenuMarketing.dataUiId}}"/> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/CartPriceRuleForConfigurableProductTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/CartPriceRuleForConfigurableProductTest.xml index ab8149978996e..41062b8153b3f 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/CartPriceRuleForConfigurableProductTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/CartPriceRuleForConfigurableProductTest.xml @@ -89,7 +89,7 @@ <deleteData createDataKey="createConfigChildProduct2" stepKey="deleteConfigChildProduct2"/> <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteConfigProductAttribute"/> <deleteData createDataKey="createCategory" stepKey="deleteApiCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontAutoGeneratedCouponCodeTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontAutoGeneratedCouponCodeTest.xml index 84537fb69ed41..60ece859dde96 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontAutoGeneratedCouponCodeTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontAutoGeneratedCouponCodeTest.xml @@ -34,7 +34,7 @@ <deleteData createDataKey="createSalesRule" stepKey="deleteSalesRule"/> <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Login as Admin --> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartRuleCouponForFreeShippingTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartRuleCouponForFreeShippingTest.xml index 3526ab20aa6b4..12c278d1e7b63 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartRuleCouponForFreeShippingTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartRuleCouponForFreeShippingTest.xml @@ -39,7 +39,7 @@ <deleteData createDataKey="createCartPriceRule" stepKey="deleteSalesRule"/> <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> <deleteData createDataKey="createSimpleProduct" stepKey="deleteProduct"/> - <actionGroup ref="logout" stepKey="logoutFromBackend"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromBackend"/> </after> <!-- Login with created Customer --> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartTotalValueWithFullDiscountUsingCartRuleTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartTotalValueWithFullDiscountUsingCartRuleTest.xml index f12b8ea7ca331..80b0747a3bf72 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartTotalValueWithFullDiscountUsingCartRuleTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartTotalValueWithFullDiscountUsingCartRuleTest.xml @@ -92,7 +92,7 @@ <magentoCLI command="config:set tax/cart_display/subtotal 1" stepKey="unsetSubtotal"/> <magentoCLI command="config:set carriers/freeshipping/active 0" stepKey="unsetFreeShipping"/> <!-- Log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Add testing products to the cart --> <amOnPage url="{{StorefrontProductPage.url($$createSimpleProductFirst.custom_attributes[url_key]$$)}}" stepKey="goToProductPage"/> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCategoryRulesShouldApplyToComplexProductsTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCategoryRulesShouldApplyToComplexProductsTest.xml index dbeb4ba94061b..b43fd095b5556 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCategoryRulesShouldApplyToComplexProductsTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCategoryRulesShouldApplyToComplexProductsTest.xml @@ -72,7 +72,7 @@ <deleteData createDataKey="createConfigProductAttributeCreateConfigurableProduct2" stepKey="deleteConfigProductAttribute2"/> <!--Delete Cart Price Rule --> <deleteData createDataKey="createCartPriceRule" stepKey="deleteCartPriceRule"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- 1: Create a cart price rule applying to CAT1 with discount --> <createData entity="SalesRuleNoCouponWithFixedDiscount" stepKey="createCartPriceRule"/> diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCategoryRulesShouldApplyToGroupedProductWithInvisibleIndividualProductTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCategoryRulesShouldApplyToGroupedProductWithInvisibleIndividualProductTest.xml index 13b2661dcb9d0..13c1100bd21f6 100644 --- a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCategoryRulesShouldApplyToGroupedProductWithInvisibleIndividualProductTest.xml +++ b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCategoryRulesShouldApplyToGroupedProductWithInvisibleIndividualProductTest.xml @@ -14,7 +14,7 @@ <title value="Category rules should apply to grouped product with invisible individual products"/> <description value="Category rules should apply to grouped product with invisible individual products"/> <severity value="CRITICAL"/> - <testCaseId value="MC-13608"/> + <testCaseId value="MC-31863"/> <group value="SalesRule"/> </annotations> <before> @@ -77,7 +77,7 @@ <argument name="ruleName" value="TestSalesRule"/> </actionGroup> <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearGridFilter"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Start to create new cart price rule via Category conditions --> <actionGroup ref="AdminCreateCartPriceRuleWithConditionIsCategoryActionGroup" stepKey="createCartPriceRuleWithCondition"> diff --git a/app/code/Magento/SalesRule/Test/Unit/Observer/AssignCouponDataAfterOrderCustomerAssignObserverTest.php b/app/code/Magento/SalesRule/Test/Unit/Observer/AssignCouponDataAfterOrderCustomerAssignObserverTest.php new file mode 100644 index 0000000000000..f72a47a318de0 --- /dev/null +++ b/app/code/Magento/SalesRule/Test/Unit/Observer/AssignCouponDataAfterOrderCustomerAssignObserverTest.php @@ -0,0 +1,150 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +namespace Magento\SalesRule\Test\Unit\Observer; + +use Magento\Framework\Event; +use Magento\Framework\Event\Observer; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\Sales\Api\Data\OrderInterface; +use Magento\SalesRule\Model\Coupon\UpdateCouponUsages; +use Magento\SalesRule\Observer\AssignCouponDataAfterOrderCustomerAssignObserver; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; + +/** + * Unit test for Magento\SalesRule\Observer\AssignCouponDataAfterOrderCustomerAssignObserver + */ +class AssignCouponDataAfterOrderCustomerAssignObserverTest extends TestCase +{ + /* + * Stub event key order + */ + private const STUB_EVENT_KEY_ORDER = 'order'; + + /* + * Stub customer ID + */ + private const STUB_CUSTOMER_ID = 1; + + /** + * Testable Object + * + * @var AssignCouponDataAfterOrderCustomerAssignObserver + */ + private $observer; + + /** + * @var ObjectManager + */ + private $objectManager; + + /** + * @var Observer|MockObject + */ + private $observerMock; + + /** + * @var Event|MockObject + */ + private $eventMock; + + /** + * @var OrderInterface|MockObject + */ + private $orderMock; + + /** + * @var UpdateCouponUsages|MockObject + */ + private $updateCouponUsagesMock; + + protected function setUp(): void + { + $this->objectManager = new ObjectManager($this); + $this->observerMock = $this->createMock(Observer::class); + + $this->eventMock = $this->getMockBuilder(Event::class) + ->disableOriginalConstructor() + ->setMethods(['getData']) + ->getMock(); + + $this->orderMock = $this->getMockBuilder(OrderInterface::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->updateCouponUsagesMock = $this->getMockBuilder(UpdateCouponUsages::class) + ->disableOriginalConstructor() + ->setMethods(['execute']) + ->getMock(); + + $this->observer = $this->objectManager->getObject( + AssignCouponDataAfterOrderCustomerAssignObserver::class, + [ + 'updateCouponUsages' => $this->updateCouponUsagesMock + ] + ); + } + + /** + * Test for execute(), covers test case for assign coupon data after order customer + */ + public function testExecuteAssignCouponData(): void + { + $this->observerMock + ->expects($this->once()) + ->method('getEvent') + ->willReturn($this->eventMock); + + $this->eventMock + ->expects($this->once()) + ->method('getData') + ->with(self::STUB_EVENT_KEY_ORDER) + ->willReturn($this->orderMock); + + $this->orderMock + ->expects($this->once()) + ->method('getCustomerId') + ->willReturn(self::STUB_CUSTOMER_ID); + + $this->updateCouponUsagesMock + ->expects($this->once()) + ->method('execute') + ->with($this->orderMock, true); + + $this->observer->execute($this->observerMock); + } + + /** + * Test for execute(), covers test case for assign coupon data after order customer with empty customer ID + */ + public function testExecuteAssignCouponDataWithEmptyCustomerId(): void + { + $this->observerMock + ->expects($this->once()) + ->method('getEvent') + ->willReturn($this->eventMock); + + $this->eventMock + ->expects($this->once()) + ->method('getData') + ->with(self::STUB_EVENT_KEY_ORDER) + ->willReturn($this->orderMock); + + $this->orderMock + ->expects($this->once()) + ->method('getCustomerId') + ->willReturn(null); + + $this->updateCouponUsagesMock + ->expects($this->never()) + ->method('execute'); + + $this->observer->execute($this->observerMock); + } +} diff --git a/app/code/Magento/Search/Test/Mftf/Test/AdminGlobalSearchOnProductPageTest.xml b/app/code/Magento/Search/Test/Mftf/Test/AdminGlobalSearchOnProductPageTest.xml index 725f45c0bc6e3..6ff7a34a03b8a 100644 --- a/app/code/Magento/Search/Test/Mftf/Test/AdminGlobalSearchOnProductPageTest.xml +++ b/app/code/Magento/Search/Test/Mftf/Test/AdminGlobalSearchOnProductPageTest.xml @@ -34,7 +34,7 @@ </actionGroup> <!-- Logout --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Create Simple Product --> diff --git a/app/code/Magento/Search/Test/Mftf/Test/AdminMassDeleteSearchTermEntityTest.xml b/app/code/Magento/Search/Test/Mftf/Test/AdminMassDeleteSearchTermEntityTest.xml index 01c361d336541..2b7a4e7f5e5cb 100644 --- a/app/code/Magento/Search/Test/Mftf/Test/AdminMassDeleteSearchTermEntityTest.xml +++ b/app/code/Magento/Search/Test/Mftf/Test/AdminMassDeleteSearchTermEntityTest.xml @@ -30,7 +30,7 @@ </before> <after> <!-- Log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Go to the catalog search term page --> diff --git a/app/code/Magento/Search/Test/Mftf/Test/StorefrontUsingElasticSearchWithWeightAttributeTest.xml b/app/code/Magento/Search/Test/Mftf/Test/StorefrontUsingElasticSearchWithWeightAttributeTest.xml index a8391ce5ca33b..504dee5067187 100644 --- a/app/code/Magento/Search/Test/Mftf/Test/StorefrontUsingElasticSearchWithWeightAttributeTest.xml +++ b/app/code/Magento/Search/Test/Mftf/Test/StorefrontUsingElasticSearchWithWeightAttributeTest.xml @@ -37,7 +37,7 @@ <actionGroup ref="SaveProductAttributeActionGroup" stepKey="saveAttributeChanges"/> <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearFilter"/> <!-- Logout from admin --> - <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> </after> <!-- Step 2 --> <actionGroup ref="OpenProductAttributeFromSearchResultInGridActionGroup" stepKey="openWeightProductAttribute"> diff --git a/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductDescriptionTest.xml b/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductDescriptionTest.xml index 93a0f98f6f828..5030484434925 100644 --- a/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductDescriptionTest.xml +++ b/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductDescriptionTest.xml @@ -39,7 +39,7 @@ </actionGroup> <!-- Delete created below search terms --> <actionGroup ref="AdminDeleteSearchTermActionGroup" stepKey="deleteSearchTerms"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Go to storefront home page --> <actionGroup ref="StorefrontOpenHomePageActionGroup" stepKey="openStoreFrontHomePage"/> diff --git a/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductNameTest.xml b/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductNameTest.xml index fc933c90341f9..1d312959a4a00 100644 --- a/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductNameTest.xml +++ b/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductNameTest.xml @@ -43,7 +43,7 @@ </actionGroup> <!-- Delete created below search terms --> <actionGroup ref="AdminDeleteSearchTermActionGroup" stepKey="deleteSearchTerms"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Go to storefront home page --> diff --git a/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductShortDescriptionTest.xml b/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductShortDescriptionTest.xml index 65472b9e10282..3ae29f60a8e86 100644 --- a/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductShortDescriptionTest.xml +++ b/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductShortDescriptionTest.xml @@ -45,7 +45,7 @@ <!-- Delete created below search terms --> <actionGroup ref="AdminDeleteSearchTermActionGroup" stepKey="deleteSearchTerms"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Go to storefront home page --> diff --git a/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductSkuTest.xml b/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductSkuTest.xml index 6e80823b78e0f..e14cbbb85a0e7 100644 --- a/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductSkuTest.xml +++ b/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductSkuTest.xml @@ -45,7 +45,7 @@ <!-- Delete created below search terms --> <actionGroup ref="AdminDeleteSearchTermActionGroup" stepKey="deleteSearchTerms"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Go to storefront home page --> diff --git a/app/code/Magento/Security/Test/Mftf/Test/AdminUserLockWhenEditingUserTest.xml b/app/code/Magento/Security/Test/Mftf/Test/AdminUserLockWhenEditingUserTest.xml index 9f421668bdc4f..47a0224a1c4db 100644 --- a/app/code/Magento/Security/Test/Mftf/Test/AdminUserLockWhenEditingUserTest.xml +++ b/app/code/Magento/Security/Test/Mftf/Test/AdminUserLockWhenEditingUserTest.xml @@ -31,7 +31,7 @@ <actionGroup ref="AdminDeleteUserViaCurlActionGroup" stepKey="deleteUser"> <argument name="user" value="$$user$$" /> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminOpenUserEditPageActionGroup" stepKey="openEditUserPageFirstAttempt"> diff --git a/app/code/Magento/Shipping/Test/Mftf/Test/AdminCheckInputFieldsDisabledAfterAppConfigDumpTest.xml b/app/code/Magento/Shipping/Test/Mftf/Test/AdminCheckInputFieldsDisabledAfterAppConfigDumpTest.xml index 0b7ddd0cfa781..c3d9b243c27c7 100644 --- a/app/code/Magento/Shipping/Test/Mftf/Test/AdminCheckInputFieldsDisabledAfterAppConfigDumpTest.xml +++ b/app/code/Magento/Shipping/Test/Mftf/Test/AdminCheckInputFieldsDisabledAfterAppConfigDumpTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Assert configuration are disabled in Flat Rate section--> <comment userInput="Assert configuration are disabled in Flat Rate section" stepKey="commentSeeDisabledFlatRateConfigs"/> diff --git a/app/code/Magento/Shipping/Test/Mftf/Test/AdminCheckTheConfirmationPopupTest.xml b/app/code/Magento/Shipping/Test/Mftf/Test/AdminCheckTheConfirmationPopupTest.xml index 87058245c6014..bacfaf15f99d7 100644 --- a/app/code/Magento/Shipping/Test/Mftf/Test/AdminCheckTheConfirmationPopupTest.xml +++ b/app/code/Magento/Shipping/Test/Mftf/Test/AdminCheckTheConfirmationPopupTest.xml @@ -24,7 +24,7 @@ <after> <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="CreateOrderActionGroup" stepKey="goToCreateOrderPage"> <argument name="customer" value="$$createCustomer$$"/> diff --git a/app/code/Magento/Shipping/Test/Mftf/Test/AdminCreateOrderCustomStoreShippingMethodTableRatesTest.xml b/app/code/Magento/Shipping/Test/Mftf/Test/AdminCreateOrderCustomStoreShippingMethodTableRatesTest.xml index 7784fdd31e58e..5319992efa585 100644 --- a/app/code/Magento/Shipping/Test/Mftf/Test/AdminCreateOrderCustomStoreShippingMethodTableRatesTest.xml +++ b/app/code/Magento/Shipping/Test/Mftf/Test/AdminCreateOrderCustomStoreShippingMethodTableRatesTest.xml @@ -73,7 +73,7 @@ <actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="DeleteWebsite"> <argument name="websiteName" value="{{customWebsite.name}}"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Assign product to custom website--> <amOnPage url="{{AdminProductEditPage.url($$createProduct.id$$)}}" stepKey="goToProductEditPage"/> diff --git a/app/code/Magento/Shipping/Test/Mftf/Test/AdminCreatePartialShipmentEntityTest.xml b/app/code/Magento/Shipping/Test/Mftf/Test/AdminCreatePartialShipmentEntityTest.xml index 0e4fd3ce9a86c..64d0932e9272d 100644 --- a/app/code/Magento/Shipping/Test/Mftf/Test/AdminCreatePartialShipmentEntityTest.xml +++ b/app/code/Magento/Shipping/Test/Mftf/Test/AdminCreatePartialShipmentEntityTest.xml @@ -35,7 +35,7 @@ <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> <deleteData createDataKey="createSimpleProduct" stepKey="deleteProduct"/> <createData entity="FreeShippinMethodDefault" stepKey="disableFreeShippingMethod"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- TEST BODY --> diff --git a/app/code/Magento/Shipping/Test/Mftf/Test/AdminCreateShipmentEntityTest.xml b/app/code/Magento/Shipping/Test/Mftf/Test/AdminCreateShipmentEntityTest.xml index f4087932a0710..0985aea2e502c 100644 --- a/app/code/Magento/Shipping/Test/Mftf/Test/AdminCreateShipmentEntityTest.xml +++ b/app/code/Magento/Shipping/Test/Mftf/Test/AdminCreateShipmentEntityTest.xml @@ -35,7 +35,7 @@ <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> <deleteData createDataKey="createSimpleProduct" stepKey="deleteProduct"/> <createData entity="FreeShippinMethodDefault" stepKey="disableFreeShippingMethod"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- TEST BODY --> diff --git a/app/code/Magento/Shipping/Test/Mftf/Test/AdminValidateShippingTrackingNumberTest.xml b/app/code/Magento/Shipping/Test/Mftf/Test/AdminValidateShippingTrackingNumberTest.xml index ca4d731eb82b1..7df8f08e79530 100644 --- a/app/code/Magento/Shipping/Test/Mftf/Test/AdminValidateShippingTrackingNumberTest.xml +++ b/app/code/Magento/Shipping/Test/Mftf/Test/AdminValidateShippingTrackingNumberTest.xml @@ -24,7 +24,7 @@ <after> <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="CreateOrderActionGroup" stepKey="goToCreateOrderPage"> <argument name="customer" value="$$createCustomer$$"/> diff --git a/app/code/Magento/Shipping/Test/Mftf/Test/StorefrontDisplayTableRatesShippingMethodForAETest.xml b/app/code/Magento/Shipping/Test/Mftf/Test/StorefrontDisplayTableRatesShippingMethodForAETest.xml index 81fe492ffc005..81c76ec916f7e 100644 --- a/app/code/Magento/Shipping/Test/Mftf/Test/StorefrontDisplayTableRatesShippingMethodForAETest.xml +++ b/app/code/Magento/Shipping/Test/Mftf/Test/StorefrontDisplayTableRatesShippingMethodForAETest.xml @@ -39,7 +39,7 @@ <argument name="status" value="0"/> </actionGroup> <actionGroup ref="AdminSaveConfigActionGroup" stepKey="saveSystemConfig"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Admin Configuration: enable Table Rates and import CSV file with the rates--> <actionGroup ref="AdminOpenShippingMethodsConfigPageActionGroup" stepKey="openShippingMethodConfigPage"/> diff --git a/app/code/Magento/Shipping/Test/Mftf/Test/TableRatesShippingMethodForDifferentStatesTest.xml b/app/code/Magento/Shipping/Test/Mftf/Test/TableRatesShippingMethodForDifferentStatesTest.xml index 5721af7fdb71b..3a375be6533db 100644 --- a/app/code/Magento/Shipping/Test/Mftf/Test/TableRatesShippingMethodForDifferentStatesTest.xml +++ b/app/code/Magento/Shipping/Test/Mftf/Test/TableRatesShippingMethodForDifferentStatesTest.xml @@ -36,7 +36,7 @@ <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> <!-- Log out --> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Go to Stores > Configuration > Sales > Shipping Methods --> diff --git a/app/code/Magento/Signifyd/Test/Mftf/Test/AdminSignifydConfigDependentOnActiveFieldTest.xml b/app/code/Magento/Signifyd/Test/Mftf/Test/AdminSignifydConfigDependentOnActiveFieldTest.xml index b8fb91c4dcd99..e3275d4097c63 100644 --- a/app/code/Magento/Signifyd/Test/Mftf/Test/AdminSignifydConfigDependentOnActiveFieldTest.xml +++ b/app/code/Magento/Signifyd/Test/Mftf/Test/AdminSignifydConfigDependentOnActiveFieldTest.xml @@ -21,7 +21,7 @@ </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <magentoCLI command="config:set fraud_protection/signifyd/active 0" stepKey="disableSignifyd"/> </after> diff --git a/app/code/Magento/Sitemap/Test/Mftf/Test/AdminMarketingSiteMapCreateNewTest.xml b/app/code/Magento/Sitemap/Test/Mftf/Test/AdminMarketingSiteMapCreateNewTest.xml index 57d8f8c75d23d..0ddc0640b56df 100644 --- a/app/code/Magento/Sitemap/Test/Mftf/Test/AdminMarketingSiteMapCreateNewTest.xml +++ b/app/code/Magento/Sitemap/Test/Mftf/Test/AdminMarketingSiteMapCreateNewTest.xml @@ -25,7 +25,7 @@ <argument name="filename" value="{{DefaultSiteMap.filename}}" /> </actionGroup> <actionGroup ref="AssertSiteMapDeleteSuccessActionGroup" stepKey="assertDeleteSuccessMessage"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminMarketingSiteMapNavigateNewActionGroup" stepKey="navigateNewSiteMap"/> <actionGroup ref="AdminMarketingSiteMapFillFormActionGroup" stepKey="fillSiteMapForm"> diff --git a/app/code/Magento/Sitemap/Test/Mftf/Test/AdminMarketingSiteMapNavigateMenuTest.xml b/app/code/Magento/Sitemap/Test/Mftf/Test/AdminMarketingSiteMapNavigateMenuTest.xml index 54543fab8649d..608b284f247f3 100644 --- a/app/code/Magento/Sitemap/Test/Mftf/Test/AdminMarketingSiteMapNavigateMenuTest.xml +++ b/app/code/Magento/Sitemap/Test/Mftf/Test/AdminMarketingSiteMapNavigateMenuTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToMarketingSiteMapPage"> <argument name="menuUiId" value="{{AdminMenuMarketing.dataUiId}}"/> diff --git a/app/code/Magento/Store/App/Action/Plugin/StoreCheck.php b/app/code/Magento/Store/App/Action/Plugin/StoreCheck.php index d9cb146c9f12a..d1171865275a8 100644 --- a/app/code/Magento/Store/App/Action/Plugin/StoreCheck.php +++ b/app/code/Magento/Store/App/Action/Plugin/StoreCheck.php @@ -1,40 +1,46 @@ <?php /** - * * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Store\App\Action\Plugin; +use Magento\Framework\App\ActionInterface; +use Magento\Framework\Exception\State\InitException; +use Magento\Store\Model\StoreManagerInterface; + +/** + * Plugin verify Store on before Execute on ActionInterface + */ class StoreCheck { /** - * @var \Magento\Store\Model\StoreManagerInterface + * @var StoreManagerInterface */ protected $_storeManager; /** - * @param \Magento\Store\Model\StoreManagerInterface $storeManager + * @param StoreManagerInterface $storeManager */ public function __construct( - \Magento\Store\Model\StoreManagerInterface $storeManager + StoreManagerInterface $storeManager ) { $this->_storeManager = $storeManager; } /** - * @param \Magento\Framework\App\Action\AbstractAction $subject - * @param \Magento\Framework\App\RequestInterface $request + * Verify before execute + * + * @param ActionInterface $subject * @return void * @SuppressWarnings(PHPMD.UnusedFormalParameter) * @throws \Magento\Framework\Exception\State\InitException */ - public function beforeDispatch( - \Magento\Framework\App\Action\AbstractAction $subject, - \Magento\Framework\App\RequestInterface $request - ) { + public function beforeExecute(ActionInterface $subject) + { if (!$this->_storeManager->getStore()->isActive()) { - throw new \Magento\Framework\Exception\State\InitException( + throw new InitException( __('Current store is not active.') ); } diff --git a/app/code/Magento/Store/Controller/Store/Redirect.php b/app/code/Magento/Store/Controller/Store/Redirect.php index 51e6c2646e1ab..45924b5b0d28a 100644 --- a/app/code/Magento/Store/Controller/Store/Redirect.php +++ b/app/code/Magento/Store/Controller/Store/Redirect.php @@ -11,10 +11,15 @@ use Magento\Framework\App\Action\Context; use Magento\Framework\App\Action\HttpGetActionInterface; use Magento\Framework\App\Action\HttpPostActionInterface; +use Magento\Framework\App\ActionInterface; +use Magento\Framework\App\ObjectManager; use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\Session\Generic; +use Magento\Framework\Session\SidResolverInterface; use Magento\Store\Api\StoreRepositoryInterface; use Magento\Store\Api\StoreResolverInterface; use Magento\Store\Model\Store; +use Magento\Store\Model\StoreManagerInterface; use Magento\Store\Model\StoreResolver; use Magento\Store\Model\StoreSwitcher\HashGenerator; @@ -38,27 +43,35 @@ class Redirect extends Action implements HttpGetActionInterface, HttpPostActionI */ private $hashGenerator; + /** + * @var StoreManagerInterface + */ + private $storeManager; + /** * @param Context $context * @param StoreRepositoryInterface $storeRepository * @param StoreResolverInterface $storeResolver - * @param \Magento\Framework\Session\Generic $session - * @param \Magento\Framework\Session\SidResolverInterface $sidResolver + * @param Generic $session + * @param SidResolverInterface $sidResolver * @param HashGenerator $hashGenerator + * @param StoreManagerInterface $storeManager * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ public function __construct( Context $context, StoreRepositoryInterface $storeRepository, StoreResolverInterface $storeResolver, - \Magento\Framework\Session\Generic $session, - \Magento\Framework\Session\SidResolverInterface $sidResolver, - HashGenerator $hashGenerator + Generic $session, + SidResolverInterface $sidResolver, + HashGenerator $hashGenerator, + StoreManagerInterface $storeManager = null ) { parent::__construct($context); $this->storeRepository = $storeRepository; $this->storeResolver = $storeResolver; $this->hashGenerator = $hashGenerator; + $this->storeManager = $storeManager ?: ObjectManager::getInstance()->get(StoreManagerInterface::class); } /** @@ -81,6 +94,9 @@ public function execute() try { /** @var Store $fromStore */ $fromStore = $this->storeRepository->get($fromStoreCode); + /** @var Store $targetStore */ + $targetStore = $this->storeRepository->get($targetStoreCode); + $this->storeManager->setCurrentStore($targetStore); } catch (NoSuchEntityException $e) { $error = __("Requested store is not found ({$fromStoreCode})"); } @@ -89,12 +105,11 @@ public function execute() $this->messageManager->addErrorMessage($error); $this->_redirect->redirect($this->_response, $currentStore->getBaseUrl()); } else { - $encodedUrl = $this->_request->getParam(\Magento\Framework\App\ActionInterface::PARAM_NAME_URL_ENCODED); - + $encodedUrl = $this->_request->getParam(ActionInterface::PARAM_NAME_URL_ENCODED); $query = [ '___from_store' => $fromStore->getCode(), StoreResolverInterface::PARAM_NAME => $targetStoreCode, - \Magento\Framework\App\ActionInterface::PARAM_NAME_URL_ENCODED => $encodedUrl, + ActionInterface::PARAM_NAME_URL_ENCODED => $encodedUrl, ]; $customerHash = $this->hashGenerator->generateHash($fromStore); @@ -104,6 +119,7 @@ public function execute() '_nosid' => true, '_query' => $query ]; + $this->_redirect->redirect($this->_response, 'stores/store/switch', $arguments); } diff --git a/app/code/Magento/Store/Test/Mftf/Test/AdminCreateCustomStoreViewStatusDisabledVerifyErrorSaveMessageTest.xml b/app/code/Magento/Store/Test/Mftf/Test/AdminCreateCustomStoreViewStatusDisabledVerifyErrorSaveMessageTest.xml index 94e723c9afafb..d4b5bc9a9b50f 100644 --- a/app/code/Magento/Store/Test/Mftf/Test/AdminCreateCustomStoreViewStatusDisabledVerifyErrorSaveMessageTest.xml +++ b/app/code/Magento/Store/Test/Mftf/Test/AdminCreateCustomStoreViewStatusDisabledVerifyErrorSaveMessageTest.xml @@ -34,7 +34,7 @@ <actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteWebsite"> <argument name="websiteName" value="{{customWebsite.name}}"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Create store view selecting store created, choose disabled status and verify AssertStoreDisabledErrorSaveMessage--> @@ -44,4 +44,4 @@ <argument name="storeViewStatus" value="{{storeViewDataDisabled.is_active}}"/> </actionGroup> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Store/Test/Mftf/Test/AdminCreateCustomStoreViewStatusEnabledVerifyAbsenceOfDeleteButtonTest.xml b/app/code/Magento/Store/Test/Mftf/Test/AdminCreateCustomStoreViewStatusEnabledVerifyAbsenceOfDeleteButtonTest.xml index 5d4ac8de74680..dc24a2f635b52 100644 --- a/app/code/Magento/Store/Test/Mftf/Test/AdminCreateCustomStoreViewStatusEnabledVerifyAbsenceOfDeleteButtonTest.xml +++ b/app/code/Magento/Store/Test/Mftf/Test/AdminCreateCustomStoreViewStatusEnabledVerifyAbsenceOfDeleteButtonTest.xml @@ -29,7 +29,7 @@ <actionGroup ref="DeleteCustomStoreActionGroup" stepKey="deleteStore"> <argument name="storeGroupName" value="customStore.name"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Create custom store view--> diff --git a/app/code/Magento/Store/Test/Mftf/Test/AdminCreateCustomStoreViewStatusEnabledVerifyBackendAndFrontendTest.xml b/app/code/Magento/Store/Test/Mftf/Test/AdminCreateCustomStoreViewStatusEnabledVerifyBackendAndFrontendTest.xml index 2ba8c675b3b2a..188300acc7015 100644 --- a/app/code/Magento/Store/Test/Mftf/Test/AdminCreateCustomStoreViewStatusEnabledVerifyBackendAndFrontendTest.xml +++ b/app/code/Magento/Store/Test/Mftf/Test/AdminCreateCustomStoreViewStatusEnabledVerifyBackendAndFrontendTest.xml @@ -29,7 +29,7 @@ <actionGroup ref="DeleteCustomStoreActionGroup" stepKey="deleteStore"> <argument name="storeGroupName" value="customStore.name"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Create custom store view--> diff --git a/app/code/Magento/Store/Test/Mftf/Test/AdminCreateNewLocalizedStoreViewStatusEnabledTest.xml b/app/code/Magento/Store/Test/Mftf/Test/AdminCreateNewLocalizedStoreViewStatusEnabledTest.xml index 6c60445107b28..faa9d38a2d6fe 100644 --- a/app/code/Magento/Store/Test/Mftf/Test/AdminCreateNewLocalizedStoreViewStatusEnabledTest.xml +++ b/app/code/Magento/Store/Test/Mftf/Test/AdminCreateNewLocalizedStoreViewStatusEnabledTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteStoreView"> <argument name="customStore" value="storeViewGermany"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Create new localized store view--> diff --git a/app/code/Magento/Store/Test/Mftf/Test/AdminCreateStoreGroupWithCustomWebsiteAndDefaultCategoryTest.xml b/app/code/Magento/Store/Test/Mftf/Test/AdminCreateStoreGroupWithCustomWebsiteAndDefaultCategoryTest.xml index 4892556929f80..aaac3e5ea08b6 100644 --- a/app/code/Magento/Store/Test/Mftf/Test/AdminCreateStoreGroupWithCustomWebsiteAndDefaultCategoryTest.xml +++ b/app/code/Magento/Store/Test/Mftf/Test/AdminCreateStoreGroupWithCustomWebsiteAndDefaultCategoryTest.xml @@ -30,7 +30,7 @@ <actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteWebsite"> <argument name="websiteName" value="{{customWebsite.name}}"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Create custom store group with custom website and default category and verify AssertStoreGroupSuccessSaveMessage--> diff --git a/app/code/Magento/Store/Test/Mftf/Test/AdminCreateStoreGroupWithCustomWebsiteAndRootCategoryTest.xml b/app/code/Magento/Store/Test/Mftf/Test/AdminCreateStoreGroupWithCustomWebsiteAndRootCategoryTest.xml index 27037f45f3835..8091f01e1f7ec 100644 --- a/app/code/Magento/Store/Test/Mftf/Test/AdminCreateStoreGroupWithCustomWebsiteAndRootCategoryTest.xml +++ b/app/code/Magento/Store/Test/Mftf/Test/AdminCreateStoreGroupWithCustomWebsiteAndRootCategoryTest.xml @@ -38,7 +38,7 @@ </actionGroup> <!--Delete root category--> <deleteData stepKey="deleteRootCategory" createDataKey="rootCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Create custom store group with custom website and root category and verify AssertStoreGroupSuccessSaveMessage--> diff --git a/app/code/Magento/Store/Test/Mftf/Test/AdminCreateStoreGroupWithDefaultWebsiteAndDefaultCategoryTest.xml b/app/code/Magento/Store/Test/Mftf/Test/AdminCreateStoreGroupWithDefaultWebsiteAndDefaultCategoryTest.xml index 0db65501b4112..a161abe767010 100644 --- a/app/code/Magento/Store/Test/Mftf/Test/AdminCreateStoreGroupWithDefaultWebsiteAndDefaultCategoryTest.xml +++ b/app/code/Magento/Store/Test/Mftf/Test/AdminCreateStoreGroupWithDefaultWebsiteAndDefaultCategoryTest.xml @@ -25,7 +25,7 @@ <actionGroup ref="DeleteCustomStoreActionGroup" stepKey="deleteStoreGroup"> <argument name="storeGroupName" value="SecondStoreGroupUnique.name"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Create custom store group with default website and default category and verify AssertStoreGroupSuccessSaveMessage--> diff --git a/app/code/Magento/Store/Test/Mftf/Test/AdminCreateStoreViewStatusDisabledVerifyBackendAndFrontendTest.xml b/app/code/Magento/Store/Test/Mftf/Test/AdminCreateStoreViewStatusDisabledVerifyBackendAndFrontendTest.xml index 2d8fbc72263d4..0207faf692f14 100644 --- a/app/code/Magento/Store/Test/Mftf/Test/AdminCreateStoreViewStatusDisabledVerifyBackendAndFrontendTest.xml +++ b/app/code/Magento/Store/Test/Mftf/Test/AdminCreateStoreViewStatusDisabledVerifyBackendAndFrontendTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteStoreView"> <argument name="customStore" value="storeViewDataDisabled"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Create store view--> diff --git a/app/code/Magento/Store/Test/Mftf/Test/AdminCreateStoreViewStatusEnabledVerifyBackendAndFrontendTest.xml b/app/code/Magento/Store/Test/Mftf/Test/AdminCreateStoreViewStatusEnabledVerifyBackendAndFrontendTest.xml index 150e1082352cf..767b452544714 100644 --- a/app/code/Magento/Store/Test/Mftf/Test/AdminCreateStoreViewStatusEnabledVerifyBackendAndFrontendTest.xml +++ b/app/code/Magento/Store/Test/Mftf/Test/AdminCreateStoreViewStatusEnabledVerifyBackendAndFrontendTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteStoreView"> <argument name="customStore" value="storeViewData"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Create store view--> diff --git a/app/code/Magento/Store/Test/Mftf/Test/AdminCreateStoreViewTest.xml b/app/code/Magento/Store/Test/Mftf/Test/AdminCreateStoreViewTest.xml index e20eb70ae6f45..4171aa6f08915 100644 --- a/app/code/Magento/Store/Test/Mftf/Test/AdminCreateStoreViewTest.xml +++ b/app/code/Magento/Store/Test/Mftf/Test/AdminCreateStoreViewTest.xml @@ -20,7 +20,7 @@ </annotations> <before> - <actionGroup ref="LoginActionGroup" stepKey="loginAsAdmin"/> + <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/> <actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createStoreView" /> </before> @@ -29,7 +29,7 @@ <argument name="customStore" value="customStore"/> </actionGroup> <click selector="{{AdminStoresGridSection.resetButton}}" stepKey="resetSearchFilter"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Filter grid and see created store view--> diff --git a/app/code/Magento/Store/Test/Mftf/Test/AdminCreateWebsiteTest.xml b/app/code/Magento/Store/Test/Mftf/Test/AdminCreateWebsiteTest.xml index a8782acb1eb07..208ed316e2e51 100644 --- a/app/code/Magento/Store/Test/Mftf/Test/AdminCreateWebsiteTest.xml +++ b/app/code/Magento/Store/Test/Mftf/Test/AdminCreateWebsiteTest.xml @@ -25,7 +25,7 @@ <actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteWebsite"> <argument name="websiteName" value="{{customWebsite.name}}"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Create website and AssertWebsiteSuccessSaveMessage--> diff --git a/app/code/Magento/Store/Test/Mftf/Test/AdminDeleteDefaultStoreViewTest.xml b/app/code/Magento/Store/Test/Mftf/Test/AdminDeleteDefaultStoreViewTest.xml index 85fd8561f90b5..c010935233a5b 100644 --- a/app/code/Magento/Store/Test/Mftf/Test/AdminDeleteDefaultStoreViewTest.xml +++ b/app/code/Magento/Store/Test/Mftf/Test/AdminDeleteDefaultStoreViewTest.xml @@ -20,7 +20,7 @@ <actionGroup ref = "LoginAsAdmin" stepKey="loginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Create custom store view--> <actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createNewStoreView"> diff --git a/app/code/Magento/Store/Test/Mftf/Test/AdminDeleteStoreGroupTest.xml b/app/code/Magento/Store/Test/Mftf/Test/AdminDeleteStoreGroupTest.xml index 185cf87531d9a..a3afddd794723 100644 --- a/app/code/Magento/Store/Test/Mftf/Test/AdminDeleteStoreGroupTest.xml +++ b/app/code/Magento/Store/Test/Mftf/Test/AdminDeleteStoreGroupTest.xml @@ -30,7 +30,7 @@ </before> <after> <magentoCLI command="config:set system/backup/functionality_enabled 0" stepKey="setEnableBackupToNo"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Delete custom store group and verify AssertStoreGroupSuccessDeleteAndBackupMessages--> diff --git a/app/code/Magento/Store/Test/Mftf/Test/AdminDeleteStoreViewTest.xml b/app/code/Magento/Store/Test/Mftf/Test/AdminDeleteStoreViewTest.xml index df6fc391b2972..a197f88bafba2 100644 --- a/app/code/Magento/Store/Test/Mftf/Test/AdminDeleteStoreViewTest.xml +++ b/app/code/Magento/Store/Test/Mftf/Test/AdminDeleteStoreViewTest.xml @@ -28,7 +28,7 @@ </before> <after> <magentoCLI command="config:set system/backup/functionality_enabled 0" stepKey="setEnableBackupToNo"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Delete custom store view and verify AssertStoreSuccessDeleteMessage And BackupMessage--> diff --git a/app/code/Magento/Store/Test/Mftf/Test/AdminMoveStoreToOtherGroupSameWebsiteTest.xml b/app/code/Magento/Store/Test/Mftf/Test/AdminMoveStoreToOtherGroupSameWebsiteTest.xml index f1983dca53bf7..a94c1f8f66c7c 100644 --- a/app/code/Magento/Store/Test/Mftf/Test/AdminMoveStoreToOtherGroupSameWebsiteTest.xml +++ b/app/code/Magento/Store/Test/Mftf/Test/AdminMoveStoreToOtherGroupSameWebsiteTest.xml @@ -50,7 +50,7 @@ <actionGroup ref="DeleteCustomStoreActionGroup" stepKey="deleteSecondStore"> <argument name="storeGroupName" value="customStoreGroup.name"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Search created second store view in grid--> diff --git a/app/code/Magento/Store/Test/Mftf/Test/AdminUpdateStoreGroupAcceptAlertAndVerifyStoreViewFormTest.xml b/app/code/Magento/Store/Test/Mftf/Test/AdminUpdateStoreGroupAcceptAlertAndVerifyStoreViewFormTest.xml index 16f830224f7f4..8d4e095d6ed87 100644 --- a/app/code/Magento/Store/Test/Mftf/Test/AdminUpdateStoreGroupAcceptAlertAndVerifyStoreViewFormTest.xml +++ b/app/code/Magento/Store/Test/Mftf/Test/AdminUpdateStoreGroupAcceptAlertAndVerifyStoreViewFormTest.xml @@ -44,7 +44,7 @@ </actionGroup> <!--Delete root category--> <deleteData stepKey="deleteRootCategory" createDataKey="rootCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Open created Store group in grid--> diff --git a/app/code/Magento/Store/Test/Mftf/Test/AdminUpdateStoreGroupAndVerifyStoreViewFormTest.xml b/app/code/Magento/Store/Test/Mftf/Test/AdminUpdateStoreGroupAndVerifyStoreViewFormTest.xml index ab204560f11c6..f8df1059fb1ef 100644 --- a/app/code/Magento/Store/Test/Mftf/Test/AdminUpdateStoreGroupAndVerifyStoreViewFormTest.xml +++ b/app/code/Magento/Store/Test/Mftf/Test/AdminUpdateStoreGroupAndVerifyStoreViewFormTest.xml @@ -34,7 +34,7 @@ <actionGroup ref="DeleteCustomStoreActionGroup" stepKey="deleteUpdatedStoreGroup"> <argument name="storeGroupName" value="SecondStoreGroupUnique.name"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Open created Store group in grid--> diff --git a/app/code/Magento/Store/Test/Mftf/Test/AdminUpdateStoreViewTest.xml b/app/code/Magento/Store/Test/Mftf/Test/AdminUpdateStoreViewTest.xml index 26dee6c632928..3b16767e60d55 100644 --- a/app/code/Magento/Store/Test/Mftf/Test/AdminUpdateStoreViewTest.xml +++ b/app/code/Magento/Store/Test/Mftf/Test/AdminUpdateStoreViewTest.xml @@ -32,7 +32,7 @@ <actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteUpdatedStoreView"> <argument name="customStore" value="SecondStoreUnique"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Search created store view in grid--> diff --git a/app/code/Magento/Store/Test/Mftf/Test/AdminUpdateWebsiteTest.xml b/app/code/Magento/Store/Test/Mftf/Test/AdminUpdateWebsiteTest.xml index 5c4ecb87dda53..e9f72e46e3973 100644 --- a/app/code/Magento/Store/Test/Mftf/Test/AdminUpdateWebsiteTest.xml +++ b/app/code/Magento/Store/Test/Mftf/Test/AdminUpdateWebsiteTest.xml @@ -30,7 +30,7 @@ <actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteWebsite"> <argument name="websiteName" value="{{updateCustomWebsite.name}}"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Search created custom website in grid--> diff --git a/app/code/Magento/Store/Test/Unit/App/Action/Plugin/StoreCheckTest.php b/app/code/Magento/Store/Test/Unit/App/Action/Plugin/StoreCheckTest.php index 93bd4f2ccfba4..9ecd640b246af 100644 --- a/app/code/Magento/Store/Test/Unit/App/Action/Plugin/StoreCheckTest.php +++ b/app/code/Magento/Store/Test/Unit/App/Action/Plugin/StoreCheckTest.php @@ -5,37 +5,38 @@ */ namespace Magento\Store\Test\Unit\App\Action\Plugin; +use Magento\Framework\App\Action\AbstractAction; +use Magento\Store\App\Action\Plugin\StoreCheck; +use Magento\Store\Model\Store; +use Magento\Store\Model\StoreManagerInterface; +use PHPUnit\Framework\MockObject\MockObject; + class StoreCheckTest extends \PHPUnit\Framework\TestCase { /** - * @var \Magento\Store\App\Action\Plugin\StoreCheck + * @var StoreCheck */ protected $_plugin; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var StoreManagerInterface|MockObject */ protected $_storeManagerMock; /** - * @var \PHPUnit_Framework_MockObject_MockObject + * @var Store|MockObject */ protected $_storeMock; /** - * @var \Magento\Framework\App\Action\AbstractAction|\PHPUnit_Framework_MockObject_MockObject + * @var AbstractAction|MockObject */ protected $subjectMock; - /** - * @var \Magento\Framework\App\RequestInterface|\PHPUnit_Framework_MockObject_MockObject - */ - protected $requestMock; - protected function setUp() { - $this->_storeManagerMock = $this->createMock(\Magento\Store\Model\StoreManagerInterface::class); - $this->_storeMock = $this->createMock(\Magento\Store\Model\Store::class); + $this->_storeManagerMock = $this->createMock(StoreManagerInterface::class); + $this->_storeMock = $this->createMock(Store::class); $this->_storeManagerMock->expects( $this->any() )->method( @@ -43,28 +44,27 @@ protected function setUp() )->will( $this->returnValue($this->_storeMock) ); - $this->requestMock = $this->createMock(\Magento\Framework\App\RequestInterface::class); - $this->subjectMock = $this->getMockBuilder(\Magento\Framework\App\Action\AbstractAction::class) + $this->subjectMock = $this->getMockBuilder(AbstractAction::class) ->disableOriginalConstructor() ->getMockForAbstractClass(); - $this->_plugin = new \Magento\Store\App\Action\Plugin\StoreCheck($this->_storeManagerMock); + $this->_plugin = new StoreCheck($this->_storeManagerMock); } /** * @expectedException \Magento\Framework\Exception\State\InitException * @expectedExceptionMessage Current store is not active. */ - public function testBeforeDispatchWhenStoreNotActive() + public function testBeforeExecuteWhenStoreNotActive() { $this->_storeMock->expects($this->any())->method('isActive')->will($this->returnValue(false)); - $this->_plugin->beforeDispatch($this->subjectMock, $this->requestMock); + $this->_plugin->beforeExecute($this->subjectMock); } - public function testBeforeDispatchWhenStoreIsActive() + public function testBeforeExecuteWhenStoreIsActive() { $this->_storeMock->expects($this->any())->method('isActive')->will($this->returnValue(true)); - $result = $this->_plugin->beforeDispatch($this->subjectMock, $this->requestMock); + $result = $this->_plugin->beforeExecute($this->subjectMock); $this->assertNull($result); } } diff --git a/app/code/Magento/Store/Test/Unit/Controller/Store/RedirectTest.php b/app/code/Magento/Store/Test/Unit/Controller/Store/RedirectTest.php index 4408c45d6a640..cb92f14e6227c 100755 --- a/app/code/Magento/Store/Test/Unit/Controller/Store/RedirectTest.php +++ b/app/code/Magento/Store/Test/Unit/Controller/Store/RedirectTest.php @@ -20,6 +20,7 @@ use Magento\Store\Api\StoreResolverInterface; use Magento\Store\Controller\Store\Redirect; use Magento\Store\Model\Store; +use Magento\Store\Model\StoreManagerInterface; use Magento\Store\Model\StoreResolver; use Magento\Store\Model\StoreSwitcher\HashGenerator; use PHPUnit\Framework\MockObject\MockObject; @@ -31,8 +32,20 @@ */ class RedirectTest extends TestCase { - private const DEFAULT_STORE_VIEW_CODE = 'default'; - private const STORE_CODE = 'sv1'; + /** + * Stub for default store view code + */ + private const STUB_DEFAULT_STORE_VIEW_CODE = 'default'; + + /** + * Stub for default store code + */ + private const STUB_STORE_CODE = 'sv1'; + + /** + * @var StoreManagerInterface|MockObject + */ + private $storeManagerMock; /** * @var StoreRepositoryInterface|MockObject @@ -67,7 +80,12 @@ class RedirectTest extends TestCase /** * @var Store|MockObject */ - private $formStoreMock; + private $fromStoreMock; + + /** + * @var Store|MockObject + */ + private $targetStoreMock; /** * @var Store|MockObject @@ -87,13 +105,14 @@ class RedirectTest extends TestCase /** * @var Redirect */ - private $redirectController; + private $model; /** * @inheritDoc */ protected function setUp() { + $this->storeManagerMock = $this->createMock(StoreManagerInterface::class); $this->requestMock = $this->getMockBuilder(RequestInterface::class) ->disableOriginalConstructor() ->setMethods(['getParam']) @@ -117,7 +136,11 @@ protected function setUp() $this->responseMock = $this->getMockBuilder(ResponseInterface::class) ->disableOriginalConstructor() ->getMockForAbstractClass(); - $this->formStoreMock = $this->getMockBuilder(Store::class) + $this->fromStoreMock = $this->getMockBuilder(Store::class) + ->disableOriginalConstructor() + ->setMethods(['getCode']) + ->getMockForAbstractClass(); + $this->targetStoreMock = $this->getMockBuilder(Store::class) ->disableOriginalConstructor() ->setMethods(['getCode']) ->getMockForAbstractClass(); @@ -150,9 +173,10 @@ protected function setUp() 'messageManager' => $this->messageManagerMock, ] ); - $this->redirectController = $objectManager->getObject( + $this->model = $objectManager->getObject( Redirect::class, [ + 'storeManager' => $this->storeManagerMock, 'storeRepository' => $this->storeRepositoryMock, 'storeResolver' => $this->storeResolverMock, 'sidResolver' => $this->sidResolverMock, @@ -186,19 +210,25 @@ public function testRedirect(string $defaultStoreViewCode, string $storeCode): v $defaultStoreViewCode ); $this->storeRepositoryMock - ->expects($this->once()) + ->expects($this->exactly(2)) ->method('get') - ->with($defaultStoreViewCode) - ->willReturn($this->formStoreMock); - $this->formStoreMock + ->willReturnMap([ + [$defaultStoreViewCode, $this->fromStoreMock], + [$storeCode, $this->targetStoreMock], + ]); + $this->fromStoreMock ->expects($this->once()) ->method('getCode') ->willReturn($defaultStoreViewCode); $this->hashGeneratorMock ->expects($this->once()) ->method('generateHash') - ->with($this->formStoreMock) + ->with($this->fromStoreMock) ->willReturn([]); + $this->storeManagerMock + ->expects($this->once()) + ->method('setCurrentStore') + ->with($this->targetStoreMock); $this->redirectMock ->expects($this->once()) ->method('redirect') @@ -214,7 +244,7 @@ public function testRedirect(string $defaultStoreViewCode, string $storeCode): v ] ); - $this->assertEquals(null, $this->redirectController->execute()); + $this->assertEquals(null, $this->model->execute()); } /** @@ -257,7 +287,7 @@ public function testRedirectWithThrowsException(string $defaultStoreViewCode, st ->with($this->responseMock, $this->currentStoreMock) ->willReturnSelf(); - $this->assertEquals(null, $this->redirectController->execute()); + $this->assertEquals(null, $this->model->execute()); } /** @@ -281,7 +311,7 @@ public function testRedirectTargetIsNull(): void ->expects($this->never()) ->method('get'); - $this->assertEquals($this->responseMock, $this->redirectController->execute()); + $this->assertEquals($this->responseMock, $this->model->execute()); } /** @@ -292,7 +322,7 @@ public function testRedirectTargetIsNull(): void public function getConfigDataProvider(): array { return [ - [self::DEFAULT_STORE_VIEW_CODE, self::STORE_CODE] + [self::STUB_DEFAULT_STORE_VIEW_CODE, self::STUB_STORE_CODE] ]; } } diff --git a/app/code/Magento/Store/etc/di.xml b/app/code/Magento/Store/etc/di.xml index 8f4151b8fc966..5bd8f6e2349fc 100644 --- a/app/code/Magento/Store/etc/di.xml +++ b/app/code/Magento/Store/etc/di.xml @@ -63,9 +63,11 @@ </type> <preference for="Magento\Framework\App\ScopeResolverInterface" type="Magento\Store\Model\Resolver\Store" /> <preference for="Magento\Framework\App\Router\PathConfigInterface" type="Magento\Store\Model\PathConfig" /> - <type name="Magento\Framework\App\Action\AbstractAction"> - <plugin name="storeCheck" type="Magento\Store\App\Action\Plugin\StoreCheck" sortOrder="10"/> - <plugin name="designLoader" type="Magento\Framework\App\Action\Plugin\Design" /> + <type name="Magento\Framework\App\ActionInterface"> + <plugin name="storeCheck" type="Magento\Store\App\Action\Plugin\StoreCheck"/> + <plugin name="designLoader" type="Magento\Framework\App\Action\Plugin\LoadDesignPlugin"/> + <plugin name="eventDispatch" type="Magento\Framework\App\Action\Plugin\EventDispatchPlugin"/> + <plugin name="actionFlagNoDispatch" type="Magento\Framework\App\Action\Plugin\ActionFlagNoDispatchPlugin"/> </type> <type name="Magento\Framework\Url\SecurityInfo"> <plugin name="storeUrlSecurityInfo" type="Magento\Store\Url\Plugin\SecurityInfo"/> diff --git a/app/code/Magento/Swatches/Test/Mftf/Section/AdminManageSwatchSection.xml b/app/code/Magento/Swatches/Test/Mftf/Section/AdminManageSwatchSection.xml index c3ef0a7324bfd..629599eba84fe 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Section/AdminManageSwatchSection.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Section/AdminManageSwatchSection.xml @@ -17,6 +17,8 @@ <element name="nthSwatchText" type="input" selector="#swatch-text-options-panel table tbody tr:nth-of-type({{var}}) td:nth-of-type(3) input" parameterized="true"/> <element name="nthIsDefault" type="input" selector="(//input[@name='defaultvisual[]'])[{{var}}]" parameterized="true"/> <element name="nthSwatchAdminDescription" type="input" selector="#swatch-text-options-panel table tbody tr:nth-of-type({{var}}) td:nth-of-type(4) input" parameterized="true"/> + <element name="nthVisualSwatch" type="button" selector="#swatch-visual-options-panel table tbody tr:nth-of-type({{var}}) .swatches-visual-col" parameterized="true"/> + <element name="chooserBlock" type="block" selector="#swatch-visual-options-panel table tbody tr:nth-of-type({{var}}) .swatches-visual-col .swatch_sub-menu_container" parameterized="true"/> <!-- Selector for Admin Description input where the index is zero-based --> <element name="swatchAdminDescriptionByIndex" type="input" selector="input[name='optiontext[value][option_{{index}}][0]']" parameterized="true"/> <element name="nthChooseColor" type="button" selector="#swatch-visual-options-panel table tbody tr:nth-of-type({{var}}) .swatch_row_name.colorpicker_handler" parameterized="true"/> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/AdminCheckColorUploadChooserVisualSwatchTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/AdminCheckColorUploadChooserVisualSwatchTest.xml new file mode 100644 index 0000000000000..65ac017072917 --- /dev/null +++ b/app/code/Magento/Swatches/Test/Mftf/Test/AdminCheckColorUploadChooserVisualSwatchTest.xml @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> + <test name="AdminCheckColorUploadChooserVisualSwatchTest"> + <annotations> + <features value="Swatches"/> + <stories value="Check correct view of visual swatches"/> + <title value="Correct view of Swatches while choosing color or upload image"/> + <description value="Correct view of Swatches while choosing color or upload image"/> + <severity value="AVERAGE"/> + <group value="Swatches"/> + </annotations> + <before> + <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> + </before> + <amOnPage url="{{ProductAttributePage.url}}" stepKey="addNewProductAttribute"/> + <selectOption selector="{{AttributePropertiesSection.InputType}}" + userInput="{{visualSwatchAttribute.input_type}}" stepKey="fillInputType"/> + + <click selector="{{AdminManageSwatchSection.addSwatch}}" stepKey="clickAddSwatch1"/> + <click selector="{{AdminManageSwatchSection.addSwatch}}" stepKey="clickAddSwatch2"/> + <click selector="{{AdminManageSwatchSection.addSwatch}}" stepKey="clickAddSwatch3"/> + <click selector="{{AdminManageSwatchSection.nthVisualSwatch('3')}}" stepKey="clickSwatch3"/> + + <click selector="{{AdminManageSwatchSection.nthVisualSwatch('2')}}" stepKey="clickSwatch2"/> + <seeElement selector="{{AdminManageSwatchSection.chooserBlock('2')}}" stepKey="seeSwatch2"/> + <dontSeeElement selector="{{AdminManageSwatchSection.chooserBlock('3')}}" stepKey="dontSeeSwatch3"/> + + <click selector="{{AdminManageSwatchSection.nthVisualSwatch('1')}}" stepKey="clickSwatch1"/> + <seeElement selector="{{AdminManageSwatchSection.chooserBlock('1')}}" stepKey="seeSwatch1"/> + <dontSeeElement selector="{{AdminManageSwatchSection.chooserBlock('2')}}" stepKey="dontSeeSwatch2"/> + </test> +</tests> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/AdminCreateImageSwatchTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/AdminCreateImageSwatchTest.xml index 5cbc7ee49d6cc..0e24d63728d9d 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/AdminCreateImageSwatchTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/AdminCreateImageSwatchTest.xml @@ -29,7 +29,7 @@ </actionGroup> <actionGroup ref="AdminDeleteProductAttributeByLabelActionGroup" stepKey="deleteProductAttribute"/> <actionGroup ref="NavigateToAndResetProductAttributeGridToDefaultViewActionGroup" stepKey="resetProductAttributeFilters"/> - <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> </after> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/AdminCreateTextSwatchTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/AdminCreateTextSwatchTest.xml index 4685670fbfdd2..b01dff6a8ca06 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/AdminCreateTextSwatchTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/AdminCreateTextSwatchTest.xml @@ -22,7 +22,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> </after> <!-- Create a new product attribute of type "Text Swatch" --> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/AdminCreateVisualSwatchTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/AdminCreateVisualSwatchTest.xml index 1c8e86b3765d4..7599111260980 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/AdminCreateVisualSwatchTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/AdminCreateVisualSwatchTest.xml @@ -35,7 +35,7 @@ <waitForPageLoad stepKey="waitToClickSave"/> <click selector="{{AttributePropertiesSection.SaveAndEdit}}" stepKey="clickSaveAndEdit"/> <!-- Logout --> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> </after> <!-- Go to the edit page for the "color" attribute --> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/AdminCreateVisualSwatchWithNonValidOptionsTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/AdminCreateVisualSwatchWithNonValidOptionsTest.xml index 8e63a14413f2f..5660922962b47 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/AdminCreateVisualSwatchWithNonValidOptionsTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/AdminCreateVisualSwatchWithNonValidOptionsTest.xml @@ -24,7 +24,7 @@ <actionGroup ref="DeleteProductAttributeActionGroup" stepKey="deleteAttribute"> <argument name="ProductAttribute" value="visualSwatchAttribute"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <amOnPage url="{{ProductAttributePage.url}}" stepKey="navigateToNewProductAttributePage"/> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/AdminDisablingSwatchTooltipsTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/AdminDisablingSwatchTooltipsTest.xml index b44c04d2c1b46..7d3d1aafd8d6d 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/AdminDisablingSwatchTooltipsTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/AdminDisablingSwatchTooltipsTest.xml @@ -37,7 +37,7 @@ <click selector="{{AttributePropertiesSection.SaveAndEdit}}" stepKey="clickSaveAndEdit"/> <!-- Log out --> - <actionGroup ref="logout" stepKey="logOut"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logOut"/> <!-- Delete category --> <deleteData stepKey="deleteCategory" createDataKey="createCategory"/> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/AdminSaveConfigurableProductWithAttributesImagesAndSwatchesTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/AdminSaveConfigurableProductWithAttributesImagesAndSwatchesTest.xml index d034faeefbdc0..0ca0561be0a0d 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/AdminSaveConfigurableProductWithAttributesImagesAndSwatchesTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/AdminSaveConfigurableProductWithAttributesImagesAndSwatchesTest.xml @@ -71,7 +71,7 @@ <actionGroup ref="AdminOpenProductIndexPageActionGroup" stepKey="openProductIndexPage"/> <actionGroup ref="AdminGridFilterResetActionGroup" stepKey="clearProductsGridFilter"/> <!-- Admin logout --> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> </after> <!-- Add created product attribute to the Default set --> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/AdminSetUpWatermarkForSwatchImageTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/AdminSetUpWatermarkForSwatchImageTest.xml index b24420061db65..d5bc8dbadfb56 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/AdminSetUpWatermarkForSwatchImageTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/AdminSetUpWatermarkForSwatchImageTest.xml @@ -27,7 +27,7 @@ <after> <!-- Log out --> <comment userInput="Log out" stepKey="commentLogOut"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Go to Admin > Content > Configuration page --> <comment userInput="Go to Configuration Page" stepKey="commentOpenConfigurationPage"/> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontConfigurableProductSwatchMinimumPriceTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontConfigurableProductSwatchMinimumPriceTest.xml index 1cfa7da6f3410..6651692bcada4 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontConfigurableProductSwatchMinimumPriceTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontConfigurableProductSwatchMinimumPriceTest.xml @@ -40,7 +40,7 @@ <argument name="ProductAttribute" value="ProductSizeAttribute"/> </actionGroup> <!-- Logout --> - <actionGroup ref="logout" stepKey="amOnLogoutPage"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="amOnLogoutPage"/> </after> <!--Create text swatch attribute with 3 options: Black, White and Blue--> <actionGroup ref="AddTextSwatchToProductActionGroup" stepKey="addColorAttribute"> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByImageSwatchTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByImageSwatchTest.xml index 0c179e92adc8d..427797bdb09e2 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByImageSwatchTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByImageSwatchTest.xml @@ -30,7 +30,7 @@ <after> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> </after> <!-- Begin creating a new product attribute --> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByTextSwatchTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByTextSwatchTest.xml index 0024a95360ef2..1d1c5c9c4e683 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByTextSwatchTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByTextSwatchTest.xml @@ -28,7 +28,7 @@ <after> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> </after> <!-- Begin creating a new product attribute --> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByVisualSwatchTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByVisualSwatchTest.xml index 3cd2e13c9d75d..0b6238d7d46be 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByVisualSwatchTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByVisualSwatchTest.xml @@ -30,7 +30,7 @@ <after> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> </after> <!-- Begin creating a new product attribute --> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontImageColorWhenFilterByColorFilterTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontImageColorWhenFilterByColorFilterTest.xml index 208f5cecc6fa9..18e9f82e74121 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontImageColorWhenFilterByColorFilterTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontImageColorWhenFilterByColorFilterTest.xml @@ -39,7 +39,7 @@ <argument name="perPage" value="100"/> </actionGroup> <actionGroup ref="DeleteProductsIfTheyExistActionGroup" stepKey="deleteAllProducts"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <amOnPage url="{{AdminProductEditPage.url($$createConfigProduct.id$$)}}" stepKey="navigateToConfigProductPage"/> <waitForPageLoad stepKey="waitForProductPageLoad"/> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontSeeProductImagesMatchingProductSwatchesTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontSeeProductImagesMatchingProductSwatchesTest.xml index d3f6a2e6ccff7..8bfdb77cbe177 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontSeeProductImagesMatchingProductSwatchesTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontSeeProductImagesMatchingProductSwatchesTest.xml @@ -34,7 +34,7 @@ <argument name="product" value="$$createSimpleProduct$$"/> </actionGroup> <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearProductGridFilter"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Begin creating a new product attribute --> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontSwatchAttributesDisplayInWidgetCMSTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontSwatchAttributesDisplayInWidgetCMSTest.xml index 119a645252685..9acfdf394be4b 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontSwatchAttributesDisplayInWidgetCMSTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontSwatchAttributesDisplayInWidgetCMSTest.xml @@ -51,7 +51,7 @@ <waitForElementVisible selector="{{AdminCategoryMessagesSection.SuccessMessage}}" stepKey="waitForPageReloadAfterDeleteDefaultCategory"/> <magentoCLI command="config:set cms/wysiwyg/enabled enabled" stepKey="enableWYSIWYG"/> <!--logout--> - <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> </after> <!--Login--> <actionGroup ref="LoginAsAdmin" stepKey="loginToAdmin"/> @@ -77,7 +77,7 @@ <click selector="{{CmsNewPagePageSeoSection.header}}" stepKey="clickToExpandSEOSection"/> <scrollTo selector="{{CmsNewPagePageSeoSection.urlKey}}" stepKey="scrollToUrlKey"/> <grabValueFrom selector="{{CmsNewPagePageSeoSection.urlKey}}" stepKey="grabTextFromUrlKey"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!--Open Storefront page for the new created page--> <amOnPage url="{{StorefrontHomePage.url}}$grabTextFromUrlKey" stepKey="gotToCreatedCmsPage"/> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontSwatchProductWithFileCustomOptionTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontSwatchProductWithFileCustomOptionTest.xml index 99b38bd3b34d6..5c0ad3bc4ea77 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontSwatchProductWithFileCustomOptionTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontSwatchProductWithFileCustomOptionTest.xml @@ -26,7 +26,7 @@ <after> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> </after> <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> diff --git a/app/code/Magento/Swatches/view/adminhtml/web/js/visual.js b/app/code/Magento/Swatches/view/adminhtml/web/js/visual.js index 19307432c4122..c27d2e60b2899 100644 --- a/app/code/Magento/Swatches/view/adminhtml/web/js/visual.js +++ b/app/code/Magento/Swatches/view/adminhtml/web/js/visual.js @@ -404,8 +404,11 @@ define([ /** * Toggle color upload chooser */ - $(document).on('click', '.swatch_window', function () { - $(this).next('div').toggle(); + $(document).on('click', '.swatches-visual-col', function () { + var currentElement = $(this).find('.swatch_sub-menu_container'); + + jQuery('.swatch_sub-menu_container').not(currentElement).hide(); + currentElement.toggle(); }); }); }; diff --git a/app/code/Magento/Tax/Block/Adminhtml/Rate/Form.php b/app/code/Magento/Tax/Block/Adminhtml/Rate/Form.php index 29ce7e6d4b0aa..1884b247e530a 100644 --- a/app/code/Magento/Tax/Block/Adminhtml/Rate/Form.php +++ b/app/code/Magento/Tax/Block/Adminhtml/Rate/Form.php @@ -211,7 +211,12 @@ protected function _prepareForm() $fieldset->addField( 'zip_is_range', 'checkbox', - ['name' => 'zip_is_range', 'label' => __('Zip/Post is Range'), 'value' => '1'] + [ + 'name' => 'zip_is_range', + 'label' => __('Zip/Post is Range'), + 'value' => '1', + 'class' => 'zip-is-range-checkbox' + ] ); if (!isset($formData['tax_postcode'])) { diff --git a/app/code/Magento/Tax/Model/App/Action/ContextPlugin.php b/app/code/Magento/Tax/Model/App/Action/ContextPlugin.php index 913fa4c46f0ae..d768e2f6092a0 100644 --- a/app/code/Magento/Tax/Model/App/Action/ContextPlugin.php +++ b/app/code/Magento/Tax/Model/App/Action/ContextPlugin.php @@ -6,60 +6,68 @@ namespace Magento\Tax\Model\App\Action; +use Magento\Customer\Model\Session; +use Magento\Framework\App\ActionInterface; +use Magento\Framework\App\Http\Context as HttpContext; +use Magento\Framework\Module\Manager as ModuleManager; +use Magento\PageCache\Model\Config as PageCacheConfig; +use Magento\Tax\Helper\Data as TaxHelper; +use Magento\Tax\Model\Calculation; + /** - * Class ContextPlugin + * Provides Action Context on before executing Controller Action */ class ContextPlugin { /** - * @var \Magento\Customer\Model\Session + * @var Session */ protected $customerSession; /** - * @var \Magento\Framework\App\Http\Context + * @var HttpContext */ protected $httpContext; /** - * @var \Magento\Tax\Helper\Data + * @var TaxHelper */ protected $taxHelper; /** - * @var \Magento\Tax\Model\Calculation\Proxy + * @var Calculation */ protected $taxCalculation; /** * Module manager * - * @var \Magento\Framework\Module\Manager + * @var ModuleManager */ private $moduleManager; /** * Cache config * - * @var \Magento\PageCache\Model\Config + * @var PageCacheConfig */ private $cacheConfig; /** - * @param \Magento\Customer\Model\Session $customerSession - * @param \Magento\Framework\App\Http\Context $httpContext - * @param \Magento\Tax\Model\Calculation\Proxy $calculation - * @param \Magento\Tax\Helper\Data $taxHelper - * @param \Magento\Framework\Module\Manager $moduleManager - * @param \Magento\PageCache\Model\Config $cacheConfig + * @param Session $customerSession + * @param HttpContext $httpContext + * @param Calculation $calculation + * @param TaxHelper $taxHelper + * @param ModuleManager $moduleManager + * @param PageCacheConfig $cacheConfig */ public function __construct( - \Magento\Customer\Model\Session $customerSession, - \Magento\Framework\App\Http\Context $httpContext, - \Magento\Tax\Model\Calculation\Proxy $calculation, //phpcs:ignore Magento2.Classes.DiscouragedDependencies - \Magento\Tax\Helper\Data $taxHelper, - \Magento\Framework\Module\Manager $moduleManager, - \Magento\PageCache\Model\Config $cacheConfig + Session $customerSession, + HttpContext $httpContext, + Calculation $calculation, //phpcs:ignore Magento2.Classes.DiscouragedDependencies + TaxHelper $taxHelper, + ModuleManager $moduleManager, + PageCacheConfig $cacheConfig ) { $this->customerSession = $customerSession; $this->httpContext = $httpContext; @@ -72,15 +80,12 @@ public function __construct( /** * Before dispatch. * - * @param \Magento\Framework\App\ActionInterface $subject - * @param \Magento\Framework\App\RequestInterface $request - * @return mixed + * @param ActionInterface $subject + * @return void * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function beforeDispatch( - \Magento\Framework\App\ActionInterface $subject, - \Magento\Framework\App\RequestInterface $request - ) { + public function beforeExecute(ActionInterface $subject) + { if (!$this->customerSession->isLoggedIn() || !$this->moduleManager->isEnabled('Magento_PageCache') || !$this->cacheConfig->isEnabled() || diff --git a/app/code/Magento/Tax/Test/Mftf/Test/AdminCheckCreditMemoTotalsTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/AdminCheckCreditMemoTotalsTest.xml index dfed39e861f05..dce8852ac5628 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/AdminCheckCreditMemoTotalsTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/AdminCheckCreditMemoTotalsTest.xml @@ -59,7 +59,7 @@ <!-- Delete Tax Class --> <deleteData createDataKey="createProductTaxClass" stepKey="deleteProductTaxClass"/> <!--Logout--> - <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> </after> <!--Create new order--> <actionGroup ref="NavigateToNewOrderPageExistingCustomerActionGroup" stepKey="createNewOrder"> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/AdminStoresTaxRulesNavigateMenuTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/AdminStoresTaxRulesNavigateMenuTest.xml index 1277d6e5f9fd2..219cb309820d8 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/AdminStoresTaxRulesNavigateMenuTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/AdminStoresTaxRulesNavigateMenuTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToStoresTaxRulesPage"> <argument name="menuUiId" value="{{AdminMenuStores.dataUiId}}"/> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/AdminStoresTaxZonesAndRatesNavigateMenuTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/AdminStoresTaxZonesAndRatesNavigateMenuTest.xml index e0a4d5d9a4016..73c8c63be0318 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/AdminStoresTaxZonesAndRatesNavigateMenuTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/AdminStoresTaxZonesAndRatesNavigateMenuTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToStoresTaxZonesAndRatesPage"> <argument name="menuUiId" value="{{AdminMenuStores.dataUiId}}"/> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/AdminSystemImportExportTaxRatesNavigateMenuTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/AdminSystemImportExportTaxRatesNavigateMenuTest.xml index a84ae61d66305..2b2e0c5184d4a 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/AdminSystemImportExportTaxRatesNavigateMenuTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/AdminSystemImportExportTaxRatesNavigateMenuTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToSystemImportExportTaxRatesPage"> <argument name="menuUiId" value="{{AdminMenuSystem.dataUiId}}"/> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/AdminTaxCalcWithApplyTaxOnSettingTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/AdminTaxCalcWithApplyTaxOnSettingTest.xml index fbf7873d37438..64d047c1a4dff 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/AdminTaxCalcWithApplyTaxOnSettingTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/AdminTaxCalcWithApplyTaxOnSettingTest.xml @@ -27,7 +27,7 @@ <createData entity="ApiSimpleProductWithCustomPrice" stepKey="createProduct"> <requiredEntity createDataKey="createCategory"/> </createData> - <actionGroup ref="LoginActionGroup" stepKey="loginAsAdmin"/> + <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/> <actionGroup ref="SetTaxClassForShippingActionGroup" stepKey="setTaxClass"/> <actionGroup ref="SetTaxApplyOnSettingActionGroup" stepKey="setApplyTaxOnSetting"> <argument name="userInput" value="Original price only"/> @@ -49,7 +49,7 @@ <argument name="userInput" value="Custom price if available"/> </actionGroup> <actionGroup ref="ResetTaxClassForShippingActionGroup" stepKey="resetTaxClassForShipping"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="NavigateToNewOrderPageNewCustomerSingleStoreActionGroup" stepKey="gotoNewOrderCreationPage"/> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/AdminTaxReportGridTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/AdminTaxReportGridTest.xml index e90602441261d..1611704c43334 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/AdminTaxReportGridTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/AdminTaxReportGridTest.xml @@ -219,7 +219,7 @@ <argument name="taxClassName" value="TaxClasses2"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> </test> </tests> diff --git a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCartTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCartTest.xml index e7bf7702328c0..3d584f988780e 100644 --- a/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCartTest.xml +++ b/app/code/Magento/Tax/Test/Mftf/Test/StorefrontTaxQuoteCartTest.xml @@ -48,7 +48,7 @@ <argument name="Customer" value="Simple_US_Customer_NY"/> </actionGroup> - <actionGroup ref="EnterCustomerAddressInfo" stepKey="enterAddressInfo"> + <actionGroup ref="EnterCustomerAddressInfoActionGroup" stepKey="enterAddressInfo"> <argument name="Address" value="US_Address_NY"/> </actionGroup> </before> @@ -166,7 +166,7 @@ <argument name="Customer" value="Simple_US_Customer_NY"/> </actionGroup> - <actionGroup ref="EnterCustomerAddressInfo" stepKey="enterAddressInfo"> + <actionGroup ref="EnterCustomerAddressInfoActionGroup" stepKey="enterAddressInfo"> <argument name="Address" value="US_Address_NY"/> </actionGroup> </before> diff --git a/app/code/Magento/Tax/Test/Unit/App/Action/ContextPluginTest.php b/app/code/Magento/Tax/Test/Unit/App/Action/ContextPluginTest.php index a6c7e9bb8685a..8601bdc175ae8 100644 --- a/app/code/Magento/Tax/Test/Unit/App/Action/ContextPluginTest.php +++ b/app/code/Magento/Tax/Test/Unit/App/Action/ContextPluginTest.php @@ -5,81 +5,105 @@ */ namespace Magento\Tax\Test\Unit\App\Action; +use Magento\Customer\Model\Session; +use Magento\Framework\App\Http\Context as HttpContext; +use Magento\Framework\App\Test\Unit\Action\Stub\ActionStub; +use Magento\Framework\Module\Manager as ModuleManager; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; +use Magento\PageCache\Model\Config as PageCacheConfig; +use Magento\Tax\Helper\Data as TaxHelper; +use Magento\Tax\Model\App\Action\ContextPlugin as TaxContextPlugin; +use Magento\Tax\Model\Calculation; +use Magento\Weee\Helper\Data as WeeeHelper; +use Magento\Weee\Model\Tax; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; + /** - * Context plugin test + * Unit Tests to cover ContextPlugin */ -class ContextPluginTest extends \PHPUnit\Framework\TestCase +class ContextPluginTest extends TestCase { /** - * @var \Magento\Tax\Helper\Data + * @var ObjectManagerHelper + */ + private $objectManager; + + /** + * @var TaxHelper|MockObject */ protected $taxHelperMock; /** - * @var \Magento\Weee\Helper\Data + * @var WeeeHelper|MockObject */ protected $weeeHelperMock; /** - * @var \Magento\Weee\Model\Tax + * @var Tax|MockObject */ protected $weeeTaxMock; /** - * @var \Magento\Framework\App\Http\Context + * @var HttpContext|MockObject */ protected $httpContextMock; /** - * @var \Magento\Tax\Model\Calculation\Proxy + * @var Calculation|MockObject */ protected $taxCalculationMock; /** * Module manager * - * @var \Magento\Framework\Module\Manager + * @var ModuleManager|MockObject */ private $moduleManagerMock; /** * Cache config * - * @var \Magento\PageCache\Model\Config + * @var PageCacheConfig|MockObject */ private $cacheConfigMock; /** - * @var \Magento\Tax\Model\App\Action\ContextPlugin + * @var Session|MockObject + */ + private $customerSessionMock; + + /** + * @var TaxContextPlugin */ protected $contextPlugin; protected function setUp() { - $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + $this->objectManager = new ObjectManagerHelper($this); - $this->taxHelperMock = $this->getMockBuilder(\Magento\Tax\Helper\Data::class) + $this->taxHelperMock = $this->getMockBuilder(TaxHelper::class) ->disableOriginalConstructor() ->getMock(); - $this->weeeHelperMock = $this->getMockBuilder(\Magento\Weee\Helper\Data::class) + $this->weeeHelperMock = $this->getMockBuilder(WeeeHelper::class) ->disableOriginalConstructor() ->getMock(); - $this->weeeTaxMock = $this->getMockBuilder(\Magento\Weee\Model\Tax::class) + $this->weeeTaxMock = $this->getMockBuilder(Tax::class) ->disableOriginalConstructor() ->getMock(); - $this->httpContextMock = $this->getMockBuilder(\Magento\Framework\App\Http\Context::class) + $this->httpContextMock = $this->getMockBuilder(HttpContext::class) ->disableOriginalConstructor() ->getMock(); - $this->taxCalculationMock = $this->getMockBuilder(\Magento\Tax\Model\Calculation\Proxy::class) + $this->taxCalculationMock = $this->getMockBuilder(Calculation::class) ->disableOriginalConstructor() ->setMethods(['getTaxRates']) ->getMock(); - $this->customerSessionMock = $this->getMockBuilder(\Magento\Customer\Model\Session::class) + $this->customerSessionMock = $this->getMockBuilder(Session::class) ->disableOriginalConstructor() ->setMethods( [ @@ -89,16 +113,16 @@ protected function setUp() ) ->getMock(); - $this->moduleManagerMock = $this->getMockBuilder(\Magento\Framework\Module\Manager::class) + $this->moduleManagerMock = $this->getMockBuilder(ModuleManager::class) ->disableOriginalConstructor() ->getMock(); - $this->cacheConfigMock = $this->getMockBuilder(\Magento\PageCache\Model\Config::class) + $this->cacheConfigMock = $this->getMockBuilder(PageCacheConfig::class) ->disableOriginalConstructor() ->getMock(); $this->contextPlugin = $this->objectManager->getObject( - \Magento\Tax\Model\App\Action\ContextPlugin::class, + TaxContextPlugin::class, [ 'customerSession' => $this->customerSessionMock, 'httpContext' => $this->httpContextMock, @@ -116,9 +140,9 @@ protected function setUp() * @param bool $cache * @param bool $taxEnabled * @param bool $loggedIn - * @dataProvider beforeDispatchDataProvider + * @dataProvider beforeExecuteDataProvider */ - public function testBeforeDispatch($cache, $taxEnabled, $loggedIn) + public function testBeforeExecute($cache, $taxEnabled, $loggedIn) { $this->customerSessionMock->expects($this->any()) ->method('isLoggedIn') @@ -163,9 +187,8 @@ public function testBeforeDispatch($cache, $taxEnabled, $loggedIn) ->with('tax_rates', [], 0); } - $action = $this->objectManager->getObject(\Magento\Framework\App\Test\Unit\Action\Stub\ActionStub::class); - $request = $this->createPartialMock(\Magento\Framework\App\Request\Http::class, ['getActionName']); - $result = $this->contextPlugin->beforeDispatch($action, $request); + $action = $this->objectManager->getObject(ActionStub::class); + $result = $this->contextPlugin->beforeExecute($action); $this->assertNull($result); } else { $this->assertFalse($loggedIn); @@ -175,7 +198,7 @@ public function testBeforeDispatch($cache, $taxEnabled, $loggedIn) /** * @return array */ - public function beforeDispatchDataProvider() + public function beforeExecuteDataProvider() { return [ [false, false, false], diff --git a/app/code/Magento/Tax/etc/frontend/di.xml b/app/code/Magento/Tax/etc/frontend/di.xml index 4db3f54b0edd9..d1b8d93e96935 100644 --- a/app/code/Magento/Tax/etc/frontend/di.xml +++ b/app/code/Magento/Tax/etc/frontend/di.xml @@ -35,7 +35,7 @@ <plugin name="tax-session-depersonalize" type="Magento\Tax\Model\Layout\DepersonalizePlugin" sortOrder="20"/> </type> - <type name="Magento\Framework\App\Action\AbstractAction"> + <type name="Magento\Framework\App\ActionInterface"> <plugin name="tax-app-action-dispatchController-context-plugin" type="Magento\Tax\Model\App\Action\ContextPlugin"/> </type> diff --git a/app/code/Magento/Theme/Model/Theme/Plugin/Registration.php b/app/code/Magento/Theme/Model/Theme/Plugin/Registration.php index 05030c56c2ee0..13102a722eddf 100644 --- a/app/code/Magento/Theme/Model/Theme/Plugin/Registration.php +++ b/app/code/Magento/Theme/Model/Theme/Plugin/Registration.php @@ -5,8 +5,7 @@ */ namespace Magento\Theme\Model\Theme\Plugin; -use Magento\Backend\App\AbstractAction; -use Magento\Framework\App\RequestInterface; +use Magento\Framework\App\ActionInterface; use Magento\Theme\Model\Theme\Registration as ThemeRegistration; use Magento\Framework\Exception\LocalizedException; use Psr\Log\LoggerInterface; @@ -16,32 +15,34 @@ use Magento\Framework\Config\Theme; /** + * Plugin for Theme Registration + * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class Registration { /** - * @var \Magento\Theme\Model\Theme\Registration + * @var ThemeRegistration */ protected $themeRegistration; /** - * @var \Magento\Theme\Model\Theme\Collection + * @var ThemeCollection */ protected $themeCollection; /** - * @var \Magento\Theme\Model\ResourceModel\Theme\Collection + * @var ThemeLoader */ protected $themeLoader; /** - * @var \Psr\Log\LoggerInterface + * @var LoggerInterface */ protected $logger; /** - * @var \Magento\Framework\App\State + * @var AppState */ protected $appState; @@ -69,15 +70,13 @@ public function __construct( /** * Add new theme from filesystem and update existing * - * @param AbstractAction $subject - * @param RequestInterface $request + * @param ActionInterface $subject * * @return void * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function beforeDispatch( - AbstractAction $subject, - RequestInterface $request + public function beforeExecute( + ActionInterface $subject ) { try { if ($this->appState->getMode() != AppState::MODE_PRODUCTION) { diff --git a/app/code/Magento/Theme/Test/Mftf/Section/AdminDesignConfigSection.xml b/app/code/Magento/Theme/Test/Mftf/Section/AdminDesignConfigSection.xml index 762537ba426f2..820917661b2ce 100644 --- a/app/code/Magento/Theme/Test/Mftf/Section/AdminDesignConfigSection.xml +++ b/app/code/Magento/Theme/Test/Mftf/Section/AdminDesignConfigSection.xml @@ -26,6 +26,9 @@ <element name="logoUpload" type ="input" selector="[name='email_logo']" /> <element name="logoWrapperOpen" type ="text" selector="[data-index='email'] [data-state-collapsible ='closed']"/> <element name="logoPreview" type ="text" selector="[alt ='magento-logo.png']"/> + <element name="logoImageAlt" type ="text" selector="[name='email_logo_alt']"/> + <element name="logoImageWidth" type ="text" selector="[name='email_logo_width']"/> + <element name="logoImageHeight" type ="text" selector="[name='email_logo_height']"/> <element name="faviconArrow" type="button" selector="#ZmF2aWNvbg-- > .jstree-icon" /> <element name="checkIfFaviconArrowExpand" type="button" selector="//li[@id='ZmF2aWNvbg--' and contains(@class,'jstree-closed')]" /> <element name="storesArrow" type="button" selector="#ZmF2aWNvbi9zdG9yZXM- > .jstree-icon" /> @@ -34,5 +37,7 @@ <element name="imageWatermarkType" type="text" selector="//div[contains(@class, 'fieldset-wrapper-title')]//span[contains(text(), '{{watermarkType}}')]" parameterized="true"/> <element name="appliedTheme" type="select" selector="select[name='theme_theme_id']"/> <element name="scopeEditLinkByName" type="button" selector="//tr//td[count(//div[@data-role='grid-wrapper']//tr//th[normalize-space(.)= '{{scope}}']/preceding-sibling::th)+1][contains(.,'{{scopeName}}')]/..//a[contains(@class, 'action-menu-item')]" timeout="30" parameterized="true"/> + <element name="transactionalEmailSectionHeader" type="button" selector="[data-index='email'] .fieldset-wrapper-title" timeout="30"/> + <element name="transactionalEmailSectionBody" type="block" selector="[data-index='email'] .admin__fieldset-wrapper-content" timeout="30"/> </section> </sections> diff --git a/app/code/Magento/Theme/Test/Mftf/Test/AdminContentThemeSortTest.xml b/app/code/Magento/Theme/Test/Mftf/Test/AdminContentThemeSortTest.xml index 9facab57e9a09..4a074a484537d 100644 --- a/app/code/Magento/Theme/Test/Mftf/Test/AdminContentThemeSortTest.xml +++ b/app/code/Magento/Theme/Test/Mftf/Test/AdminContentThemeSortTest.xml @@ -22,7 +22,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToContentThemesPage"> <argument name="menuUiId" value="{{AdminMenuContent.dataUiId}}"/> diff --git a/app/code/Magento/Theme/Test/Mftf/Test/AdminContentThemesNavigateMenuTest.xml b/app/code/Magento/Theme/Test/Mftf/Test/AdminContentThemesNavigateMenuTest.xml index 8e7bfd71b07d3..2d0dc4501dfa1 100644 --- a/app/code/Magento/Theme/Test/Mftf/Test/AdminContentThemesNavigateMenuTest.xml +++ b/app/code/Magento/Theme/Test/Mftf/Test/AdminContentThemesNavigateMenuTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToContentThemesPage"> <argument name="menuUiId" value="{{AdminMenuContent.dataUiId}}"/> diff --git a/app/code/Magento/Theme/Test/Mftf/Test/AdminDesignConfigMediaGalleryImageUploadTest.xml b/app/code/Magento/Theme/Test/Mftf/Test/AdminDesignConfigMediaGalleryImageUploadTest.xml index 8291ddc12b3b1..ae0ebe2ed7ef3 100644 --- a/app/code/Magento/Theme/Test/Mftf/Test/AdminDesignConfigMediaGalleryImageUploadTest.xml +++ b/app/code/Magento/Theme/Test/Mftf/Test/AdminDesignConfigMediaGalleryImageUploadTest.xml @@ -22,7 +22,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginToAdminArea"/> </before> <after> - <actionGroup ref="logout" stepKey="logoutOfAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutOfAdmin"/> </after> <!--Edit Store View--> <comment userInput="Edit Store View" stepKey="editStoreViewComment"/> diff --git a/app/code/Magento/Theme/Test/Mftf/Test/AdminWatermarkUploadTest.xml b/app/code/Magento/Theme/Test/Mftf/Test/AdminWatermarkUploadTest.xml index afe70243f602c..666d01e1090c1 100644 --- a/app/code/Magento/Theme/Test/Mftf/Test/AdminWatermarkUploadTest.xml +++ b/app/code/Magento/Theme/Test/Mftf/Test/AdminWatermarkUploadTest.xml @@ -25,7 +25,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginToAdminArea"/> </before> <after> - <actionGroup ref="logout" stepKey="logoutOfAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutOfAdmin"/> </after> <amOnPage url="{{DesignConfigPage.url}}" stepKey="navigateToDesignConfigPage" /> <waitForPageLoad stepKey="waitForPageload1"/> diff --git a/app/code/Magento/Theme/Test/Mftf/Test/ThemeTest.xml b/app/code/Magento/Theme/Test/Mftf/Test/ThemeTest.xml index 67213934a6c41..56041c6ccc99a 100644 --- a/app/code/Magento/Theme/Test/Mftf/Test/ThemeTest.xml +++ b/app/code/Magento/Theme/Test/Mftf/Test/ThemeTest.xml @@ -19,7 +19,7 @@ <group value="Theme"/> </annotations> <after> - <actionGroup ref="logout" stepKey="logoutOfAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutOfAdmin"/> </after> <!--Login to Admin Area--> <actionGroup ref="LoginAsAdmin" stepKey="loginToAdminArea"/> diff --git a/app/code/Magento/Theme/Test/Unit/Block/Adminhtml/Wysiwyg/Files/ContentTest.php b/app/code/Magento/Theme/Test/Unit/Block/Adminhtml/Wysiwyg/Files/ContentTest.php deleted file mode 100644 index 7fe3b25cf97b2..0000000000000 --- a/app/code/Magento/Theme/Test/Unit/Block/Adminhtml/Wysiwyg/Files/ContentTest.php +++ /dev/null @@ -1,220 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Theme\Test\Unit\Block\Adminhtml\Wysiwyg\Files; - -use Magento\Theme\Model\Wysiwyg\Storage; - -class ContentTest extends \PHPUnit\Framework\TestCase -{ - /** - * @var \Magento\Backend\Model\Url|PHPUnit_Framework_MockObject_MockObject - */ - protected $_urlBuilder; - - /** - * @var \Magento\Theme\Helper\Storage|PHPUnit_Framework_MockObject_MockObject - */ - protected $_helperStorage; - - /** - * @var \Magento\Theme\Block\Adminhtml\Wysiwyg\Files\Content|PHPUnit_Framework_MockObject_MockObject - */ - protected $_filesContent; - - /** - * @var \Magento\Framework\App\RequestInterface|PHPUnit_Framework_MockObject_MockObject - */ - protected $_request; - - protected function setUp() - { - $this->_helperStorage = $this->createMock(\Magento\Theme\Helper\Storage::class); - $this->_urlBuilder = $this->createMock(\Magento\Backend\Model\Url::class); - $this->_request = $this->createMock(\Magento\Framework\App\RequestInterface::class); - - $objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); - $constructArguments = $objectManagerHelper->getConstructArguments( - \Magento\Theme\Block\Adminhtml\Wysiwyg\Files\Content::class, - [ - 'urlBuilder' => $this->_urlBuilder, - 'request' => $this->_request, - 'storageHelper' => $this->_helperStorage - ] - ); - $this->_filesContent = $objectManagerHelper->getObject( - \Magento\Theme\Block\Adminhtml\Wysiwyg\Files\Content::class, - $constructArguments - ); - } - - /** - * @dataProvider requestParamsProvider - * @param array $requestParams - */ - public function testGetNewFolderUrl($requestParams) - { - $expectedUrl = 'some_url'; - - $this->_helperStorage->expects( - $this->once() - )->method( - 'getRequestParams' - )->will( - $this->returnValue($requestParams) - ); - - $this->_urlBuilder->expects( - $this->once() - )->method( - 'getUrl' - )->with( - 'adminhtml/*/newFolder', - $requestParams - )->will( - $this->returnValue($expectedUrl) - ); - - $this->assertEquals($expectedUrl, $this->_filesContent->getNewfolderUrl()); - } - - /** - * @dataProvider requestParamsProvider - * @param array $requestParams - */ - public function testGetDeleteFilesUrl($requestParams) - { - $expectedUrl = 'some_url'; - - $this->_helperStorage->expects( - $this->once() - )->method( - 'getRequestParams' - )->will( - $this->returnValue($requestParams) - ); - - $this->_urlBuilder->expects( - $this->once() - )->method( - 'getUrl' - )->with( - 'adminhtml/*/deleteFiles', - $requestParams - )->will( - $this->returnValue($expectedUrl) - ); - - $this->assertEquals($expectedUrl, $this->_filesContent->getDeleteFilesUrl()); - } - - /** - * @dataProvider requestParamsProvider - * @param array $requestParams - */ - public function testGetOnInsertUrl($requestParams) - { - $expectedUrl = 'some_url'; - - $this->_helperStorage->expects( - $this->once() - )->method( - 'getRequestParams' - )->will( - $this->returnValue($requestParams) - ); - - $this->_urlBuilder->expects( - $this->once() - )->method( - 'getUrl' - )->with( - 'adminhtml/*/onInsert', - $requestParams - )->will( - $this->returnValue($expectedUrl) - ); - - $this->assertEquals($expectedUrl, $this->_filesContent->getOnInsertUrl()); - } - - /** - * Data provider for requestParams - * @return array - */ - public function requestParamsProvider() - { - return [ - [ - 'requestParams' => [ - \Magento\Theme\Helper\Storage::PARAM_THEME_ID => 1, - \Magento\Theme\Helper\Storage::PARAM_CONTENT_TYPE => Storage::TYPE_IMAGE, - \Magento\Theme\Helper\Storage::PARAM_NODE => 'root', - ] - ] - ]; - } - - public function testGetTargetElementId() - { - $expectedRequest = 'some_request'; - - $this->_request->expects( - $this->once() - )->method( - 'getParam' - )->with( - 'target_element_id' - )->will( - $this->returnValue($expectedRequest) - ); - - $this->assertEquals($expectedRequest, $this->_filesContent->getTargetElementId()); - } - - public function testGetContentsUrl() - { - $expectedUrl = 'some_url'; - - $expectedRequest = 'some_request'; - - $requestParams = [ - \Magento\Theme\Helper\Storage::PARAM_THEME_ID => 1, - \Magento\Theme\Helper\Storage::PARAM_CONTENT_TYPE => Storage::TYPE_IMAGE, - \Magento\Theme\Helper\Storage::PARAM_NODE => 'root', - ]; - - $this->_urlBuilder->expects( - $this->once() - )->method( - 'getUrl' - )->with( - 'adminhtml/*/contents', - ['type' => $expectedRequest] + $requestParams - )->will( - $this->returnValue($expectedUrl) - ); - - $this->_request->expects( - $this->once() - )->method( - 'getParam' - )->with( - 'type' - )->will( - $this->returnValue($expectedRequest) - ); - - $this->_helperStorage->expects( - $this->once() - )->method( - 'getRequestParams' - )->will( - $this->returnValue($requestParams) - ); - - $this->assertEquals($expectedUrl, $this->_filesContent->getContentsUrl()); - } -} diff --git a/app/code/Magento/Theme/Test/Unit/Model/Theme/Plugin/RegistrationTest.php b/app/code/Magento/Theme/Test/Unit/Model/Theme/Plugin/RegistrationTest.php index 190a6edf55900..fb320de97dcc8 100644 --- a/app/code/Magento/Theme/Test/Unit/Model/Theme/Plugin/RegistrationTest.php +++ b/app/code/Magento/Theme/Test/Unit/Model/Theme/Plugin/RegistrationTest.php @@ -3,73 +3,89 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Theme\Test\Unit\Model\Theme\Plugin; -use Magento\Theme\Model\Theme\Plugin\Registration; +use Magento\Framework\App\ActionInterface; +use Magento\Framework\App\State; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\Theme\Model\ResourceModel\Theme\Collection as ThemeCollectionResourceModel; +use Magento\Theme\Model\Theme; +use Magento\Theme\Model\Theme\Collection as ThemeCollection; +use Magento\Theme\Model\Theme\Plugin\Registration as RegistrationPlugin; use Magento\Framework\Exception\LocalizedException; use Magento\Framework\Phrase; +use Magento\Theme\Model\Theme\Registration as ThemeRegistration; +use PHPUnit\Framework\MockObject\MockObject; +use Psr\Log\LoggerInterface; class RegistrationTest extends \PHPUnit\Framework\TestCase { - /** @var \Magento\Theme\Model\Theme\Registration|\PHPUnit_Framework_MockObject_MockObject */ - protected $themeRegistration; - - /** @var \Psr\Log\LoggerInterface|\PHPUnit_Framework_MockObject_MockObject */ - protected $logger; + /** + * @var ThemeRegistration|MockObject + */ + protected $themeRegistrationMock; - /** @var \Magento\Backend\App\AbstractAction|\PHPUnit_Framework_MockObject_MockObject */ - protected $abstractAction; + /** + * @var LoggerInterface|MockObject + */ + protected $loggerMock; - /** @var \Magento\Framework\App\RequestInterface|\PHPUnit_Framework_MockObject_MockObject */ - protected $request; + /** + * @var ActionInterface|MockObject + */ + protected $actionMock; - /** @var \Magento\Framework\App\State|\PHPUnit_Framework_MockObject_MockObject */ - protected $appState; + /** + * @var State|MockObject + */ + protected $appStateMock; - /** @var \Magento\Theme\Model\Theme\Collection|\PHPUnit_Framework_MockObject_MockObject */ - protected $themeCollection; + /** + * @var ThemeCollection|MockObject + */ + protected $themeCollectionMock; - /** @var \Magento\Theme\Model\ResourceModel\Theme\Collection|\PHPUnit_Framework_MockObject_MockObject */ - protected $themeLoader; + /** + * @var ThemeCollectionResourceModel|MockObject + */ + protected $themeLoaderMock; - /** @var Registration */ + /** + * @var RegistrationPlugin + */ protected $plugin; protected function setUp() { - $this->themeRegistration = $this->createMock(\Magento\Theme\Model\Theme\Registration::class); - $this->logger = $this->getMockForAbstractClass(\Psr\Log\LoggerInterface::class, [], '', false); - $this->abstractAction = $this->getMockForAbstractClass( - \Magento\Backend\App\AbstractAction::class, - [], - '', - false - ); - $this->request = $this->getMockForAbstractClass(\Magento\Framework\App\RequestInterface::class, [], '', false); - $this->appState = $this->createMock(\Magento\Framework\App\State::class); - $this->themeCollection = $this->createMock(\Magento\Theme\Model\Theme\Collection::class); - $this->themeLoader = $this->createMock(\Magento\Theme\Model\ResourceModel\Theme\Collection::class); - $this->plugin = new Registration( - $this->themeRegistration, - $this->themeCollection, - $this->themeLoader, - $this->logger, - $this->appState - ); + $this->themeRegistrationMock = $this->createMock(ThemeRegistration::class); + $this->loggerMock = $this->getMockForAbstractClass(LoggerInterface::class, [], '', false); + $this->actionMock = $this->createMock(ActionInterface::class); + $this->appStateMock = $this->createMock(State::class); + $this->themeCollectionMock = $this->createMock(ThemeCollection::class); + $this->themeLoaderMock = $this->createMock(ThemeCollectionResourceModel::class); + + $objectManager = new ObjectManager($this); + $this->plugin = $objectManager->getObject(RegistrationPlugin::class, [ + 'themeRegistration' => $this->themeRegistrationMock, + 'themeCollection' => $this->themeCollectionMock, + 'themeLoader' => $this->themeLoaderMock, + 'logger' => $this->loggerMock, + 'appState' => $this->appStateMock + ]); } /** * @param bool $hasParentTheme - * @dataProvider dataProviderBeforeDispatch + * @dataProvider dataProviderBeforeExecute * @SuppressWarnings(PHPMD.NPathComplexity) */ - public function testBeforeDispatch( - $hasParentTheme - ) { + public function testBeforeExecute($hasParentTheme) + { $themeId = 1; $themeTitle = 'Theme title'; - $themeFromConfigMock = $this->getMockBuilder(\Magento\Theme\Model\Theme::class) + $themeFromConfigMock = $this->getMockBuilder(Theme::class) ->disableOriginalConstructor() ->setMethods([ 'getArea', @@ -79,7 +95,7 @@ public function testBeforeDispatch( ]) ->getMock(); - $themeFromDbMock = $this->getMockBuilder(\Magento\Theme\Model\Theme::class) + $themeFromDbMock = $this->getMockBuilder(Theme::class) ->disableOriginalConstructor() ->setMethods([ 'setParentId', @@ -88,26 +104,26 @@ public function testBeforeDispatch( ]) ->getMock(); - $parentThemeFromDbMock = $this->getMockBuilder(\Magento\Theme\Model\Theme::class) + $parentThemeFromDbMock = $this->getMockBuilder(Theme::class) ->disableOriginalConstructor() ->getMock(); - $parentThemeFromConfigMock = $this->getMockBuilder(\Magento\Theme\Model\Theme::class) + $parentThemeFromConfigMock = $this->getMockBuilder(Theme::class) ->disableOriginalConstructor() ->getMock(); - $this->appState->expects($this->once()) + $this->appStateMock->expects($this->once()) ->method('getMode') ->willReturn('default'); - $this->themeRegistration->expects($this->once()) + $this->themeRegistrationMock->expects($this->once()) ->method('register'); - $this->themeCollection->expects($this->once()) + $this->themeCollectionMock->expects($this->once()) ->method('loadData') ->willReturn([$themeFromConfigMock]); - $this->themeLoader->expects($hasParentTheme ? $this->exactly(2) : $this->once()) + $this->themeLoaderMock->expects($hasParentTheme ? $this->exactly(2) : $this->once()) ->method('getThemeByFullPath') ->willReturnMap([ ['frontend/Magento/blank', $parentThemeFromDbMock], @@ -147,13 +163,13 @@ public function testBeforeDispatch( ->method('save') ->willReturnSelf(); - $this->plugin->beforeDispatch($this->abstractAction, $this->request); + $this->plugin->beforeExecute($this->actionMock); } /** * @return array */ - public function dataProviderBeforeDispatch() + public function dataProviderBeforeExecute() { return [ [true], @@ -163,16 +179,16 @@ public function dataProviderBeforeDispatch() public function testBeforeDispatchWithProductionMode() { - $this->appState->expects($this->once())->method('getMode')->willReturn('production'); - $this->plugin->beforeDispatch($this->abstractAction, $this->request); + $this->appStateMock->expects($this->once())->method('getMode')->willReturn('production'); + $this->plugin->beforeExecute($this->actionMock); } public function testBeforeDispatchWithException() { $exception = new LocalizedException(new Phrase('Phrase')); - $this->themeRegistration->expects($this->once())->method('register')->willThrowException($exception); - $this->logger->expects($this->once())->method('critical'); + $this->themeRegistrationMock->expects($this->once())->method('register')->willThrowException($exception); + $this->loggerMock->expects($this->once())->method('critical'); - $this->plugin->beforeDispatch($this->abstractAction, $this->request); + $this->plugin->beforeExecute($this->actionMock); } } diff --git a/app/code/Magento/Theme/etc/di.xml b/app/code/Magento/Theme/etc/di.xml index 9e06f6c0f4e51..921e6bfc6ecf1 100644 --- a/app/code/Magento/Theme/etc/di.xml +++ b/app/code/Magento/Theme/etc/di.xml @@ -289,4 +289,24 @@ <argument name="identifierName" xsi:type="string">theme_id</argument> </arguments> </type> + <virtualType name="configured_design_cache" type="Magento\Framework\App\Cache"> + <arguments> + <argument name="cacheIdentifier" xsi:type="string">layout</argument> + </arguments> + </virtualType> + <virtualType name="design_context" type="Magento\Framework\Model\Context"> + <arguments> + <argument name="cacheManager" xsi:type="object">configured_design_cache</argument> + </arguments> + </virtualType> + <type name="Magento\Theme\Model\Design"> + <arguments> + <argument name="context" xsi:type="object">design_context</argument> + </arguments> + </type> + <type name="Magento\Theme\Model\Theme\ThemeProvider"> + <arguments> + <argument name="cache" xsi:type="object">configured_design_cache</argument> + </arguments> + </type> </config> diff --git a/app/code/Magento/Tinymce3/Test/Mftf/Test/AdminSwitchWYSIWYGOptionsTest.xml b/app/code/Magento/Tinymce3/Test/Mftf/Test/AdminSwitchWYSIWYGOptionsTest.xml index deb94a7f30d34..9c4e7bf3a646a 100644 --- a/app/code/Magento/Tinymce3/Test/Mftf/Test/AdminSwitchWYSIWYGOptionsTest.xml +++ b/app/code/Magento/Tinymce3/Test/Mftf/Test/AdminSwitchWYSIWYGOptionsTest.xml @@ -19,7 +19,7 @@ <testCaseId value="MC-6114"/> </annotations> <before> - <actionGroup ref="LoginActionGroup" stepKey="loginGetFromGeneralFile"/> + <actionGroup ref="AdminLoginActionGroup" stepKey="loginGetFromGeneralFile"/> <actionGroup ref="EnabledWYSIWYGActionGroup" stepKey="enableWYSIWYG"/> </before> <amOnPage url="{{ConfigurationStoresPage.url}}" stepKey="navigateToWYSIWYGConfigPage1"/> @@ -81,7 +81,7 @@ <actionGroup ref="SwitchToVersion4ActionGroup" stepKey="switchToTinyMCE4" /> <after> <actionGroup ref="DisabledWYSIWYGActionGroup" stepKey="disableWYSIWYG"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> </test> </tests> diff --git a/app/code/Magento/Translation/Test/Mftf/Test/AdminInlineTranslationOnCheckoutTest.xml b/app/code/Magento/Translation/Test/Mftf/Test/AdminInlineTranslationOnCheckoutTest.xml index 08448f7735f7c..c6f2bb0713f48 100644 --- a/app/code/Magento/Translation/Test/Mftf/Test/AdminInlineTranslationOnCheckoutTest.xml +++ b/app/code/Magento/Translation/Test/Mftf/Test/AdminInlineTranslationOnCheckoutTest.xml @@ -43,7 +43,7 @@ <deleteData createDataKey="createCustomer3" stepKey="deleteCustomer3"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!-- Set production mode --> <!-- <magentoCLI command="cache:flush" stepKey="flushCache"/>--> diff --git a/app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminGridFilterSearchResultsBySelectActionGroup.xml b/app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminGridFilterSearchResultsBySelectActionGroup.xml new file mode 100644 index 0000000000000..5ae764ce100aa --- /dev/null +++ b/app/code/Magento/Ui/Test/Mftf/ActionGroup/AdminGridFilterSearchResultsBySelectActionGroup.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd"> + <actionGroup name="AdminGridFilterSearchResultsBySelectActionGroup"> + <annotations> + <description>Filters an Admin Grid page using the provided Filter Selector and Search Value.</description> + </annotations> + <arguments> + <argument name="attributeSelector" type="string" defaultValue="store_id"/> + <argument name="attributeValue" type="string" defaultValue="{{_defaultStore.name}}"/> + </arguments> + + <conditionalClick selector="{{AdminGridFilterControls.clearAll}}" dependentSelector="{{AdminGridFilterControls.clearAll}}" visible="true" stepKey="clearTheFiltersIfPresent"/> + <waitForPageLoad time="30" stepKey="waitForFilterApplied"/> + <click selector="{{AdminGridFilterControls.filters}}" stepKey="clickOnFilters"/> + <selectOption selector="{{AdminDataGridFilterSection.filterSelectFieldByName(attributeSelector)}}" userInput="{{attributeValue}}" stepKey="setAttributeValue"/> + <click selector="{{AdminGridFilterControls.applyFilters}}" stepKey="clickOnApplyFilters"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Ui/Test/Mftf/Section/AdminDataGridFilterSection.xml b/app/code/Magento/Ui/Test/Mftf/Section/AdminDataGridFilterSection.xml index ad8182c62ae68..e93df2d26ffc4 100644 --- a/app/code/Magento/Ui/Test/Mftf/Section/AdminDataGridFilterSection.xml +++ b/app/code/Magento/Ui/Test/Mftf/Section/AdminDataGridFilterSection.xml @@ -13,6 +13,7 @@ <element name="filterExpand" type="button" selector="//div[@class='admin__data-grid-header'][(not(ancestor::*[@class='sticky-header']) and not(contains(@style,'visibility: hidden'))) or (ancestor::*[@class='sticky-header' and not(contains(@style,'display: none'))])]//button[@data-action='grid-filter-expand']" /> <element name="inputFieldByNameAttr" type="input" selector="//*[@data-part='filter-form']//input[@name='{{inputNameAttr}}']" parameterized="true" /> <element name="inputFieldByNameAttrInGrid" type="input" selector="//*[@data-role='filter-form']//input[@name='{{inputNameAttr}}']" parameterized="true"/> + <element name="filterSelectFieldByName" type="select" selector="//*[@data-part='filter-form']//select[@name='{{fieldName}}']" parameterized="true"/> <element name="apply" type="button" selector="//*[@data-part='filter-form']//button[@data-action='grid-filter-apply']" /> <element name="clear" type="button" selector=".admin__data-grid-header [data-action='grid-filter-reset']" /> </section> diff --git a/app/code/Magento/Ui/Test/Mftf/Test/AdminGridFilterDeleteAndVerifyErrorMessageTest.xml b/app/code/Magento/Ui/Test/Mftf/Test/AdminGridFilterDeleteAndVerifyErrorMessageTest.xml index 674d1d2216793..3cc120ad98176 100644 --- a/app/code/Magento/Ui/Test/Mftf/Test/AdminGridFilterDeleteAndVerifyErrorMessageTest.xml +++ b/app/code/Magento/Ui/Test/Mftf/Test/AdminGridFilterDeleteAndVerifyErrorMessageTest.xml @@ -47,7 +47,7 @@ <magentoCLI command="config:set system/backup/functionality_enabled 0" stepKey="setEnableBackupToNo"/> <deleteData stepKey="deleteRootCategory" createDataKey="rootCategory"/> <deleteData stepKey="deleteProduct" createDataKey="createProduct"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Filter created simple product in grid and add category and website created in create data--> diff --git a/app/code/Magento/Ui/view/frontend/web/js/model/messages.js b/app/code/Magento/Ui/view/frontend/web/js/model/messages.js index fb9a20c054da2..f0680fe6eaae5 100644 --- a/app/code/Magento/Ui/view/frontend/web/js/model/messages.js +++ b/app/code/Magento/Ui/view/frontend/web/js/model/messages.js @@ -48,6 +48,10 @@ define([ message = messageObj.message.replace(expr, function (varName) { varName = varName.substr(1); + if (!isNaN(varName)) { + varName--; + } + if (messageObj.parameters.hasOwnProperty(varName)) { return messageObj.parameters[varName]; } diff --git a/app/code/Magento/Ups/Test/Mftf/Test/DefaultConfigForUPSTypeTest.xml b/app/code/Magento/Ups/Test/Mftf/Test/DefaultConfigForUPSTypeTest.xml index 9caa32609c487..bd278c9dbe975 100644 --- a/app/code/Magento/Ups/Test/Mftf/Test/DefaultConfigForUPSTypeTest.xml +++ b/app/code/Magento/Ups/Test/Mftf/Test/DefaultConfigForUPSTypeTest.xml @@ -26,7 +26,7 @@ <!--Collapse UPS tab and logout--> <comment userInput="Collapse UPS tab and logout" stepKey="collapseTabAndLogout"/> <click selector="{{AdminShippingMethodsUpsSection.carriersUpsTab}}" stepKey="collapseTab"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Set shipping methods UPS type to default --> <comment userInput="Set shipping methods UPS type to default" stepKey="setToDefaultShippingMethodsUpsType"/> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminAutoUpdateURLRewriteWhenCategoryIsDeletedTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminAutoUpdateURLRewriteWhenCategoryIsDeletedTest.xml index 022d28ed692c1..eae8c7f0838c4 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminAutoUpdateURLRewriteWhenCategoryIsDeletedTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminAutoUpdateURLRewriteWhenCategoryIsDeletedTest.xml @@ -26,7 +26,7 @@ </before> <after> <deleteData createDataKey="createSimpleProduct" stepKey="deleteProduct"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Filter and Select the created Product --> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCheckUrlRewritesCorrectlyGeneratedForMultipleStoreviewsDuringProductImportTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCheckUrlRewritesCorrectlyGeneratedForMultipleStoreviewsDuringProductImportTest.xml index 9e041b5e48028..f635df7edb6f7 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCheckUrlRewritesCorrectlyGeneratedForMultipleStoreviewsDuringProductImportTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCheckUrlRewritesCorrectlyGeneratedForMultipleStoreviewsDuringProductImportTest.xml @@ -51,7 +51,7 @@ <argument name="name" value="productformagetwo68980"/> </actionGroup> <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearFiltersIfSet"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="SwitchCategoryStoreViewActionGroup" stepKey="switchToStoreViewEn"> <argument name="Store" value="customStoreENNotUnique.name"/> @@ -187,7 +187,7 @@ <argument name="name" value="productformagetwo68980"/> </actionGroup> <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearFiltersIfSet"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <magentoCLI command="config:set catalog/seo/generate_category_product_rewrites 1" stepKey="resetConfigurationSetting"/> <!--Flush cache--> <magentoCLI command="cache:flush" stepKey="cleanCache2"/> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCheckUrlRewritesInCatalogCategoriesAfterChangingUrlKeyForStoreViewAndMovingCategory2Test.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCheckUrlRewritesInCatalogCategoriesAfterChangingUrlKeyForStoreViewAndMovingCategory2Test.xml index e14bb5342db91..7244ed1d6b534 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCheckUrlRewritesInCatalogCategoriesAfterChangingUrlKeyForStoreViewAndMovingCategory2Test.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCheckUrlRewritesInCatalogCategoriesAfterChangingUrlKeyForStoreViewAndMovingCategory2Test.xml @@ -45,7 +45,7 @@ <deleteData createDataKey="createSecondSimpleProduct" stepKey="deleteSecondSimpleProduct"/> <actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteStoreView"/> <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearWebsitesGridFilters"/> - <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> </after> <!-- On the categories editing page change store view to created additional view --> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCheckUrlRewritesInCatalogCategoriesAfterChangingUrlKeyForStoreViewAndMovingCategoryTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCheckUrlRewritesInCatalogCategoriesAfterChangingUrlKeyForStoreViewAndMovingCategoryTest.xml index 7f9ee3020c388..cd17d169804db 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCheckUrlRewritesInCatalogCategoriesAfterChangingUrlKeyForStoreViewAndMovingCategoryTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCheckUrlRewritesInCatalogCategoriesAfterChangingUrlKeyForStoreViewAndMovingCategoryTest.xml @@ -48,7 +48,7 @@ <deleteData createDataKey="createFirstSimpleProduct" stepKey="deleteFirstSimpleProduct"/> <deleteData createDataKey="createSecondSimpleProduct" stepKey="deleteSecondSimpleProduct"/> <actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteStoreView"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- On the categories editing page change store view to created additional view --> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCategoryUrlRewriteAndAddNoRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCategoryUrlRewriteAndAddNoRedirectTest.xml index 732fc22aaf84a..339e078faa5a4 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCategoryUrlRewriteAndAddNoRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCategoryUrlRewriteAndAddNoRedirectTest.xml @@ -23,7 +23,7 @@ </before> <after> <deleteData createDataKey="category" stepKey="deleteRootCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Open Url Rewrite Index Page and update the Custom Url Rewrite, Store, Request Path, Redirect Type and Description --> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCategoryUrlRewriteAndAddPermanentRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCategoryUrlRewriteAndAddPermanentRedirectTest.xml index 867b3ee54161c..546637f2e548d 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCategoryUrlRewriteAndAddPermanentRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCategoryUrlRewriteAndAddPermanentRedirectTest.xml @@ -23,7 +23,7 @@ </before> <after> <deleteData createDataKey="category" stepKey="deleteRootCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Open Url Rewrite Index Page and update the Custom Url Rewrite, Store, Request Path, Redirect Type and Description --> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCategoryUrlRewriteAndAddTemporaryRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCategoryUrlRewriteAndAddTemporaryRedirectTest.xml index ab18add56aeb9..2ea04625b7d3d 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCategoryUrlRewriteAndAddTemporaryRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCategoryUrlRewriteAndAddTemporaryRedirectTest.xml @@ -23,7 +23,7 @@ </before> <after> <deleteData createDataKey="category" stepKey="deleteRootCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Open Url Rewrite Index Page and update the Custom Url Rewrite, Store, Request Path, Redirect Type and Description --> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCustomCMSPageUrlRewriteAndAddPermanentRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCustomCMSPageUrlRewriteAndAddPermanentRedirectTest.xml index bd4f7d7a32165..d0a744a168ce3 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCustomCMSPageUrlRewriteAndAddPermanentRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCustomCMSPageUrlRewriteAndAddPermanentRedirectTest.xml @@ -26,7 +26,7 @@ <actionGroup ref="AdminDeleteUrlRewriteActionGroup" stepKey="deleteCustomUrlRewrite"> <argument name="requestPath" value="{{defaultCmsPage.title}}"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Open CMS Edit Page and Get the CMS ID --> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCustomCMSPageUrlRewriteAndAddTemporaryRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCustomCMSPageUrlRewriteAndAddTemporaryRedirectTest.xml index 074140845c8a6..4327b02d396f9 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCustomCMSPageUrlRewriteAndAddTemporaryRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCustomCMSPageUrlRewriteAndAddTemporaryRedirectTest.xml @@ -26,7 +26,7 @@ <actionGroup ref="AdminDeleteUrlRewriteActionGroup" stepKey="deleteCustomUrlRewrite"> <argument name="requestPath" value="{{defaultCmsPage.title}}"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Open CMS Edit Page and Get the CMS ID --> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCustomCategoryUrlRewriteAndAddPermanentRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCustomCategoryUrlRewriteAndAddPermanentRedirectTest.xml index cdd7c334e35cd..c70112c0953b3 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCustomCategoryUrlRewriteAndAddPermanentRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCustomCategoryUrlRewriteAndAddPermanentRedirectTest.xml @@ -26,7 +26,7 @@ <actionGroup ref="AdminDeleteUrlRewriteActionGroup" stepKey="deleteCustomUrlRewrite"> <argument name="requestPath" value="{{FirstLevelSubCat.name}}.html"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Open Category Page and Get Category ID --> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCustomProductUrlRewriteAndAddTemporaryRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCustomProductUrlRewriteAndAddTemporaryRedirectTest.xml index 593c4282fc516..c39bae9fd2ff2 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCustomProductUrlRewriteAndAddTemporaryRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateCustomProductUrlRewriteAndAddTemporaryRedirectTest.xml @@ -26,7 +26,7 @@ <actionGroup ref="AdminDeleteUrlRewriteActionGroup" stepKey="deleteCustomUrlRewrite"> <argument name="requestPath" value="{{_defaultProduct.name}}.html"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Filter Product in product page and get the Product ID --> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductURLRewriteAndAddNoRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductURLRewriteAndAddNoRedirectTest.xml index c51030315b287..36c25d9a21685 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductURLRewriteAndAddNoRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductURLRewriteAndAddNoRedirectTest.xml @@ -23,7 +23,7 @@ </before> <after> <deleteData createDataKey="createSimpleProduct" stepKey="deleteProduct"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Filter and Select the created Product --> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductURLRewriteWithCategoryAndAddTemporaryRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductURLRewriteWithCategoryAndAddTemporaryRedirectTest.xml index d433aa7557094..92a2b6cac6b16 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductURLRewriteWithCategoryAndAddTemporaryRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductURLRewriteWithCategoryAndAddTemporaryRedirectTest.xml @@ -27,7 +27,7 @@ <after> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createSimpleProduct" stepKey="deleteProduct"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Filter and Select the created Product --> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductUrLRewriteAndAddPermanentRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductUrLRewriteAndAddPermanentRedirectTest.xml index e1ff4f598943e..b03912728a3d9 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductUrLRewriteAndAddPermanentRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductUrLRewriteAndAddPermanentRedirectTest.xml @@ -22,7 +22,7 @@ </before> <after> <deleteData createDataKey="createSimpleProduct" stepKey="deleteProduct"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Filter and Select the created Product --> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductUrLRewriteAndAddTemporaryRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductUrLRewriteAndAddTemporaryRedirectTest.xml index 3fa4e6b7bad90..4b03d28d44867 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductUrLRewriteAndAddTemporaryRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductUrLRewriteAndAddTemporaryRedirectTest.xml @@ -23,7 +23,7 @@ </before> <after> <deleteData createDataKey="createSimpleProduct" stepKey="deleteProduct"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Filter and Select the created Product --> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductWithSeveralWebsitesAndCheckURLRewritesTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductWithSeveralWebsitesAndCheckURLRewritesTest.xml index e1028a285f183..653995da1a3a8 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductWithSeveralWebsitesAndCheckURLRewritesTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminCreateProductWithSeveralWebsitesAndCheckURLRewritesTest.xml @@ -35,7 +35,7 @@ </actionGroup> <deleteData stepKey="deleteRootCategory" createDataKey="rootCategory"/> <deleteData stepKey="deleteProduct" createDataKey="createProduct"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Create first store --> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCMSPageNoRedirectUrlRewriteTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCMSPageNoRedirectUrlRewriteTest.xml index 1171a5e8b79c3..a65efce1a48ea 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCMSPageNoRedirectUrlRewriteTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCMSPageNoRedirectUrlRewriteTest.xml @@ -23,7 +23,7 @@ </before> <after> <deleteData createDataKey="createCMSPage" stepKey="deleteCMSPage"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Open CMS Edit Page and Get the CMS ID --> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCMSPagePermanentRedirectUrlRewriteTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCMSPagePermanentRedirectUrlRewriteTest.xml index 566204094cabd..fa19b2a30c2cd 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCMSPagePermanentRedirectUrlRewriteTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCMSPagePermanentRedirectUrlRewriteTest.xml @@ -23,7 +23,7 @@ </before> <after> <deleteData createDataKey="createCMSPage" stepKey="deleteCMSPage"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Open CMS Edit Page and Get the CMS ID --> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCMSPageTemporaryRedirectUrlRewriteTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCMSPageTemporaryRedirectUrlRewriteTest.xml index 22cb74bf96ad6..2bed25aa3f39d 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCMSPageTemporaryRedirectUrlRewriteTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCMSPageTemporaryRedirectUrlRewriteTest.xml @@ -23,7 +23,7 @@ </before> <after> <deleteData createDataKey="createCMSPage" stepKey="deleteCMSPage"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Open CMS Edit Page and Get the CMS ID --> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteHypenAsRequestPathTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteHypenAsRequestPathTest.xml index ad952225c2ff5..fe71094e49064 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteHypenAsRequestPathTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteHypenAsRequestPathTest.xml @@ -25,7 +25,7 @@ </before> <after> <deleteData createDataKey="category" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Create the Category Url Rewrite--> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteTest.xml index ceb71f65e4489..b781a8297499c 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteTest.xml @@ -21,7 +21,7 @@ </before> <after> <deleteData createDataKey="category" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Open Url Rewrite Index Page and update the Category Url Rewrite, Store, Request Path, Redirect Type and Description --> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteWithRequestPathTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteWithRequestPathTest.xml index dc9928773bf35..06b5745c32be3 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteWithRequestPathTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCategoryUrlRewriteWithRequestPathTest.xml @@ -25,7 +25,7 @@ </before> <after> <deleteData createDataKey="category" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Create the Category Url Rewrite--> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithNoRedirectsTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithNoRedirectsTest.xml index e2f0d6af0deab..d58560e40533e 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithNoRedirectsTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithNoRedirectsTest.xml @@ -23,7 +23,7 @@ </before> <after> <deleteData createDataKey="createCMSPage" stepKey="deleteCMSPage"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminGoToAddNewUrlRewritePageActionGroup" stepKey="openUrlRewriteEditPage"/> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithPermanentRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithPermanentRedirectTest.xml index 741be6985d517..989aa277f7de1 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithPermanentRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithPermanentRedirectTest.xml @@ -14,6 +14,7 @@ <title value="Delete CMS Page URL rewrite with Permanent Redirect"/> <description value="Log in to admin and delete CMS Page URL rewrite with Permanent Redirect"/> <testCaseId value="MC-14649"/> + <severity value="CRITICAL"/> <group value="mtf_migrated"/> </annotations> <before> @@ -22,7 +23,7 @@ </before> <after> <deleteData createDataKey="createCMSPage" stepKey="deleteCMSPage"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminGoToAddNewUrlRewritePageActionGroup" stepKey="openUrlRewriteEditPage"/> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithTemporaryRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithTemporaryRedirectTest.xml index e3d417f3c1f39..a81c00506c671 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithTemporaryRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCmsPageUrlRewriteWithTemporaryRedirectTest.xml @@ -23,7 +23,7 @@ </before> <after> <deleteData createDataKey="createCMSPage" stepKey="deleteCMSPage"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminGoToAddNewUrlRewritePageActionGroup" stepKey="openUrlRewriteEditPage"/> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCustomUrlRewriteTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCustomUrlRewriteTest.xml index 288c32102c606..c03c21abb9e7e 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCustomUrlRewriteTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteCustomUrlRewriteTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginToAdminPanel"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Delete created custom url rewrite and verify AssertUrlRewriteDeletedMessage--> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteProductURLRewriteEntityTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteProductURLRewriteEntityTest.xml index 2becb177ee72b..6803816f42d85 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteProductURLRewriteEntityTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteProductURLRewriteEntityTest.xml @@ -28,7 +28,7 @@ <after> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createSimpleProduct" stepKey="deleteProduct"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Filter and Select the created Product --> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteProductUrlRewriteTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteProductUrlRewriteTest.xml index 8e0ea8334a2cc..8ebad9656e7af 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteProductUrlRewriteTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminDeleteProductUrlRewriteTest.xml @@ -21,7 +21,7 @@ </before> <after> <deleteData createDataKey="simpleProduct" stepKey="deleteProduct"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Delete created product url rewrite and verify AssertUrlRewriteDeletedMessage--> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminGenerateUrlRewritesForProductInCategoriesSwitchOffTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminGenerateUrlRewritesForProductInCategoriesSwitchOffTest.xml index 2c81333bcd674..63e76717dd6b6 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminGenerateUrlRewritesForProductInCategoriesSwitchOffTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminGenerateUrlRewritesForProductInCategoriesSwitchOffTest.xml @@ -40,7 +40,7 @@ <!--Flush cache--> <magentoCLI command="cache:flush" stepKey="cleanCache1"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- 1. Open Marketing - SEO & Search - URL Rewrites --> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminMarketingUrlRewritesNavigateMenuTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminMarketingUrlRewritesNavigateMenuTest.xml index 443307b427b42..51561cfcb220f 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminMarketingUrlRewritesNavigateMenuTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminMarketingUrlRewritesNavigateMenuTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToMarketingURLRewritesPage"> <argument name="menuUiId" value="{{AdminMenuMarketing.dataUiId}}"/> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminProductCreateUrlRewriteForCustomStoreViewTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminProductCreateUrlRewriteForCustomStoreViewTest.xml index 0ad68dae4e4ce..f3b0ca2237975 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminProductCreateUrlRewriteForCustomStoreViewTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminProductCreateUrlRewriteForCustomStoreViewTest.xml @@ -41,7 +41,7 @@ <argument name="customStore" value="customStore"/> </actionGroup> <actionGroup ref="AdminGridFilterResetActionGroup" stepKey="clearFilterForStores"/> - <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> </after> <!--Step 1. Navigate as Admin on Product Page for edit product`s Url Key--> <actionGroup ref="NavigateToCreatedProductEditPageActionGroup" stepKey="goToProductForUrlRewrite"> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCategoryUrlRewriteAndAddAspxRequestPathTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCategoryUrlRewriteAndAddAspxRequestPathTest.xml index fb8f200741c8a..21b0486bd1aad 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCategoryUrlRewriteAndAddAspxRequestPathTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCategoryUrlRewriteAndAddAspxRequestPathTest.xml @@ -23,7 +23,7 @@ </before> <after> <deleteData createDataKey="category" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Search and Select Edit option for created category in grid --> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCategoryUrlRewriteAndAddNoRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCategoryUrlRewriteAndAddNoRedirectTest.xml index 72180105b38f8..7edeba336a7e9 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCategoryUrlRewriteAndAddNoRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCategoryUrlRewriteAndAddNoRedirectTest.xml @@ -23,7 +23,7 @@ </before> <after> <deleteData createDataKey="category" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Search and Select Edit option for created category in grid --> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCategoryUrlRewriteAndAddPermanentRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCategoryUrlRewriteAndAddPermanentRedirectTest.xml index 3fb8e5da39caf..a91da90581dda 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCategoryUrlRewriteAndAddPermanentRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCategoryUrlRewriteAndAddPermanentRedirectTest.xml @@ -23,7 +23,7 @@ </before> <after> <deleteData createDataKey="category" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Search and Select Edit option for created category in grid --> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCategoryUrlRewriteAndAddTemporaryRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCategoryUrlRewriteAndAddTemporaryRedirectTest.xml index bea5c44461a70..e49318af53639 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCategoryUrlRewriteAndAddTemporaryRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCategoryUrlRewriteAndAddTemporaryRedirectTest.xml @@ -23,7 +23,7 @@ </before> <after> <deleteData createDataKey="category" stepKey="deleteCategory"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Search and Select Edit option for created category in grid --> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithNoRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithNoRedirectTest.xml index b2fa13ead1164..c47419eee28e0 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithNoRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithNoRedirectTest.xml @@ -23,7 +23,7 @@ </before> <after> <deleteData createDataKey="createCMSPage" stepKey="deleteCMSPage"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Create Custom Store View--> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithPermanentReirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithPermanentReirectTest.xml index 3bf278db8410a..510b2f5607df7 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithPermanentReirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithPermanentReirectTest.xml @@ -12,6 +12,7 @@ <stories value="Update CMS Page URL Redirect With Permanent Redirect"/> <title value="Update CMS Page URL Redirect With Permanent Redirect"/> <description value="Login as Admin and tried to update the created URL Rewrite for CMS page"/> + <severity value="CRITICAL"/> <group value="cMSContent"/> <group value="mtf_migrated"/> </annotations> @@ -22,7 +23,7 @@ </before> <after> <deleteData createDataKey="createCMSPage" stepKey="deleteCMSPage"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Create Custom Store View--> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithTemporaryRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithTemporaryRedirectTest.xml index b00241bc3acac..b696811cfa8c9 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithTemporaryRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageRewriteEntityWithTemporaryRedirectTest.xml @@ -23,7 +23,7 @@ </before> <after> <deleteData createDataKey="createCMSPage" stepKey="deleteCMSPage"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Create Custom Store View--> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageUrlRewriteAndAddNoRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageUrlRewriteAndAddNoRedirectTest.xml index b799a58ac9e40..b04d417cf7efa 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageUrlRewriteAndAddNoRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageUrlRewriteAndAddNoRedirectTest.xml @@ -22,7 +22,7 @@ </before> <after> <deleteData createDataKey="createCMSPage" stepKey="deleteCMSPage"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Open CMS Edit Page and Get the CMS ID --> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageUrlRewriteAndAddPermanentRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageUrlRewriteAndAddPermanentRedirectTest.xml index 3cf30444fcaee..138b5f280d5f2 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageUrlRewriteAndAddPermanentRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageUrlRewriteAndAddPermanentRedirectTest.xml @@ -22,7 +22,7 @@ </before> <after> <deleteData createDataKey="createCMSPage" stepKey="deleteCMSPage"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Open CMS Edit Page and Get the CMS ID --> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageUrlRewriteAndAddTemporaryRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageUrlRewriteAndAddTemporaryRedirectTest.xml index b95d1eaa44d7f..d996f2e3c7bb9 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageUrlRewriteAndAddTemporaryRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCmsPageUrlRewriteAndAddTemporaryRedirectTest.xml @@ -22,7 +22,7 @@ </before> <after> <deleteData createDataKey="createCMSPage" stepKey="deleteCMSPage"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Open CMS Edit Page and Get the CMS ID --> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCustomURLRewritesPermanentTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCustomURLRewritesPermanentTest.xml index a07f7b8c0fe60..79376dfd7be35 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCustomURLRewritesPermanentTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCustomURLRewritesPermanentTest.xml @@ -26,7 +26,7 @@ <actionGroup ref="AdminDeleteUrlRewriteActionGroup" stepKey="deleteCustomUrlRewrite"> <argument name="requestPath" value="{{customPermanentUrlRewrite.request_path}}"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Search default custom url rewrite in grid--> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCustomURLRewritesTemporaryTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCustomURLRewritesTemporaryTest.xml index dcf923a34081b..9253cad21f936 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCustomURLRewritesTemporaryTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateCustomURLRewritesTemporaryTest.xml @@ -28,7 +28,7 @@ <actionGroup ref="AdminDeleteUrlRewriteActionGroup" stepKey="deleteCustomUrlRewrite"> <argument name="requestPath" value="{{customTemporaryUrlRewrite.request_path}}"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Filter Product in product page and get the Product ID --> diff --git a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateProductUrlRewriteAndAddTemporaryRedirectTest.xml b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateProductUrlRewriteAndAddTemporaryRedirectTest.xml index 74f3a60f35cea..e70896b7de04f 100644 --- a/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateProductUrlRewriteAndAddTemporaryRedirectTest.xml +++ b/app/code/Magento/UrlRewrite/Test/Mftf/Test/AdminUpdateProductUrlRewriteAndAddTemporaryRedirectTest.xml @@ -23,7 +23,7 @@ </before> <after> <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Search and Select Edit option for created product in grid --> diff --git a/app/code/Magento/User/Test/Mftf/Test/AdminBulkOperationsLogIsNotAccessibleForAdminUserWithLimitedAccessTest.xml b/app/code/Magento/User/Test/Mftf/Test/AdminBulkOperationsLogIsNotAccessibleForAdminUserWithLimitedAccessTest.xml index 4aa9e7b7fb4cd..e0db8d8b25b96 100644 --- a/app/code/Magento/User/Test/Mftf/Test/AdminBulkOperationsLogIsNotAccessibleForAdminUserWithLimitedAccessTest.xml +++ b/app/code/Magento/User/Test/Mftf/Test/AdminBulkOperationsLogIsNotAccessibleForAdminUserWithLimitedAccessTest.xml @@ -35,7 +35,7 @@ <actionGroup ref="AdminDeleteRoleByRoleNameActionGroup" stepKey="deleteRole"> <argument name="role" value="adminWithoutBulkActionRole"/> </actionGroup> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Create admin user2 who doesn't have access to "Bulk Operations". Role Resources, uncheck point with title "Bulk Operations" --> @@ -44,7 +44,7 @@ <argument name="user" value="NewAdminUser"/> <argument name="role" value="adminWithoutBulkActionRole"/> </actionGroup> - <actionGroup ref="logout" stepKey="logoutAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutAdmin"/> <!-- Login as user2 --> <actionGroup ref="LoginAsAdmin" stepKey="LoginAsUser"> @@ -63,9 +63,9 @@ <!-- Navigate to "Your Bulk Operations log" directly: %your_build_backend_url%/bulk/ --> <amOnPage url="{{AdminBulkActionsLogIndexPage.url}}" stepKey="OnBulkPage"/> <waitForPageLoad stepKey="waitForPageLoad"/> - + <!-- Access Denied --> <see userInput="Sorry, you need permissions to view this content." selector="{{AdminMessagesSection.accessDenied}}" stepKey="seeAccessDenied"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </test> </tests> diff --git a/app/code/Magento/User/Test/Mftf/Test/AdminCreateActiveUserEntityTest.xml b/app/code/Magento/User/Test/Mftf/Test/AdminCreateActiveUserEntityTest.xml index 753ab02f84053..218be4e282b4a 100644 --- a/app/code/Magento/User/Test/Mftf/Test/AdminCreateActiveUserEntityTest.xml +++ b/app/code/Magento/User/Test/Mftf/Test/AdminCreateActiveUserEntityTest.xml @@ -33,7 +33,7 @@ <argument name="role" value="genericAdminRole"/> <argument name="user" value="activeAdmin"/> </actionGroup> - <actionGroup ref="logout" stepKey="logoutMasterAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutMasterAdmin"/> <amOnPage url="{{AdminLoginPage.url}}" stepKey="navigateToAdmin"/> <fillField selector="{{AdminLoginFormSection.username}}" userInput="{{activeAdmin.username}}" stepKey="fillUsername"/> <fillField selector="{{AdminLoginFormSection.password}}" userInput="{{activeAdmin.password}}" stepKey="fillPassword"/> @@ -44,6 +44,6 @@ <click selector="{{AdminUserGridSection.searchButton}}" stepKey="clickSearchButton"/> <waitForPageLoad time="10" stepKey="wait1"/> <see selector="{{AdminUserGridSection.usernameInFirstRow}}" userInput="{{activeAdmin.username}}" stepKey="seeFoundUsername"/> - <actionGroup ref="logout" stepKey="logoutCreatedUser"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutCreatedUser"/> </test> </tests> diff --git a/app/code/Magento/User/Test/Mftf/Test/AdminCreateInactiveUserEntityTest.xml b/app/code/Magento/User/Test/Mftf/Test/AdminCreateInactiveUserEntityTest.xml index d0fdd72ebbdcc..d52cafa13b7b8 100644 --- a/app/code/Magento/User/Test/Mftf/Test/AdminCreateInactiveUserEntityTest.xml +++ b/app/code/Magento/User/Test/Mftf/Test/AdminCreateInactiveUserEntityTest.xml @@ -38,7 +38,7 @@ <click selector="{{AdminUserGridSection.searchButton}}" stepKey="clickSearchButton"/> <waitForPageLoad time="10" stepKey="wait1"/> <see selector="{{AdminUserGridSection.usernameInFirstRow}}" userInput="{{inactiveAdmin.username}}" stepKey="seeFoundUsername"/> - <actionGroup ref="logout" stepKey="logoutMasterAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutMasterAdmin"/> <amOnPage url="{{AdminLoginPage.url}}" stepKey="navigateToAdmin"/> <fillField selector="{{AdminLoginFormSection.username}}" userInput="{{inactiveAdmin.username}}" stepKey="fillUsername"/> <fillField selector="{{AdminLoginFormSection.password}}" userInput="{{inactiveAdmin.password}}" stepKey="fillPassword"/> diff --git a/app/code/Magento/User/Test/Mftf/Test/AdminLockAdminUserEntityTest.xml b/app/code/Magento/User/Test/Mftf/Test/AdminLockAdminUserEntityTest.xml index 3bd55a454c3b0..c367bddc8d999 100644 --- a/app/code/Magento/User/Test/Mftf/Test/AdminLockAdminUserEntityTest.xml +++ b/app/code/Magento/User/Test/Mftf/Test/AdminLockAdminUserEntityTest.xml @@ -28,7 +28,7 @@ <after> <magentoCLI command="config:set admin/captcha/enable 1" stepKey="enableAdminCaptcha"/> <magentoCLI command="cache:clean config full_page" stepKey="cleanInvalidatedCaches"/> - <actionGroup ref="logout" stepKey="logOut"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logOut"/> </after> <!--Create New User--> @@ -47,7 +47,7 @@ <actionGroup ref="AdminSaveConfigActionGroup" stepKey="saveChanges"/> <!-- Log in to Admin Panel with incorrect password specified number of times--> - <actionGroup ref="logout" stepKey="logoutAsDefaultUser"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutAsDefaultUser"/> <actionGroup ref="LoginAsAdmin" stepKey="loginAsNewUserFirstAttempt"> <argument name="adminUser" value="adminUserIncorrectPassword"/> </actionGroup> diff --git a/app/code/Magento/User/Test/Mftf/Test/AdminSystemAllUsersNavigateMenuTest.xml b/app/code/Magento/User/Test/Mftf/Test/AdminSystemAllUsersNavigateMenuTest.xml index b899320403d71..57e2ab0faccf6 100644 --- a/app/code/Magento/User/Test/Mftf/Test/AdminSystemAllUsersNavigateMenuTest.xml +++ b/app/code/Magento/User/Test/Mftf/Test/AdminSystemAllUsersNavigateMenuTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToSystemAllUsersPage"> <argument name="menuUiId" value="{{AdminMenuSystem.dataUiId}}"/> diff --git a/app/code/Magento/User/Test/Mftf/Test/AdminSystemLockedUsersNavigateMenuTest.xml b/app/code/Magento/User/Test/Mftf/Test/AdminSystemLockedUsersNavigateMenuTest.xml index aea46f3273157..963af44ac3bc0 100644 --- a/app/code/Magento/User/Test/Mftf/Test/AdminSystemLockedUsersNavigateMenuTest.xml +++ b/app/code/Magento/User/Test/Mftf/Test/AdminSystemLockedUsersNavigateMenuTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToSystemLockedUsersPage"> <argument name="menuUiId" value="{{AdminMenuSystem.dataUiId}}"/> diff --git a/app/code/Magento/User/Test/Mftf/Test/AdminSystemManageEncryptionKeyNavigateMenuTest.xml b/app/code/Magento/User/Test/Mftf/Test/AdminSystemManageEncryptionKeyNavigateMenuTest.xml index f8013a54058c3..d6a4318c7d7be 100644 --- a/app/code/Magento/User/Test/Mftf/Test/AdminSystemManageEncryptionKeyNavigateMenuTest.xml +++ b/app/code/Magento/User/Test/Mftf/Test/AdminSystemManageEncryptionKeyNavigateMenuTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToManageEncryptionKeyPage"> <argument name="menuUiId" value="{{AdminMenuSystem.dataUiId}}"/> diff --git a/app/code/Magento/User/Test/Mftf/Test/AdminSystemUserRolesNavigateMenuTest.xml b/app/code/Magento/User/Test/Mftf/Test/AdminSystemUserRolesNavigateMenuTest.xml index c4052a7f4219c..ef9cb5ebfa5fe 100644 --- a/app/code/Magento/User/Test/Mftf/Test/AdminSystemUserRolesNavigateMenuTest.xml +++ b/app/code/Magento/User/Test/Mftf/Test/AdminSystemUserRolesNavigateMenuTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToSystemUserRolesPage"> <argument name="menuUiId" value="{{AdminMenuSystem.dataUiId}}"/> diff --git a/app/code/Magento/User/Test/Mftf/Test/AdminUpdateUserTest.xml b/app/code/Magento/User/Test/Mftf/Test/AdminUpdateUserTest.xml index dfadee8ee6807..cfc6016b91906 100644 --- a/app/code/Magento/User/Test/Mftf/Test/AdminUpdateUserTest.xml +++ b/app/code/Magento/User/Test/Mftf/Test/AdminUpdateUserTest.xml @@ -39,7 +39,7 @@ </before> <after> <!--Delete new User--> - <actionGroup ref="logout" stepKey="logoutAsSaleRoleUser"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutAsSaleRoleUser"/> <actionGroup ref="LoginAsAdmin" stepKey="loginAsDefaultAdminUser"/> <actionGroup ref="AdminDeleteCustomUserActionGroup" stepKey="deleteNewUser"> <argument name="user" value="AdminUserWithUpdatedUserRoleToSales"/> @@ -49,7 +49,7 @@ <actionGroup ref="AdminDeleteUserRoleActionGroup" stepKey="deleteCustomRole"> <argument name="roleName" value="{{roleSales.rolename}}"/> </actionGroup> - <actionGroup ref="logout" stepKey="logOut"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logOut"/> </after> @@ -68,7 +68,7 @@ <actionGroup ref="AssertAdminUserIsInGridActionGroup" stepKey="seeUserInGrid"> <argument name="user" value="AdminUserWithUpdatedUserRoleToSales"/> </actionGroup> - <actionGroup ref="logout" stepKey="logOutFromAdminPanel"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logOutFromAdminPanel"/> <actionGroup ref="LoginAsAdmin" stepKey="loginAsSaleRoleUser"> <argument name="adminUser" value="AdminUserWithUpdatedUserRoleToSales"/> </actionGroup> diff --git a/app/code/Magento/Variable/Test/Mftf/Test/AdminCreateCustomVariableEntityTest.xml b/app/code/Magento/Variable/Test/Mftf/Test/AdminCreateCustomVariableEntityTest.xml index 3185640e3783a..ee7368a44616d 100644 --- a/app/code/Magento/Variable/Test/Mftf/Test/AdminCreateCustomVariableEntityTest.xml +++ b/app/code/Magento/Variable/Test/Mftf/Test/AdminCreateCustomVariableEntityTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminOpenNewVariablePageActionGroup" stepKey="goToNewVariableAdminPage"/> <actionGroup ref="AdminFillVariableFormActionGroup" stepKey="fillInCustomVariableData"> diff --git a/app/code/Magento/Variable/Test/Mftf/Test/AdminSystemCustomVariablesNavigateMenuTest.xml b/app/code/Magento/Variable/Test/Mftf/Test/AdminSystemCustomVariablesNavigateMenuTest.xml index 74446cf601348..c5d85907d15fc 100644 --- a/app/code/Magento/Variable/Test/Mftf/Test/AdminSystemCustomVariablesNavigateMenuTest.xml +++ b/app/code/Magento/Variable/Test/Mftf/Test/AdminSystemCustomVariablesNavigateMenuTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToSystemCustomVariablesPage"> <argument name="menuUiId" value="{{AdminMenuSystem.dataUiId}}"/> diff --git a/app/code/Magento/Weee/Model/App/Action/ContextPlugin.php b/app/code/Magento/Weee/Model/App/Action/ContextPlugin.php index aae6f769eb500..66485d0410872 100644 --- a/app/code/Magento/Weee/Model/App/Action/ContextPlugin.php +++ b/app/code/Magento/Weee/Model/App/Action/ContextPlugin.php @@ -6,78 +6,92 @@ namespace Magento\Weee\Model\App\Action; +use Magento\Customer\Model\Session as CustomerSession; +use Magento\Framework\App\ActionInterface; +use Magento\Framework\App\Config\ScopeConfigInterface; +use Magento\Framework\App\Http\Context as HttpContext; +use Magento\Framework\Module\Manager as ModuleManager; +use Magento\PageCache\Model\Config as PageCacheConfig; +use Magento\Store\Model\ScopeInterface; +use Magento\Store\Model\StoreManagerInterface; +use Magento\Tax\Helper\Data as TaxHelper; +use Magento\Tax\Model\Config as TaxConfig; +use Magento\Weee\Helper\Data as WeeeHelper; +use Magento\Weee\Model\Tax; + /** - * Class ContextPlugin + * Plugin to provide Context information to Weee Action + * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class ContextPlugin { /** - * @var \Magento\Customer\Model\Session + * @var CustomerSession */ protected $customerSession; /** - * @var \Magento\Framework\App\Http\Context + * @var HttpContext */ protected $httpContext; /** - * @var \Magento\Tax\Helper\Data + * @var TaxHelper */ protected $taxHelper; /** - * @var \Magento\Weee\Helper\Data + * @var WeeeHelper */ protected $weeeHelper; /** - * @var \Magento\Framework\Module\Manager + * @var ModuleManager */ protected $moduleManager; /** - * @var \Magento\Weee\Model\Tax + * @var Tax */ protected $weeeTax; /** - * @var \Magento\PageCache\Model\Config + * @var PageCacheConfig */ protected $cacheConfig; /** - * @var \Magento\Store\Model\StoreManagerInterface + * @var StoreManagerInterface */ protected $storeManager; /** - * @var \Magento\Framework\App\Config\ScopeConfigInterface + * @var ScopeConfigInterface */ protected $scopeConfig; /** - * @param \Magento\Customer\Model\Session $customerSession - * @param \Magento\Framework\App\Http\Context $httpContext - * @param \Magento\Weee\Model\Tax $weeeTax - * @param \Magento\Tax\Helper\Data $taxHelper - * @param \Magento\Weee\Helper\Data $weeeHelper - * @param \Magento\Framework\Module\Manager $moduleManager - * @param \Magento\PageCache\Model\Config $cacheConfig - * @param \Magento\Store\Model\StoreManagerInterface $storeManager - * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig + * @param CustomerSession $customerSession + * @param HttpContext $httpContext + * @param Tax $weeeTax + * @param TaxHelper $taxHelper + * @param WeeeHelper $weeeHelper + * @param ModuleManager $moduleManager + * @param PageCacheConfig $cacheConfig + * @param StoreManagerInterface $storeManager + * @param ScopeConfigInterface $scopeConfig */ public function __construct( - \Magento\Customer\Model\Session $customerSession, - \Magento\Framework\App\Http\Context $httpContext, - \Magento\Weee\Model\Tax $weeeTax, - \Magento\Tax\Helper\Data $taxHelper, - \Magento\Weee\Helper\Data $weeeHelper, - \Magento\Framework\Module\Manager $moduleManager, - \Magento\PageCache\Model\Config $cacheConfig, - \Magento\Store\Model\StoreManagerInterface $storeManager, - \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig + CustomerSession $customerSession, + HttpContext $httpContext, + Tax $weeeTax, + TaxHelper $taxHelper, + WeeeHelper $weeeHelper, + ModuleManager $moduleManager, + PageCacheConfig $cacheConfig, + StoreManagerInterface $storeManager, + ScopeConfigInterface $scopeConfig ) { $this->customerSession = $customerSession; $this->httpContext = $httpContext; @@ -93,18 +107,15 @@ public function __construct( /** * Before dispatch. * - * @param \Magento\Framework\App\ActionInterface $subject - * @param \Magento\Framework\App\RequestInterface $request + * @param ActionInterface $subject * @return void * @SuppressWarnings(PHPMD.UnusedFormalParameter) * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ - public function beforeDispatch( - \Magento\Framework\App\ActionInterface $subject, - \Magento\Framework\App\RequestInterface $request - ) { + public function beforeExecute(ActionInterface $subject) + { if (!$this->weeeHelper->isEnabled() || !$this->customerSession->isLoggedIn() || !$this->moduleManager->isEnabled('Magento_PageCache') || @@ -128,26 +139,14 @@ public function beforeDispatch( } elseif ($countryId && !$regionId) { // country exist and region does not exist $regionId = 0; - $exist = $this->weeeTax->isWeeeInLocation( - $countryId, - $regionId, - $websiteId - ); + $exist = $this->weeeTax->isWeeeInLocation($countryId, $regionId, $websiteId); } else { // country and region exist - $exist = $this->weeeTax->isWeeeInLocation( - $countryId, - $regionId, - $websiteId - ); + $exist = $this->weeeTax->isWeeeInLocation($countryId, $regionId, $websiteId); if (!$exist) { // just check the country for weee $regionId = 0; - $exist = $this->weeeTax->isWeeeInLocation( - $countryId, - $regionId, - $websiteId - ); + $exist = $this->weeeTax->isWeeeInLocation($countryId, $regionId, $websiteId); } } @@ -171,13 +170,13 @@ protected function getWeeeTaxRegion($basedOn) $countryId = null; $regionId = null; $defaultCountryId = $this->scopeConfig->getValue( - \Magento\Tax\Model\Config::CONFIG_XML_PATH_DEFAULT_COUNTRY, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + TaxConfig::CONFIG_XML_PATH_DEFAULT_COUNTRY, + ScopeInterface::SCOPE_STORE, null ); $defaultRegionId = $this->scopeConfig->getValue( - \Magento\Tax\Model\Config::CONFIG_XML_PATH_DEFAULT_REGION, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + TaxConfig::CONFIG_XML_PATH_DEFAULT_REGION, + ScopeInterface::SCOPE_STORE, null ); diff --git a/app/code/Magento/Weee/Test/Mftf/Test/AdminFixedTaxValSavedForSpecificWebsiteTest.xml b/app/code/Magento/Weee/Test/Mftf/Test/AdminFixedTaxValSavedForSpecificWebsiteTest.xml index 6cbdbe0db267d..b929fd3d304c0 100644 --- a/app/code/Magento/Weee/Test/Mftf/Test/AdminFixedTaxValSavedForSpecificWebsiteTest.xml +++ b/app/code/Magento/Weee/Test/Mftf/Test/AdminFixedTaxValSavedForSpecificWebsiteTest.xml @@ -66,7 +66,7 @@ <actionGroup ref="AdminDeleteWebsiteActionGroup" stepKey="deleteCustomWebsite"> <argument name="websiteName" value="{{NewWebSiteData.name}}"/> </actionGroup> - <actionGroup ref="logout" stepKey="logoutOfAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutOfAdmin"/> </after> <!-- Go to product edit page and assign it to created website --> <comment userInput="Go to product edit page and assign it to created website" stepKey="assignProductToCreatedWebsite"/> diff --git a/app/code/Magento/Weee/Test/Mftf/Test/AdminRemoveProductWeeeAttributeOptionTest.xml b/app/code/Magento/Weee/Test/Mftf/Test/AdminRemoveProductWeeeAttributeOptionTest.xml index 6164f037048ba..d3f39e9aee664 100644 --- a/app/code/Magento/Weee/Test/Mftf/Test/AdminRemoveProductWeeeAttributeOptionTest.xml +++ b/app/code/Magento/Weee/Test/Mftf/Test/AdminRemoveProductWeeeAttributeOptionTest.xml @@ -41,7 +41,7 @@ <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductListing"/> <waitForPageLoad stepKey="waitForProductListingPageLoad"/> <actionGroup ref="ResetProductGridToDefaultViewActionGroup" stepKey="resetGridToDefaultKeywordSearch"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <deleteData createDataKey="createProductFPTAttribute" stepKey="deleteProductFPTAttribute"/> <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> </after> diff --git a/app/code/Magento/Weee/Test/Mftf/Test/StorefrontFPTTaxInformationInShoppingCartForCustomerPhysicalQuoteTest.xml b/app/code/Magento/Weee/Test/Mftf/Test/StorefrontFPTTaxInformationInShoppingCartForCustomerPhysicalQuoteTest.xml index a43f8a306902f..befce13ef036b 100644 --- a/app/code/Magento/Weee/Test/Mftf/Test/StorefrontFPTTaxInformationInShoppingCartForCustomerPhysicalQuoteTest.xml +++ b/app/code/Magento/Weee/Test/Mftf/Test/StorefrontFPTTaxInformationInShoppingCartForCustomerPhysicalQuoteTest.xml @@ -72,7 +72,7 @@ <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearProductsGridFilters"/> - <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexBrokenIndices"/> </after> diff --git a/app/code/Magento/Weee/Test/Mftf/Test/StorefrontFPTTaxInformationInShoppingCartForCustomerVirtualQuoteTest.xml b/app/code/Magento/Weee/Test/Mftf/Test/StorefrontFPTTaxInformationInShoppingCartForCustomerVirtualQuoteTest.xml index 7c6394e6f8848..8abdbede98922 100644 --- a/app/code/Magento/Weee/Test/Mftf/Test/StorefrontFPTTaxInformationInShoppingCartForCustomerVirtualQuoteTest.xml +++ b/app/code/Magento/Weee/Test/Mftf/Test/StorefrontFPTTaxInformationInShoppingCartForCustomerVirtualQuoteTest.xml @@ -54,7 +54,7 @@ <createData entity="DefaultTaxConfig" stepKey="defaultTaxConfiguration"/> <deleteData createDataKey="createVirtualProduct" stepKey="deleteVirtualProduct"/> <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> - <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexBrokenIndices"/> </after> diff --git a/app/code/Magento/Weee/Test/Mftf/Test/StorefrontFPTTaxInformationInShoppingCartForGuestPhysicalQuoteTest.xml b/app/code/Magento/Weee/Test/Mftf/Test/StorefrontFPTTaxInformationInShoppingCartForGuestPhysicalQuoteTest.xml index 7a1077675cbee..d4e5ed74be9a3 100644 --- a/app/code/Magento/Weee/Test/Mftf/Test/StorefrontFPTTaxInformationInShoppingCartForGuestPhysicalQuoteTest.xml +++ b/app/code/Magento/Weee/Test/Mftf/Test/StorefrontFPTTaxInformationInShoppingCartForGuestPhysicalQuoteTest.xml @@ -67,7 +67,7 @@ <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearProductsGridFilters"/> - <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexBrokenIndices"/> </after> diff --git a/app/code/Magento/Weee/Test/Mftf/Test/StorefrontFPTTaxInformationInShoppingCartForGuestVirtualQuoteTest.xml b/app/code/Magento/Weee/Test/Mftf/Test/StorefrontFPTTaxInformationInShoppingCartForGuestVirtualQuoteTest.xml index a7059fcfb4644..0fc4af813c5a1 100644 --- a/app/code/Magento/Weee/Test/Mftf/Test/StorefrontFPTTaxInformationInShoppingCartForGuestVirtualQuoteTest.xml +++ b/app/code/Magento/Weee/Test/Mftf/Test/StorefrontFPTTaxInformationInShoppingCartForGuestVirtualQuoteTest.xml @@ -49,7 +49,7 @@ <deleteData createDataKey="createProductFPTAttribute" stepKey="deleteProductFPTAttribute"/> <createData entity="DefaultTaxConfig" stepKey="defaultTaxConfiguration"/> <deleteData createDataKey="createVirtualProduct" stepKey="deleteVirtualProduct"/> - <actionGroup ref="logout" stepKey="logoutFromAdmin"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logoutFromAdmin"/> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexBrokenIndices"/> </after> diff --git a/app/code/Magento/Weee/Test/Unit/App/Action/ContextPluginTest.php b/app/code/Magento/Weee/Test/Unit/App/Action/ContextPluginTest.php index c829b524527a6..b28a223ef2dce 100644 --- a/app/code/Magento/Weee/Test/Unit/App/Action/ContextPluginTest.php +++ b/app/code/Magento/Weee/Test/Unit/App/Action/ContextPluginTest.php @@ -3,114 +3,146 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Weee\Test\Unit\App\Action; +use Magento\Customer\Model\Session as CustomerSession; +use Magento\Framework\App\Config; +use Magento\Framework\App\Http\Context as HttpContext; +use Magento\Framework\App\Test\Unit\Action\Stub\ActionStub; +use Magento\Framework\Module\Manager as ModuleManager; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\PageCache\Model\Config as PageCacheConfig; +use Magento\Store\Model\ScopeInterface; +use Magento\Store\Model\Store; +use Magento\Store\Model\StoreManager; +use Magento\Tax\Helper\Data as TaxHelper; +use Magento\Tax\Model\Calculation\Proxy as TaxCalculation; +use Magento\Tax\Model\Config as TaxConfig; +use Magento\Weee\Helper\Data as WeeeHelper; +use Magento\Weee\Model\App\Action\ContextPlugin; +use Magento\Weee\Model\Tax; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; + /** - * Class ContextPluginTest + * Unit Tests to cover Context Plugin * - * @package Magento\Weee\Test\Unit\App\Action * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class ContextPluginTest extends \PHPUnit\Framework\TestCase +class ContextPluginTest extends TestCase { /** - * @var \Magento\Tax\Helper\Data + * @var TaxHelper|MockObject */ protected $taxHelperMock; /** - * @var \Magento\Weee\Helper\Data + * @var WeeeHelper|MockObject */ protected $weeeHelperMock; /** - * @var \Magento\Weee\Model\Tax + * @var Tax|MockObject */ protected $weeeTaxMock; /** - * @var \Magento\Framework\App\Http\Context + * @var HttpContext|MockObject */ protected $httpContextMock; /** - * @var \Magento\Tax\Model\Calculation\Proxy + * @var TaxCalculation|MockObject */ protected $taxCalculationMock; /** - * @var \Magento\Framework\Module\Manager + * @var ModuleManager|MockObject */ protected $moduleManagerMock; /** - * @var \Magento\PageCache\Model\Config + * @var PageCacheConfig|MockObject */ protected $cacheConfigMock; /** - * @var \Magento\Store\Model\StoreManager + * @var StoreManager|MockObject */ - protected $storeManageMock; + protected $storeManagerMock; /** - * @var \Magento\Framework\App\Config\ScopeConfig + * @var Config|MockObject */ protected $scopeConfigMock; /** - * @var \Magento\Tax\Model\App\Action\ContextPlugin + * @var CustomerSession|MockObject + */ + private $customerSessionMock; + + /** + * @var ObjectManager + */ + private $objectManager; + + /** + * @var ContextPlugin */ protected $contextPlugin; protected function setUp() { - $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + $this->objectManager = new ObjectManager($this); - $this->taxHelperMock = $this->getMockBuilder(\Magento\Tax\Helper\Data::class) + $this->taxHelperMock = $this->getMockBuilder(TaxHelper::class) ->disableOriginalConstructor() ->getMock(); - $this->weeeHelperMock = $this->getMockBuilder(\Magento\Weee\Helper\Data::class) + $this->weeeHelperMock = $this->getMockBuilder(WeeeHelper::class) ->disableOriginalConstructor() ->getMock(); - $this->weeeTaxMock = $this->getMockBuilder(\Magento\Weee\Model\Tax::class) + $this->weeeTaxMock = $this->getMockBuilder(Tax::class) ->disableOriginalConstructor() ->getMock(); - $this->httpContextMock = $this->getMockBuilder(\Magento\Framework\App\Http\Context::class) + $this->httpContextMock = $this->getMockBuilder(HttpContext::class) ->disableOriginalConstructor() ->getMock(); - $this->customerSessionMock = $this->getMockBuilder(\Magento\Customer\Model\Session::class) + $this->customerSessionMock = $this->getMockBuilder(CustomerSession::class) ->disableOriginalConstructor() ->setMethods( [ - 'getDefaultTaxBillingAddress', 'getDefaultTaxShippingAddress', 'getCustomerTaxClassId', - 'getWebsiteId', 'isLoggedIn' + 'getDefaultTaxBillingAddress', + 'getDefaultTaxShippingAddress', + 'getCustomerTaxClassId', + 'getWebsiteId', + 'isLoggedIn' ] ) ->getMock(); - $this->moduleManagerMock = $this->getMockBuilder(\Magento\Framework\Module\Manager::class) + $this->moduleManagerMock = $this->getMockBuilder(ModuleManager::class) ->disableOriginalConstructor() ->getMock(); - $this->cacheConfigMock = $this->getMockBuilder(\Magento\PageCache\Model\Config::class) + $this->cacheConfigMock = $this->getMockBuilder(PageCacheConfig::class) ->disableOriginalConstructor() ->getMock(); - $this->storeManagerMock = $this->getMockBuilder(\Magento\Store\Model\StoreManager::class) + $this->storeManagerMock = $this->getMockBuilder(StoreManager::class) ->disableOriginalConstructor() ->getMock(); - $this->scopeConfigMock = $this->getMockBuilder(\Magento\Framework\App\Config::class) + $this->scopeConfigMock = $this->getMockBuilder(Config::class) ->disableOriginalConstructor() ->getMock(); $this->contextPlugin = $this->objectManager->getObject( - \Magento\Weee\Model\App\Action\ContextPlugin::class, + ContextPlugin::class, [ 'customerSession' => $this->customerSessionMock, 'httpContext' => $this->httpContextMock, @@ -125,7 +157,7 @@ protected function setUp() ); } - public function testBeforeDispatchBasedOnDefault() + public function testBeforeExecuteBasedOnDefault() { $this->customerSessionMock->expects($this->once()) ->method('isLoggedIn') @@ -148,7 +180,7 @@ public function testBeforeDispatchBasedOnDefault() ->method('getTaxBasedOn') ->willReturn('billing'); - $storeMock = $this->getMockBuilder(\Magento\Store\Model\Store::class) + $storeMock = $this->getMockBuilder(Store::class) ->disableOriginalConstructor() ->getMock(); @@ -163,8 +195,8 @@ public function testBeforeDispatchBasedOnDefault() $this->scopeConfigMock->expects($this->at(0)) ->method('getValue') ->with( - \Magento\Tax\Model\Config::CONFIG_XML_PATH_DEFAULT_COUNTRY, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + TaxConfig::CONFIG_XML_PATH_DEFAULT_COUNTRY, + ScopeInterface::SCOPE_STORE, null ) ->willReturn('US'); @@ -172,8 +204,8 @@ public function testBeforeDispatchBasedOnDefault() $this->scopeConfigMock->expects($this->at(1)) ->method('getValue') ->with( - \Magento\Tax\Model\Config::CONFIG_XML_PATH_DEFAULT_REGION, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + TaxConfig::CONFIG_XML_PATH_DEFAULT_REGION, + ScopeInterface::SCOPE_STORE, null ) ->willReturn(0); @@ -187,13 +219,13 @@ public function testBeforeDispatchBasedOnDefault() ->method('setValue') ->with('weee_tax_region', ['countryId' => 'US', 'regionId' => 0], 0); - $action = $this->objectManager->getObject(\Magento\Framework\App\Test\Unit\Action\Stub\ActionStub::class); - $request = $this->createPartialMock(\Magento\Framework\App\Request\Http::class, ['getActionName']); + /** @var ActionStub $action */ + $action = $this->objectManager->getObject(ActionStub::class); - $this->contextPlugin->beforeDispatch($action, $request); + $this->contextPlugin->beforeExecute($action); } - public function testBeforeDispatchBasedOnOrigin() + public function testBeforeExecuteBasedOnOrigin() { $this->customerSessionMock->expects($this->once()) ->method('isLoggedIn') @@ -216,13 +248,13 @@ public function testBeforeDispatchBasedOnOrigin() ->method('getTaxBasedOn') ->willReturn('origin'); - $action = $this->objectManager->getObject(\Magento\Framework\App\Test\Unit\Action\Stub\ActionStub::class); - $request = $this->createPartialMock(\Magento\Framework\App\Request\Http::class, ['getActionName']); + /** @var ActionStub $action */ + $action = $this->objectManager->getObject(ActionStub::class); - $this->contextPlugin->beforeDispatch($action, $request); + $this->contextPlugin->beforeExecute($action); } - public function testBeforeDispatchBasedOnBilling() + public function testBeforeExecuteBasedOnBilling() { $this->customerSessionMock->expects($this->once()) ->method('isLoggedIn') @@ -245,7 +277,7 @@ public function testBeforeDispatchBasedOnBilling() ->method('getTaxBasedOn') ->willReturn('billing'); - $storeMock = $this->getMockBuilder(\Magento\Store\Model\Store::class) + $storeMock = $this->getMockBuilder(Store::class) ->disableOriginalConstructor() ->getMock(); @@ -260,8 +292,8 @@ public function testBeforeDispatchBasedOnBilling() $this->scopeConfigMock->expects($this->at(0)) ->method('getValue') ->with( - \Magento\Tax\Model\Config::CONFIG_XML_PATH_DEFAULT_COUNTRY, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + TaxConfig::CONFIG_XML_PATH_DEFAULT_COUNTRY, + ScopeInterface::SCOPE_STORE, null ) ->willReturn('US'); @@ -269,8 +301,8 @@ public function testBeforeDispatchBasedOnBilling() $this->scopeConfigMock->expects($this->at(1)) ->method('getValue') ->with( - \Magento\Tax\Model\Config::CONFIG_XML_PATH_DEFAULT_REGION, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + TaxConfig::CONFIG_XML_PATH_DEFAULT_REGION, + ScopeInterface::SCOPE_STORE, null ) ->willReturn(0); @@ -288,13 +320,13 @@ public function testBeforeDispatchBasedOnBilling() ->method('setValue') ->with('weee_tax_region', ['countryId' => 'US', 'regionId' => 1], 0); - $action = $this->objectManager->getObject(\Magento\Framework\App\Test\Unit\Action\Stub\ActionStub::class); - $request = $this->createPartialMock(\Magento\Framework\App\Request\Http::class, ['getActionName']); + /** @var ActionStub $action */ + $action = $this->objectManager->getObject(ActionStub::class); - $this->contextPlugin->beforeDispatch($action, $request); + $this->contextPlugin->beforeExecute($action); } - public function testBeforeDispatchBasedOnShipping() + public function testBeforeExecuterBasedOnShipping() { $this->customerSessionMock->expects($this->once()) ->method('isLoggedIn') @@ -317,7 +349,7 @@ public function testBeforeDispatchBasedOnShipping() ->method('getTaxBasedOn') ->willReturn('shipping'); - $storeMock = $this->getMockBuilder(\Magento\Store\Model\Store::class) + $storeMock = $this->getMockBuilder(Store::class) ->disableOriginalConstructor() ->getMock(); @@ -332,8 +364,8 @@ public function testBeforeDispatchBasedOnShipping() $this->scopeConfigMock->expects($this->at(0)) ->method('getValue') ->with( - \Magento\Tax\Model\Config::CONFIG_XML_PATH_DEFAULT_COUNTRY, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + TaxConfig::CONFIG_XML_PATH_DEFAULT_COUNTRY, + ScopeInterface::SCOPE_STORE, null ) ->willReturn('US'); @@ -341,8 +373,8 @@ public function testBeforeDispatchBasedOnShipping() $this->scopeConfigMock->expects($this->at(1)) ->method('getValue') ->with( - \Magento\Tax\Model\Config::CONFIG_XML_PATH_DEFAULT_REGION, - \Magento\Store\Model\ScopeInterface::SCOPE_STORE, + TaxConfig::CONFIG_XML_PATH_DEFAULT_REGION, + ScopeInterface::SCOPE_STORE, null ) ->willReturn(0); @@ -360,9 +392,9 @@ public function testBeforeDispatchBasedOnShipping() ->method('setValue') ->with('weee_tax_region', ['countryId' => 'US', 'regionId' => 1], 0); - $action = $this->objectManager->getObject(\Magento\Framework\App\Test\Unit\Action\Stub\ActionStub::class); - $request = $this->createPartialMock(\Magento\Framework\App\Request\Http::class, ['getActionName']); + /** @var ActionStub $action */ + $action = $this->objectManager->getObject(ActionStub::class); - $this->contextPlugin->beforeDispatch($action, $request); + $this->contextPlugin->beforeExecute($action); } } diff --git a/app/code/Magento/Weee/Test/Unit/Observer/UpdateElementTypesObserverTest.php b/app/code/Magento/Weee/Test/Unit/Observer/UpdateElementTypesObserverTest.php new file mode 100644 index 0000000000000..bcdbfe1d6f03f --- /dev/null +++ b/app/code/Magento/Weee/Test/Unit/Observer/UpdateElementTypesObserverTest.php @@ -0,0 +1,105 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +namespace Magento\Weee\Test\Unit\Observer; + +use Magento\Framework\DataObject; +use Magento\Framework\Event\Observer; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\Reports\Model\Event; +use Magento\Weee\Block\Element\Weee\Tax; +use Magento\Weee\Observer\UpdateElementTypesObserver; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; + +/** + * Unit test for Magento\Weee\Observer\UpdateElementTypesObserver + */ +class UpdateElementTypesObserverTest extends TestCase +{ + /* + * Stub response type + */ + const STUB_RESPONSE_TYPE = []; + + /** + * Testable Object + * + * @var UpdateElementTypesObserver + */ + private $observer; + + /** + * @var ObjectManager + */ + private $objectManager; + + /** + * @var Observer|MockObject + */ + private $observerMock; + + /** + * @var Event|MockObject + */ + private $eventMock; + + /** + * @var DataObject|MockObject + */ + private $responseMock; + + /** + * @inheritDoc + */ + protected function setUp(): void + { + $this->objectManager = new ObjectManager($this); + $this->observerMock = $this->createMock(Observer::class); + + $this->eventMock = $this->getMockBuilder(Event::class) + ->disableOriginalConstructor() + ->setMethods(['getResponse']) + ->getMock(); + + $this->responseMock = $this->getMockBuilder(DataObject::class) + ->disableOriginalConstructor() + ->setMethods(['getTypes', 'setTypes']) + ->getMock(); + + $this->observer = $this->objectManager->getObject(UpdateElementTypesObserver::class); + } + + /** + * Test for execute(), covers test case to adding custom element type for attributes form + */ + public function testRemoveProductUrlsFromStorage(): void + { + $this->observerMock + ->expects($this->once()) + ->method('getEvent') + ->willReturn($this->eventMock); + + $this->eventMock + ->expects($this->once()) + ->method('getResponse') + ->willReturn($this->responseMock); + + $this->responseMock + ->expects($this->once()) + ->method('getTypes') + ->willReturn(self::STUB_RESPONSE_TYPE); + + $this->responseMock + ->expects($this->once()) + ->method('setTypes') + ->with(['weee' => Tax::class]); + + $this->observer->execute($this->observerMock); + } +} diff --git a/app/code/Magento/Weee/etc/frontend/di.xml b/app/code/Magento/Weee/etc/frontend/di.xml index 1ce09205b6e77..f6417fd86a3e1 100644 --- a/app/code/Magento/Weee/etc/frontend/di.xml +++ b/app/code/Magento/Weee/etc/frontend/di.xml @@ -13,7 +13,7 @@ </argument> </arguments> </type> - <type name="Magento\Framework\App\Action\AbstractAction"> + <type name="Magento\Framework\App\ActionInterface"> <plugin name="weee-app-action-dispatchController-context-plugin" type="Magento\Weee\Model\App\Action\ContextPlugin"/> </type> diff --git a/app/code/Magento/Widget/Test/Mftf/Test/AdminContentWidgetsNavigateMenuTest.xml b/app/code/Magento/Widget/Test/Mftf/Test/AdminContentWidgetsNavigateMenuTest.xml index f5af024ec1d51..e62383d57fc93 100644 --- a/app/code/Magento/Widget/Test/Mftf/Test/AdminContentWidgetsNavigateMenuTest.xml +++ b/app/code/Magento/Widget/Test/Mftf/Test/AdminContentWidgetsNavigateMenuTest.xml @@ -23,7 +23,7 @@ <actionGroup ref="LoginAsAdmin" stepKey="LoginAsAdmin"/> </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="AdminNavigateMenuActionGroup" stepKey="navigateToContentWidgetsPage"> <argument name="menuUiId" value="{{AdminMenuContent.dataUiId}}"/> diff --git a/app/code/Magento/Widget/Test/Mftf/Test/NewProductsListWidgetTest.xml b/app/code/Magento/Widget/Test/Mftf/Test/NewProductsListWidgetTest.xml index e2fb9cb50f88a..e3e0b957cf550 100644 --- a/app/code/Magento/Widget/Test/Mftf/Test/NewProductsListWidgetTest.xml +++ b/app/code/Magento/Widget/Test/Mftf/Test/NewProductsListWidgetTest.xml @@ -27,7 +27,7 @@ </before> <after> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Create a CMS page containing the New Products widget --> diff --git a/app/code/Magento/Widget/Test/Mftf/Test/ProductsListWidgetTest.xml b/app/code/Magento/Widget/Test/Mftf/Test/ProductsListWidgetTest.xml index 4407991ff5a93..df9b724783372 100644 --- a/app/code/Magento/Widget/Test/Mftf/Test/ProductsListWidgetTest.xml +++ b/app/code/Magento/Widget/Test/Mftf/Test/ProductsListWidgetTest.xml @@ -6,8 +6,7 @@ */ --> -<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> +<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd"> <test name="ProductsListWidgetTest"> <annotations> <features value="Widget"/> @@ -28,7 +27,7 @@ </before> <after> <conditionalClick selector="{{CmsPagesPageActionsSection.clearAllButton}}" dependentSelector="{{CmsPagesPageActionsSection.activeFilters}}" stepKey="clickToResetFilter" visible="true"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createSimpleProduct" stepKey="deleteSimpleProduct"/> </after> @@ -61,8 +60,10 @@ <click selector="{{CmsPagesPageActionsSection.select(_newDefaultCmsPage.title)}}" stepKey="clickSelect" /> <waitForElementVisible selector="{{CmsPagesPageActionsSection.edit(_newDefaultCmsPage.title)}}" stepKey="waitForEditLink" /> <click selector="{{CmsPagesPageActionsSection.preview(_newDefaultCmsPage.title)}}" stepKey="clickEdit" /> + <switchToNextTab stepKey="switchToNextTab"/> <waitForPageLoad stepKey="waitForCMSPage"/> <seeInTitle userInput="{{_newDefaultCmsPage.title}}" stepKey="seePageTitle"/> <see userInput="{{_newDefaultCmsPage.title}}" stepKey="seeProduct"/> + <closeTab stepKey="closeCurrentTab"/> </test> -</tests> \ No newline at end of file +</tests> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/ConfProdAddToCartWishListWithUnselectedAttrTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/ConfProdAddToCartWishListWithUnselectedAttrTest.xml index d1d9a439c335d..4e4d5c1a0696f 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Test/ConfProdAddToCartWishListWithUnselectedAttrTest.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/ConfProdAddToCartWishListWithUnselectedAttrTest.xml @@ -38,7 +38,7 @@ </actionGroup> <conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFilters"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!--Login as customer --> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/ConfigurableProductChildImageShouldBeShownOnWishListTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/ConfigurableProductChildImageShouldBeShownOnWishListTest.xml index c9c539d215165..9d6482248df0a 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Test/ConfigurableProductChildImageShouldBeShownOnWishListTest.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/ConfigurableProductChildImageShouldBeShownOnWishListTest.xml @@ -32,7 +32,7 @@ <after> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="customer" stepKey="deleteCustomer"/> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> </after> <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> <waitForPageLoad stepKey="waitForProductIndexPageLoad"/> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontAddMultipleStoreProductsToWishlistTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontAddMultipleStoreProductsToWishlistTest.xml index 82021e75e0983..2a84043584dbe 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontAddMultipleStoreProductsToWishlistTest.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontAddMultipleStoreProductsToWishlistTest.xml @@ -48,7 +48,7 @@ <amOnPage url="{{AdminProductIndexPage.url}}" stepKey="navigateToProductIndex"/> <actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearProductsFilters"/> <!--Logout everywhere--> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> <actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="customerLogout"/> </after> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontDeleteBundleDynamicProductFromWishlistTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontDeleteBundleDynamicProductFromWishlistTest.xml index f5d7eb4c6ed02..3ff3fe0f379ce 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontDeleteBundleDynamicProductFromWishlistTest.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontDeleteBundleDynamicProductFromWishlistTest.xml @@ -62,7 +62,7 @@ <deleteData createDataKey="createBundleProduct" stepKey="deleteBundleProduct"/> <deleteData createDataKey="simpleProduct1" stepKey="deleteProduct1"/> <deleteData createDataKey="simpleProduct2" stepKey="deleteProduct2"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Login as a customer --> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontDeleteBundleFixedProductFromWishlistTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontDeleteBundleFixedProductFromWishlistTest.xml index cdd86bfecccc8..a23788d2c508f 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontDeleteBundleFixedProductFromWishlistTest.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontDeleteBundleFixedProductFromWishlistTest.xml @@ -55,7 +55,7 @@ <deleteData createDataKey="createBundleProduct" stepKey="deleteBundleProduct"/> <deleteData createDataKey="simpleProduct1" stepKey="deleteProduct1"/> <deleteData createDataKey="simpleProduct2" stepKey="deleteProduct2"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- Login as a customer --> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontDeleteConfigurableProductFromWishlistTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontDeleteConfigurableProductFromWishlistTest.xml index bb0a3c40c21f1..c380bddd2aca8 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontDeleteConfigurableProductFromWishlistTest.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontDeleteConfigurableProductFromWishlistTest.xml @@ -117,7 +117,7 @@ <deleteData createDataKey="createConfigProduct" stepKey="deleteProduct"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteProductAttribute"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> <!-- Reindex invalidated indices after product attribute has been created/deleted --> <actionGroup ref="CliRunReindexUsingCronJobsActionGroup" stepKey="reindexInvalidatedIndices"/> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontDeletePersistedWishlistTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontDeletePersistedWishlistTest.xml index f1659baaa4e09..0ead68a6b9144 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontDeletePersistedWishlistTest.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontDeletePersistedWishlistTest.xml @@ -32,7 +32,7 @@ <deleteData stepKey="deleteCategory" createDataKey="category"/> <deleteData stepKey="deleteProduct" createDataKey="product"/> <deleteData stepKey="deleteCustomer" createDataKey="customer"/> - <actionGroup ref="logout" stepKey="adminLogout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="adminLogout"/> </after> <amOnPage stepKey="amOnSignInPage" url="{{StorefrontCustomerSignInPage.url}}"/> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveConfigurableProductFromShoppingCartToWishlistTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveConfigurableProductFromShoppingCartToWishlistTest.xml index 0f94a08328c95..a5081ca2ad338 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveConfigurableProductFromShoppingCartToWishlistTest.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveConfigurableProductFromShoppingCartToWishlistTest.xml @@ -119,7 +119,7 @@ <deleteData createDataKey="createConfigProduct" stepKey="deleteProduct"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createConfigProductAttribute" stepKey="deleteProductAttribute"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- 1. Login as a customer --> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveDynamicBundleProductFromShoppingCartToWishlistTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveDynamicBundleProductFromShoppingCartToWishlistTest.xml index 9fffa51e7d3c7..6af7c6eae2c2a 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveDynamicBundleProductFromShoppingCartToWishlistTest.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveDynamicBundleProductFromShoppingCartToWishlistTest.xml @@ -62,7 +62,7 @@ <deleteData createDataKey="createBundleProduct" stepKey="deleteBundleProduct"/> <deleteData createDataKey="simpleProduct1" stepKey="deleteProduct1"/> <deleteData createDataKey="simpleProduct2" stepKey="deleteProduct2"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- 1. Login as a customer --> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveFixedBundleProductFromShoppingCartToWishlistTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveFixedBundleProductFromShoppingCartToWishlistTest.xml index f942a8f314a67..8b94c42106a6a 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveFixedBundleProductFromShoppingCartToWishlistTest.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveFixedBundleProductFromShoppingCartToWishlistTest.xml @@ -53,7 +53,7 @@ <deleteData createDataKey="createBundleProduct" stepKey="deleteBundleProduct"/> <deleteData createDataKey="simpleProduct1" stepKey="deleteProduct1"/> <deleteData createDataKey="simpleProduct2" stepKey="deleteProduct2"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- 1. Login as a customer --> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveVirtualProductFromShoppingCartToWishlistTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveVirtualProductFromShoppingCartToWishlistTest.xml index ad10b8d01bbbd..5c2762f39dde6 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveVirtualProductFromShoppingCartToWishlistTest.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/StorefrontMoveVirtualProductFromShoppingCartToWishlistTest.xml @@ -32,7 +32,7 @@ <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> <deleteData createDataKey="createCategory" stepKey="deleteCategory"/> <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <!-- 1. Login as a customer --> diff --git a/app/code/Magento/Wishlist/Test/Mftf/Test/WishListWithDisabledProductTest.xml b/app/code/Magento/Wishlist/Test/Mftf/Test/WishListWithDisabledProductTest.xml index 3aabb9e94c364..f9072402dbd73 100644 --- a/app/code/Magento/Wishlist/Test/Mftf/Test/WishListWithDisabledProductTest.xml +++ b/app/code/Magento/Wishlist/Test/Mftf/Test/WishListWithDisabledProductTest.xml @@ -26,7 +26,7 @@ <deleteData createDataKey="createProduct" stepKey="deleteProduct"/> <deleteData createDataKey="createCustomer" stepKey="deleteCustomer"/> <actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="customerLogout"/> - <actionGroup ref="logout" stepKey="logout"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> </after> <actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginToStorefrontAccount"> <argument name="Customer" value="$$createCustomer$$"/> diff --git a/app/design/adminhtml/Magento/backend/Magento_Tax/web/css/source/_module.less b/app/design/adminhtml/Magento/backend/Magento_Tax/web/css/source/_module.less index f7ae4cb821fff..2377f7c9a9c11 100644 --- a/app/design/adminhtml/Magento/backend/Magento_Tax/web/css/source/_module.less +++ b/app/design/adminhtml/Magento/backend/Magento_Tax/web/css/source/_module.less @@ -14,7 +14,7 @@ .block.mselect-list.paginated { .admin__action-multiselect-search-wrap { - border:1px solid @color-gray80; + border: 1px solid @color-gray80; border-bottom: none; border-radius: 3px; margin: 0; @@ -25,3 +25,9 @@ font-size: 1.3rem; } } + +.admin__fieldset > .admin__field > .admin__field-control { + input.zip-is-range-checkbox { + margin: 8px 0 0 0; + } +} diff --git a/app/design/frontend/Magento/luma/Magento_AdvancedCheckout/web/css/source/_module.less b/app/design/frontend/Magento/luma/Magento_AdvancedCheckout/web/css/source/_module.less index 8538a481903c7..4f2cf789d3a0e 100644 --- a/app/design/frontend/Magento/luma/Magento_AdvancedCheckout/web/css/source/_module.less +++ b/app/design/frontend/Magento/luma/Magento_AdvancedCheckout/web/css/source/_module.less @@ -48,12 +48,6 @@ } .block-content { - &:extend(.abs-add-clearfix-desktop all); - - .box { - &:extend(.abs-blocks-2columns all); - } - .actions-toolbar { clear: both; .lib-actions-toolbar( @@ -188,4 +182,16 @@ &:extend(.abs-add-clearfix-desktop all); } } + + .column { + .block-addbysku { + .block-content { + &:extend(.abs-add-clearfix-desktop all); + + .box { + &:extend(.abs-blocks-2columns all); + } + } + } + } } diff --git a/app/design/frontend/Magento/luma/Magento_CatalogSearch/web/css/source/_module.less b/app/design/frontend/Magento/luma/Magento_CatalogSearch/web/css/source/_module.less index 31859a46d3efe..2176fcd241916 100644 --- a/app/design/frontend/Magento/luma/Magento_CatalogSearch/web/css/source/_module.less +++ b/app/design/frontend/Magento/luma/Magento_CatalogSearch/web/css/source/_module.less @@ -18,7 +18,7 @@ // _____________________________________________ & when (@media-common = true) { - + .search { .fieldset { .control { @@ -31,7 +31,7 @@ } } } - + .block-search { margin-bottom: 0; @@ -136,8 +136,6 @@ } .form.search.advanced { - &:extend(.abs-forms-general-desktop all); - .fields.range { .field { &:first-child { @@ -275,4 +273,8 @@ .search-autocomplete { margin-top: 0; } + + .form.search.advanced { + &:extend(.abs-forms-general-desktop all); + } } diff --git a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_estimated-total.less b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_estimated-total.less index 530c700cbc395..e89ad3aaf137f 100644 --- a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_estimated-total.less +++ b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/_estimated-total.less @@ -14,7 +14,6 @@ // --------------------------------------------- .opc-estimated-wrapper { - &:extend(.abs-no-display-desktop all); &:extend(.abs-add-clearfix all); .lib-css(background, @checkout-step-content-mobile__background); .lib-css(border-bottom, @checkout-step-title__border); @@ -54,6 +53,6 @@ .media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__m) { .opc-estimated-wrapper { - display: none; + &:extend(.abs-no-display-desktop all); } } diff --git a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/fields/_file-uploader.less b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/fields/_file-uploader.less index 7b06186ef9ad3..fbd9701d44be9 100644 --- a/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/fields/_file-uploader.less +++ b/app/design/frontend/Magento/luma/Magento_Checkout/web/css/source/module/checkout/fields/_file-uploader.less @@ -129,7 +129,6 @@ .file-uploader-preview { .action-remove { - &:extend(.abs-action-reset all); .lib-icon-font ( @icon-delete__content, @_icon-font: @icons__font-name, diff --git a/app/design/frontend/Magento/luma/Magento_Downloadable/web/css/source/_module.less b/app/design/frontend/Magento/luma/Magento_Downloadable/web/css/source/_module.less index 7d911220d9dca..40b8cb8740810 100644 --- a/app/design/frontend/Magento/luma/Magento_Downloadable/web/css/source/_module.less +++ b/app/design/frontend/Magento/luma/Magento_Downloadable/web/css/source/_module.less @@ -92,7 +92,6 @@ } .field.choice { - &:extend(.clearer all); border-bottom: 1px solid @color-gray92; box-sizing: border-box; margin-bottom: @indent__s; @@ -178,10 +177,6 @@ .media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__m) { .page-product-downloadable { - .product-add-form { - &:extend(.clearer all); - } - .product-options-wrapper { float: left; width: 55%; diff --git a/app/design/frontend/Magento/luma/Magento_GiftMessage/web/css/source/_module.less b/app/design/frontend/Magento/luma/Magento_GiftMessage/web/css/source/_module.less index 0f2a0db56a355..0453937471a28 100644 --- a/app/design/frontend/Magento/luma/Magento_GiftMessage/web/css/source/_module.less +++ b/app/design/frontend/Magento/luma/Magento_GiftMessage/web/css/source/_module.less @@ -27,7 +27,6 @@ & when (@media-common = true) { .gift-message { .field { - &:extend(.abs-clearfix all); margin-bottom: @indent__base; .label { diff --git a/app/design/frontend/Magento/luma/Magento_Sales/web/css/source/_module.less b/app/design/frontend/Magento/luma/Magento_Sales/web/css/source/_module.less index 599218f970907..bab8a2abb9b93 100644 --- a/app/design/frontend/Magento/luma/Magento_Sales/web/css/source/_module.less +++ b/app/design/frontend/Magento/luma/Magento_Sales/web/css/source/_module.less @@ -311,7 +311,6 @@ margin-right: 30px; &.print { - &:extend(.abs-action-print all); display: none; margin: 0; } @@ -589,6 +588,7 @@ .order-actions-toolbar { .action.print { + &:extend(.abs-action-print all); display: block; float: right; } @@ -709,7 +709,7 @@ } } -.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__l) { +.media-width(@extremum, @break) when (@extremum = 'min') and (@break = @screen__l) { .order-links { .item { margin: 0 @tab-control__margin-right 0 0; diff --git a/app/etc/di.xml b/app/etc/di.xml index 8120676e8dda5..85d05b6be38fa 100644 --- a/app/etc/di.xml +++ b/app/etc/di.xml @@ -1804,4 +1804,23 @@ </type> <preference for="Magento\Framework\GraphQl\Query\ErrorHandlerInterface" type="Magento\Framework\GraphQl\Query\ErrorHandler"/> <preference for="Magento\Framework\Filter\VariableResolverInterface" type="Magento\Framework\Filter\VariableResolver\StrategyResolver"/> + <virtualType name="configured_block_cache" type="Magento\Framework\App\Cache"> + <arguments> + <argument name="cacheIdentifier" xsi:type="string">block_html</argument> + </arguments> + </virtualType> + <type name="Magento\Framework\View\Element\Context"> + <arguments> + <argument name="cache" xsi:type="object">configured_block_cache</argument> + </arguments> + </type> + <type name="Magento\Framework\Storage\StorageAdapterProvider"> + <arguments> + <argument name="config" xsi:type="array"> + <item name="local" xsi:type="string">Magento\Framework\Storage\AdapterFactory\LocalFactory</item> + <item name="aws_s3" xsi:type="string">Magento\Framework\Storage\AdapterFactory\AwsS3Factory</item> + <item name="ms_azure" xsi:type="string">Magento\Framework\Storage\AdapterFactory\AzureFactory</item> + </argument> + </arguments> + </type> </config> diff --git a/app/functions.php b/app/functions.php deleted file mode 100644 index 6b3dae71c42c6..0000000000000 --- a/app/functions.php +++ /dev/null @@ -1,30 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ - -/** - * Create value-object \Magento\Framework\Phrase - * @deprecated The global function __() is now loaded via Magento Framework, the below require is only - * for backwards compatibility reasons and this file will be removed in a future version - * @see Magento\Framework\Phrase\__.php - * @SuppressWarnings(PHPMD.ShortMethodName) - * @return \Magento\Framework\Phrase - */ -if (!function_exists('__')) { - /** - * @return \Magento\Framework\Phrase - */ - function __() - { - $argc = func_get_args(); - - $text = array_shift($argc); - if (!empty($argc) && is_array($argc[0])) { - $argc = $argc[0]; - } - - return new \Magento\Framework\Phrase($text, $argc); - } -} diff --git a/composer.json b/composer.json index 9c42a05a457c5..ac005f9da6a1e 100644 --- a/composer.json +++ b/composer.json @@ -35,11 +35,14 @@ "colinmollenhour/php-redis-session-abstract": "~1.4.0", "composer/composer": "^1.6", "elasticsearch/elasticsearch": "~2.0||~5.1||~6.1", + "guzzlehttp/guzzle": "^6.3.3", + "league/flysystem": "^1.0", + "league/flysystem-aws-s3-v3": "^1.0", + "league/flysystem-azure-blob-storage": "^0.1.6", "magento/composer": "1.6.x-dev", "magento/magento-composer-installer": ">=0.1.11", "magento/zendframework1": "~1.14.2", "monolog/monolog": "^1.17", - "wikimedia/less.php": "~1.8.0", "paragonie/sodium_compat": "^1.6", "pelago/emogrifier": "^2.0.0", "php-amqplib/php-amqplib": "~2.7.0||~2.10.0", @@ -52,6 +55,7 @@ "tedivm/jshrink": "~1.3.0", "tubalmartin/cssmin": "4.1.1", "webonyx/graphql-php": "^0.13.8", + "wikimedia/less.php": "~1.8.0", "zendframework/zend-captcha": "^2.7.1", "zendframework/zend-code": "~3.3.0", "zendframework/zend-config": "^2.6.0", @@ -79,8 +83,7 @@ "zendframework/zend-text": "^2.6.0", "zendframework/zend-uri": "^2.5.1", "zendframework/zend-validator": "^2.6.0", - "zendframework/zend-view": "~2.11.2", - "guzzlehttp/guzzle": "^6.3.3" + "zendframework/zend-view": "~2.11.2" }, "require-dev": { "allure-framework/allure-phpunit": "~1.2.0", @@ -88,7 +91,7 @@ "friendsofphp/php-cs-fixer": "~2.14.0", "lusitanian/oauth": "~0.8.10", "magento/magento-coding-standard": "*", - "magento/magento2-functional-testing-framework": "2.6.2", + "magento/magento2-functional-testing-framework": "~2.6.3", "pdepend/pdepend": "2.5.2", "phpcompatibility/php-compatibility": "^9.3", "phpmd/phpmd": "@stable", diff --git a/composer.lock b/composer.lock index 6ac7f36cd2e32..1236d2b0ae82f 100644 --- a/composer.lock +++ b/composer.lock @@ -1,11 +1,95 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "f06887dfc3e06489a251fbb5c18d30ca", + "content-hash": "522d676db5baf5864a824409c54948fc", "packages": [ + { + "name": "aws/aws-sdk-php", + "version": "3.133.24", + "source": { + "type": "git", + "url": "https://github.com/aws/aws-sdk-php.git", + "reference": "726426e1514be5220d55ecf02eb1f938a3b4a105" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/726426e1514be5220d55ecf02eb1f938a3b4a105", + "reference": "726426e1514be5220d55ecf02eb1f938a3b4a105", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-pcre": "*", + "ext-simplexml": "*", + "guzzlehttp/guzzle": "^5.3.3|^6.2.1|^7.0", + "guzzlehttp/promises": "^1.0", + "guzzlehttp/psr7": "^1.4.1", + "mtdowling/jmespath.php": "^2.5", + "php": ">=5.5" + }, + "require-dev": { + "andrewsville/php-token-reflection": "^1.4", + "aws/aws-php-sns-message-validator": "~1.0", + "behat/behat": "~3.0", + "doctrine/cache": "~1.4", + "ext-dom": "*", + "ext-openssl": "*", + "ext-pcntl": "*", + "ext-sockets": "*", + "nette/neon": "^2.3", + "phpunit/phpunit": "^4.8.35|^5.4.3", + "psr/cache": "^1.0", + "psr/simple-cache": "^1.0", + "sebastian/comparator": "^1.2.3" + }, + "suggest": { + "aws/aws-php-sns-message-validator": "To validate incoming SNS notifications", + "doctrine/cache": "To use the DoctrineCacheAdapter", + "ext-curl": "To send requests using cURL", + "ext-openssl": "Allows working with CloudFront private distributions and verifying received SNS messages", + "ext-sockets": "To use client-side monitoring" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0-dev" + } + }, + "autoload": { + "psr-4": { + "Aws\\": "src/" + }, + "files": [ + "src/functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Amazon Web Services", + "homepage": "http://aws.amazon.com" + } + ], + "description": "AWS SDK for PHP - Use Amazon Web Services in your PHP project", + "homepage": "http://aws.amazon.com/sdkforphp", + "keywords": [ + "amazon", + "aws", + "cloud", + "dynamodb", + "ec2", + "glacier", + "s3", + "sdk" + ], + "time": "2020-02-27T19:13:45+00:00" + }, { "name": "braintree/braintree_php", "version": "3.35.0", @@ -257,16 +341,16 @@ }, { "name": "composer/composer", - "version": "1.9.2", + "version": "1.9.3", "source": { "type": "git", "url": "https://github.com/composer/composer.git", - "reference": "7a04aa0201ddaa0b3cf64d41022bd8cdcd7fafeb" + "reference": "1291a16ce3f48bfdeca39d64fca4875098af4d7b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/composer/zipball/7a04aa0201ddaa0b3cf64d41022bd8cdcd7fafeb", - "reference": "7a04aa0201ddaa0b3cf64d41022bd8cdcd7fafeb", + "url": "https://api.github.com/repos/composer/composer/zipball/1291a16ce3f48bfdeca39d64fca4875098af4d7b", + "reference": "1291a16ce3f48bfdeca39d64fca4875098af4d7b", "shasum": "" }, "require": { @@ -333,7 +417,7 @@ "dependency", "package" ], - "time": "2020-01-14T15:30:32+00:00" + "time": "2020-02-04T11:58:49+00:00" }, { "name": "composer/semver", @@ -398,16 +482,16 @@ }, { "name": "composer/spdx-licenses", - "version": "1.5.2", + "version": "1.5.3", "source": { "type": "git", "url": "https://github.com/composer/spdx-licenses.git", - "reference": "7ac1e6aec371357df067f8a688c3d6974df68fa5" + "reference": "0c3e51e1880ca149682332770e25977c70cf9dae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/spdx-licenses/zipball/7ac1e6aec371357df067f8a688c3d6974df68fa5", - "reference": "7ac1e6aec371357df067f8a688c3d6974df68fa5", + "url": "https://api.github.com/repos/composer/spdx-licenses/zipball/0c3e51e1880ca149682332770e25977c70cf9dae", + "reference": "0c3e51e1880ca149682332770e25977c70cf9dae", "shasum": "" }, "require": { @@ -454,7 +538,7 @@ "spdx", "validator" ], - "time": "2019-07-29T10:31:59+00:00" + "time": "2020-02-14T07:44:31+00:00" }, { "name": "composer/xdebug-handler", @@ -950,6 +1034,178 @@ ], "time": "2019-09-25T14:49:45+00:00" }, + { + "name": "league/flysystem", + "version": "1.0.64", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/flysystem.git", + "reference": "d13c43dbd4b791f815215959105a008515d1a2e0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/d13c43dbd4b791f815215959105a008515d1a2e0", + "reference": "d13c43dbd4b791f815215959105a008515d1a2e0", + "shasum": "" + }, + "require": { + "ext-fileinfo": "*", + "php": ">=5.5.9" + }, + "conflict": { + "league/flysystem-sftp": "<1.0.6" + }, + "require-dev": { + "phpspec/phpspec": "^3.4", + "phpunit/phpunit": "^5.7.26" + }, + "suggest": { + "ext-fileinfo": "Required for MimeType", + "ext-ftp": "Allows you to use FTP server storage", + "ext-openssl": "Allows you to use FTPS server storage", + "league/flysystem-aws-s3-v2": "Allows you to use S3 storage with AWS SDK v2", + "league/flysystem-aws-s3-v3": "Allows you to use S3 storage with AWS SDK v3", + "league/flysystem-azure": "Allows you to use Windows Azure Blob storage", + "league/flysystem-cached-adapter": "Flysystem adapter decorator for metadata caching", + "league/flysystem-eventable-filesystem": "Allows you to use EventableFilesystem", + "league/flysystem-rackspace": "Allows you to use Rackspace Cloud Files", + "league/flysystem-sftp": "Allows you to use SFTP server storage via phpseclib", + "league/flysystem-webdav": "Allows you to use WebDAV storage", + "league/flysystem-ziparchive": "Allows you to use ZipArchive adapter", + "spatie/flysystem-dropbox": "Allows you to use Dropbox storage", + "srmklive/flysystem-dropbox-v2": "Allows you to use Dropbox storage for PHP 5 applications" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "psr-4": { + "League\\Flysystem\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Frank de Jonge", + "email": "info@frenky.net" + } + ], + "description": "Filesystem abstraction: Many filesystems, one API.", + "keywords": [ + "Cloud Files", + "WebDAV", + "abstraction", + "aws", + "cloud", + "copy.com", + "dropbox", + "file systems", + "files", + "filesystem", + "filesystems", + "ftp", + "rackspace", + "remote", + "s3", + "sftp", + "storage" + ], + "time": "2020-02-05T18:14:17+00:00" + }, + { + "name": "league/flysystem-aws-s3-v3", + "version": "1.0.24", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/flysystem-aws-s3-v3.git", + "reference": "4382036bde5dc926f9b8b337e5bdb15e5ec7b570" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/flysystem-aws-s3-v3/zipball/4382036bde5dc926f9b8b337e5bdb15e5ec7b570", + "reference": "4382036bde5dc926f9b8b337e5bdb15e5ec7b570", + "shasum": "" + }, + "require": { + "aws/aws-sdk-php": "^3.0.0", + "league/flysystem": "^1.0.40", + "php": ">=5.5.0" + }, + "require-dev": { + "henrikbjorn/phpspec-code-coverage": "~1.0.1", + "phpspec/phpspec": "^2.0.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "League\\Flysystem\\AwsS3v3\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Frank de Jonge", + "email": "info@frenky.net" + } + ], + "description": "Flysystem adapter for the AWS S3 SDK v3.x", + "time": "2020-02-23T13:31:58+00:00" + }, + { + "name": "league/flysystem-azure-blob-storage", + "version": "0.1.6", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/flysystem-azure-blob-storage.git", + "reference": "97215345f3c42679299ba556a4d16d4847ee7f6d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/flysystem-azure-blob-storage/zipball/97215345f3c42679299ba556a4d16d4847ee7f6d", + "reference": "97215345f3c42679299ba556a4d16d4847ee7f6d", + "shasum": "" + }, + "require": { + "guzzlehttp/psr7": "^1.5", + "league/flysystem": "^1.0", + "microsoft/azure-storage-blob": "^1.1", + "php": ">=5.6" + }, + "require-dev": { + "phpunit/phpunit": "^5.7" + }, + "type": "library", + "autoload": { + "psr-4": { + "League\\Flysystem\\AzureBlobStorage\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Frank de Jonge", + "email": "info@frenky.net" + } + ], + "time": "2019-06-07T20:42:16+00:00" + }, { "name": "magento/composer", "version": "1.6.x-dev", @@ -1112,6 +1368,94 @@ ], "time": "2019-11-26T15:09:40+00:00" }, + { + "name": "microsoft/azure-storage-blob", + "version": "1.5.0", + "source": { + "type": "git", + "url": "https://github.com/Azure/azure-storage-blob-php.git", + "reference": "6a333cd28a3742c3e99e79042dc6510f9f917919" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Azure/azure-storage-blob-php/zipball/6a333cd28a3742c3e99e79042dc6510f9f917919", + "reference": "6a333cd28a3742c3e99e79042dc6510f9f917919", + "shasum": "" + }, + "require": { + "microsoft/azure-storage-common": "~1.4", + "php": ">=5.6.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "MicrosoftAzure\\Storage\\Blob\\": "src/Blob" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Azure Storage PHP Client Library", + "email": "dmsh@microsoft.com" + } + ], + "description": "This project provides a set of PHP client libraries that make it easy to access Microsoft Azure Storage Blob APIs.", + "keywords": [ + "azure", + "blob", + "php", + "sdk", + "storage" + ], + "time": "2020-01-02T07:18:59+00:00" + }, + { + "name": "microsoft/azure-storage-common", + "version": "1.4.1", + "source": { + "type": "git", + "url": "https://github.com/Azure/azure-storage-common-php.git", + "reference": "be4df800761d0d0fa91a9460c7f42517197d57a0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Azure/azure-storage-common-php/zipball/be4df800761d0d0fa91a9460c7f42517197d57a0", + "reference": "be4df800761d0d0fa91a9460c7f42517197d57a0", + "shasum": "" + }, + "require": { + "guzzlehttp/guzzle": "~6.0", + "php": ">=5.6.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "MicrosoftAzure\\Storage\\Common\\": "src/Common" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Azure Storage PHP Client Library", + "email": "dmsh@microsoft.com" + } + ], + "description": "This project provides a set of common code shared by Azure Storage Blob, Table, Queue and File PHP client libraries.", + "keywords": [ + "azure", + "common", + "php", + "sdk", + "storage" + ], + "time": "2020-01-02T07:15:54+00:00" + }, { "name": "monolog/monolog", "version": "1.25.3", @@ -1190,6 +1534,63 @@ ], "time": "2019-12-20T14:15:16+00:00" }, + { + "name": "mtdowling/jmespath.php", + "version": "2.5.0", + "source": { + "type": "git", + "url": "https://github.com/jmespath/jmespath.php.git", + "reference": "52168cb9472de06979613d365c7f1ab8798be895" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/jmespath/jmespath.php/zipball/52168cb9472de06979613d365c7f1ab8798be895", + "reference": "52168cb9472de06979613d365c7f1ab8798be895", + "shasum": "" + }, + "require": { + "php": ">=5.4.0", + "symfony/polyfill-mbstring": "^1.4" + }, + "require-dev": { + "composer/xdebug-handler": "^1.2", + "phpunit/phpunit": "^4.8.36|^7.5.15" + }, + "bin": [ + "bin/jp.php" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.5-dev" + } + }, + "autoload": { + "psr-4": { + "JmesPath\\": "src/" + }, + "files": [ + "src/JmesPath.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + } + ], + "description": "Declaratively specify how to extract elements from a JSON document", + "keywords": [ + "json", + "jsonpath" + ], + "time": "2019-12-30T18:03:34+00:00" + }, { "name": "paragonie/random_compat", "version": "v9.99.99", @@ -1515,16 +1916,16 @@ }, { "name": "phpseclib/phpseclib", - "version": "2.0.23", + "version": "2.0.25", "source": { "type": "git", "url": "https://github.com/phpseclib/phpseclib.git", - "reference": "c78eb5058d5bb1a183133c36d4ba5b6675dfa099" + "reference": "c18159618ed7cd7ff721ac1a8fec7860a475d2f0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/c78eb5058d5bb1a183133c36d4ba5b6675dfa099", - "reference": "c78eb5058d5bb1a183133c36d4ba5b6675dfa099", + "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/c18159618ed7cd7ff721ac1a8fec7860a475d2f0", + "reference": "c18159618ed7cd7ff721ac1a8fec7860a475d2f0", "shasum": "" }, "require": { @@ -1603,7 +2004,7 @@ "x.509", "x509" ], - "time": "2019-09-17T03:41:22+00:00" + "time": "2020-02-25T04:16:50+00:00" }, { "name": "psr/container", @@ -1970,16 +2371,16 @@ }, { "name": "seld/phar-utils", - "version": "1.0.2", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/Seldaek/phar-utils.git", - "reference": "84715761c35808076b00908a20317a3a8a67d17e" + "reference": "8800503d56b9867d43d9c303b9cbcc26016e82f0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/phar-utils/zipball/84715761c35808076b00908a20317a3a8a67d17e", - "reference": "84715761c35808076b00908a20317a3a8a67d17e", + "url": "https://api.github.com/repos/Seldaek/phar-utils/zipball/8800503d56b9867d43d9c303b9cbcc26016e82f0", + "reference": "8800503d56b9867d43d9c303b9cbcc26016e82f0", "shasum": "" }, "require": { @@ -2008,22 +2409,22 @@ ], "description": "PHAR file format utilities, for when PHP phars you up", "keywords": [ - "phra" + "phar" ], - "time": "2020-01-13T10:41:09+00:00" + "time": "2020-02-14T15:25:33+00:00" }, { "name": "symfony/console", - "version": "v4.4.3", + "version": "v4.4.4", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "e9ee09d087e2c88eaf6e5fc0f5c574f64d100e4f" + "reference": "f512001679f37e6a042b51897ed24a2f05eba656" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/e9ee09d087e2c88eaf6e5fc0f5c574f64d100e4f", - "reference": "e9ee09d087e2c88eaf6e5fc0f5c574f64d100e4f", + "url": "https://api.github.com/repos/symfony/console/zipball/f512001679f37e6a042b51897ed24a2f05eba656", + "reference": "f512001679f37e6a042b51897ed24a2f05eba656", "shasum": "" }, "require": { @@ -2086,11 +2487,11 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2020-01-10T21:54:01+00:00" + "time": "2020-01-25T12:44:29+00:00" }, { "name": "symfony/css-selector", - "version": "v4.4.3", + "version": "v4.4.4", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", @@ -2143,7 +2544,7 @@ }, { "name": "symfony/event-dispatcher", - "version": "v4.4.3", + "version": "v4.4.4", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", @@ -2271,7 +2672,7 @@ }, { "name": "symfony/filesystem", - "version": "v4.4.3", + "version": "v4.4.4", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", @@ -2321,7 +2722,7 @@ }, { "name": "symfony/finder", - "version": "v4.4.3", + "version": "v4.4.4", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", @@ -2370,16 +2771,16 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.13.1", + "version": "v1.14.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3" + "reference": "fbdeaec0df06cf3d51c93de80c7eb76e271f5a38" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/f8f0b461be3385e56d6de3dbb5a0df24c0c275e3", - "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/fbdeaec0df06cf3d51c93de80c7eb76e271f5a38", + "reference": "fbdeaec0df06cf3d51c93de80c7eb76e271f5a38", "shasum": "" }, "require": { @@ -2391,7 +2792,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.13-dev" + "dev-master": "1.14-dev" } }, "autoload": { @@ -2424,20 +2825,20 @@ "polyfill", "portable" ], - "time": "2019-11-27T13:56:44+00:00" + "time": "2020-01-13T11:15:53+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.13.1", + "version": "v1.14.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "7b4aab9743c30be783b73de055d24a39cf4b954f" + "reference": "34094cfa9abe1f0f14f48f490772db7a775559f2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7b4aab9743c30be783b73de055d24a39cf4b954f", - "reference": "7b4aab9743c30be783b73de055d24a39cf4b954f", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/34094cfa9abe1f0f14f48f490772db7a775559f2", + "reference": "34094cfa9abe1f0f14f48f490772db7a775559f2", "shasum": "" }, "require": { @@ -2449,7 +2850,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.13-dev" + "dev-master": "1.14-dev" } }, "autoload": { @@ -2483,20 +2884,20 @@ "portable", "shim" ], - "time": "2019-11-27T14:18:11+00:00" + "time": "2020-01-13T11:15:53+00:00" }, { "name": "symfony/polyfill-php73", - "version": "v1.13.1", + "version": "v1.14.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "4b0e2222c55a25b4541305a053013d5647d3a25f" + "reference": "5e66a0fa1070bf46bec4bea7962d285108edd675" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/4b0e2222c55a25b4541305a053013d5647d3a25f", - "reference": "4b0e2222c55a25b4541305a053013d5647d3a25f", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/5e66a0fa1070bf46bec4bea7962d285108edd675", + "reference": "5e66a0fa1070bf46bec4bea7962d285108edd675", "shasum": "" }, "require": { @@ -2505,7 +2906,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.13-dev" + "dev-master": "1.14-dev" } }, "autoload": { @@ -2541,11 +2942,11 @@ "portable", "shim" ], - "time": "2019-11-27T16:25:15+00:00" + "time": "2020-01-13T11:15:53+00:00" }, { "name": "symfony/process", - "version": "v4.4.3", + "version": "v4.4.4", "source": { "type": "git", "url": "https://github.com/symfony/process.git", @@ -5098,16 +5499,16 @@ }, { "name": "allure-framework/allure-php-api", - "version": "1.1.6", + "version": "1.1.7", "source": { "type": "git", "url": "https://github.com/allure-framework/allure-php-commons.git", - "reference": "2c62a70d60eca190253a6b80e9aa4c2ebc2e6e7f" + "reference": "243c9a2259b60c1b7a9d298d4fb3fc72b4f64c18" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/allure-framework/allure-php-commons/zipball/2c62a70d60eca190253a6b80e9aa4c2ebc2e6e7f", - "reference": "2c62a70d60eca190253a6b80e9aa4c2ebc2e6e7f", + "url": "https://api.github.com/repos/allure-framework/allure-php-commons/zipball/243c9a2259b60c1b7a9d298d4fb3fc72b4f64c18", + "reference": "243c9a2259b60c1b7a9d298d4fb3fc72b4f64c18", "shasum": "" }, "require": { @@ -5147,7 +5548,7 @@ "php", "report" ], - "time": "2020-01-09T10:26:09+00:00" + "time": "2020-02-05T16:43:19+00:00" }, { "name": "allure-framework/allure-phpunit", @@ -5199,102 +5600,18 @@ ], "time": "2017-11-03T13:08:21+00:00" }, - { - "name": "aws/aws-sdk-php", - "version": "3.133.8", - "source": { - "type": "git", - "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "c564fcccd5fc7b5e8514d1cbe35558be1e3a11cd" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/c564fcccd5fc7b5e8514d1cbe35558be1e3a11cd", - "reference": "c564fcccd5fc7b5e8514d1cbe35558be1e3a11cd", - "shasum": "" - }, - "require": { - "ext-json": "*", - "ext-pcre": "*", - "ext-simplexml": "*", - "guzzlehttp/guzzle": "^5.3.3|^6.2.1|^7.0", - "guzzlehttp/promises": "^1.0", - "guzzlehttp/psr7": "^1.4.1", - "mtdowling/jmespath.php": "^2.5", - "php": ">=5.5" - }, - "require-dev": { - "andrewsville/php-token-reflection": "^1.4", - "aws/aws-php-sns-message-validator": "~1.0", - "behat/behat": "~3.0", - "doctrine/cache": "~1.4", - "ext-dom": "*", - "ext-openssl": "*", - "ext-pcntl": "*", - "ext-sockets": "*", - "nette/neon": "^2.3", - "phpunit/phpunit": "^4.8.35|^5.4.3", - "psr/cache": "^1.0", - "psr/simple-cache": "^1.0", - "sebastian/comparator": "^1.2.3" - }, - "suggest": { - "aws/aws-php-sns-message-validator": "To validate incoming SNS notifications", - "doctrine/cache": "To use the DoctrineCacheAdapter", - "ext-curl": "To send requests using cURL", - "ext-openssl": "Allows working with CloudFront private distributions and verifying received SNS messages", - "ext-sockets": "To use client-side monitoring" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "psr-4": { - "Aws\\": "src/" - }, - "files": [ - "src/functions.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "Amazon Web Services", - "homepage": "http://aws.amazon.com" - } - ], - "description": "AWS SDK for PHP - Use Amazon Web Services in your PHP project", - "homepage": "http://aws.amazon.com/sdkforphp", - "keywords": [ - "amazon", - "aws", - "cloud", - "dynamodb", - "ec2", - "glacier", - "s3", - "sdk" - ], - "time": "2020-02-05T19:12:47+00:00" - }, { "name": "behat/gherkin", - "version": "v4.6.0", + "version": "v4.6.1", "source": { "type": "git", "url": "https://github.com/Behat/Gherkin.git", - "reference": "ab0a02ea14893860bca00f225f5621d351a3ad07" + "reference": "25bdcaf37898b4a939fa3031d5d753ced97e4759" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Behat/Gherkin/zipball/ab0a02ea14893860bca00f225f5621d351a3ad07", - "reference": "ab0a02ea14893860bca00f225f5621d351a3ad07", + "url": "https://api.github.com/repos/Behat/Gherkin/zipball/25bdcaf37898b4a939fa3031d5d753ced97e4759", + "reference": "25bdcaf37898b4a939fa3031d5d753ced97e4759", "shasum": "" }, "require": { @@ -5340,7 +5657,7 @@ "gherkin", "parser" ], - "time": "2019-01-16T14:22:17+00:00" + "time": "2020-02-27T11:29:57+00:00" }, { "name": "cache/cache", @@ -5604,80 +5921,43 @@ }, { "name": "consolidation/annotated-command", - "version": "2.12.0", + "version": "4.1.0", "source": { "type": "git", "url": "https://github.com/consolidation/annotated-command.git", - "reference": "512a2e54c98f3af377589de76c43b24652bcb789" + "reference": "33e472d3cceb0f22a527d13ccfa3f76c4d21c178" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/consolidation/annotated-command/zipball/512a2e54c98f3af377589de76c43b24652bcb789", - "reference": "512a2e54c98f3af377589de76c43b24652bcb789", + "url": "https://api.github.com/repos/consolidation/annotated-command/zipball/33e472d3cceb0f22a527d13ccfa3f76c4d21c178", + "reference": "33e472d3cceb0f22a527d13ccfa3f76c4d21c178", "shasum": "" }, "require": { - "consolidation/output-formatters": "^3.4", - "php": ">=5.4.5", - "psr/log": "^1", - "symfony/console": "^2.8|^3|^4", - "symfony/event-dispatcher": "^2.5|^3|^4", - "symfony/finder": "^2.5|^3|^4" + "consolidation/output-formatters": "^4.1", + "php": ">=7.1.3", + "psr/log": "^1|^2", + "symfony/console": "^4|^5", + "symfony/event-dispatcher": "^4|^5", + "symfony/finder": "^4|^5" }, "require-dev": { "g1a/composer-test-scenarios": "^3", "php-coveralls/php-coveralls": "^1", "phpunit/phpunit": "^6", - "squizlabs/php_codesniffer": "^2.7" + "squizlabs/php_codesniffer": "^3" }, "type": "library", "extra": { "scenarios": { "symfony4": { "require": { - "symfony/console": "^4.0" - }, - "config": { - "platform": { - "php": "7.1.3" - } - } - }, - "symfony2": { - "require": { - "symfony/console": "^2.8" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.36" - }, - "remove": [ - "php-coveralls/php-coveralls" - ], - "config": { - "platform": { - "php": "5.4.8" - } - }, - "scenario-options": { - "create-lockfile": "false" - } - }, - "phpunit4": { - "require-dev": { - "phpunit/phpunit": "^4.8.36" - }, - "remove": [ - "php-coveralls/php-coveralls" - ], - "config": { - "platform": { - "php": "5.4.8" - } + "symfony/console": "^4.0" } } }, "branch-alias": { - "dev-master": "2.x-dev" + "dev-master": "4.x-dev" } }, "autoload": { @@ -5696,7 +5976,7 @@ } ], "description": "Initialize Symfony Console commands from annotated command class methods.", - "time": "2019-03-08T16:55:03+00:00" + "time": "2020-02-07T03:35:30+00:00" }, { "name": "consolidation/config", @@ -5781,74 +6061,33 @@ }, { "name": "consolidation/log", - "version": "1.1.1", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/consolidation/log.git", - "reference": "b2e887325ee90abc96b0a8b7b474cd9e7c896e3a" + "reference": "446f804476db4f73957fa4bcb66ab2facf5397ff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/consolidation/log/zipball/b2e887325ee90abc96b0a8b7b474cd9e7c896e3a", - "reference": "b2e887325ee90abc96b0a8b7b474cd9e7c896e3a", + "url": "https://api.github.com/repos/consolidation/log/zipball/446f804476db4f73957fa4bcb66ab2facf5397ff", + "reference": "446f804476db4f73957fa4bcb66ab2facf5397ff", "shasum": "" }, "require": { "php": ">=5.4.5", "psr/log": "^1.0", - "symfony/console": "^2.8|^3|^4" + "symfony/console": "^4|^5" }, "require-dev": { "g1a/composer-test-scenarios": "^3", "php-coveralls/php-coveralls": "^1", "phpunit/phpunit": "^6", - "squizlabs/php_codesniffer": "^2" + "squizlabs/php_codesniffer": "^3" }, "type": "library", "extra": { - "scenarios": { - "symfony4": { - "require": { - "symfony/console": "^4.0" - }, - "config": { - "platform": { - "php": "7.1.3" - } - } - }, - "symfony2": { - "require": { - "symfony/console": "^2.8" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.36" - }, - "remove": [ - "php-coveralls/php-coveralls" - ], - "config": { - "platform": { - "php": "5.4.8" - } - } - }, - "phpunit4": { - "require-dev": { - "phpunit/phpunit": "^4.8.36" - }, - "remove": [ - "php-coveralls/php-coveralls" - ], - "config": { - "platform": { - "php": "5.4.8" - } - } - } - }, "branch-alias": { - "dev-master": "1.x-dev" + "dev-master": "4.x-dev" } }, "autoload": { @@ -5867,34 +6106,35 @@ } ], "description": "Improved Psr-3 / Psr\\Log logger based on Symfony Console components.", - "time": "2019-01-01T17:30:51+00:00" + "time": "2020-02-07T01:22:27+00:00" }, { "name": "consolidation/output-formatters", - "version": "3.5.0", + "version": "4.1.0", "source": { "type": "git", "url": "https://github.com/consolidation/output-formatters.git", - "reference": "99ec998ffb697e0eada5aacf81feebfb13023605" + "reference": "eae721c3a916707c40d4390efbf48d4c799709cc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/consolidation/output-formatters/zipball/99ec998ffb697e0eada5aacf81feebfb13023605", - "reference": "99ec998ffb697e0eada5aacf81feebfb13023605", + "url": "https://api.github.com/repos/consolidation/output-formatters/zipball/eae721c3a916707c40d4390efbf48d4c799709cc", + "reference": "eae721c3a916707c40d4390efbf48d4c799709cc", "shasum": "" }, "require": { "dflydev/dot-access-data": "^1.1.0", - "php": ">=5.4.0", - "symfony/console": "^2.8|^3|^4", - "symfony/finder": "^2.5|^3|^4" + "php": ">=7.1.3", + "symfony/console": "^4|^5", + "symfony/finder": "^4|^5" }, "require-dev": { "g1a/composer-test-scenarios": "^3", "php-coveralls/php-coveralls": "^1", - "phpunit/phpunit": "^5.7.27", - "squizlabs/php_codesniffer": "^2.7", - "symfony/var-dumper": "^2.8|^3|^4", + "phpunit/phpunit": "^6", + "squizlabs/php_codesniffer": "^3", + "symfony/var-dumper": "^4", + "symfony/yaml": "^4", "victorjonsson/markdowndocs": "^1.3" }, "suggest": { @@ -5906,50 +6146,11 @@ "symfony4": { "require": { "symfony/console": "^4.0" - }, - "require-dev": { - "phpunit/phpunit": "^6" - }, - "config": { - "platform": { - "php": "7.1.3" - } - } - }, - "symfony3": { - "require": { - "symfony/console": "^3.4", - "symfony/finder": "^3.4", - "symfony/var-dumper": "^3.4" - }, - "config": { - "platform": { - "php": "5.6.32" - } - } - }, - "symfony2": { - "require": { - "symfony/console": "^2.8" - }, - "require-dev": { - "phpunit/phpunit": "^4.8.36" - }, - "remove": [ - "php-coveralls/php-coveralls" - ], - "config": { - "platform": { - "php": "5.4.8" - } - }, - "scenario-options": { - "create-lockfile": "false" } } }, "branch-alias": { - "dev-master": "3.x-dev" + "dev-master": "4.x-dev" } }, "autoload": { @@ -5968,30 +6169,30 @@ } ], "description": "Format text by applying transformations provided by plug-in formatters.", - "time": "2019-05-30T23:16:01+00:00" + "time": "2020-02-07T03:22:30+00:00" }, { "name": "consolidation/robo", - "version": "1.4.11", + "version": "1.4.12", "source": { "type": "git", "url": "https://github.com/consolidation/Robo.git", - "reference": "5fa1d901776a628167a325baa9db95d8edf13a80" + "reference": "eb45606f498b3426b9a98b7c85e300666a968e51" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/consolidation/Robo/zipball/5fa1d901776a628167a325baa9db95d8edf13a80", - "reference": "5fa1d901776a628167a325baa9db95d8edf13a80", + "url": "https://api.github.com/repos/consolidation/Robo/zipball/eb45606f498b3426b9a98b7c85e300666a968e51", + "reference": "eb45606f498b3426b9a98b7c85e300666a968e51", "shasum": "" }, "require": { - "consolidation/annotated-command": "^2.11.0", - "consolidation/config": "^1.2", - "consolidation/log": "~1", - "consolidation/output-formatters": "^3.1.13", - "consolidation/self-update": "^1", - "grasmash/yaml-expander": "^1.3", - "league/container": "^2.2", + "consolidation/annotated-command": "^2.11.0|^4.1", + "consolidation/config": "^1.2.1", + "consolidation/log": "^1.1.1|^2", + "consolidation/output-formatters": "^3.1.13|^4.1", + "consolidation/self-update": "^1.1.5", + "grasmash/yaml-expander": "^1.4", + "league/container": "^2.4.1", "php": ">=5.5.0", "symfony/console": "^2.8|^3|^4", "symfony/event-dispatcher": "^2.5|^3|^4", @@ -6003,20 +6204,13 @@ "codegyre/robo": "< 1.0" }, "require-dev": { - "codeception/aspect-mock": "^1|^2.1.1", - "codeception/base": "^2.3.7", - "codeception/verify": "^0.3.2", "g1a/composer-test-scenarios": "^3", - "goaop/framework": "~2.1.2", - "goaop/parser-reflection": "^1.1.0", "natxet/cssmin": "3.0.4", - "nikic/php-parser": "^3.1.5", - "patchwork/jsqueeze": "~2", + "patchwork/jsqueeze": "^2", "pear/archive_tar": "^1.4.4", "php-coveralls/php-coveralls": "^1", - "phpunit/php-code-coverage": "~2|~4", - "sebastian/comparator": "^1.2.4", - "squizlabs/php_codesniffer": "^2.8" + "phpunit/phpunit": "^5.7.27", + "squizlabs/php_codesniffer": "^3" }, "suggest": { "henrikbjorn/lurker": "For monitoring filesystem changes in taskWatch", @@ -6044,8 +6238,11 @@ "require": { "symfony/console": "^2.8" }, + "require-dev": { + "phpunit/phpunit": "^4.8.36" + }, "remove": [ - "goaop/framework" + "php-coveralls/php-coveralls" ], "config": { "platform": { @@ -6058,7 +6255,7 @@ } }, "branch-alias": { - "dev-master": "2.x-dev" + "dev-master": "1.x-dev" } }, "autoload": { @@ -6077,7 +6274,7 @@ } ], "description": "Modern task runner", - "time": "2019-10-29T15:50:02+00:00" + "time": "2020-02-18T17:31:26+00:00" }, { "name": "consolidation/self-update", @@ -7042,16 +7239,16 @@ }, { "name": "jms/serializer", - "version": "1.14.0", + "version": "1.14.1", "source": { "type": "git", "url": "https://github.com/schmittjoh/serializer.git", - "reference": "ee96d57024af9a7716d56fcbe3aa94b3d030f3ca" + "reference": "ba908d278fff27ec01fb4349f372634ffcd697c0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/serializer/zipball/ee96d57024af9a7716d56fcbe3aa94b3d030f3ca", - "reference": "ee96d57024af9a7716d56fcbe3aa94b3d030f3ca", + "url": "https://api.github.com/repos/schmittjoh/serializer/zipball/ba908d278fff27ec01fb4349f372634ffcd697c0", + "reference": "ba908d278fff27ec01fb4349f372634ffcd697c0", "shasum": "" }, "require": { @@ -7104,13 +7301,13 @@ "MIT" ], "authors": [ - { - "name": "Asmir Mustafic", - "email": "goetas@gmail.com" - }, { "name": "Johannes M. Schmitt", "email": "schmittjoh@gmail.com" + }, + { + "name": "Asmir Mustafic", + "email": "goetas@gmail.com" } ], "description": "Library for (de-)serializing data of any complexity; supports XML, JSON, and YAML.", @@ -7122,7 +7319,7 @@ "serialization", "xml" ], - "time": "2019-04-17T08:12:16+00:00" + "time": "2020-02-22T20:59:37+00:00" }, { "name": "league/container", @@ -7189,90 +7386,6 @@ ], "time": "2017-05-10T09:20:27+00:00" }, - { - "name": "league/flysystem", - "version": "1.0.63", - "source": { - "type": "git", - "url": "https://github.com/thephpleague/flysystem.git", - "reference": "8132daec326565036bc8e8d1876f77ec183a7bd6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/8132daec326565036bc8e8d1876f77ec183a7bd6", - "reference": "8132daec326565036bc8e8d1876f77ec183a7bd6", - "shasum": "" - }, - "require": { - "ext-fileinfo": "*", - "php": ">=5.5.9" - }, - "conflict": { - "league/flysystem-sftp": "<1.0.6" - }, - "require-dev": { - "phpspec/phpspec": "^3.4", - "phpunit/phpunit": "^5.7.10" - }, - "suggest": { - "ext-fileinfo": "Required for MimeType", - "ext-ftp": "Allows you to use FTP server storage", - "ext-openssl": "Allows you to use FTPS server storage", - "league/flysystem-aws-s3-v2": "Allows you to use S3 storage with AWS SDK v2", - "league/flysystem-aws-s3-v3": "Allows you to use S3 storage with AWS SDK v3", - "league/flysystem-azure": "Allows you to use Windows Azure Blob storage", - "league/flysystem-cached-adapter": "Flysystem adapter decorator for metadata caching", - "league/flysystem-eventable-filesystem": "Allows you to use EventableFilesystem", - "league/flysystem-rackspace": "Allows you to use Rackspace Cloud Files", - "league/flysystem-sftp": "Allows you to use SFTP server storage via phpseclib", - "league/flysystem-webdav": "Allows you to use WebDAV storage", - "league/flysystem-ziparchive": "Allows you to use ZipArchive adapter", - "spatie/flysystem-dropbox": "Allows you to use Dropbox storage", - "srmklive/flysystem-dropbox-v2": "Allows you to use Dropbox storage for PHP 5 applications" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, - "autoload": { - "psr-4": { - "League\\Flysystem\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Frank de Jonge", - "email": "info@frenky.net" - } - ], - "description": "Filesystem abstraction: Many filesystems, one API.", - "keywords": [ - "Cloud Files", - "WebDAV", - "abstraction", - "aws", - "cloud", - "copy.com", - "dropbox", - "file systems", - "files", - "filesystem", - "filesystems", - "ftp", - "rackspace", - "remote", - "s3", - "sftp", - "storage" - ], - "time": "2020-01-04T16:30:31+00:00" - }, { "name": "lusitanian/oauth", "version": "v0.8.11", @@ -7381,16 +7494,16 @@ }, { "name": "magento/magento2-functional-testing-framework", - "version": "2.6.2", + "version": "2.6.3", "source": { "type": "git", "url": "https://github.com/magento/magento2-functional-testing-framework.git", - "reference": "8b332582751a830b3a6eafe1b09ac3b403e9a20e" + "reference": "f1d9f9ede3fea875427f5d1b012561da1dca6206" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/magento/magento2-functional-testing-framework/zipball/8b332582751a830b3a6eafe1b09ac3b403e9a20e", - "reference": "8b332582751a830b3a6eafe1b09ac3b403e9a20e", + "url": "https://api.github.com/repos/magento/magento2-functional-testing-framework/zipball/f1d9f9ede3fea875427f5d1b012561da1dca6206", + "reference": "f1d9f9ede3fea875427f5d1b012561da1dca6206", "shasum": "" }, "require": { @@ -7462,7 +7575,7 @@ "magento", "testing" ], - "time": "2020-02-13T21:29:32+00:00" + "time": "2020-02-27T19:56:31+00:00" }, { "name": "mikey179/vfsstream", @@ -7510,63 +7623,6 @@ "homepage": "http://vfs.bovigo.org/", "time": "2019-10-30T15:31:00+00:00" }, - { - "name": "mtdowling/jmespath.php", - "version": "2.5.0", - "source": { - "type": "git", - "url": "https://github.com/jmespath/jmespath.php.git", - "reference": "52168cb9472de06979613d365c7f1ab8798be895" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/jmespath/jmespath.php/zipball/52168cb9472de06979613d365c7f1ab8798be895", - "reference": "52168cb9472de06979613d365c7f1ab8798be895", - "shasum": "" - }, - "require": { - "php": ">=5.4.0", - "symfony/polyfill-mbstring": "^1.4" - }, - "require-dev": { - "composer/xdebug-handler": "^1.2", - "phpunit/phpunit": "^4.8.36|^7.5.15" - }, - "bin": [ - "bin/jp.php" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.5-dev" - } - }, - "autoload": { - "psr-4": { - "JmesPath\\": "src/" - }, - "files": [ - "src/JmesPath.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Michael Dowling", - "email": "mtdowling@gmail.com", - "homepage": "https://github.com/mtdowling" - } - ], - "description": "Declaratively specify how to extract elements from a JSON document", - "keywords": [ - "json", - "jsonpath" - ], - "time": "2019-12-30T18:03:34+00:00" - }, { "name": "mustache/mustache", "version": "v2.13.0", @@ -7856,16 +7912,16 @@ }, { "name": "php-webdriver/webdriver", - "version": "1.8.0", + "version": "1.8.1", "source": { "type": "git", "url": "https://github.com/php-webdriver/php-webdriver.git", - "reference": "3e33ee3b8a688d719c55acdd7c6788e3006e1d3e" + "reference": "262ea0d209c292e0330be1041424887bbbffef04" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-webdriver/php-webdriver/zipball/3e33ee3b8a688d719c55acdd7c6788e3006e1d3e", - "reference": "3e33ee3b8a688d719c55acdd7c6788e3006e1d3e", + "url": "https://api.github.com/repos/php-webdriver/php-webdriver/zipball/262ea0d209c292e0330be1041424887bbbffef04", + "reference": "262ea0d209c292e0330be1041424887bbbffef04", "shasum": "" }, "require": { @@ -7897,12 +7953,12 @@ } }, "autoload": { - "files": [ - "lib/Exception/TimeoutException.php" - ], "psr-4": { "Facebook\\WebDriver\\": "lib/" - } + }, + "files": [ + "lib/Exception/TimeoutException.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -7917,7 +7973,7 @@ "selenium", "webdriver" ], - "time": "2020-02-10T15:04:25+00:00" + "time": "2020-02-17T08:14:38+00:00" }, { "name": "phpcollection/phpcollection", @@ -8079,41 +8135,38 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "4.3.4", + "version": "5.1.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "da3fd972d6bafd628114f7e7e036f45944b62e9c" + "reference": "cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/da3fd972d6bafd628114f7e7e036f45944b62e9c", - "reference": "da3fd972d6bafd628114f7e7e036f45944b62e9c", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e", + "reference": "cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e", "shasum": "" }, "require": { - "php": "^7.0", - "phpdocumentor/reflection-common": "^1.0.0 || ^2.0.0", - "phpdocumentor/type-resolver": "~0.4 || ^1.0.0", - "webmozart/assert": "^1.0" + "ext-filter": "^7.1", + "php": "^7.2", + "phpdocumentor/reflection-common": "^2.0", + "phpdocumentor/type-resolver": "^1.0", + "webmozart/assert": "^1" }, "require-dev": { - "doctrine/instantiator": "^1.0.5", - "mockery/mockery": "^1.0", - "phpdocumentor/type-resolver": "0.4.*", - "phpunit/phpunit": "^6.4" + "doctrine/instantiator": "^1", + "mockery/mockery": "^1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.x-dev" + "dev-master": "5.x-dev" } }, "autoload": { "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] + "phpDocumentor\\Reflection\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -8124,10 +8177,14 @@ { "name": "Mike van Riel", "email": "me@mikevanriel.com" + }, + { + "name": "Jaap van Otterdijk", + "email": "account@ijaap.nl" } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2019-12-28T18:55:12+00:00" + "time": "2020-02-22T12:28:44+00:00" }, { "name": "phpdocumentor/type-resolver", @@ -8364,16 +8421,16 @@ }, { "name": "phpstan/phpstan", - "version": "0.12.7", + "version": "0.12.11", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "07fa7958027fd98c567099bbcda5d6a0f2ec5197" + "reference": "ca5f2b7cf81c6d8fba74f9576970399c5817e03b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/07fa7958027fd98c567099bbcda5d6a0f2ec5197", - "reference": "07fa7958027fd98c567099bbcda5d6a0f2ec5197", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/ca5f2b7cf81c6d8fba74f9576970399c5817e03b", + "reference": "ca5f2b7cf81c6d8fba74f9576970399c5817e03b", "shasum": "" }, "require": { @@ -8399,7 +8456,7 @@ "MIT" ], "description": "PHPStan - PHP Static Analysis Tool", - "time": "2020-01-20T21:59:06+00:00" + "time": "2020-02-16T14:00:29+00:00" }, { "name": "phpunit/php-code-coverage", @@ -9593,7 +9650,7 @@ }, { "name": "symfony/browser-kit", - "version": "v4.4.3", + "version": "v4.4.4", "source": { "type": "git", "url": "https://github.com/symfony/browser-kit.git", @@ -9652,7 +9709,7 @@ }, { "name": "symfony/config", - "version": "v4.4.3", + "version": "v4.4.4", "source": { "type": "git", "url": "https://github.com/symfony/config.git", @@ -9716,16 +9773,16 @@ }, { "name": "symfony/dependency-injection", - "version": "v4.4.3", + "version": "v4.4.4", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "6faf589e1f6af78692aed3ab6b3c336c58d5d83c" + "reference": "ec60a7d12f5e8ab0f99456adce724717d9c1784a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/6faf589e1f6af78692aed3ab6b3c336c58d5d83c", - "reference": "6faf589e1f6af78692aed3ab6b3c336c58d5d83c", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/ec60a7d12f5e8ab0f99456adce724717d9c1784a", + "reference": "ec60a7d12f5e8ab0f99456adce724717d9c1784a", "shasum": "" }, "require": { @@ -9785,11 +9842,11 @@ ], "description": "Symfony DependencyInjection Component", "homepage": "https://symfony.com", - "time": "2020-01-21T07:39:36+00:00" + "time": "2020-01-31T09:49:27+00:00" }, { "name": "symfony/dom-crawler", - "version": "v4.4.3", + "version": "v4.4.4", "source": { "type": "git", "url": "https://github.com/symfony/dom-crawler.git", @@ -9850,16 +9907,16 @@ }, { "name": "symfony/http-foundation", - "version": "v4.4.3", + "version": "v4.4.4", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "c33998709f3fe9b8e27e0277535b07fbf6fde37a" + "reference": "491a20dfa87e0b3990170593bc2de0bb34d828a5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/c33998709f3fe9b8e27e0277535b07fbf6fde37a", - "reference": "c33998709f3fe9b8e27e0277535b07fbf6fde37a", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/491a20dfa87e0b3990170593bc2de0bb34d828a5", + "reference": "491a20dfa87e0b3990170593bc2de0bb34d828a5", "shasum": "" }, "require": { @@ -9901,11 +9958,11 @@ ], "description": "Symfony HttpFoundation Component", "homepage": "https://symfony.com", - "time": "2020-01-04T13:00:46+00:00" + "time": "2020-01-31T09:11:17+00:00" }, { "name": "symfony/mime", - "version": "v5.0.3", + "version": "v5.0.4", "source": { "type": "git", "url": "https://github.com/symfony/mime.git", @@ -9967,7 +10024,7 @@ }, { "name": "symfony/options-resolver", - "version": "v4.4.3", + "version": "v4.4.4", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", @@ -10021,22 +10078,22 @@ }, { "name": "symfony/polyfill-intl-idn", - "version": "v1.13.1", + "version": "v1.14.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-idn.git", - "reference": "6f9c239e61e1b0c9229a28ff89a812dc449c3d46" + "reference": "6842f1a39cf7d580655688069a03dd7cd83d244a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/6f9c239e61e1b0c9229a28ff89a812dc449c3d46", - "reference": "6f9c239e61e1b0c9229a28ff89a812dc449c3d46", + "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/6842f1a39cf7d580655688069a03dd7cd83d244a", + "reference": "6842f1a39cf7d580655688069a03dd7cd83d244a", "shasum": "" }, "require": { "php": ">=5.3.3", "symfony/polyfill-mbstring": "^1.3", - "symfony/polyfill-php72": "^1.9" + "symfony/polyfill-php72": "^1.10" }, "suggest": { "ext-intl": "For best performance" @@ -10044,7 +10101,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.13-dev" + "dev-master": "1.14-dev" } }, "autoload": { @@ -10079,20 +10136,20 @@ "portable", "shim" ], - "time": "2019-11-27T13:56:44+00:00" + "time": "2020-01-17T12:01:36+00:00" }, { "name": "symfony/polyfill-php70", - "version": "v1.13.1", + "version": "v1.14.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php70.git", - "reference": "af23c7bb26a73b850840823662dda371484926c4" + "reference": "419c4940024c30ccc033650373a1fe13890d3255" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/af23c7bb26a73b850840823662dda371484926c4", - "reference": "af23c7bb26a73b850840823662dda371484926c4", + "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/419c4940024c30ccc033650373a1fe13890d3255", + "reference": "419c4940024c30ccc033650373a1fe13890d3255", "shasum": "" }, "require": { @@ -10102,7 +10159,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.13-dev" + "dev-master": "1.14-dev" } }, "autoload": { @@ -10138,20 +10195,20 @@ "portable", "shim" ], - "time": "2019-11-27T13:56:44+00:00" + "time": "2020-01-13T11:15:53+00:00" }, { "name": "symfony/polyfill-php72", - "version": "v1.13.1", + "version": "v1.14.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "66fea50f6cb37a35eea048d75a7d99a45b586038" + "reference": "46ecacf4751dd0dc81e4f6bf01dbf9da1dc1dadf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/66fea50f6cb37a35eea048d75a7d99a45b586038", - "reference": "66fea50f6cb37a35eea048d75a7d99a45b586038", + "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/46ecacf4751dd0dc81e4f6bf01dbf9da1dc1dadf", + "reference": "46ecacf4751dd0dc81e4f6bf01dbf9da1dc1dadf", "shasum": "" }, "require": { @@ -10160,7 +10217,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.13-dev" + "dev-master": "1.14-dev" } }, "autoload": { @@ -10193,11 +10250,11 @@ "portable", "shim" ], - "time": "2019-11-27T13:56:44+00:00" + "time": "2020-01-13T11:15:53+00:00" }, { "name": "symfony/stopwatch", - "version": "v4.4.3", + "version": "v4.4.4", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", @@ -10247,7 +10304,7 @@ }, { "name": "symfony/yaml", - "version": "v4.4.3", + "version": "v4.4.4", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", @@ -10437,16 +10494,16 @@ }, { "name": "webmozart/assert", - "version": "1.6.0", + "version": "1.7.0", "source": { "type": "git", "url": "https://github.com/webmozart/assert.git", - "reference": "573381c0a64f155a0d9a23f4b0c797194805b925" + "reference": "aed98a490f9a8f78468232db345ab9cf606cf598" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/573381c0a64f155a0d9a23f4b0c797194805b925", - "reference": "573381c0a64f155a0d9a23f4b0c797194805b925", + "url": "https://api.github.com/repos/webmozart/assert/zipball/aed98a490f9a8f78468232db345ab9cf606cf598", + "reference": "aed98a490f9a8f78468232db345ab9cf606cf598", "shasum": "" }, "require": { @@ -10481,7 +10538,7 @@ "check", "validate" ], - "time": "2019-11-24T13:36:37+00:00" + "time": "2020-02-14T12:15:55+00:00" }, { "name": "weew/helpers-array", diff --git a/dev/tests/api-functional/testsuite/Magento/Customer/Api/CustomerRepositoryTest.php b/dev/tests/api-functional/testsuite/Magento/Customer/Api/CustomerRepositoryTest.php index 7a02e2f843719..8ee23a1efea44 100644 --- a/dev/tests/api-functional/testsuite/Magento/Customer/Api/CustomerRepositoryTest.php +++ b/dev/tests/api-functional/testsuite/Magento/Customer/Api/CustomerRepositoryTest.php @@ -8,6 +8,8 @@ use Magento\Customer\Api\Data\CustomerInterface as Customer; use Magento\Customer\Api\Data\AddressInterface as Address; +use Magento\Framework\Api\FilterBuilder; +use Magento\Framework\Api\SearchCriteriaInterface; use Magento\Framework\Api\SortOrder; use Magento\Framework\Exception\InputException; use Magento\Framework\Exception\LocalizedException; @@ -482,11 +484,17 @@ public function testCreateCustomerWithoutAddressRequiresException() /** * Test with a single filter + * + * @param bool $subscribeStatus + * @return void + * + * @dataProvider subscriptionDataProvider */ - public function testSearchCustomers() + public function testSearchCustomers(bool $subscribeStatus): void { - $builder = Bootstrap::getObjectManager()->create(\Magento\Framework\Api\FilterBuilder::class); - $customerData = $this->_createCustomer(); + $builder = Bootstrap::getObjectManager()->create(FilterBuilder::class); + $subscribeData = $this->buildSubscriptionData($subscribeStatus); + $customerData = $this->_createCustomer($subscribeData); $filter = $builder ->setField(Customer::EMAIL) ->setValue($customerData[Customer::EMAIL]) @@ -494,13 +502,13 @@ public function testSearchCustomers() $this->searchCriteriaBuilder->addFilters([$filter]); $searchData = $this->dataObjectProcessor->buildOutputDataArray( $this->searchCriteriaBuilder->create(), - \Magento\Framework\Api\SearchCriteriaInterface::class + SearchCriteriaInterface::class ); $requestData = ['searchCriteria' => $searchData]; $serviceInfo = [ 'rest' => [ 'resourcePath' => self::RESOURCE_PATH . '/search' . '?' . http_build_query($requestData), - 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_GET, + 'httpMethod' => Request::HTTP_METHOD_GET, ], 'soap' => [ 'service' => self::SERVICE_NAME, @@ -511,6 +519,35 @@ public function testSearchCustomers() $searchResults = $this->_webApiCall($serviceInfo, $requestData); $this->assertEquals(1, $searchResults['total_count']); $this->assertEquals($customerData[Customer::ID], $searchResults['items'][0][Customer::ID]); + $this->assertEquals($subscribeStatus, $searchResults['items'][0]['extension_attributes']['is_subscribed']); + } + + /** + * Build subscription extension attributes data + * + * @param bool $status + * @return array + */ + private function buildSubscriptionData(bool $status): array + { + return [ + 'extension_attributes' => [ + 'is_subscribed' => $status, + ], + ]; + } + + /** + * Subscription customer data provider + * + * @return array + */ + public function subscriptionDataProvider(): array + { + return [ + 'subscribed user' => [true], + 'not subscribed user' => [false], + ]; } /** @@ -857,11 +894,12 @@ protected function _getCustomerData($customerId) } /** + * @param array|null $additionalData * @return array|bool|float|int|string */ - protected function _createCustomer() + protected function _createCustomer(?array $additionalData = []) { - $customerData = $this->customerHelper->createSampleCustomer(); + $customerData = $this->customerHelper->createSampleCustomer($additionalData); $this->currentCustomerId[] = $customerData['id']; return $customerData; } diff --git a/dev/tests/integration/testsuite/Magento/Authorizenet/Controller/Adminhtml/Authorizenet/Directpost/Payment/PlaceTest.php b/dev/tests/integration/testsuite/Magento/Authorizenet/Controller/Adminhtml/Authorizenet/Directpost/Payment/PlaceTest.php index 35892623ef7af..1b8b1b716ce5f 100644 --- a/dev/tests/integration/testsuite/Magento/Authorizenet/Controller/Adminhtml/Authorizenet/Directpost/Payment/PlaceTest.php +++ b/dev/tests/integration/testsuite/Magento/Authorizenet/Controller/Adminhtml/Authorizenet/Directpost/Payment/PlaceTest.php @@ -3,17 +3,34 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Authorizenet\Controller\Adminhtml\Authorizenet\Directpost\Payment; +use Magento\Authorizenet\Model\Directpost; +use Magento\Backend\App\Action\Context as BackendActionContext; +use Magento\Backend\Model\Session\Quote as SessionQuote; +use Magento\Backend\Model\UrlInterface; +use Magento\Framework\Json\Helper\Data as JsonHelper; +use Magento\Framework\ObjectManagerInterface; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager; +use Magento\Quote\Model\Quote; +use Magento\Quote\Model\Quote\Payment; +use Magento\Sales\Model\AdminOrder\Create as AdminOrderCreate; +use Magento\Sales\Model\Order; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\TestFramework\TestCase\AbstractBackendController; +use PHPUnit\Framework\MockObject\MockObject; + /** - * Class PlaceTest + * Verify AuthorizeNet Controller for PlaceOrder * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class PlaceTest extends \Magento\TestFramework\TestCase\AbstractBackendController +class PlaceTest extends AbstractBackendController { /** * Test requestToAuthorizenetData returning + * @magentoAppArea adminhtml */ public function testExecuteAuthorizenetDataReturning() { @@ -22,44 +39,44 @@ public function testExecuteAuthorizenetDataReturning() $this->getRequest()->setParam('payment', ['method' => 'authorizenet_directpost']); $this->getRequest()->setParam('controller', 'order_create'); $orderCreateMock = $this->getOrderCreateMock($requestToAuthorizenetData); - $directpostMock = $this->getMockBuilder(\Magento\Authorizenet\Model\Directpost::class) + $directpostMock = $this->getMockBuilder(Directpost::class) ->setMethods(['getCode']) ->disableOriginalConstructor() ->getMock(); $directpostMock->expects($this->once()) ->method('getCode') ->willReturn('authorizenet_directpost'); - $jsonHelper = $this->_objectManager->get(\Magento\Framework\Json\Helper\Data::class); - $objectManagerMock = $this->getMockBuilder(\Magento\Framework\ObjectManagerInterface::class) + $jsonHelper = $this->_objectManager->get(JsonHelper::class); + $objectManagerMock = $this->getMockBuilder(ObjectManagerInterface::class) ->setMethods(['create', 'get']) ->getMockForAbstractClass(); $objectManagerMock->expects($this->atLeastOnce()) ->method('create') - ->with(\Magento\Authorizenet\Model\Directpost::class) + ->with(Directpost::class) ->willReturn($directpostMock); - $authorizenetSessionMock = $this->getMockBuilder(\Magento\Authorizenet\Model\Directpost::class) + $authorizenetSessionMock = $this->getMockBuilder(Directpost::class) ->disableOriginalConstructor() ->getMock(); - $urlMock = $this->getMockBuilder(\Magento\Backend\Model\UrlInterface::class) + $urlMock = $this->getMockBuilder(UrlInterface::class) ->getMockForAbstractClass(); $objectManagerMock->expects($this->atLeastOnce()) ->method('get') ->willReturnMap([ - [\Magento\Sales\Model\AdminOrder\Create::class, $orderCreateMock], - [\Magento\Framework\Json\Helper\Data::class, $jsonHelper], - [\Magento\Authorizenet\Model\Directpost\Session::class, $authorizenetSessionMock], - [\Magento\Backend\Model\UrlInterface::class, $urlMock], + [AdminOrderCreate::class, $orderCreateMock], + [JsonHelper::class, $jsonHelper], + [Directpost\Session::class, $authorizenetSessionMock], + [UrlInterface::class, $urlMock], ]); - $context = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - \Magento\Backend\App\Action\Context::class, + $context = $this->getObjectManager()->create( + BackendActionContext::class, [ 'objectManager' => $objectManagerMock ] ); - $controller = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - \Magento\Authorizenet\Controller\Adminhtml\Authorizenet\Directpost\Payment\PlaceTesting::class, + $controller = $this->getObjectManager()->create( + PlaceTesting::class, ['context' => $context] ); $controller->execute(); @@ -68,14 +85,14 @@ public function testExecuteAuthorizenetDataReturning() /** * @param array $requestToAuthorizenetData - * @return \PHPUnit_Framework_MockObject_MockObject + * @return AdminOrderCreate|MockObject */ private function getOrderCreateMock($requestToAuthorizenetData) { - $methodInstanceMock = $this->getMockBuilder(\Magento\Authorizenet\Model\Directpost::class) + $methodInstanceMock = $this->getMockBuilder(Directpost::class) ->disableOriginalConstructor() ->getMock(); - $directpostRequestMock = $this->getMockBuilder(\Magento\Authorizenet\Model\Directpost\Request::class) + $directpostRequestMock = $this->getMockBuilder(Directpost\Request::class) ->setMethods(['getData']) ->disableOriginalConstructor() ->getMock(); @@ -85,7 +102,7 @@ private function getOrderCreateMock($requestToAuthorizenetData) $methodInstanceMock->expects($this->once()) ->method('generateRequestFromOrder') ->willReturn($directpostRequestMock); - $paymentMock = $this->getMockBuilder(\Magento\Quote\Model\Quote\Payment::class) + $paymentMock = $this->getMockBuilder(Payment::class) ->setMethods(['getMethod', 'getMethodInstance']) ->disableOriginalConstructor() ->getMock(); @@ -95,28 +112,28 @@ private function getOrderCreateMock($requestToAuthorizenetData) $paymentMock->expects($this->once()) ->method('getMethodInstance') ->willReturn($methodInstanceMock); - $quoteMock = $this->getMockBuilder(\Magento\Quote\Model\Quote::class) + $quoteMock = $this->getMockBuilder(Quote::class) ->setMethods(['getPayment', 'getStoreId']) ->disableOriginalConstructor() ->getMock(); $quoteMock->expects($this->any()) ->method('getPayment') ->willReturn($paymentMock); - $orderMock = $this->getMockBuilder(\Magento\Sales\Model\Order::class) + $orderMock = $this->getMockBuilder(Order::class) ->setMethods(['getPayment']) ->disableOriginalConstructor() ->getMock(); $orderMock->expects($this->any()) ->method('getPayment') ->willReturn($paymentMock); - $sessionQuoteMock = $this->getMockBuilder(\Magento\Backend\Model\Session\Quote::class) + $sessionQuoteMock = $this->getMockBuilder(SessionQuote::class) ->setMethods(['getOrder']) ->disableOriginalConstructor() ->getMock(); $sessionQuoteMock->expects($this->once()) ->method('getOrder') ->willReturn($orderMock); - $orderCreateMock = $this->getMockBuilder(\Magento\Sales\Model\AdminOrder\Create::class) + $orderCreateMock = $this->getMockBuilder(AdminOrderCreate::class) ->setMethods(['getQuote', 'getSession', 'setIsValidate', 'importPostData', 'createOrder', 'setPaymentData']) ->disableOriginalConstructor() ->getMock(); @@ -138,4 +155,12 @@ private function getOrderCreateMock($requestToAuthorizenetData) return $orderCreateMock; } + + /** + * @return ObjectManagerInterface + */ + private function getObjectManager(): ObjectManagerInterface + { + return Bootstrap::getObjectManager(); + } } diff --git a/dev/tests/integration/testsuite/Magento/Bundle/_files/bundle_product_checkbox_options.php b/dev/tests/integration/testsuite/Magento/Bundle/_files/bundle_product_checkbox_options.php index f9636890e61f6..4b581a5cbf5d6 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/_files/bundle_product_checkbox_options.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/_files/bundle_product_checkbox_options.php @@ -34,7 +34,7 @@ $bundleProduct->setTypeId(Type::TYPE_BUNDLE) ->setAttributeSetId($bundleProduct->getDefaultAttributeSetId()) ->setWebsiteIds([$baseWebsiteId]) - ->setName('Bundle Product') + ->setName('Bundle Product Checkbox Options') ->setSku('bundle-product-checkbox-options') ->setVisibility(Visibility::VISIBILITY_BOTH) ->setStatus(Status::STATUS_ENABLED) diff --git a/dev/tests/integration/testsuite/Magento/Bundle/_files/bundle_product_checkbox_required_option.php b/dev/tests/integration/testsuite/Magento/Bundle/_files/bundle_product_checkbox_required_option.php index 453b531f75b2d..1cc9ede5d71e4 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/_files/bundle_product_checkbox_required_option.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/_files/bundle_product_checkbox_required_option.php @@ -33,7 +33,7 @@ $bundleProduct->setTypeId(Type::TYPE_BUNDLE) ->setAttributeSetId($bundleProduct->getDefaultAttributeSetId()) ->setWebsiteIds([$baseWebsiteId]) - ->setName('Bundle Product') + ->setName('Bundle Product Checkbox Required Option') ->setSku('bundle-product-checkbox-required-option') ->setVisibility(Visibility::VISIBILITY_BOTH) ->setStatus(Status::STATUS_ENABLED) diff --git a/dev/tests/integration/testsuite/Magento/Bundle/_files/bundle_product_checkbox_required_options.php b/dev/tests/integration/testsuite/Magento/Bundle/_files/bundle_product_checkbox_required_options.php index 9b84d1236c5c9..5bb6fe6973287 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/_files/bundle_product_checkbox_required_options.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/_files/bundle_product_checkbox_required_options.php @@ -34,7 +34,7 @@ $bundleProduct->setTypeId(Type::TYPE_BUNDLE) ->setAttributeSetId($product->getDefaultAttributeSetId()) ->setWebsiteIds([$baseWebsiteId]) - ->setName('Bundle Product') + ->setName('Bundle Product Checkbox Required Options') ->setSku('bundle-product-checkbox-required-options') ->setVisibility(Visibility::VISIBILITY_BOTH) ->setStatus(Status::STATUS_ENABLED) diff --git a/dev/tests/integration/testsuite/Magento/Bundle/_files/bundle_product_dropdown_options.php b/dev/tests/integration/testsuite/Magento/Bundle/_files/bundle_product_dropdown_options.php index 06f6473802ee2..62c80abc6415f 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/_files/bundle_product_dropdown_options.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/_files/bundle_product_dropdown_options.php @@ -34,7 +34,7 @@ $bundleProduct->setTypeId(Type::TYPE_BUNDLE) ->setAttributeSetId($product->getDefaultAttributeSetId()) ->setWebsiteIds([$baseWebsiteId]) - ->setName('Bundle Product') + ->setName('Bundle Product Dropdown options') ->setSku('bundle-product-dropdown-options') ->setVisibility(Visibility::VISIBILITY_BOTH) ->setStatus(Status::STATUS_ENABLED) diff --git a/dev/tests/integration/testsuite/Magento/Bundle/_files/bundle_product_dropdown_required_options.php b/dev/tests/integration/testsuite/Magento/Bundle/_files/bundle_product_dropdown_required_options.php index 1789f472f968d..4093c9ff057e7 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/_files/bundle_product_dropdown_required_options.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/_files/bundle_product_dropdown_required_options.php @@ -34,7 +34,7 @@ $bundleProduct->setTypeId(Type::TYPE_BUNDLE) ->setAttributeSetId($product->getDefaultAttributeSetId()) ->setWebsiteIds([$baseWebsiteId]) - ->setName('Bundle Product') + ->setName('Bundle Product Dropdown Required options') ->setSku('bundle-product-dropdown-required-options') ->setVisibility(Visibility::VISIBILITY_BOTH) ->setStatus(Status::STATUS_ENABLED) diff --git a/dev/tests/integration/testsuite/Magento/Bundle/_files/bundle_product_multiselect_options.php b/dev/tests/integration/testsuite/Magento/Bundle/_files/bundle_product_multiselect_options.php index a5667b89f8bf4..29b7710c47040 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/_files/bundle_product_multiselect_options.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/_files/bundle_product_multiselect_options.php @@ -34,7 +34,7 @@ $bundleProduct->setTypeId(Type::TYPE_BUNDLE) ->setAttributeSetId($product->getDefaultAttributeSetId()) ->setWebsiteIds([$baseWebsiteId]) - ->setName('Bundle Product') + ->setName('Bundle Product Multiselect Options') ->setSku('bundle-product-multiselect-options') ->setVisibility(Visibility::VISIBILITY_BOTH) ->setStatus(Status::STATUS_ENABLED) diff --git a/dev/tests/integration/testsuite/Magento/Bundle/_files/bundle_product_multiselect_required_option.php b/dev/tests/integration/testsuite/Magento/Bundle/_files/bundle_product_multiselect_required_option.php index 7789045f6f7ef..0cde1e65c9e54 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/_files/bundle_product_multiselect_required_option.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/_files/bundle_product_multiselect_required_option.php @@ -33,7 +33,7 @@ $bundleProduct->setTypeId(Type::TYPE_BUNDLE) ->setAttributeSetId($product->getDefaultAttributeSetId()) ->setWebsiteIds([$baseWebsiteId]) - ->setName('Bundle Product') + ->setName('Bundle Product Multiselect Required Option') ->setSku('bundle-product-multiselect-required-option') ->setVisibility(Visibility::VISIBILITY_BOTH) ->setStatus(Status::STATUS_ENABLED) diff --git a/dev/tests/integration/testsuite/Magento/Bundle/_files/bundle_product_multiselect_required_options.php b/dev/tests/integration/testsuite/Magento/Bundle/_files/bundle_product_multiselect_required_options.php index 65bb49f3b6122..f18494d08215c 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/_files/bundle_product_multiselect_required_options.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/_files/bundle_product_multiselect_required_options.php @@ -34,7 +34,7 @@ $bundleProduct->setTypeId(Type::TYPE_BUNDLE) ->setAttributeSetId($product->getDefaultAttributeSetId()) ->setWebsiteIds([$baseWebsiteId]) - ->setName('Bundle Product') + ->setName('Bundle Product Multiselect Required Options') ->setSku('bundle-product-multiselect-required-options') ->setVisibility(Visibility::VISIBILITY_BOTH) ->setStatus(Status::STATUS_ENABLED) diff --git a/dev/tests/integration/testsuite/Magento/Bundle/_files/bundle_product_radio_options.php b/dev/tests/integration/testsuite/Magento/Bundle/_files/bundle_product_radio_options.php index def31b48b2172..23a5713e46eb0 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/_files/bundle_product_radio_options.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/_files/bundle_product_radio_options.php @@ -34,7 +34,7 @@ $bundleProduct->setTypeId(Type::TYPE_BUNDLE) ->setAttributeSetId($product->getDefaultAttributeSetId()) ->setWebsiteIds([$baseWebsiteId]) - ->setName('Bundle Product') + ->setName('Bundle Product Radio Options') ->setSku('bundle-product-radio-options') ->setVisibility(Visibility::VISIBILITY_BOTH) ->setStatus(Status::STATUS_ENABLED) diff --git a/dev/tests/integration/testsuite/Magento/Bundle/_files/bundle_product_radio_required_option.php b/dev/tests/integration/testsuite/Magento/Bundle/_files/bundle_product_radio_required_option.php index c659387e09dcc..1472986023e21 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/_files/bundle_product_radio_required_option.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/_files/bundle_product_radio_required_option.php @@ -33,7 +33,7 @@ $bundleProduct->setTypeId(Type::TYPE_BUNDLE) ->setAttributeSetId($product->getDefaultAttributeSetId()) ->setWebsiteIds([$baseWebsiteId]) - ->setName('Bundle Product') + ->setName('Bundle Product Radio Required Option') ->setSku('bundle-product-radio-required-option') ->setVisibility(Visibility::VISIBILITY_BOTH) ->setStatus(Status::STATUS_ENABLED) diff --git a/dev/tests/integration/testsuite/Magento/Bundle/_files/bundle_product_radio_required_options.php b/dev/tests/integration/testsuite/Magento/Bundle/_files/bundle_product_radio_required_options.php index ec28bf556b69c..cb703902a0b7a 100644 --- a/dev/tests/integration/testsuite/Magento/Bundle/_files/bundle_product_radio_required_options.php +++ b/dev/tests/integration/testsuite/Magento/Bundle/_files/bundle_product_radio_required_options.php @@ -34,7 +34,7 @@ $bundleProduct->setTypeId(Type::TYPE_BUNDLE) ->setAttributeSetId($product->getDefaultAttributeSetId()) ->setWebsiteIds([$baseWebsiteId]) - ->setName('Bundle Product') + ->setName('Bundle Product Radio Required Options') ->setSku('bundle-product-radio-required-options') ->setVisibility(Visibility::VISIBILITY_BOTH) ->setStatus(Status::STATUS_ENABLED) diff --git a/dev/tests/integration/testsuite/Magento/Bundle/_files/dynamic_and_fixed_bundle_products_in_category.php b/dev/tests/integration/testsuite/Magento/Bundle/_files/dynamic_and_fixed_bundle_products_in_category.php new file mode 100644 index 0000000000000..9a6cae37fbe25 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Bundle/_files/dynamic_and_fixed_bundle_products_in_category.php @@ -0,0 +1,23 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Catalog\Api\CategoryLinkManagementInterface; +use Magento\Catalog\Helper\DefaultCategory; + +require __DIR__ . '/product.php'; +require __DIR__ . '/bundle_product_dropdown_options.php'; +require __DIR__ . '/../../Catalog/_files/category.php'; + +/** @var CategoryLinkManagementInterface $categoryLinkManagement */ +$categoryLinkManagement = $objectManager->create(CategoryLinkManagementInterface::class); +/** @var DefaultCategory $categoryHelper */ +$categoryHelper = $objectManager->get(DefaultCategory::class); +$categoryLinkManagement->assignProductToCategories('bundle-product', [2, $category->getId()]); +$categoryLinkManagement->assignProductToCategories( + 'bundle-product-dropdown-options', + [$categoryHelper->getId(), $category->getId()] +); diff --git a/dev/tests/integration/testsuite/Magento/Bundle/_files/dynamic_and_fixed_bundle_products_in_category_rollback.php b/dev/tests/integration/testsuite/Magento/Bundle/_files/dynamic_and_fixed_bundle_products_in_category_rollback.php new file mode 100644 index 0000000000000..58eb8cacde815 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Bundle/_files/dynamic_and_fixed_bundle_products_in_category_rollback.php @@ -0,0 +1,10 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +require __DIR__ . '/product_rollback.php'; +require __DIR__ . '/bundle_product_dropdown_options_rollback.php'; +require __DIR__ . '/../../Catalog/_files/category_rollback.php'; diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/CategoryRepositoryTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/CategoryRepositoryTest.php index e1e4a87c033d0..c4cabe46f5b32 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/CategoryRepositoryTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/CategoryRepositoryTest.php @@ -9,10 +9,10 @@ use Magento\Catalog\Api\CategoryRepositoryInterface; use Magento\Catalog\Api\CategoryRepositoryInterfaceFactory; -use Magento\Framework\Exception\LocalizedException; -use Magento\TestFramework\Catalog\Model\CategoryLayoutUpdateManager; use Magento\Catalog\Model\ResourceModel\Category\CollectionFactory as CategoryCollectionFactory; use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory; +use Magento\Framework\Exception\LocalizedException; +use Magento\TestFramework\Catalog\Model\CategoryLayoutUpdateManager; use Magento\TestFramework\Helper\Bootstrap; use PHPUnit\Framework\TestCase; @@ -21,6 +21,11 @@ */ class CategoryRepositoryTest extends TestCase { + private const FIXTURE_CATEGORY_ID = 333; + private const FIXTURE_TWO_STORES_CATEGORY_ID = 555; + private const FIXTURE_SECOND_STORE_CODE = 'fixturestore'; + private const FIXTURE_FIRST_STORE_CODE = 'default'; + /** * @var CategoryLayoutUpdateManager */ @@ -77,13 +82,13 @@ public function testCustomLayout(): void { //New valid value $repo = $this->createRepo(); - $category = $repo->get(333); + $category = $repo->get(self::FIXTURE_CATEGORY_ID); $newFile = 'test'; - $this->layoutManager->setCategoryFakeFiles(333, [$newFile]); + $this->layoutManager->setCategoryFakeFiles(self::FIXTURE_CATEGORY_ID, [$newFile]); $category->setCustomAttribute('custom_layout_update_file', $newFile); $repo->save($category); $repo = $this->createRepo(); - $category = $repo->get(333); + $category = $repo->get(self::FIXTURE_CATEGORY_ID); $this->assertEquals($newFile, $category->getCustomAttribute('custom_layout_update_file')->getValue()); //Setting non-existent value @@ -126,4 +131,36 @@ public function testCategoryBehaviourAfterDelete(): void 'Wrong categories was deleted' ); } + + /** + * Verifies whether `get()` method `$storeId` attribute works as expected. + * + * @magentoDbIsolation enabled + * @magentoDataFixture Magento/Store/_files/core_fixturestore.php + * @magentoDataFixture Magento/Catalog/_files/category_with_two_stores.php + */ + public function testGetCategoryForProvidedStore() + { + $categoryRepository = $this->repositoryFactory->create(); + + $categoryDefault = $categoryRepository->get( + self::FIXTURE_TWO_STORES_CATEGORY_ID + ); + + $this->assertSame('category-defaultstore', $categoryDefault->getUrlKey()); + + $categoryFirstStore = $categoryRepository->get( + self::FIXTURE_TWO_STORES_CATEGORY_ID, + self::FIXTURE_FIRST_STORE_CODE + ); + + $this->assertSame('category-defaultstore', $categoryFirstStore->getUrlKey()); + + $categorySecondStore = $categoryRepository->get( + self::FIXTURE_TWO_STORES_CATEGORY_ID, + self::FIXTURE_SECOND_STORE_CODE + ); + + $this->assertSame('category-fixturestore', $categorySecondStore->getUrlKey()); + } } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/ImageUploaderTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/ImageUploaderTest.php deleted file mode 100644 index 569cf2357675c..0000000000000 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/ImageUploaderTest.php +++ /dev/null @@ -1,165 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -declare(strict_types=1); - -namespace Magento\Catalog\Model; - -use Magento\Framework\App\Filesystem\DirectoryList; - -/** - * Tests for the \Magento\Catalog\Model\ImageUploader class - */ -class ImageUploaderTest extends \PHPUnit\Framework\TestCase -{ - /** - * @var \Magento\Framework\ObjectManagerInterface - */ - private $objectManager; - - /** - * @var \Magento\Catalog\Model\ImageUploader - */ - private $imageUploader; - - /** - * @var \Magento\Framework\Filesystem - */ - private $filesystem; - - /** - * @var \Magento\Framework\Filesystem\Directory\WriteInterface - */ - private $mediaDirectory; - - /** - * @inheritdoc - */ - protected function setUp() - { - $this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - /** @var \Magento\Framework\Filesystem $filesystem */ - $this->filesystem = $this->objectManager->get(\Magento\Framework\Filesystem::class); - $this->mediaDirectory = $this->filesystem->getDirectoryWrite(DirectoryList::MEDIA); - /** @var $uploader \Magento\MediaStorage\Model\File\Uploader */ - $this->imageUploader = $this->objectManager->create( - \Magento\Catalog\Model\ImageUploader::class, - [ - 'baseTmpPath' => 'catalog/tmp/category', - 'basePath' => 'catalog/category', - 'allowedExtensions' => ['jpg', 'jpeg', 'gif', 'png'], - 'allowedMimeTypes' => ['image/jpg', 'image/jpeg', 'image/gif', 'image/png'] - ] - ); - } - - /** - * @return void - */ - public function testSaveFileToTmpDir(): void - { - $fileName = 'magento_small_image.jpg'; - $tmpDirectory = $this->filesystem->getDirectoryWrite(\Magento\Framework\App\Filesystem\DirectoryList::SYS_TMP); - $fixtureDir = realpath(__DIR__ . '/../_files'); - $filePath = $tmpDirectory->getAbsolutePath($fileName); - copy($fixtureDir . DIRECTORY_SEPARATOR . $fileName, $filePath); - - $_FILES['image'] = [ - 'name' => $fileName, - 'type' => 'image/jpeg', - 'tmp_name' => $filePath, - 'error' => 0, - 'size' => 12500, - ]; - - $this->imageUploader->saveFileToTmpDir('image'); - $filePath = $this->imageUploader->getBaseTmpPath() . DIRECTORY_SEPARATOR. $fileName; - $this->assertTrue(is_file($this->mediaDirectory->getAbsolutePath($filePath))); - } - - /** - * Test that method rename files when move it with the same name into base directory. - * - * @return void - * @magentoDataFixture Magento/Catalog/_files/catalog_category_image.php - * @magentoDataFixture Magento/Catalog/_files/catalog_tmp_category_image.php - */ - public function testMoveFileFromTmp(): void - { - $expectedFilePath = $this->imageUploader->getBasePath() . DIRECTORY_SEPARATOR . 'magento_small_image_1.jpg'; - - $this->assertFileNotExists($this->mediaDirectory->getAbsolutePath($expectedFilePath)); - - $this->imageUploader->moveFileFromTmp('magento_small_image.jpg'); - - $this->assertFileExists($this->mediaDirectory->getAbsolutePath($expectedFilePath)); - } - - /** - * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage File validation failed. - * @return void - */ - public function testSaveFileToTmpDirWithWrongExtension(): void - { - $fileName = 'text.txt'; - $tmpDirectory = $this->filesystem->getDirectoryWrite(\Magento\Framework\App\Filesystem\DirectoryList::SYS_TMP); - $filePath = $tmpDirectory->getAbsolutePath($fileName); - $file = fopen($filePath, "wb"); - fwrite($file, 'just a text'); - - $_FILES['image'] = [ - 'name' => $fileName, - 'type' => 'text/plain', - 'tmp_name' => $filePath, - 'error' => 0, - 'size' => 12500, - ]; - - $this->imageUploader->saveFileToTmpDir('image'); - $filePath = $this->imageUploader->getBaseTmpPath() . DIRECTORY_SEPARATOR. $fileName; - $this->assertFalse(is_file($this->mediaDirectory->getAbsolutePath($filePath))); - } - - /** - * @expectedException \Magento\Framework\Exception\LocalizedException - * @expectedExceptionMessage File validation failed. - * @return void - */ - public function testSaveFileToTmpDirWithWrongFile(): void - { - $fileName = 'file.gif'; - $tmpDirectory = $this->filesystem->getDirectoryWrite(\Magento\Framework\App\Filesystem\DirectoryList::SYS_TMP); - $filePath = $tmpDirectory->getAbsolutePath($fileName); - $file = fopen($filePath, "wb"); - fwrite($file, 'just a text'); - - $_FILES['image'] = [ - 'name' => $fileName, - 'type' => 'image/gif', - 'tmp_name' => $filePath, - 'error' => 0, - 'size' => 12500, - ]; - - $this->imageUploader->saveFileToTmpDir('image'); - $filePath = $this->imageUploader->getBaseTmpPath() . DIRECTORY_SEPARATOR. $fileName; - $this->assertFalse(is_file($this->mediaDirectory->getAbsolutePath($filePath))); - } - - /** - * @inheritdoc - */ - public static function tearDownAfterClass() - { - parent::tearDownAfterClass(); - $filesystem = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - \Magento\Framework\Filesystem::class - ); - /** @var \Magento\Framework\Filesystem\Directory\WriteInterface $mediaDirectory */ - $mediaDirectory = $filesystem->getDirectoryWrite(DirectoryList::MEDIA); - $mediaDirectory->delete('tmp'); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Gallery/ReadHandlerTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Gallery/ReadHandlerTest.php index 89b91ab57e51a..f348372f2029a 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Gallery/ReadHandlerTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/Gallery/ReadHandlerTest.php @@ -338,11 +338,7 @@ private function getProductInstance(?int $storeId = null): ProductInterface { /** @var ProductInterface $product */ $product = $this->productFactory->create(); - $product->setData( - $this->productLinkField, - $this->getProduct()->getData($this->productLinkField) - ); - + $product->setId($this->getProduct()->getId()); if ($storeId) { $product->setStoreId($storeId); } diff --git a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/ProductFrontendAction/SynchronizerTest.php b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/ProductFrontendAction/SynchronizerTest.php index 3ea30005e9f6c..5cf53349480f1 100644 --- a/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/ProductFrontendAction/SynchronizerTest.php +++ b/dev/tests/integration/testsuite/Magento/Catalog/Model/Product/ProductFrontendAction/SynchronizerTest.php @@ -40,20 +40,24 @@ protected function setUp() * @magentoDataFixture Magento/Catalog/_files/second_product_simple.php * * @return void + * @throws \Magento\Framework\Exception\LocalizedException + * @throws \Magento\Framework\Exception\NoSuchEntityException */ public function testSyncActions(): void { $actionsType = 'recently_viewed_product'; + $productScope = 'website'; + $scopeId = 1; $product1 = $this->productRepository->get('simple'); $product2 = $this->productRepository->get('simple2'); $product1Id = $product1->getId(); $product2Id = $product2->getId(); $productsData = [ - $product1Id => [ + $productScope . '-' . $scopeId . '-' . $product1Id => [ 'added_at' => '1576582660', 'product_id' => $product1Id, ], - $product2Id => [ + $productScope . '-' . $scopeId . '-' . $product2Id => [ 'added_at' => '1576587153', 'product_id' => $product2Id, ], @@ -71,8 +75,9 @@ public function testSyncActions(): void ); foreach ($synchronizedCollection as $item) { - $this->assertArrayHasKey($item->getProductId(), $productsData); - $this->assertEquals($productsData[$item->getProductId()]['added_at'], $item->getAddedAt()); + $productScopeId = $productScope . '-' . $scopeId . '-' . $item->getProductId(); + $this->assertArrayHasKey($productScopeId, $productsData); + $this->assertEquals($productsData[$productScopeId]['added_at'], $item->getAddedAt()); } } @@ -81,6 +86,8 @@ public function testSyncActions(): void * @magentoDataFixture Magento/Catalog/_files/second_product_simple.php * * @return void + * @throws \Magento\Framework\Exception\LocalizedException + * @throws \Magento\Framework\Exception\NoSuchEntityException */ public function testSyncActionsWithoutActionsType(): void { diff --git a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php index 302534679d073..93684b1e7a070 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest.php @@ -2416,6 +2416,16 @@ public function validateRowDataProvider() 'behavior' => Import::BEHAVIOR_REPLACE, 'expectedResult' => true, ], + [ + 'row' => ['sku' => 'sku with whitespace ', + 'name' => 'Test', + 'product_type' => 'simple', + '_attribute_set' => 'Default', + 'price' => 10.20, + ], + 'behavior' => Import::BEHAVIOR_ADD_UPDATE, + 'expectedResult' => false, + ], ]; } diff --git a/dev/tests/integration/testsuite/Magento/CatalogWidget/Block/Product/ProductListTest.php b/dev/tests/integration/testsuite/Magento/CatalogWidget/Block/Product/ProductListTest.php index f11083dd2ba91..8bcd0001b8119 100644 --- a/dev/tests/integration/testsuite/Magento/CatalogWidget/Block/Product/ProductListTest.php +++ b/dev/tests/integration/testsuite/Magento/CatalogWidget/Block/Product/ProductListTest.php @@ -256,4 +256,80 @@ public function testCreateAnchorCollection() "Anchor root category does not contain products of it's children." ); } + + /** + * Test that price rule condition works correctly + * + * @magentoDbIsolation disabled + * @magentoDataFixture Magento/Catalog/_files/category_with_different_price_products.php + * @magentoDataFixture Magento/ConfigurableProduct/_files/product_configurable.php + * @param string $operator + * @param int $value + * @param array $matches + * @dataProvider priceFilterDataProvider + */ + public function testPriceFilter(string $operator, int $value, array $matches) + { + $encodedConditions = '^[`1`:^[`type`:`Magento||CatalogWidget||Model||Rule||Condition||Combine`, + `aggregator`:`all`,`value`:`1`,`new_child`:``^], + `1--1`:^[`type`:`Magento||CatalogWidget||Model||Rule||Condition||Product`, + `attribute`:`price`, + `operator`:`' . $operator . '`,`value`:`' . $value . '`^]^]'; + + $this->block->setData('conditions_encoded', $encodedConditions); + + $productCollection = $this->block->createCollection(); + $productCollection->load(); + $skus = array_map( + function ($item) { + return $item['sku']; + }, + $productCollection->getItems() + ); + $this->assertEquals($matches, $skus, '', 0.0, 10, true); + } + + public function priceFilterDataProvider(): array + { + return [ + [ + '>', + 10, + [ + 'simple1001', + ] + ], + [ + '>=', + 10, + [ + 'simple1000', + 'simple1001', + 'configurable', + ] + ], + [ + '<', + 10, + [] + ], + [ + '<', + 20, + [ + 'simple1000', + 'configurable', + ] + ], + [ + '<=', + 20, + [ + 'simple1000', + 'simple1001', + 'configurable', + ] + ], + ]; + } } diff --git a/dev/tests/integration/testsuite/Magento/Checkout/Api/GuestShippingInformationManagementTest.php b/dev/tests/integration/testsuite/Magento/Checkout/Api/GuestShippingInformationManagementTest.php index 50b1256c0f124..8018f76567d16 100644 --- a/dev/tests/integration/testsuite/Magento/Checkout/Api/GuestShippingInformationManagementTest.php +++ b/dev/tests/integration/testsuite/Magento/Checkout/Api/GuestShippingInformationManagementTest.php @@ -11,6 +11,7 @@ use Magento\Checkout\Api\Data\ShippingInformationInterfaceFactory; use Magento\Customer\Api\CustomerRepositoryInterface; use Magento\Framework\Api\SearchCriteriaBuilder; +use Magento\Framework\Exception\InputException; use Magento\Quote\Api\CartRepositoryInterface; use Magento\Quote\Api\Data\ShippingAssignmentInterface; use Magento\TestFramework\Helper\Bootstrap; @@ -53,6 +54,9 @@ class GuestShippingInformationManagementTest extends TestCase */ private $maskFactory; + /** + * @inheritdoc + */ protected function setUp() { $objectManager = Bootstrap::getObjectManager(); @@ -73,10 +77,8 @@ protected function setUp() * @magentoDataFixture Magento/Sales/_files/quote.php * @magentoDataFixture Magento/Customer/_files/customer_with_addresses.php * @dataProvider getAddressesVariation - * @expectedException \Magento\Framework\Exception\InputException - * @expectedExceptionMessage The shipping information was unable to be saved. Verify the input data and try again. */ - public function testDifferentAddresses(bool $swapShipping) + public function testDifferentAddresses(bool $swapShipping): void { $carts = $this->cartRepo->getList( $this->searchCriteria->addFilter('reserved_order_id', 'test01')->create() @@ -107,6 +109,14 @@ public function testDifferentAddresses(bool $swapShipping) /** @var QuoteIdMask $idMask */ $idMask = $this->maskFactory->create(); $idMask->load($cart->getId(), 'quote_id'); + + $this->expectExceptionMessage( + sprintf( + 'The shipping information was unable to be saved. Error: "Invalid customer address id %s"', + $address->getCustomerAddressId() + ) + ); + $this->expectException(InputException::class); $this->management->saveAddressInformation($idMask->getMaskedId(), $shippingInformation); } diff --git a/dev/tests/integration/testsuite/Magento/Checkout/Api/ShippingInformationManagementTest.php b/dev/tests/integration/testsuite/Magento/Checkout/Api/ShippingInformationManagementTest.php index 7440fb7fd3d98..a0ccc5014bc19 100644 --- a/dev/tests/integration/testsuite/Magento/Checkout/Api/ShippingInformationManagementTest.php +++ b/dev/tests/integration/testsuite/Magento/Checkout/Api/ShippingInformationManagementTest.php @@ -13,6 +13,7 @@ use Magento\Quote\Api\CartRepositoryInterface; use Magento\Quote\Api\Data\ShippingAssignmentInterface; use Magento\TestFramework\Helper\Bootstrap; +use Magento\Framework\Exception\InputException; use PHPUnit\Framework\TestCase; /** @@ -40,6 +41,9 @@ class ShippingInformationManagementTest extends TestCase */ private $shippingFactory; + /** + * @inheritdoc + */ protected function setUp() { $objectManager = Bootstrap::getObjectManager(); @@ -58,10 +62,8 @@ protected function setUp() * @magentoDataFixture Magento/Sales/_files/quote_with_customer.php * @magentoDataFixture Magento/Customer/_files/customer_with_addresses.php * @dataProvider getAddressesVariation - * @expectedException \Magento\Framework\Exception\InputException - * @expectedExceptionMessage The shipping information was unable to be saved. Verify the input data and try again. */ - public function testDifferentAddresses(bool $swapShipping) + public function testDifferentAddresses(bool $swapShipping): void { $cart = $this->cartRepo->getForCustomer(1); $otherCustomer = $this->customerRepo->get('customer_with_addresses@test.com'); @@ -86,6 +88,14 @@ public function testDifferentAddresses(bool $swapShipping) $shippingInformation->setBillingAddress($billingAddress); $shippingInformation->setShippingAddress($shippingAddress); $shippingInformation->setShippingMethodCode('flatrate'); + + $this->expectExceptionMessage( + sprintf( + 'The shipping information was unable to be saved. Error: "Invalid customer address id %s"', + $address->getCustomerAddressId() + ) + ); + $this->expectException(InputException::class); $this->management->saveAddressInformation($cart->getId(), $shippingInformation); } diff --git a/dev/tests/integration/testsuite/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/DeleteFilesTest.php b/dev/tests/integration/testsuite/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/DeleteFilesTest.php index c135a89a00bc7..15bd56f86486c 100644 --- a/dev/tests/integration/testsuite/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/DeleteFilesTest.php +++ b/dev/tests/integration/testsuite/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/DeleteFilesTest.php @@ -10,6 +10,8 @@ /** * Test for \Magento\Cms\Controller\Adminhtml\Wysiwyg\Images\DeleteFiles class. + * + * @magentoAppArea adminhtml */ class DeleteFilesTest extends \PHPUnit\Framework\TestCase { diff --git a/dev/tests/integration/testsuite/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/DeleteFolderTest.php b/dev/tests/integration/testsuite/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/DeleteFolderTest.php index af495841b9672..94638f3a71537 100644 --- a/dev/tests/integration/testsuite/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/DeleteFolderTest.php +++ b/dev/tests/integration/testsuite/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/DeleteFolderTest.php @@ -11,6 +11,8 @@ /** * Test for \Magento\Cms\Controller\Adminhtml\Wysiwyg\Images\DeleteFolder class. + * + * @magentoAppArea adminhtml */ class DeleteFolderTest extends \PHPUnit\Framework\TestCase { diff --git a/dev/tests/integration/testsuite/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/NewFolderTest.php b/dev/tests/integration/testsuite/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/NewFolderTest.php index e509737a0020f..4a572f8cdf228 100644 --- a/dev/tests/integration/testsuite/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/NewFolderTest.php +++ b/dev/tests/integration/testsuite/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/NewFolderTest.php @@ -10,6 +10,8 @@ /** * Test for \Magento\Cms\Controller\Adminhtml\Wysiwyg\Images\NewFolder class. + * + * @magentoAppArea adminhtml */ class NewFolderTest extends \PHPUnit\Framework\TestCase { diff --git a/dev/tests/integration/testsuite/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/UploadTest.php b/dev/tests/integration/testsuite/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/UploadTest.php index 9303a5eac7868..df8994c1a5a91 100644 --- a/dev/tests/integration/testsuite/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/UploadTest.php +++ b/dev/tests/integration/testsuite/Magento/Cms/Controller/Adminhtml/Wysiwyg/Images/UploadTest.php @@ -15,6 +15,8 @@ /** * Test for \Magento\Cms\Controller\Adminhtml\Wysiwyg\Images\Upload class. + * + * @magentoAppArea adminhtml */ class UploadTest extends \PHPUnit\Framework\TestCase { diff --git a/dev/tests/integration/testsuite/Magento/Csp/Model/Policy/Renderer/SimplePolicyHeaderRendererTest.php b/dev/tests/integration/testsuite/Magento/Csp/Model/Policy/Renderer/SimplePolicyHeaderRendererTest.php index 93e7833038a42..12ed71b708b88 100644 --- a/dev/tests/integration/testsuite/Magento/Csp/Model/Policy/Renderer/SimplePolicyHeaderRendererTest.php +++ b/dev/tests/integration/testsuite/Magento/Csp/Model/Policy/Renderer/SimplePolicyHeaderRendererTest.php @@ -58,6 +58,8 @@ public function testRenderRestrictMode(): void foreach ($header as $item) { $contentSecurityPolicyContent[] = $item->getFieldValue(); } + } else { + $contentSecurityPolicyContent = [$header->getFieldValue()]; } $this->assertEquals(['default-src https://magento.com \'self\';'], $contentSecurityPolicyContent); } @@ -84,6 +86,8 @@ public function testRenderRestrictWithReportingMode(): void foreach ($header as $item) { $contentSecurityPolicyContent[] = $item->getFieldValue(); } + } else { + $contentSecurityPolicyContent = [$header->getFieldValue()]; } $this->assertEquals( ['default-src https://magento.com \'self\'; report-uri /csp-reports/; report-to report-endpoint;'], diff --git a/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/Orders/RenderOrdersTabTest.php b/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/Orders/RenderOrdersTabTest.php new file mode 100644 index 0000000000000..1d18814487bf8 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Customer/Block/Adminhtml/Edit/Tab/Orders/RenderOrdersTabTest.php @@ -0,0 +1,433 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Customer\Block\Adminhtml\Edit\Tab\Orders; + +use Magento\Customer\Block\Adminhtml\Edit\Tab\Orders; +use Magento\Customer\Controller\RegistryConstants; +use Magento\Directory\Model\Currency; +use Magento\Framework\App\Config\ScopeConfigInterface; +use Magento\Framework\Locale\CurrencyInterface; +use Magento\Framework\ObjectManagerInterface; +use Magento\Framework\Registry; +use Magento\Framework\Stdlib\DateTime\TimezoneInterface; +use Magento\Framework\View\Element\UiComponent\DataProvider\Document; +use Magento\Framework\View\LayoutInterface; +use Magento\Sales\Api\Data\OrderInterface; +use Magento\Store\Model\System\Store; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\TestFramework\Helper\Xpath; +use PHPUnit\Framework\TestCase; + +/** + * Test cases related to check that orders tab with customer orders + * grid correctly renders and contains all necessary data. + * + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + * @magentoAppArea adminhtml + * @magentoDbIsolation enabled + */ +class RenderOrdersTabTest extends TestCase +{ + private const PATHS_TO_TABLE_BODY = [ + "//div[contains(@data-grid-id, 'customer_orders_grid')]", + "//table[contains(@class, 'data-grid')]", + "//tbody", + ]; + + /** + * @var ObjectManagerInterface + */ + private $objectManager; + + /** + * @var Store + */ + private $store; + + /** + * @var LayoutInterface + */ + private $layout; + + /** + * @var CurrencyInterface + */ + private $currency; + + /** + * @var TimezoneInterface + */ + private $timezone; + + /** + * @var Registry + */ + private $registry; + + /** + * @var ScopeConfigInterface + */ + private $scopeConfig; + + /** + * @var Orders + */ + private $ordersGridBlock; + + /** + * @inheritdoc + */ + protected function setUp() + { + $this->objectManager = Bootstrap::getObjectManager(); + $this->store = $this->objectManager->get(Store::class); + $this->layout = $this->objectManager->get(LayoutInterface::class); + $this->currency = $this->objectManager->get(CurrencyInterface::class); + $this->timezone = $this->objectManager->get(TimezoneInterface::class); + $this->registry = $this->objectManager->get(Registry::class); + $this->scopeConfig = $this->objectManager->get(ScopeConfigInterface::class); + parent::setUp(); + } + + /** + * @inheritdoc + */ + protected function tearDown() + { + $this->registry->unregister(RegistryConstants::CURRENT_CUSTOMER_ID); + parent::tearDown(); + } + + /** + * Assert that customer orders tab renders with message "We couldn't find any records." + * when customer doesn't have any orders. + * + * @magentoDataFixture Magento/Customer/_files/customer.php + * + * @return void + */ + public function testRenderBlockWithoutOrders(): void + { + $this->processCheckOrdersGridByCustomerId(1, 0); + } + + /** + * Assert that customer orders tab renders without message "We couldn't find any records." + * and contains rendered order item when customer has one order. + * + * @magentoDataFixture Magento/Sales/_files/order_with_customer.php + * + * @return void + */ + public function testRenderBlockWithOneOrder(): void + { + $this->processCheckOrdersGridByCustomerId(1, 1); + } + + /** + * Assert that customer orders tab renders without message "We couldn't find any records." + * and contains rendered orders items when customer has few orders. + * + * @magentoDataFixture Magento/Customer/_files/customer.php + * @magentoDataFixture Magento/Sales/_files/orders_with_customer.php + * + * @return void + */ + public function testRenderBlockWithFewOrders(): void + { + $this->processCheckOrdersGridByCustomerId(1, 5); + } + + /** + * Render orders grid and assert that all data rendered as expected. + * + * @param int $customerId + * @param int $expectedOrderCount + * @return void + */ + private function processCheckOrdersGridByCustomerId(int $customerId, int $expectedOrderCount): void + { + $this->registerCustomerId($customerId); + $ordersGridHtml = $this->getOrdersGridHtml(); + $orderItemsData = $this->getOrderGridItemsData(); + $this->assertOrdersCount($expectedOrderCount, $ordersGridHtml); + $this->assertIsEmptyGridMessageArrears($ordersGridHtml, $expectedOrderCount === 0); + $this->checkOrderItemsFields($orderItemsData, $ordersGridHtml); + } + + /** + * Add customer id to registry. + * + * @param int $customerId + * @return void + */ + private function registerCustomerId(int $customerId): void + { + $this->registry->unregister(RegistryConstants::CURRENT_CUSTOMER_ID); + $this->registry->register(RegistryConstants::CURRENT_CUSTOMER_ID, $customerId); + } + + /** + * Render customer orders tab. + * + * @return string + */ + private function getOrdersGridHtml(): string + { + $this->ordersGridBlock = $this->layout->createBlock(Orders::class); + + return $this->ordersGridBlock->toHtml(); + } + + /** + * Check that rendered html contains all provided order items. + * + * @param array $orderItemsData + * @param string $html + * @return void + */ + private function checkOrderItemsFields(array $orderItemsData, string $html): void + { + foreach ($orderItemsData as $itemOrder => $orderItemData) { + $this->assertViewOrderUrl($itemOrder, $orderItemData['order_id'], $html); + $this->assertReorderUrl($itemOrder, $orderItemData['order_id'], $html); + $this->assertStoreViewLabels($itemOrder, $orderItemData['store_view_labels'], $html); + unset($orderItemData['order_id'], $orderItemData['store_view_labels']); + $this->assertColumnsValues($itemOrder, $orderItemData, $html); + } + } + + /** + * Assert that field store_id contains all provided store codes. + * + * @param int $itemOrder + * @param array $storeViewLabels + * @param string $html + * @return void + */ + private function assertStoreViewLabels(int $itemOrder, array $storeViewLabels, string $html): void + { + if (empty($storeViewLabels)) { + return; + } + + $elementPaths = array_merge(self::PATHS_TO_TABLE_BODY, [ + "//tr[{$itemOrder}]", + "//td[contains(@class, 'store_id') and %s]", + ]); + $storeLabelsPaths = []; + foreach ($storeViewLabels as $labelIndex => $storeViewLabel) { + $storeLabelsPaths[] = "contains(text()[{$labelIndex}], '{$storeViewLabel}')"; + } + $checkStoreViewsXPath = sprintf(implode('', $elementPaths), implode(' and ', $storeLabelsPaths)); + $this->assertEquals( + 1, + Xpath::getElementsCountForXpath($checkStoreViewsXPath, $html), + sprintf("Some store view label not found. Labels: %s. Html: %s", implode(', ', $storeViewLabels), $html) + ); + } + + /** + * Assert that columns values as expected. + * + * @param int $itemOrder + * @param array $columnsData + * @param string $html + * @return void + */ + private function assertColumnsValues(int $itemOrder, array $columnsData, string $html): void + { + $elementPaths = array_merge(self::PATHS_TO_TABLE_BODY, [ + "//tr[{$itemOrder}]", + "//td[contains(@class, '%s') and contains(text(), '%s')]", + ]); + $elementXPathTemplate = implode('', $elementPaths); + foreach ($columnsData as $columnName => $columnValue) { + $preparedXPath = sprintf($elementXPathTemplate, $columnName, $columnValue); + $this->assertEquals( + 1, + Xpath::getElementsCountForXpath($preparedXPath, $html), + sprintf("Column %s doesn't have value %s. Html: %s", $columnName, $columnValue, $html) + ); + } + } + + /** + * Assert that rendered html contains URL to reorder by order id. + * + * @param int $itemOrder + * @param int $orderId + * @param string $html + * @return void + */ + private function assertReorderUrl(int $itemOrder, int $orderId, string $html): void + { + $urlLabel = (string)__('Reorder'); + $elementPaths = array_merge(self::PATHS_TO_TABLE_BODY, [ + "//tr[{$itemOrder}]", + "//td[contains(@class, 'action')]", + "//a[contains(@href, 'sales/order_create/reorder/order_id/$orderId') and contains(text(), '{$urlLabel}')]", + ]); + $reorderUrlXPath = implode('', $elementPaths); + $this->assertEquals( + 1, + Xpath::getElementsCountForXpath($reorderUrlXPath, $html), + sprintf('Reorder URL is not as expected. Html: %s', $html) + ); + } + + /** + * Assert that rendered html contains URL to order view by order id. + * + * @param int $itemOrder + * @param int $orderId + * @param string $html + * @return void + */ + private function assertViewOrderUrl(int $itemOrder, int $orderId, string $html): void + { + $elementPaths = array_merge(self::PATHS_TO_TABLE_BODY, [ + "//tr[{$itemOrder}][contains(@title, 'sales/order/view/order_id/{$orderId}')]", + ]); + $viewOrderUrlXPath = implode('', $elementPaths); + $this->assertEquals( + 1, + Xpath::getElementsCountForXpath($viewOrderUrlXPath, $html), + sprintf('URL to view order is not as expected. Html: %s', $html) + ); + } + + /** + * Assert that provided orders count and count in html are equals. + * + * @param int $expectedOrdersCount + * @param string $html + * @return void + */ + private function assertOrdersCount(int $expectedOrdersCount, string $html): void + { + $elementPaths = [ + "//div[contains(@data-grid-id, 'customer_orders_grid')]", + "//div[contains(@class, 'grid-header-row')]", + "//div[contains(@class, 'control-support-text')]", + sprintf("//span[contains(@id, 'grid-total-count') and contains(text(), '%s')]", $expectedOrdersCount), + ]; + $ordersCountXPath = implode('', $elementPaths); + $this->assertEquals( + 1, + Xpath::getElementsCountForXpath($ordersCountXPath, $html), + sprintf('Provided count and count in html are not equals. Html: %s', $html) + ); + } + + /** + * Assert that grid contains or not contains message "We couldn't find any records.". + * + * @param string $html + * @param bool $isMessageAppears + * @return void + */ + private function assertIsEmptyGridMessageArrears(string $html, bool $isMessageAppears = false): void + { + $gridText = (string)__("We couldn't find any records."); + $elementPaths = array_merge(self::PATHS_TO_TABLE_BODY, [ + "//tr[contains(@class, 'tr-no-data')]", + "//td[contains(@class, 'empty-text') and contains(text(), \"{$gridText}\")]", + ]); + $emptyTextXPath = implode('', $elementPaths); + $this->assertEquals( + $isMessageAppears ? 1 : 0, + Xpath::getElementsCountForXpath($emptyTextXPath, $html), + sprintf('Message "We couldn\'t find any records." not found in html. Html: %s', $html) + ); + } + + /** + * Build array with rendered orders for check that all contained data appears. + * + * @return array + */ + private function getOrderGridItemsData(): array + { + $orders = []; + $orderNumber = 1; + /** @var Document $order */ + foreach ($this->ordersGridBlock->getCollection() as $order) { + $orderGrandTotal = $this->prepareGrandTotal( + $order->getData('grand_total'), + $order->getData('order_currency_code') + ); + $orders[$orderNumber] = [ + 'order_id' => (int)$order->getData(OrderInterface::ENTITY_ID), + 'increment_id' => $order->getData(OrderInterface::INCREMENT_ID), + 'created_at' => $this->prepareCreatedAtDate($order->getData(OrderInterface::CREATED_AT)), + 'billing_name' => $order->getData('billing_name'), + 'shipping_name' => $order->getData('shipping_name'), + 'grand_total' => $orderGrandTotal, + 'store_view_labels' => $this->prepareStoreViewLabels([$order->getData(OrderInterface::STORE_ID)]), + ]; + $orderNumber++; + } + + return $orders; + } + + /** + * Normalize created at date. + * + * @param string $createdAt + * @return string + */ + private function prepareCreatedAtDate(string $createdAt): string + { + $date = new \DateTime($createdAt); + + return $this->timezone->formatDateTime($date, \IntlDateFormatter::MEDIUM, \IntlDateFormatter::MEDIUM); + } + + /** + * Normalize grand total. + * + * @param string $grandTotal + * @param string|null $orderCurrencyCode + * @return string + */ + private function prepareGrandTotal(string $grandTotal, ?string $orderCurrencyCode = null): string + { + $resultGrandTotal = sprintf("%f", (float)$grandTotal * 1.0); + $orderCurrencyCode = $orderCurrencyCode ?: + $this->scopeConfig->getValue(Currency::XML_PATH_CURRENCY_BASE, 'default'); + + return $this->currency->getCurrency($orderCurrencyCode)->toCurrency($resultGrandTotal); + } + + /** + * Normalize store ids. + * + * @param array $orderStoreIds + * @return array + */ + private function prepareStoreViewLabels(array $orderStoreIds): array + { + $result = []; + $storeStructure = $this->store->getStoresStructure(false, $orderStoreIds); + $textIndex = 0; + foreach ($storeStructure as $website) { + $textIndex++; + foreach ($website['children'] as $group) { + $textIndex++; + foreach ($group['children'] as $store) { + $textIndex++; + $result[$textIndex] = $store['label']; + } + } + } + + return $result; + } +} diff --git a/dev/tests/integration/testsuite/Magento/Customer/Block/NewsletterTest.php b/dev/tests/integration/testsuite/Magento/Customer/Block/NewsletterTest.php new file mode 100644 index 0000000000000..8778a00e81499 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Customer/Block/NewsletterTest.php @@ -0,0 +1,89 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Customer\Block; + +use Magento\Customer\Model\Session; +use Magento\Framework\ObjectManagerInterface; +use Magento\Framework\View\LayoutInterface; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\TestFramework\Helper\Xpath; +use PHPUnit\Framework\TestCase; + +/** + * Class check newsletter subscription block behavior + * + * @see \Magento\Customer\Block\Newsletter + * @magentoAppArea frontend + * @magentoDbIsolation enabled + * @magentoDataFixture Magento/Customer/_files/customer.php + */ +class NewsletterTest extends TestCase +{ + private const LABEL_XPATH = "//form[contains(@class, 'form-newsletter-manage')]" + . "//span[contains(text(), 'Subscription option')]"; + private const CHECKBOX_XPATH = "//form[contains(@class, 'form-newsletter-manage')]" + . "//input[@type='checkbox' and @name='is_subscribed']"; + private const CHECKBOX_TITLE_XPATH = "//form[contains(@class, 'form-newsletter-manage')]" + . "//label/span[contains(text(), 'General Subscription')]"; + private const SAVE_BUTTON_XPATH = "//form[contains(@class, 'form-newsletter-manage')]" + . "//button[@type='submit']/span[contains(text(), 'Save')]"; + + /** @var ObjectManagerInterface */ + private $objectManager; + + /** @var LayoutInterface */ + private $layout; + + /** @var Newsletter */ + private $block; + + /** @var Session */ + private $customerSession; + + /** + * @inheritdoc + */ + protected function setUp() + { + parent::setUp(); + + $this->objectManager = Bootstrap::getObjectManager(); + $this->layout = $this->objectManager->get(LayoutInterface::class); + $this->block = $this->layout->createBlock(Newsletter::class); + $this->customerSession = $this->objectManager->get(Session::class); + } + + /** + * @return void + */ + public function testSubscriptionCheckbox(): void + { + $this->customerSession->loginById(1); + $html = $this->block->toHtml(); + $this->assertEquals( + 1, + Xpath::getElementsCountForXpath(self::LABEL_XPATH, $html), + 'Subscription label is not present on the page' + ); + $this->assertEquals( + 1, + Xpath::getElementsCountForXpath(self::CHECKBOX_XPATH, $html), + 'Subscription checkbox is not present on the page' + ); + $this->assertEquals( + 1, + Xpath::getElementsCountForXpath(self::CHECKBOX_TITLE_XPATH, $html), + 'Subscription checkbox label is not present on the page' + ); + $this->assertEquals( + 1, + Xpath::getElementsCountForXpath(self::SAVE_BUTTON_XPATH, $html), + 'Subscription save button is not present on the page' + ); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Customer/Controller/Address/Delete/DeleteAddressTest.php b/dev/tests/integration/testsuite/Magento/Customer/Controller/Address/Delete/DeleteAddressTest.php new file mode 100644 index 0000000000000..86a443d7aa3e1 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Customer/Controller/Address/Delete/DeleteAddressTest.php @@ -0,0 +1,217 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Customer\Controller\Address\Delete; + +use Magento\Customer\Api\AddressRepositoryInterface; +use Magento\Customer\Api\CustomerRepositoryInterface; +use Magento\Customer\Api\Data\AddressInterface; +use Magento\Customer\Model\Session; +use Magento\Framework\App\Request\Http; +use Magento\Framework\Escaper; +use Magento\Framework\Exception\LocalizedException; +use Magento\Framework\Message\MessageInterface; +use Magento\TestFramework\TestCase\AbstractController; + +/** + * Test cases related to check that customer address correctly deleted on frontend + * or wasn't deleted and proper error message appears. + * + * @magentoAppArea frontend + * @magentoDbIsolation enabled + * + * @see \Magento\Customer\Controller\Address\Delete::execute + */ +class DeleteAddressTest extends AbstractController +{ + /** + * @var Escaper + */ + private $escaper; + + /** + * @var Session + */ + private $customerSession; + + /** + * @var AddressRepositoryInterface + */ + private $addressRepository; + + /** + * @var CustomerRepositoryInterface + */ + private $customerRepository; + + /** + * @inheritdoc + */ + protected function setUp() + { + parent::setUp(); + $this->escaper = $this->_objectManager->get(Escaper::class); + $this->customerSession = $this->_objectManager->get(Session::class); + $this->addressRepository = $this->_objectManager->get(AddressRepositoryInterface::class); + $this->customerRepository = $this->_objectManager->get(CustomerRepositoryInterface::class); + } + + /** + * Assert that customer address deleted successfully. + * + * @magentoDataFixture Magento/Customer/_files/customer.php + * @magentoDataFixture Magento/Customer/_files/customer_address.php + * + * @return void + */ + public function testSuccessDeleteExistCustomerAddress(): void + { + $customer = $this->customerRepository->get('customer@example.com'); + $customerAddresses = $customer->getAddresses() ?? []; + $this->assertCount(1, $customerAddresses); + /** @var AddressInterface $currentCustomerAddress */ + $currentCustomerAddress = reset($customerAddresses); + $this->customerSession->setCustomerId($customer->getId()); + $this->performAddressDeleteRequest((int)$currentCustomerAddress->getId()); + $this->checkRequestPerformedSuccessfully(); + $customer = $this->customerRepository->get('customer@example.com'); + $this->assertCount(0, $customer->getAddresses() ?? []); + try { + $this->addressRepository->getById((int)$currentCustomerAddress->getId()); + $this->fail('Customer address is not deleted.'); + } catch (LocalizedException $e) { + //Do nothing, this block mean that address deleted successfully from DB. + } + } + + /** + * Check that customer address will not be deleted if we don't pass address ID parameter. + * + * @magentoDataFixture Magento/Customer/_files/customer.php + * @magentoDataFixture Magento/Customer/_files/customer_address.php + * + * @return void + */ + public function testDeleteWithoutParam(): void + { + $customer = $this->customerRepository->get('customer@example.com'); + $customerAddresses = $customer->getAddresses() ?? []; + $this->assertCount(1, $customerAddresses); + /** @var AddressInterface $currentCustomerAddress */ + $currentCustomerAddress = reset($customerAddresses); + $this->customerSession->setCustomerId($customer->getId()); + $this->performAddressDeleteRequest(); + $this->assertRedirect($this->stringContains('customer/address/index')); + $customer = $this->customerRepository->get('customer@example.com'); + $this->assertCount(1, $customer->getAddresses() ?? []); + $this->checkAddressWasntDeleted((int)$currentCustomerAddress->getId()); + } + + /** + * Check that customer address will not be deleted if customer id in address and in session are not equals. + * + * @magentoDataFixture Magento/Customer/_files/customer.php + * @magentoDataFixture Magento/Customer/_files/customer_address.php + * @magentoDataFixture Magento/Customer/_files/customer_with_uk_address.php + * + * @return void + */ + public function testDeleteDifferentCustomerAddress(): void + { + $firstCustomer = $this->customerRepository->get('customer@example.com'); + $customerAddresses = $firstCustomer->getAddresses() ?? []; + $this->assertCount(1, $customerAddresses); + /** @var AddressInterface $currentCustomerAddress */ + $currentCustomerAddress = reset($customerAddresses); + $this->customerSession->setCustomerId('1'); + $secondCustomer = $this->customerRepository->get('customer_uk_address@test.com'); + $secondCustomerAddresses = $secondCustomer->getAddresses() ?? []; + /** @var AddressInterface $secondCustomerAddress */ + $secondCustomerAddress = reset($secondCustomerAddresses); + $this->performAddressDeleteRequest((int)$secondCustomerAddress->getId()); + $this->checkRequestPerformedWithError(true); + $firstCustomer = $this->customerRepository->get('customer@example.com'); + $this->assertCount(1, $firstCustomer->getAddresses() ?? []); + $this->checkAddressWasntDeleted((int)$currentCustomerAddress->getId()); + } + + /** + * Check that error message appear if we try to delete non-exits address. + * + * @magentoDataFixture Magento/Customer/_files/customer.php + * + * @return void + */ + public function testDeleteNonExistAddress(): void + { + $customer = $this->customerRepository->get('customer@example.com'); + $this->customerSession->setCustomerId($customer->getId()); + $this->performAddressDeleteRequest(999); + $this->checkRequestPerformedWithError(); + } + + /** + * Perform delete request by provided address id. + * + * @param int|null $processAddressId + * @return void + */ + private function performAddressDeleteRequest(?int $processAddressId = null): void + { + $this->getRequest()->setMethod(Http::METHOD_POST); + if (null !== $processAddressId) { + $this->getRequest()->setPostValue(['id' => $processAddressId]); + } + $this->dispatch('customer/address/delete'); + } + + /** + * Check that delete address request performed successfully + * (proper success message and redirect to customer/address/index are appear). + * + * @return void + */ + private function checkRequestPerformedSuccessfully(): void + { + $this->assertRedirect($this->stringContains('customer/address/index')); + $this->assertSessionMessages( + $this->equalTo([(string)__('You deleted the address.')]), + MessageInterface::TYPE_SUCCESS + ); + } + + /** + * Check that delete address request performed with error. + * (proper error messages and redirect to customer/address/edit are appear). + * + * @param bool $isNeedEscapeMessage + * @return void + */ + private function checkRequestPerformedWithError(bool $isNeedEscapeMessage = false): void + { + $message = (string)__("We can't delete the address right now."); + if ($isNeedEscapeMessage) { + $message = $this->escaper->escapeHtml($message); + } + $this->assertSessionMessages($this->contains($message), MessageInterface::TYPE_ERROR); + } + + /** + * Assert that customer address wasn't deleted. + * + * @param int $addressId + * @return void + */ + private function checkAddressWasntDeleted(int $addressId): void + { + try { + $this->addressRepository->getById($addressId); + } catch (LocalizedException $e) { + $this->fail('Expects that customer address will not be deleted.'); + } + } +} diff --git a/dev/tests/integration/testsuite/Magento/Customer/Controller/Address/FormPost/CreateAddressTest.php b/dev/tests/integration/testsuite/Magento/Customer/Controller/Address/FormPost/CreateAddressTest.php new file mode 100644 index 0000000000000..1e152008043a7 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Customer/Controller/Address/FormPost/CreateAddressTest.php @@ -0,0 +1,391 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Customer\Controller\Address\FormPost; + +use Magento\Customer\Api\CustomerRepositoryInterface; +use Magento\Customer\Api\Data\AddressInterface; +use Magento\Customer\Api\Data\RegionInterface; +use Magento\Customer\Model\CustomerRegistry; +use Magento\Customer\Model\Session; +use Magento\Framework\App\Request\Http; +use Magento\Framework\Escaper; +use Magento\Framework\Message\MessageInterface; +use Magento\TestFramework\Directory\Model\GetRegionIdByName; +use Magento\TestFramework\TestCase\AbstractController; + +/** + * Test cases related to check that customer address correctly created from + * customer account page on frontend or wasn't create and proper error message appears. + * + * @magentoDataFixture Magento/Customer/_files/customer_no_address.php + * + * @magentoAppArea frontend + * @magentoDbIsolation enabled + * + * @see \Magento\Customer\Controller\Address\FormPost::execute + */ +class CreateAddressTest extends AbstractController +{ + /** + * POST static data for create customer address via controller on frontend. + */ + private const STATIC_POST_ADDRESS_DATA = [ + AddressInterface::TELEPHONE => '+380505282812', + AddressInterface::POSTCODE => 75477, + AddressInterface::COUNTRY_ID => 'US', + 'custom_region_name' => 'Alabama', + AddressInterface::CITY => 'CityM', + AddressInterface::STREET => [ + 'Green str, 67', + ], + AddressInterface::FIRSTNAME => 'John', + AddressInterface::LASTNAME => 'Smith', + ]; + + /** + * @var Escaper + */ + private $escaper; + + /** + * @var Session + */ + private $customerSession; + + /** + * @var CustomerRegistry + */ + private $customerRegistry; + + /** + * @var GetRegionIdByName + */ + private $getRegionIdByName; + + /** + * @var CustomerRepositoryInterface + */ + private $customerRepository; + + /** + * @inheritdoc + */ + protected function setUp() + { + parent::setUp(); + $this->escaper = $this->_objectManager->get(Escaper::class); + $this->customerSession = $this->_objectManager->get(Session::class); + $this->customerRegistry = $this->_objectManager->get(CustomerRegistry::class); + $this->getRegionIdByName = $this->_objectManager->get(GetRegionIdByName::class); + $this->customerRepository = $this->_objectManager->get(CustomerRepositoryInterface::class); + $this->customerSession->setCustomerId('5'); + } + + /** + * @inheritdoc + */ + protected function tearDown() + { + $this->customerSession->setCustomerId(null); + $this->customerRegistry->removeByEmail('customer5@example.com'); + parent::tearDown(); + } + + /** + * Assert that default or non-default customer address successfully created via controller on frontend. + * + * @dataProvider postDataForSuccessCreateDefaultAddressDataProvider + * + * @param array $postData + * @param bool $isShippingDefault + * @param bool $isBillingDefault + * @return void + */ + public function testAddressSuccessfullyCreatedAsDefaultForCustomer( + array $postData, + bool $isShippingDefault, + bool $isBillingDefault + ): void { + $customer = $this->customerRepository->get('customer5@example.com'); + $this->assertNull($customer->getDefaultShipping(), 'Customer already have default shipping address'); + $this->assertNull($customer->getDefaultBilling(), 'Customer already have default billing address'); + $this->assertEmpty($customer->getAddresses(), 'Customer already has address'); + $this->performRequestWithData($postData); + $this->checkRequestPerformedSuccessfully(); + $customer = $this->customerRepository->get('customer5@example.com'); + $customerAddresses = $customer->getAddresses(); + $this->assertCount(1, $customerAddresses); + /** @var AddressInterface $address */ + $address = reset($customerAddresses); + $expectedShippingId = $isShippingDefault ? $address->getId() : null; + $expectedBillingId = $isBillingDefault ? $address->getId() : null; + $this->assertEquals($expectedShippingId, $customer->getDefaultShipping()); + $this->assertEquals($expectedBillingId, $customer->getDefaultBilling()); + } + + /** + * Data provider which contain proper POST data for create default or non-default customer address. + * + * @return array + */ + public function postDataForSuccessCreateDefaultAddressDataProvider(): array + { + return [ + 'any_addresses_are_default' => [ + array_merge( + self::STATIC_POST_ADDRESS_DATA, + [AddressInterface::DEFAULT_SHIPPING => 0, AddressInterface::DEFAULT_BILLING => 0] + ), + false, + false, + ], + 'shipping_address_is_default' => [ + array_merge( + self::STATIC_POST_ADDRESS_DATA, + [AddressInterface::DEFAULT_SHIPPING => 1, AddressInterface::DEFAULT_BILLING => 0] + ), + true, + false, + ], + 'billing_address_is_default' => [ + array_merge( + self::STATIC_POST_ADDRESS_DATA, + [AddressInterface::DEFAULT_SHIPPING => 0, AddressInterface::DEFAULT_BILLING => 1] + ), + false, + true, + ], + 'all_addresses_are_default' => [ + array_merge( + self::STATIC_POST_ADDRESS_DATA, + [AddressInterface::DEFAULT_SHIPPING => 1, AddressInterface::DEFAULT_BILLING => 1] + ), + true, + true, + ], + ]; + } + + /** + * Assert that customer address successfully created via controller on frontend. + * + * @dataProvider postDataForSuccessCreateAddressDataProvider + * + * @param array $postData + * @param array $expectedData + * @return void + */ + public function testAddressSuccessfullyCreatedForCustomer(array $postData, array $expectedData): void + { + if (isset($expectedData['custom_region_name'])) { + $expectedData[AddressInterface::REGION_ID] = $this->getRegionIdByName->execute( + $expectedData['custom_region_name'], + $expectedData[AddressInterface::COUNTRY_ID] + ); + unset($expectedData['custom_region_name']); + } + $this->performRequestWithData($postData); + $this->checkRequestPerformedSuccessfully(); + $customer = $this->customerRepository->get('customer5@example.com'); + $customerAddresses = $customer->getAddresses(); + $this->assertCount(1, $customerAddresses); + /** @var AddressInterface $address */ + $address = reset($customerAddresses); + $createdAddressData = $address->__toArray(); + foreach ($expectedData as $fieldCode => $expectedValue) { + $this->assertArrayHasKey($fieldCode, $createdAddressData, "Field $fieldCode wasn't found."); + $this->assertEquals($expectedValue, $createdAddressData[$fieldCode]); + } + } + + /** + * Data provider which contain proper POST data for create customer address. + * + * @return array + */ + public function postDataForSuccessCreateAddressDataProvider(): array + { + return [ + 'required_fields_valid_data' => [ + self::STATIC_POST_ADDRESS_DATA, + [ + AddressInterface::TELEPHONE => '+380505282812', + AddressInterface::COUNTRY_ID => 'US', + AddressInterface::POSTCODE => 75477, + 'custom_region_name' => 'Alabama', + AddressInterface::FIRSTNAME => 'John', + AddressInterface::LASTNAME => 'Smith', + AddressInterface::STREET => ['Green str, 67'], + AddressInterface::CITY => 'CityM', + ], + ], + 'required_field_empty_postcode_for_uk' => [ + array_replace( + self::STATIC_POST_ADDRESS_DATA, + [AddressInterface::POSTCODE => '', AddressInterface::COUNTRY_ID => 'GB'] + ), + [ + AddressInterface::COUNTRY_ID => 'GB', + AddressInterface::POSTCODE => null, + ], + ], + 'required_field_empty_region_id_for_ua' => [ + array_replace( + self::STATIC_POST_ADDRESS_DATA, + [AddressInterface::REGION_ID => '', AddressInterface::COUNTRY_ID => 'UA'] + ), + [ + AddressInterface::COUNTRY_ID => 'UA', + AddressInterface::REGION => [ + RegionInterface::REGION => null, + RegionInterface::REGION_CODE => null, + RegionInterface::REGION_ID => 0, + ], + ], + ], + 'required_field_street_as_array' => [ + array_replace(self::STATIC_POST_ADDRESS_DATA, [AddressInterface::STREET => ['', 'Green str, 67']]), + [AddressInterface::STREET => ['Green str, 67']], + ], + 'field_company_name' => [ + array_merge(self::STATIC_POST_ADDRESS_DATA, [AddressInterface::COMPANY => 'My company']), + [AddressInterface::COMPANY => 'My company'], + ], + 'field_vat_number' => [ + array_merge(self::STATIC_POST_ADDRESS_DATA, [AddressInterface::VAT_ID => 'My VAT number']), + [AddressInterface::VAT_ID => 'My VAT number'], + ], + ]; + } + + /** + * Assert that customer address wasn't created via controller on frontend + * when POST data broken. + * + * @dataProvider postDataForCreateAddressWithErrorDataProvider + * + * @param array $postData + * @param array $expectedSessionMessages + * @return void + */ + public function testAddressWasntCreatedForCustomer(array $postData, array $expectedSessionMessages): void + { + $this->performRequestWithData($postData); + $this->checkRequestPerformedWithInputValidationErrors($expectedSessionMessages); + } + + /** + * Data provider which contain broken POST data for create customer address with error. + * + * @return array + */ + public function postDataForCreateAddressWithErrorDataProvider(): array + { + return [ + 'empty_post_data' => [ + [], + [ + 'One or more input exceptions have occurred.', + '"firstname" is required. Enter and try again.', + '"lastname" is required. Enter and try again.', + '"street" is required. Enter and try again.', + '"city" is required. Enter and try again.', + '"telephone" is required. Enter and try again.', + '"postcode" is required. Enter and try again.', + '"countryId" is required. Enter and try again.', + ] + ], + 'required_field_empty_telephone' => [ + array_replace(self::STATIC_POST_ADDRESS_DATA, [AddressInterface::TELEPHONE => '']), + ['"telephone" is required. Enter and try again.'], + ], + 'required_field_empty_postcode_for_us' => [ + array_replace(self::STATIC_POST_ADDRESS_DATA, [AddressInterface::POSTCODE => '']), + ['"postcode" is required. Enter and try again.'], + ], +// TODO: Uncomment this variation after fix issue https://jira.corp.magento.com/browse/MC-31031 +// 'required_field_empty_region_id_for_us' => [ +// array_replace(self::STATIC_POST_ADDRESS_DATA, [AddressInterface::REGION_ID => '']), +// ['"regionId" is required. Enter and try again.'], +// ], + 'required_field_empty_firstname' => [ + array_replace(self::STATIC_POST_ADDRESS_DATA, [AddressInterface::FIRSTNAME => '']), + ['"firstname" is required. Enter and try again.'], + ], + 'required_field_empty_lastname' => [ + array_replace(self::STATIC_POST_ADDRESS_DATA, [AddressInterface::LASTNAME => '']), + ['"lastname" is required. Enter and try again.'], + ], + 'required_field_empty_street_as_string' => [ + array_replace(self::STATIC_POST_ADDRESS_DATA, [AddressInterface::STREET => '']), + ['"street" is required. Enter and try again.'], + ], + 'required_field_empty_street_as_array' => [ + array_replace(self::STATIC_POST_ADDRESS_DATA, [AddressInterface::STREET => []]), + ['"street" is required. Enter and try again.'], + ], + 'required_field_empty_city' => [ + array_replace(self::STATIC_POST_ADDRESS_DATA, [AddressInterface::CITY => '']), + ['"city" is required. Enter and try again.'], + ], + ]; + } + + /** + * Perform request with provided POST data. + * + * @param array $postData + * @return void + */ + private function performRequestWithData(array $postData): void + { + if (isset($postData['custom_region_name'])) { + $postData[AddressInterface::REGION_ID] = $this->getRegionIdByName->execute( + $postData['custom_region_name'], + $postData[AddressInterface::COUNTRY_ID] + ); + unset($postData['custom_region_name']); + } + + $this->getRequest()->setPostValue($postData)->setMethod(Http::METHOD_POST); + $this->dispatch('customer/address/formPost'); + } + + /** + * Check that save address request performed successfully + * (proper success message and redirect to customer/address/index are appear). + * + * @return void + */ + private function checkRequestPerformedSuccessfully(): void + { + $this->assertRedirect($this->stringContains('customer/address/index')); + $this->assertSessionMessages( + $this->equalTo([(string)__('You saved the address.')]), + MessageInterface::TYPE_SUCCESS + ); + } + + /** + * Check that save address request performed with input validation errors + * (proper error messages and redirect to customer/address/edit are appear). + * + * @param array $expectedSessionMessages + * @return void + */ + private function checkRequestPerformedWithInputValidationErrors(array $expectedSessionMessages): void + { + $this->assertRedirect($this->stringContains('customer/address/edit')); + foreach ($expectedSessionMessages as $expectedMessage) { + $this->assertSessionMessages( + $this->contains($this->escaper->escapeHtml((string)__($expectedMessage))), + MessageInterface::TYPE_ERROR + ); + } + } +} diff --git a/dev/tests/integration/testsuite/Magento/Customer/Controller/Address/FormPost/UpdateAddressTest.php b/dev/tests/integration/testsuite/Magento/Customer/Controller/Address/FormPost/UpdateAddressTest.php new file mode 100644 index 0000000000000..fb18cc45511c8 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Customer/Controller/Address/FormPost/UpdateAddressTest.php @@ -0,0 +1,403 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Customer\Controller\Address\FormPost; + +use Magento\Customer\Api\CustomerRepositoryInterface; +use Magento\Customer\Api\Data\AddressInterface; +use Magento\Customer\Api\Data\RegionInterface; +use Magento\Customer\Model\AddressRegistry; +use Magento\Customer\Model\CustomerRegistry; +use Magento\Customer\Model\Session; +use Magento\Framework\App\Request\Http; +use Magento\Framework\Escaper; +use Magento\Framework\Message\MessageInterface; +use Magento\TestFramework\Directory\Model\GetRegionIdByName; +use Magento\TestFramework\TestCase\AbstractController; + +/** + * Test cases related to check that customer address correctly updated from + * customer account page on frontend or wasn't updated and proper error message appears. + * + * @magentoDataFixture Magento/Customer/_files/customer.php + * @magentoDataFixture Magento/Customer/_files/customer_address.php + * + * @magentoAppArea frontend + * @magentoDbIsolation enabled + * + * @see \Magento\Customer\Controller\Address\FormPost::execute + */ +class UpdateAddressTest extends AbstractController +{ + /** + * POST static data for update customer address via controller on frontend. + */ + private const STATIC_POST_ADDRESS_DATA = [ + AddressInterface::TELEPHONE => 9548642, + AddressInterface::POSTCODE => 95556, + AddressInterface::COUNTRY_ID => 'US', + 'custom_region_name' => 'Arkansas', + AddressInterface::CITY => 'Mukachevo', + AddressInterface::STREET => [ + 'Yellow str, 228', + ], + AddressInterface::FIRSTNAME => 'Foma', + AddressInterface::LASTNAME => 'Kiniaev', + ]; + + /** + * @var Escaper + */ + private $escaper; + + /** + * @var Session + */ + private $customerSession; + + /** + * @var AddressRegistry + */ + private $addressRegistry; + + /** + * @var CustomerRegistry + */ + private $customerRegistry; + + /** + * @var GetRegionIdByName + */ + private $getRegionIdByName; + + /** + * @var CustomerRepositoryInterface + */ + private $customerRepository; + + /** + * @var array + */ + private $processedAddressesIds = []; + + /** + * @inheritdoc + */ + protected function setUp() + { + parent::setUp(); + $this->escaper = $this->_objectManager->get(Escaper::class); + $this->customerSession = $this->_objectManager->get(Session::class); + $this->addressRegistry = $this->_objectManager->get(AddressRegistry::class); + $this->customerRegistry = $this->_objectManager->get(CustomerRegistry::class); + $this->getRegionIdByName = $this->_objectManager->get(GetRegionIdByName::class); + $this->customerRepository = $this->_objectManager->get(CustomerRepositoryInterface::class); + $this->customerSession->setCustomerId('1'); + $this->processedAddressesIds[] = 1; + } + + /** + * @inheritdoc + */ + protected function tearDown() + { + $this->customerSession->setCustomerId(null); + $this->customerRegistry->removeByEmail('customer@example.com'); + foreach ($this->processedAddressesIds as $addressesId) { + $this->addressRegistry->remove($addressesId); + } + parent::tearDown(); + } + + /** + * Assert that default customer address successfully changed via controller on frontend. + * + * @magentoDataFixture Magento/Customer/_files/customer.php + * @magentoDataFixture Magento/Customer/_files/customer_two_addresses.php + * + * @dataProvider postDataForSuccessCreateDefaultAddressDataProvider + * + * @param array $postData + * @param int $expectedShippingId + * @param int $expectedBillingId + * @return void + */ + public function testAddressSuccessfullyCreatedAsDefaultForCustomer( + array $postData, + int $expectedShippingId, + int $expectedBillingId + ): void { + $this->processedAddressesIds = [1, 2]; + $customer = $this->customerRepository->get('customer@example.com'); + $this->assertEquals(1, $customer->getDefaultShipping(), "Customer doesn't have shipping address"); + $this->assertEquals(1, $customer->getDefaultBilling(), "Customer doesn't have billing address"); + $this->performRequestWithData($postData, 2); + $this->checkRequestPerformedSuccessfully(); + $customer = $this->customerRepository->get('customer@example.com'); + $this->assertEquals($expectedShippingId, $customer->getDefaultShipping()); + $this->assertEquals($expectedBillingId, $customer->getDefaultBilling()); + } + + /** + * Data provider which contain proper POST data for change default customer address. + * + * @return array + */ + public function postDataForSuccessCreateDefaultAddressDataProvider(): array + { + return [ + 'any_addresses_are_default' => [ + array_merge( + self::STATIC_POST_ADDRESS_DATA, + [AddressInterface::DEFAULT_SHIPPING => 2, AddressInterface::DEFAULT_BILLING => 2] + ), + 2, + 2, + ], + 'shipping_address_is_default' => [ + array_merge( + self::STATIC_POST_ADDRESS_DATA, + [AddressInterface::DEFAULT_BILLING => 2] + ), + 1, + 2, + ], + 'billing_address_is_default' => [ + array_merge( + self::STATIC_POST_ADDRESS_DATA, + [AddressInterface::DEFAULT_SHIPPING => 2] + ), + 2, + 1, + ], + ]; + } + + /** + * Assert that customer address successfully updated via controller on frontend. + * + * @dataProvider postDataForSuccessUpdateAddressDataProvider + * + * @param array $postData + * @param array $expectedData + * @return void + */ + public function testAddressSuccessfullyUpdatedForCustomer(array $postData, array $expectedData): void + { + if (isset($expectedData['custom_region_name'])) { + $expectedData[AddressInterface::REGION_ID] = $this->getRegionIdByName->execute( + $expectedData['custom_region_name'], + $expectedData[AddressInterface::COUNTRY_ID] + ); + unset($expectedData['custom_region_name']); + } + $this->performRequestWithData($postData, 1); + $this->checkRequestPerformedSuccessfully(); + $customer = $this->customerRepository->get('customer@example.com'); + $customerAddresses = $customer->getAddresses(); + $this->assertCount(1, $customerAddresses); + /** @var AddressInterface $address */ + $address = reset($customerAddresses); + $createdAddressData = $address->__toArray(); + foreach ($expectedData as $fieldCode => $expectedValue) { + if (null === $expectedValue) { + $this->assertArrayNotHasKey($fieldCode, $createdAddressData); + continue; + } + $this->assertArrayHasKey($fieldCode, $createdAddressData, "Field $fieldCode wasn't found."); + $this->assertEquals($expectedValue, $createdAddressData[$fieldCode]); + } + } + + /** + * Data provider which contain proper POST data for update customer address. + * + * @return array + */ + public function postDataForSuccessUpdateAddressDataProvider(): array + { + return [ + 'required_fields_valid_data' => [ + self::STATIC_POST_ADDRESS_DATA, + [ + AddressInterface::TELEPHONE => 9548642, + AddressInterface::COUNTRY_ID => 'US', + AddressInterface::POSTCODE => 95556, + 'custom_region_name' => 'Arkansas', + AddressInterface::FIRSTNAME => 'Foma', + AddressInterface::LASTNAME => 'Kiniaev', + AddressInterface::STREET => ['Yellow str, 228'], + AddressInterface::CITY => 'Mukachevo', + ], + ], + 'required_field_empty_postcode_for_uk' => [ + array_replace( + self::STATIC_POST_ADDRESS_DATA, + [AddressInterface::POSTCODE => '', AddressInterface::COUNTRY_ID => 'GB'] + ), + [ + AddressInterface::COUNTRY_ID => 'GB', + AddressInterface::POSTCODE => null, + ], + ], + 'required_field_empty_region_id_for_ua' => [ + array_replace( + self::STATIC_POST_ADDRESS_DATA, + [AddressInterface::REGION_ID => '', AddressInterface::COUNTRY_ID => 'UA'] + ), + [ + AddressInterface::COUNTRY_ID => 'UA', + AddressInterface::REGION => [ + RegionInterface::REGION => null, + RegionInterface::REGION_CODE => null, + RegionInterface::REGION_ID => 0, + ], + ], + ], + 'required_field_street_as_array' => [ + array_replace(self::STATIC_POST_ADDRESS_DATA, [AddressInterface::STREET => ['', 'Green str, 67']]), + [AddressInterface::STREET => ['Green str, 67']], + ], + 'field_company_name' => [ + array_merge(self::STATIC_POST_ADDRESS_DATA, [AddressInterface::COMPANY => 'My company']), + [AddressInterface::COMPANY => 'My company'], + ], + 'field_vat_number' => [ + array_merge(self::STATIC_POST_ADDRESS_DATA, [AddressInterface::VAT_ID => 'My VAT number']), + [AddressInterface::VAT_ID => 'My VAT number'], + ], + ]; + } + + /** + * Assert that customer address wasn't updated via controller on frontend + * when POST data broken. + * + * @dataProvider postDataForUpdateAddressWithErrorDataProvider + * + * @param array $postData + * @param array $expectedSessionMessages + * @return void + */ + public function testAddressWasntUpdatedForCustomer(array $postData, array $expectedSessionMessages): void + { + $this->performRequestWithData($postData, 1); + $this->checkRequestPerformedWithInputValidationErrors($expectedSessionMessages); + } + + /** + * Data provider which contain broken POST data for update customer address with error. + * + * @return array + */ + public function postDataForUpdateAddressWithErrorDataProvider(): array + { + return [ + 'empty_post_data' => [ + [], + [ + 'One or more input exceptions have occurred.', + '"firstname" is required. Enter and try again.', + '"lastname" is required. Enter and try again.', + '"street" is required. Enter and try again.', + '"city" is required. Enter and try again.', + '"telephone" is required. Enter and try again.', + '"postcode" is required. Enter and try again.', + '"countryId" is required. Enter and try again.', + ] + ], + 'required_field_empty_telephone' => [ + array_replace(self::STATIC_POST_ADDRESS_DATA, [AddressInterface::TELEPHONE => '']), + ['"telephone" is required. Enter and try again.'], + ], + 'required_field_empty_postcode_for_us' => [ + array_replace(self::STATIC_POST_ADDRESS_DATA, [AddressInterface::POSTCODE => '']), + ['"postcode" is required. Enter and try again.'], + ], +// TODO: Uncomment this variation after fix issue https://jira.corp.magento.com/browse/MC-31031 +// 'required_field_empty_region_id_for_us' => [ +// array_replace(self::STATIC_POST_ADDRESS_DATA, [AddressInterface::REGION_ID => '']), +// ['"regionId" is required. Enter and try again.'], +// ], + 'required_field_empty_firstname' => [ + array_replace(self::STATIC_POST_ADDRESS_DATA, [AddressInterface::FIRSTNAME => '']), + ['"firstname" is required. Enter and try again.'], + ], + 'required_field_empty_lastname' => [ + array_replace(self::STATIC_POST_ADDRESS_DATA, [AddressInterface::LASTNAME => '']), + ['"lastname" is required. Enter and try again.'], + ], + 'required_field_empty_street_as_string' => [ + array_replace(self::STATIC_POST_ADDRESS_DATA, [AddressInterface::STREET => '']), + ['"street" is required. Enter and try again.'], + ], + 'required_field_empty_street_as_array' => [ + array_replace(self::STATIC_POST_ADDRESS_DATA, [AddressInterface::STREET => []]), + ['"street" is required. Enter and try again.'], + ], + 'required_field_empty_city' => [ + array_replace(self::STATIC_POST_ADDRESS_DATA, [AddressInterface::CITY => '']), + ['"city" is required. Enter and try again.'], + ], + ]; + } + + /** + * Perform request with provided POST data. + * + * @param array $postData + * @param int $processAddressId + * @return void + */ + private function performRequestWithData(array $postData, int $processAddressId): void + { + $postData[AddressInterface::ID] = $processAddressId; + if (isset($postData['custom_region_name'])) { + $postData[AddressInterface::REGION_ID] = $this->getRegionIdByName->execute( + $postData['custom_region_name'], + $postData[AddressInterface::COUNTRY_ID] + ); + unset($postData['custom_region_name']); + } + + $this->getRequest()->setPostValue($postData)->setMethod(Http::METHOD_POST); + $this->dispatch('customer/address/formPost'); + } + + /** + * Check that save address request performed successfully + * (proper success message and redirect to customer/address/index are appear). + * + * @return void + */ + private function checkRequestPerformedSuccessfully(): void + { + $this->assertRedirect($this->stringContains('customer/address/index')); + $this->assertSessionMessages( + $this->equalTo([(string)__('You saved the address.')]), + MessageInterface::TYPE_SUCCESS + ); + } + + /** + * Check that save address request performed with input validation errors + * (proper error messages and redirect to customer/address/edit are appear). + * + * @param array $expectedSessionMessages + * @return void + */ + private function checkRequestPerformedWithInputValidationErrors(array $expectedSessionMessages): void + { + $this->assertRedirect($this->stringContains('customer/address/edit')); + foreach ($expectedSessionMessages as $expectedMessage) { + $this->assertSessionMessages( + $this->contains($this->escaper->escapeHtml((string)__($expectedMessage))), + MessageInterface::TYPE_ERROR + ); + } + } +} diff --git a/dev/tests/integration/testsuite/Magento/Customer/Controller/Section/LoadTest.php b/dev/tests/integration/testsuite/Magento/Customer/Controller/Section/LoadTest.php index 3db22b8379850..0869832091fec 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Controller/Section/LoadTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Controller/Section/LoadTest.php @@ -3,19 +3,104 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace Magento\Customer\Controller\Section; -class LoadTest extends \Magento\TestFramework\TestCase\AbstractController +use Magento\Customer\Model\Session; +use Magento\Framework\App\Request\Http as HttpRequest; +use Magento\Framework\Serialize\SerializerInterface; +use Magento\TestFramework\TestCase\AbstractController; +use Magento\Framework\Escaper; + +/** + * Load customer data test class. + * + * @magentoDbIsolation enabled + * @magentoAppArea frontend + */ +class LoadTest extends AbstractController { - public function testLoadInvalidSection() + /** @var Session */ + private $customerSession; + + /** @var SerializerInterface */ + private $json; + + /** @var Escaper */ + private $escaper; + + /** + * @inheritdoc + */ + protected function setUp() + { + parent::setUp(); + + $this->customerSession = $this->_objectManager->get(Session::class); + $this->json = $this->_objectManager->get(SerializerInterface::class); + $this->escaper = $this->_objectManager->get(Escaper::class); + } + + /** + * @inheritdoc + */ + protected function tearDown() + { + $this->customerSession->setCustomerId(null); + + parent::tearDown(); + } + + /** + * @return void + */ + public function testLoadInvalidSection(): void { - $expected = [ - 'message' => 'The "section<invalid" section source isn't supported.', - ]; + $message = $this->escaper->escapeHtml('The "section<invalid" section source isn\'t supported.'); + $expected = ['message' => $message]; $this->dispatch( '/customer/section/load/?sections=section<invalid&force_new_section_timestamp=false&_=147066166394' ); - self::assertEquals(json_encode($expected), $this->getResponse()->getBody()); + $this->assertEquals($this->json->serialize($expected), $this->getResponse()->getBody()); + } + + /** + * @magentoConfigFixture current_store wishlist/wishlist_link/use_qty 1 + * @magentoDataFixture Magento/Wishlist/_files/wishlist_with_product_qty_three.php + * + * @return void + */ + public function testWishListCounterUseQty(): void + { + $this->customerSession->setCustomerId(1); + $response = $this->performWishListSectionRequest(); + $this->assertEquals('3 items', $response['wishlist']['counter']); + } + + /** + * @magentoConfigFixture current_store wishlist/wishlist_link/use_qty 0 + * @magentoDataFixture Magento/Wishlist/_files/wishlist_with_product_qty_three.php + * + * @return void + */ + public function testWishListCounterNotUseQty(): void + { + $this->customerSession->setCustomerId(1); + $response = $this->performWishListSectionRequest(); + $this->assertEquals('1 item', $response['wishlist']['counter']); + } + + /** + * Perform wish list section request. + * + * @return array + */ + private function performWishListSectionRequest(): array + { + $this->getRequest()->setParam('sections', 'wishlist')->setMethod(HttpRequest::METHOD_GET); + $this->dispatch('customer/section/load'); + + return $this->json->unserialize($this->getResponse()->getBody()); } } diff --git a/dev/tests/integration/testsuite/Magento/Customer/Model/Metadata/FormTest.php b/dev/tests/integration/testsuite/Magento/Customer/Model/Metadata/FormTest.php index 355167d809ba3..a510c6c4e6616 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/Model/Metadata/FormTest.php +++ b/dev/tests/integration/testsuite/Magento/Customer/Model/Metadata/FormTest.php @@ -5,9 +5,11 @@ */ namespace Magento\Customer\Model\Metadata; +use Magento\Framework\App\RequestInterface; use Magento\TestFramework\Helper\Bootstrap; +use PHPUnit\Framework\TestCase; -class FormTest extends \PHPUnit\Framework\TestCase +class FormTest extends TestCase { /** * @var Form @@ -17,7 +19,7 @@ class FormTest extends \PHPUnit\Framework\TestCase /** @var array */ protected $_attributes; - /** @var \Magento\Framework\App\RequestInterface */ + /** @var RequestInterface */ protected $_request; /** @var array */ @@ -31,7 +33,7 @@ public function setUp() $objectManager = Bootstrap::getObjectManager(); /** @var FormFactory $formFactory */ - $formFactory = $objectManager->create(\Magento\Customer\Model\Metadata\FormFactory::class); + $formFactory = $objectManager->create(FormFactory::class); $this->_form = $formFactory->create('customer_address', 'customer_address_edit'); $this->_attributes = [ @@ -70,7 +72,7 @@ public function setUp() 'region_id' => 12, 'region' => 'California', ]; - $this->_request = $objectManager->get(\Magento\Framework\App\RequestInterface::class); + $this->_request = $objectManager->get(RequestInterface::class); $this->_request->setParams($requestData); $this->_expected = array_merge($this->_attributes, $requestData); @@ -105,10 +107,10 @@ public function testGetAttributes() 'suffix', 'company', 'street', - 'city', 'country_id', 'region', 'region_id', + 'city', 'postcode', 'telephone', 'fax', diff --git a/dev/tests/integration/testsuite/Magento/Customer/_files/new_customer.php b/dev/tests/integration/testsuite/Magento/Customer/_files/new_customer.php new file mode 100644 index 0000000000000..2e298a7e508a3 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Customer/_files/new_customer.php @@ -0,0 +1,44 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Customer\Api\AccountManagementInterface; +use Magento\Customer\Api\CustomerMetadataInterface; +use Magento\Customer\Model\Data\CustomerFactory; +use Magento\Customer\Model\GroupManagement; +use Magento\Eav\Model\AttributeRepository; +use Magento\Store\Model\StoreManagerInterface; +use Magento\TestFramework\Helper\Bootstrap; + +$objectManager = Bootstrap::getObjectManager(); +/** @var AccountManagementInterface $accountManagement */ +$accountManagement = $objectManager->get(AccountManagementInterface::class); +$customerFactory = $objectManager->get(CustomerFactory::class); +$customerFactory->create(); +/** @var StoreManagerInterface $storeManager */ +$storeManager = $objectManager->get(StoreManagerInterface::class); +$website = $storeManager->getWebsite('base'); +/** @var GroupManagement $groupManagement */ +$groupManagement = $objectManager->get(GroupManagement::class); +$defaultStoreId = $website->getDefaultStore()->getId(); +/** @var AttributeRepository $attributeRepository */ +$attributeRepository = $objectManager->get(AttributeRepository::class); +$gender = $attributeRepository->get(CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER, 'gender') + ->getSource()->getOptionId('Male'); +$customer = $customerFactory->create(); +$customer->setWebsiteId($website->getId()) + ->setEmail('new_customer@example.com') + ->setGroupId($groupManagement->getDefaultGroup($defaultStoreId)->getId()) + ->setStoreId($defaultStoreId) + ->setPrefix('Mr.') + ->setFirstname('John') + ->setMiddlename('A') + ->setLastname('Smith') + ->setSuffix('Esq.') + ->setDefaultBilling(1) + ->setDefaultShipping(1) + ->setGender($gender); +$accountManagement->createAccount($customer, 'Qwert12345'); diff --git a/dev/tests/integration/testsuite/Magento/Customer/_files/new_customer_rollback.php b/dev/tests/integration/testsuite/Magento/Customer/_files/new_customer_rollback.php new file mode 100644 index 0000000000000..48da309f6878f --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Customer/_files/new_customer_rollback.php @@ -0,0 +1,33 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Customer\Api\CustomerRepositoryInterface; +use Magento\Framework\Exception\NoSuchEntityException; +use Magento\Framework\Registry; +use Magento\Store\Api\WebsiteRepositoryInterface; +use Magento\TestFramework\Helper\Bootstrap; + +$objectManager = Bootstrap::getObjectManager(); +/** @var Registry $registry */ +$registry = $objectManager->get(Registry::class); +/** @var CustomerRepositoryInterface $customerRepository */ +$customerRepository = $objectManager->get(CustomerRepositoryInterface::class); +/** @var WebsiteRepositoryInterface $websiteRepository */ +$websiteRepository = $objectManager->get(WebsiteRepositoryInterface::class); +$websiteId = $websiteRepository->get('base')->getId(); +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', true); + +try { + $customer = $customerRepository->get('new_customer@example.com', $websiteId); + $customerRepository->delete($customer); +} catch (NoSuchEntityException $e) { + //customer already deleted +} + +$registry->unregister('isSecureArea'); +$registry->register('isSecureArea', false); diff --git a/dev/tests/integration/testsuite/Magento/Customer/_files/unconfirmed_customer.php b/dev/tests/integration/testsuite/Magento/Customer/_files/unconfirmed_customer.php index 3aad592ad34ef..e27010dc042ca 100644 --- a/dev/tests/integration/testsuite/Magento/Customer/_files/unconfirmed_customer.php +++ b/dev/tests/integration/testsuite/Magento/Customer/_files/unconfirmed_customer.php @@ -7,7 +7,7 @@ use Magento\Customer\Api\AccountManagementInterface; use Magento\Customer\Api\CustomerMetadataInterface; -use \Magento\Customer\Model\Data\CustomerFactory; +use Magento\Customer\Model\Data\CustomerFactory; use Magento\Eav\Model\AttributeRepository; use Magento\Framework\Math\Random; use Magento\Store\Api\WebsiteRepositoryInterface; diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/Cache/Frontend/FactoryTest.php b/dev/tests/integration/testsuite/Magento/Framework/App/Cache/Frontend/FactoryTest.php index e6ee5297e4532..a79f5511f1533 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/App/Cache/Frontend/FactoryTest.php +++ b/dev/tests/integration/testsuite/Magento/Framework/App/Cache/Frontend/FactoryTest.php @@ -63,6 +63,7 @@ public function testRemoteSynchronizedCache() //Removing data sleep(2); $this->assertTrue($this->model->remove($secondIdentifier)); + $this->assertTrue($this->model->remove($identifier)); $this->assertEquals($this->model->load($identifier), false); $this->assertEquals($this->model->load($secondIdentifier), false); @@ -73,11 +74,5 @@ public function testRemoteSynchronizedCache() //Checking data $this->assertEquals($this->model->load($identifier), $data); $this->assertEquals($this->model->load($secondIdentifier), $secondData); - - //Removing data - sleep(2); - $this->assertTrue($this->model->remove($identifier)); - $this->assertEquals($this->model->load($identifier), false); - $this->assertEquals($this->model->load($secondIdentifier), false); } } diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/ControllerActionTest.php b/dev/tests/integration/testsuite/Magento/Framework/App/ControllerActionTest.php new file mode 100644 index 0000000000000..12be7607e1872 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Framework/App/ControllerActionTest.php @@ -0,0 +1,207 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +namespace Magento\Framework\App; + +use Magento\Backend\Model\Auth as BackendAuth; +use Magento\Backend\Model\UrlInterface as BackendUrl; +use Magento\Framework\App\TestStubs\InheritanceBasedBackendAction; +use Magento\Framework\App\TestStubs\InheritanceBasedFrontendAction; +use Magento\Framework\App\TestStubs\InterfaceOnlyBackendAction; +use Magento\Framework\App\TestStubs\InterfaceOnlyFrontendAction; +use Magento\Framework\Event; +use Magento\TestFramework\Bootstrap as TestFramework; +use Magento\TestFramework\ObjectManager; +use Magento\TestFramework\Request as TestHttpRequest; +use PHPUnit\Framework\TestCase; + +/** + * @magentoAppIsolation enabled + * @SuppressWarnings(PHPMD.CouplingBetweenObjects) + * @SuppressWarnings(PHPMD.UnusedLocalVariable) + * @SuppressWarnings(PHPMD.StaticAccess) + */ +class ControllerActionTest extends TestCase +{ + public function setupEventManagerSpy() + { + /** @var ObjectManager $objectManager */ + $objectManager = ObjectManager::getInstance(); + + $originalEventManager = $objectManager->create(Event\ManagerInterface::class); + $eventManagerSpy = new class($originalEventManager) implements Event\ManagerInterface { + /** + * @var Event\ManagerInterface + */ + private $delegate; + + /** + * @var array[]; + */ + private $dispatchedEvents = []; + + public function __construct(Event\ManagerInterface $delegate) + { + $this->delegate = $delegate; + } + + public function dispatch($eventName, array $data = []) + { + $this->dispatchedEvents[$eventName][] = [$eventName, $data]; + $this->delegate->dispatch($eventName, $data); + } + + public function spyOnDispatchedEvent(string $eventName): array + { + return $this->dispatchedEvents[$eventName] ?? []; + } + }; + + $objectManager->addSharedInstance($eventManagerSpy, get_class($originalEventManager)); + } + + private function assertEventDispatchCount($eventName, $expectedCount) + { + $message = sprintf('Event %s was expected to be dispatched %d time(s).', $eventName, $expectedCount); + $this->assertCount($expectedCount, $this->getEventManager()->spyOnDispatchedEvent($eventName), $message); + } + + /** + * @return TestHttpRequest + */ + private function getRequest(): RequestInterface + { + return ObjectManager::getInstance()->get(TestHttpRequest::class); + } + + private function fakeAuthenticatedBackendRequest() + { + $objectManager = ObjectManager::getInstance(); + $objectManager->get(BackendUrl::class)->turnOffSecretKey(); + + $auth = $objectManager->get(BackendAuth::class); + $auth->login(TestFramework::ADMIN_NAME, TestFramework::ADMIN_PASSWORD); + } + + private function configureRequestForAction(string $route, string $actionPath, string $actionName) + { + $request = $this->getRequest(); + + $request->setRouteName($route); + $request->setControllerName($actionPath); + $request->setActionName($actionName); + $request->setDispatched(); + } + + private function getEventManager(): Event\ManagerInterface + { + return ObjectManager::getInstance()->get(Event\ManagerInterface::class); + } + + private function assertPreAndPostDispatchEventsAreDispatched() + { + $this->assertEventDispatchCount('controller_action_predispatch', 1); + $this->assertEventDispatchCount('controller_action_predispatch_testroute', 1); + $this->assertEventDispatchCount('controller_action_predispatch_testroute_actionpath_actionname', 1); + $this->assertEventDispatchCount('controller_action_postdispatch_testroute_actionpath_actionname', 1); + $this->assertEventDispatchCount('controller_action_postdispatch_testroute', 1); + $this->assertEventDispatchCount('controller_action_postdispatch', 1); + } + + /** + * @magentoAppArea frontend + */ + public function testInheritanceBasedFrontendActionDispatchesEvents() + { + $this->setupEventManagerSpy(); + + /** @var InheritanceBasedFrontendAction $action */ + $action = ObjectManager::getInstance()->create(InheritanceBasedFrontendAction::class); + $this->configureRequestForAction('testroute', 'actionpath', 'actionname'); + + $action->dispatch($this->getRequest()); + + $this->assertPreAndPostDispatchEventsAreDispatched(); + } + + /** + * @magentoAppArea frontend + */ + public function testInterfaceOnlyFrontendActionDispatchesEvents() + { + $this->setupEventManagerSpy(); + + /** @var InterfaceOnlyFrontendAction $action */ + $action = ObjectManager::getInstance()->create(InterfaceOnlyFrontendAction::class); + $this->configureRequestForAction('testroute', 'actionpath', 'actionname'); + + $action->execute(); + + $this->assertPreAndPostDispatchEventsAreDispatched(); + } + + /** + * @magentoAppArea adminhtml + */ + public function testInheritanceBasedAdminhtmlActionDispatchesEvents() + { + $this->fakeAuthenticatedBackendRequest(); + + $this->setupEventManagerSpy(); + + /** @var InheritanceBasedBackendAction $action */ + $action = ObjectManager::getInstance()->create(InheritanceBasedBackendAction::class); + $this->configureRequestForAction('testroute', 'actionpath', 'actionname'); + + $action->dispatch($this->getRequest()); + + $this->assertPreAndPostDispatchEventsAreDispatched(); + } + + /** + * @magentoAppArea adminhtml + */ + public function testInterfaceOnlyAdminhtmlActionDispatchesEvents() + { + $this->setupEventManagerSpy(); + + /** @var InterfaceOnlyBackendAction $action */ + $action = ObjectManager::getInstance()->create(InterfaceOnlyBackendAction::class); + $this->configureRequestForAction('testroute', 'actionpath', 'actionname'); + + $action->execute(); + + $this->assertPreAndPostDispatchEventsAreDispatched(); + } + + /** + * @magentoAppArea frontend + */ + public function testSettingTheNoDispatchActionFlagProhibitsExecuteAndPostdispatchEvents() + { + $this->setupEventManagerSpy(); + + /** @var InterfaceOnlyFrontendAction $action */ + $action = ObjectManager::getInstance()->create(InterfaceOnlyFrontendAction::class); + $this->configureRequestForAction('testroute', 'actionpath', 'actionname'); + + /** @var ActionFlag $actionFlag */ + $actionFlag = ObjectManager::getInstance()->get(ActionFlag::class); + $actionFlag->set('', ActionInterface::FLAG_NO_DISPATCH, true); + + $action->execute(); + + $this->assertFalse($action->isExecuted(), 'The controller execute() method was not expected to be called.'); + $this->assertEventDispatchCount('controller_action_predispatch', 1); + $this->assertEventDispatchCount('controller_action_predispatch_testroute', 1); + $this->assertEventDispatchCount('controller_action_predispatch_testroute_actionpath_actionname', 1); + $this->assertEventDispatchCount('controller_action_postdispatch_testroute_actionpath_actionname', 0); + $this->assertEventDispatchCount('controller_action_postdispatch_testroute', 0); + $this->assertEventDispatchCount('controller_action_postdispatch', 0); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/TestStubs/InheritanceBasedBackendAction.php b/dev/tests/integration/testsuite/Magento/Framework/App/TestStubs/InheritanceBasedBackendAction.php new file mode 100644 index 0000000000000..b24cc2e30382c --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Framework/App/TestStubs/InheritanceBasedBackendAction.php @@ -0,0 +1,46 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +namespace Magento\Framework\App\TestStubs; + +use Magento\Backend\App\Action; +use Magento\Framework\App\ResponseInterface; +use Magento\Framework\Controller\ResultInterface; +use Magento\Framework\View\Result\Page; +use Magento\Framework\View\Result\PageFactory; + +/** + * Stub inheritance based backend action controller for testing purposes. + */ +class InheritanceBasedBackendAction extends Action +{ + /** + * @var PageFactory + */ + private $pageFactory; + + /** + * @param Action\Context $context + * @param PageFactory $pageFactory + */ + public function __construct(Action\Context $context, PageFactory $pageFactory) + { + parent::__construct($context); + $this->pageFactory = $pageFactory; + } + + /** + * Creates Page + * + * @return ResponseInterface|ResultInterface|Page + */ + public function execute() + { + return $this->pageFactory->create(); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/TestStubs/InheritanceBasedFrontendAction.php b/dev/tests/integration/testsuite/Magento/Framework/App/TestStubs/InheritanceBasedFrontendAction.php new file mode 100644 index 0000000000000..315df9585c715 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Framework/App/TestStubs/InheritanceBasedFrontendAction.php @@ -0,0 +1,63 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +namespace Magento\Framework\App\TestStubs; + +use Magento\Framework\App\Action\Action; +use Magento\Framework\App\Action\Context; +use Magento\Framework\App\ResponseInterface; +use Magento\Framework\Controller\ResultInterface; +use Magento\Framework\View\Result\Page; +use Magento\Framework\View\Result\PageFactory; + +/** + * Stub inheritance based frontend action controller for testing purposes. + */ +class InheritanceBasedFrontendAction extends Action +{ + /** + * @var PageFactory + */ + private $pageFactory; + + /** + * @var bool + */ + private $executeWasCalled = false; + + /** + * @param Context $context + * @param PageFactory $pageFactory + */ + public function __construct(Context $context, PageFactory $pageFactory) + { + parent::__construct($context); + $this->pageFactory = $pageFactory; + } + + /** + * Runs `execute()` method to create Page + * + * @return ResponseInterface|ResultInterface|Page + */ + public function execute() + { + $this->executeWasCalled = true; + return $this->pageFactory->create(); + } + + /** + * Determines whether execute method was called + * + * @return bool + */ + public function isExecuted(): bool + { + return $this->executeWasCalled; + } +} diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/TestStubs/InterfaceOnlyBackendAction.php b/dev/tests/integration/testsuite/Magento/Framework/App/TestStubs/InterfaceOnlyBackendAction.php new file mode 100644 index 0000000000000..86244fd67237b --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Framework/App/TestStubs/InterfaceOnlyBackendAction.php @@ -0,0 +1,43 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Framework\App\TestStubs; + +use Magento\Framework\App\ActionInterface; +use Magento\Framework\App\ResponseInterface; +use Magento\Framework\Controller\ResultInterface; +use Magento\Framework\View\Result\Page; +use Magento\Framework\View\Result\PageFactory; + +/** + * Stub interface action controller implementation for testing purposes. + */ +class InterfaceOnlyBackendAction implements ActionInterface +{ + /** + * @var PageFactory + */ + private $pageFactory; + + /** + * @param PageFactory $pageFactory + */ + public function __construct(PageFactory $pageFactory) + { + $this->pageFactory = $pageFactory; + } + + /** + * Creates Page object + * + * @return ResponseInterface|ResultInterface|Page + */ + public function execute() + { + return $this->pageFactory->create(); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Framework/App/TestStubs/InterfaceOnlyFrontendAction.php b/dev/tests/integration/testsuite/Magento/Framework/App/TestStubs/InterfaceOnlyFrontendAction.php new file mode 100644 index 0000000000000..123fe2ea87be1 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Framework/App/TestStubs/InterfaceOnlyFrontendAction.php @@ -0,0 +1,59 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Framework\App\TestStubs; + +use Magento\Framework\App\ActionInterface; +use Magento\Framework\App\ResponseInterface; +use Magento\Framework\Controller\ResultInterface; +use Magento\Framework\View\Result\Page; +use Magento\Framework\View\Result\PageFactory; + +/** + * Stub interface only based frontend action controller for testing purposes. + */ +class InterfaceOnlyFrontendAction implements ActionInterface +{ + /** + * @var PageFactory + */ + private $pageFactory; + + /** + * @var bool + */ + private $executeWasCalled = false; + + /** + * @param PageFactory $pageFactory + */ + public function __construct(PageFactory $pageFactory) + { + $this->pageFactory = $pageFactory; + } + + /** + * Creates Page object + * + * @return ResponseInterface|ResultInterface|Page + */ + public function execute() + { + $this->executeWasCalled = true; + return $this->pageFactory->create(); + } + + /** + * Returns whether `execute()` method was ran + * + * @return bool + */ + public function isExecuted(): bool + { + return $this->executeWasCalled; + } +} diff --git a/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromCreateProject/composer.lock b/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromCreateProject/composer.lock index 4fb998ab77b34..d9da3edf3d209 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromCreateProject/composer.lock +++ b/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testFromCreateProject/composer.lock @@ -2460,10 +2460,6 @@ "app/etc/registration_globlist.php", "app/etc/registration_globlist.php" ], - [ - "app/functions.php", - "app/functions.php" - ], [ "auth.json.sample", "auth.json.sample" diff --git a/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testSkeleton/composer.lock b/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testSkeleton/composer.lock index 36a98e6cd9596..d755bfa0479e6 100644 --- a/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testSkeleton/composer.lock +++ b/dev/tests/integration/testsuite/Magento/Framework/Composer/_files/testSkeleton/composer.lock @@ -2460,10 +2460,6 @@ "app/etc/registration_globlist.php", "app/etc/registration_globlist.php" ], - [ - "app/functions.php", - "app/functions.php" - ], [ "auth.json.sample", "auth.json.sample" diff --git a/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/AbstractFiltersTest.php b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/AbstractFiltersTest.php index cf39757cb8264..fc0c23b346fe2 100644 --- a/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/AbstractFiltersTest.php +++ b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/AbstractFiltersTest.php @@ -140,7 +140,7 @@ protected function getSearchFiltersAndAssert( $this->updateAttribute($attributeData); $this->updateProducts($products, $this->getAttributeCode()); $this->clearInstanceAndReindexSearch(); - $this->navigationBlock->getRequest()->setParams(['q' => 'Simple Product']); + $this->navigationBlock->getRequest()->setParams(['q' => $this->getSearchString()]); $this->navigationBlock->setLayout($this->layout); $filter = $this->getFilterByCode($this->navigationBlock->getFilters(), $this->getAttributeCode()); @@ -293,4 +293,14 @@ protected function createNavigationBlockInstance(): void $this->navigationBlock = $this->objectManager->create(CategoryNavigationBlock::class); } } + + /** + * Returns search query for filters on search page. + * + * @return string + */ + protected function getSearchString(): string + { + return 'Simple Product'; + } } diff --git a/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/Bundle/MultiselectFilterTest.php b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/Bundle/MultiselectFilterTest.php new file mode 100644 index 0000000000000..518a0a19f857f --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/Bundle/MultiselectFilterTest.php @@ -0,0 +1,109 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\LayeredNavigation\Block\Navigation\Category\Bundle; + +use Magento\Catalog\Model\Layer\Resolver; +use Magento\Framework\Module\Manager; +use Magento\LayeredNavigation\Block\Navigation\AbstractFiltersTest; +use Magento\Catalog\Model\Layer\Filter\AbstractFilter; + +/** + * Provides tests for custom multiselect filter in navigation block on category page with bundle products. + * + * @magentoAppArea frontend + * @magentoAppIsolation enabled + * @magentoDbIsolation disabled + */ +class MultiselectFilterTest extends AbstractFiltersTest +{ + /** + * @var Manager + */ + private $moduleManager; + + /** + * @inheritdoc + */ + protected function setUp() + { + parent::setUp(); + $this->moduleManager = $this->objectManager->get(Manager::class); + //This check is needed because LayeredNavigation independent of Magento_Bundle + if (!$this->moduleManager->isEnabled('Magento_Bundle')) { + $this->markTestSkipped('Magento_Bundle module disabled.'); + } + } + + /** + * @magentoDataFixture Magento/Catalog/_files/multiselect_attribute.php + * @magentoDataFixture Magento/Bundle/_files/dynamic_and_fixed_bundle_products_in_category.php + * @dataProvider getFiltersWithCustomAttributeDataProvider + * @param array $products + * @param array $attributeData + * @param array $expectation + * @return void + */ + public function testGetFiltersWithCustomAttribute(array $products, array $attributeData, array $expectation): void + { + $this->getCategoryFiltersAndAssert($products, $attributeData, $expectation, 'Category 1'); + } + + /** + * @return array + */ + public function getFiltersWithCustomAttributeDataProvider(): array + { + return [ + 'not_used_in_navigation' => [ + 'products_data' => [], + 'attribute_data' => ['is_filterable' => 0], + 'expectation' => [], + ], + 'used_in_navigation_with_results' => [ + 'products_data' => [ + 'bundle-product' => 'Option 1', + 'bundle-product-dropdown-options' => 'Option 2', + ], + 'attribute_data' => ['is_filterable' => AbstractFilter::ATTRIBUTE_OPTIONS_ONLY_WITH_RESULTS], + 'expectation' => [ + ['label' => 'Option 1', 'count' => 1], + ['label' => 'Option 2', 'count' => 1], + ], + ], + 'used_in_navigation_without_results' => [ + 'products_data' => [ + 'bundle-product' => 'Option 1', + 'bundle-product-dropdown-options' => 'Option 2', + ], + 'attribute_data' => ['is_filterable' => 2], + 'expectation' => [ + ['label' => 'Option 1', 'count' => 1], + ['label' => 'Option 2', 'count' => 1], + ['label' => 'Option 3', 'count' => 0], + ['label' => 'Option 4 "!@#$%^&*', 'count' => 0], + ], + ], + ]; + } + + /** + * @inheritdoc + */ + protected function getLayerType(): string + { + return Resolver::CATALOG_LAYER_CATEGORY; + } + + /** + * @inheritdoc + */ + protected function getAttributeCode(): string + { + return 'multiselect_attribute'; + } +} diff --git a/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/Bundle/PriceFilterTest.php b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/Bundle/PriceFilterTest.php new file mode 100644 index 0000000000000..3817c5efc86fc --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/Bundle/PriceFilterTest.php @@ -0,0 +1,96 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\LayeredNavigation\Block\Navigation\Category\Bundle; + +use Magento\Catalog\Model\Layer\Resolver; +use Magento\Framework\Module\Manager; +use Magento\LayeredNavigation\Block\Navigation\AbstractFiltersTest; +use Magento\Catalog\Model\Layer\Filter\AbstractFilter; +use Magento\Catalog\Model\Layer\Filter\Item; + +/** + * Provides price filter tests for bundle products in navigation block on category page. + * + * @magentoAppArea frontend + * @magentoAppIsolation enabled + * @magentoDbIsolation disabled + */ +class PriceFilterTest extends AbstractFiltersTest +{ + /** + * @var Manager + */ + private $moduleManager; + + /** + * @inheritdoc + */ + protected function setUp() + { + parent::setUp(); + $this->moduleManager = $this->objectManager->get(Manager::class); + //This check is needed because LayeredNavigation independent of Magento_Bundle + if (!$this->moduleManager->isEnabled('Magento_Bundle')) { + $this->markTestSkipped('Magento_Bundle module disabled.'); + } + } + + /** + * @magentoDataFixture Magento/Bundle/_files/dynamic_and_fixed_bundle_products_in_category.php + * @magentoConfigFixture current_store catalog/layered_navigation/price_range_calculation manual + * @magentoConfigFixture current_store catalog/layered_navigation/price_range_step 10 + * @return void + */ + public function testGetFilters(): void + { + $this->getCategoryFiltersAndAssert( + ['bundle-product' => 20.00], + ['is_filterable' => '1'], + [ + ['label' => '$10.00 - $19.99', 'value' => '10-20', 'count' => 1], + ['label' => '$20.00 and above', 'value' => '20-', 'count' => 1], + ], + 'Category 1' + ); + } + + /** + * @inheritdoc + */ + protected function getLayerType(): string + { + return Resolver::CATALOG_LAYER_CATEGORY; + } + + /** + * @inheritdoc + */ + protected function getAttributeCode(): string + { + return 'price'; + } + + /** + * @inheritdoc + */ + protected function prepareFilterItems(AbstractFilter $filter): array + { + $items = []; + /** @var Item $item */ + foreach ($filter->getItems() as $item) { + $item = [ + 'label' => strip_tags(__($item->getData('label'))->render()), + 'value' => $item->getData('value'), + 'count' => $item->getData('count'), + ]; + $items[] = $item; + } + + return $items; + } +} diff --git a/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/Bundle/SelectFilterTest.php b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/Bundle/SelectFilterTest.php new file mode 100644 index 0000000000000..7b3be2afbdbdb --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/Bundle/SelectFilterTest.php @@ -0,0 +1,108 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\LayeredNavigation\Block\Navigation\Category\Bundle; + +use Magento\Catalog\Model\Layer\Resolver; +use Magento\Framework\Module\Manager; +use Magento\LayeredNavigation\Block\Navigation\AbstractFiltersTest; +use Magento\Catalog\Model\Layer\Filter\AbstractFilter; + +/** + * Provides tests for custom select filter for bundle products in navigation block on category page. + * + * @magentoAppArea frontend + * @magentoAppIsolation enabled + * @magentoDbIsolation disabled + */ +class SelectFilterTest extends AbstractFiltersTest +{ + /** + * @var Manager + */ + private $moduleManager; + + /** + * @inheritdoc + */ + protected function setUp() + { + parent::setUp(); + $this->moduleManager = $this->objectManager->get(Manager::class); + //This check is needed because LayeredNavigation independent of Magento_Bundle + if (!$this->moduleManager->isEnabled('Magento_Bundle')) { + $this->markTestSkipped('Magento_Bundle module disabled.'); + } + } + + /** + * @magentoDataFixture Magento/Catalog/_files/product_dropdown_attribute.php + * @magentoDataFixture Magento/Bundle/_files/dynamic_and_fixed_bundle_products_in_category.php + * @dataProvider getFiltersWithCustomAttributeDataProvider + * @param array $products + * @param array $attributeData + * @param array $expectation + * @return void + */ + public function testGetFiltersWithCustomAttribute(array $products, array $attributeData, array $expectation): void + { + $this->getCategoryFiltersAndAssert($products, $attributeData, $expectation, 'Category 1'); + } + + /** + * @return array + */ + public function getFiltersWithCustomAttributeDataProvider(): array + { + return [ + 'not_used_in_navigation' => [ + 'products_data' => [], + 'attribute_data' => ['is_filterable' => 0], + 'expectation' => [], + ], + 'used_in_navigation_with_results' => [ + 'products_data' => [ + 'bundle-product' => 'Option 1', + 'bundle-product-dropdown-options' => 'Option 2', + ], + 'attribute_data' => ['is_filterable' => AbstractFilter::ATTRIBUTE_OPTIONS_ONLY_WITH_RESULTS], + 'expectation' => [ + ['label' => 'Option 1', 'count' => 1], + ['label' => 'Option 2', 'count' => 1], + ], + ], + 'used_in_navigation_without_results' => [ + 'products_data' => [ + 'bundle-product' => 'Option 1', + 'bundle-product-dropdown-options' => 'Option 2', + ], + 'attribute_data' => ['is_filterable' => 2], + 'expectation' => [ + ['label' => 'Option 1', 'count' => 1], + ['label' => 'Option 2', 'count' => 1], + ['label' => 'Option 3', 'count' => 0], + ], + ], + ]; + } + + /** + * @inheritdoc + */ + protected function getLayerType(): string + { + return Resolver::CATALOG_LAYER_CATEGORY; + } + + /** + * @inheritdoc + */ + protected function getAttributeCode(): string + { + return 'dropdown_attribute'; + } +} diff --git a/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Search/Bundle/PriceFilterTest.php b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Search/Bundle/PriceFilterTest.php new file mode 100644 index 0000000000000..435dd29e16dfa --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Search/Bundle/PriceFilterTest.php @@ -0,0 +1,55 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\LayeredNavigation\Block\Navigation\Search\Bundle; + +use Magento\Catalog\Model\Layer\Resolver; +use Magento\LayeredNavigation\Block\Navigation\Category\Bundle\PriceFilterTest as CategoryFilterTest; + +/** + * Provides price filter tests for bundle product in navigation block on search page. + * + * @magentoAppArea frontend + * @magentoAppIsolation enabled + * @magentoDbIsolation disabled + */ +class PriceFilterTest extends CategoryFilterTest +{ + /** + * @magentoDataFixture Magento/Bundle/_files/dynamic_and_fixed_bundle_products_in_category.php + * @magentoConfigFixture current_store catalog/layered_navigation/price_range_calculation manual + * @magentoConfigFixture current_store catalog/layered_navigation/price_range_step 10 + * @return void + */ + public function testGetFilters(): void + { + $this->getSearchFiltersAndAssert( + ['bundle-product' => 20.00], + ['is_filterable_in_search' => 1], + [ + ['label' => '$10.00 - $19.99', 'value' => '10-20', 'count' => 1], + ['label' => '$20.00 and above', 'value' => '20-', 'count' => 1], + ] + ); + } + + /** + * @inheritdoc + */ + protected function getLayerType(): string + { + return Resolver::CATALOG_LAYER_SEARCH; + } + + /** + * @inheritdoc + */ + protected function getSearchString(): string + { + return 'Bundle'; + } +} diff --git a/dev/tests/integration/testsuite/Magento/Newsletter/Block/Account/LinkTest.php b/dev/tests/integration/testsuite/Magento/Newsletter/Block/Account/LinkTest.php new file mode 100644 index 0000000000000..6dac22bd49384 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Newsletter/Block/Account/LinkTest.php @@ -0,0 +1,79 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Newsletter\Block\Account; + +use Magento\Framework\ObjectManagerInterface; +use Magento\Framework\View\Result\Page; +use Magento\TestFramework\Helper\Bootstrap; +use PHPUnit\Framework\TestCase; + +/** + * Checks Newsletter Subscriptions link displaying in account dashboard + * + * @magentoAppArea frontend + * @magentoDbIsolation enabled + * @magentoAppIsolation enabled + */ +class LinkTest extends TestCase +{ + /** @var ObjectManagerInterface */ + private $objectManager; + + /** @var Page */ + private $page; + + /** + * @inheritdoc + */ + protected function setUp() + { + parent::setUp(); + + $this->objectManager = Bootstrap::getObjectManager(); + $this->page = $this->objectManager->create(Page::class); + } + + /** + * @return void + */ + public function testNewsletterLink(): void + { + $this->preparePage(); + $block = $this->page->getLayout()->getBlock('customer-account-navigation-newsletter-subscriptions-link'); + $this->assertNotFalse($block); + $html = $block->toHtml(); + $this->assertContains('newsletter/manage/', $html); + $this->assertEquals('Newsletter Subscriptions', strip_tags($html)); + } + + /** + * @magentoConfigFixture current_store newsletter/general/active 0 + * + * @return void + */ + public function testNewsletterLinkDisabled(): void + { + $this->preparePage(); + $block = $this->page->getLayout()->getBlock('customer-account-navigation-newsletter-subscriptions-link'); + $this->assertFalse($block); + } + + /** + * Prepare page before render + * + * @return void + */ + private function preparePage(): void + { + $this->page->addHandle([ + 'default', + 'customer_account', + ]); + $this->page->getLayout()->generateXml(); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Newsletter/Controller/Manage/SaveTest.php b/dev/tests/integration/testsuite/Magento/Newsletter/Controller/Manage/SaveTest.php new file mode 100644 index 0000000000000..87b022c942318 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Newsletter/Controller/Manage/SaveTest.php @@ -0,0 +1,157 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Newsletter\Controller\Manage; + +use Magento\Customer\Api\CustomerRepositoryInterface; +use Magento\Customer\Model\CustomerRegistry; +use Magento\Customer\Model\Session; +use Magento\Framework\Data\Form\FormKey; +use Magento\Framework\Message\MessageInterface; +use Magento\Newsletter\Model\Plugin\CustomerPlugin; +use Magento\TestFramework\TestCase\AbstractController; + +/** + * Class checks customer subscription + * + * @magentoDbIsolation enabled + */ +class SaveTest extends AbstractController +{ + /** @var Session */ + protected $customerSession; + + /** @var CustomerRepositoryInterface */ + private $customerRepository; + + /** @var FormKey */ + private $formKey; + + /** @var CustomerRegistry */ + private $customerRegistry; + + /** + * @inheritdoc + */ + protected function setUp() + { + parent::setUp(); + + $this->customerSession = $this->_objectManager->get(Session::class); + $this->customerRepository = $this->_objectManager->get(CustomerRepositoryInterface::class); + $this->formKey = $this->_objectManager->get(FormKey::class); + $this->customerRegistry = $this->_objectManager->get(CustomerRegistry::class); + } + + /** + * @inheritdoc + */ + protected function tearDown() + { + $this->customerSession->logout(); + + parent::tearDown(); + } + + /** + * @magentoDataFixture Magento/Customer/_files/new_customer.php + * + * @dataProvider subscriptionDataProvider + * + * @param bool $isSubscribed + * @param string $expectedMessage + * @return void + */ + public function testSaveAction(bool $isSubscribed, string $expectedMessage): void + { + $this->loginCustomer('new_customer@example.com'); + $this->_objectManager->removeSharedInstance(CustomerPlugin::class); + $this->dispatchSaveAction($isSubscribed); + $this->assertSuccessSubscription($expectedMessage); + } + + /** + * @return array + */ + public function subscriptionDataProvider(): array + { + return [ + 'subscribe_customer' => [ + 'is_subscribed' => true, + 'expected_message' => 'We have saved your subscription.', + ], + 'unsubscribe_customer' => [ + 'is_subscribed' => false, + 'expected_message' => 'We have updated your subscription.', + ], + ]; + } + + /** + * @magentoDataFixture Magento/Customer/_files/customer_confirmation_config_enable.php + * @magentoDataFixture Magento/Customer/_files/new_customer.php + * + * @return void + */ + public function testSubscribeWithEnabledConfirmation(): void + { + $this->loginCustomer('new_customer@example.com'); + $this->dispatchSaveAction(true); + $this->assertSuccessSubscription('A confirmation request has been sent.'); + } + + /** + * @magentoDataFixture Magento/Newsletter/_files/customer_with_subscription.php + * + * @return void + */ + public function testUnsubscribeSubscribedCustomer(): void + { + $this->loginCustomer('new_customer@example.com'); + $this->_objectManager->removeSharedInstance(CustomerPlugin::class); + $this->dispatchSaveAction(false); + $this->assertSuccessSubscription('We have removed your newsletter subscription.'); + } + + /** + * Dispatch save action with parameters + * + * @param string $isSubscribed + * @return void + */ + private function dispatchSaveAction(bool $isSubscribed): void + { + $this->_objectManager->removeSharedInstance(CustomerPlugin::class); + $this->getRequest()->setParam('form_key', $this->formKey->getFormKey()) + ->setParam('is_subscribed', $isSubscribed); + $this->dispatch('newsletter/manage/save'); + } + + /** + * Login customer by email + * + * @param string $email + * @return void + */ + private function loginCustomer(string $email): void + { + $customer = $this->customerRepository->get($email); + $this->customerSession->loginById($customer->getId()); + } + + /** + * Assert that action was successfully done + * + * @param string $expectedMessage + * @return void + */ + private function assertSuccessSubscription(string $expectedMessage): void + { + $this->assertRedirect($this->stringContains('customer/account/')); + $this->assertSessionMessages($this->equalTo([(string)__($expectedMessage)]), MessageInterface::TYPE_SUCCESS); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Newsletter/Controller/ManageTest.php b/dev/tests/integration/testsuite/Magento/Newsletter/Controller/ManageTest.php deleted file mode 100644 index 175c1c7c6c668..0000000000000 --- a/dev/tests/integration/testsuite/Magento/Newsletter/Controller/ManageTest.php +++ /dev/null @@ -1,98 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ - -namespace Magento\Newsletter\Controller; - -/** - * @magentoDbIsolation enabled - */ -class ManageTest extends \Magento\TestFramework\TestCase\AbstractController -{ - /** - * @var \Magento\Customer\Model\Session - */ - protected $customerSession; - - /** - * @var \Magento\Framework\Session\Generic - */ - protected $coreSession; - - /** - * Test setup - */ - protected function setUp() - { - parent::setUp(); - $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager(); - $this->customerSession = $objectManager->get(\Magento\Customer\Model\Session::class); - $this->customerSession->setCustomerId(1); - $this->coreSession = $objectManager->get(\Magento\Framework\Session\Generic::class); - $this->coreSession->setData('_form_key', 'formKey'); - } - - /** - * test tearDown - */ - protected function tearDown() - { - $this->customerSession->setCustomerId(null); - $this->coreSession->unsetData('_form_key'); - } - - /** - * @magentoDataFixture Magento/Customer/_files/customer.php - */ - public function testSaveAction() - { - $this->getRequest() - ->setParam('form_key', 'formKey') - ->setParam('is_subscribed', '1'); - $this->dispatch('newsletter/manage/save'); - - $this->assertRedirect($this->stringContains('customer/account/')); - - /** - * Check that errors - */ - $this->assertSessionMessages($this->isEmpty(), \Magento\Framework\Message\MessageInterface::TYPE_ERROR); - - /** - * Check that success message - */ - $this->assertSessionMessages( - $this->equalTo(['We have saved your subscription.']), - \Magento\Framework\Message\MessageInterface::TYPE_SUCCESS - ); - } - - /** - * @magentoDataFixture Magento/Customer/_files/customer.php - */ - public function testSaveActionRemoveSubscription() - { - - $this->getRequest() - ->setParam('form_key', 'formKey') - ->setParam('is_subscribed', '0'); - $this->dispatch('newsletter/manage/save'); - - $this->assertRedirect($this->stringContains('customer/account/')); - - /** - * Check that errors - */ - $this->assertSessionMessages($this->isEmpty(), \Magento\Framework\Message\MessageInterface::TYPE_ERROR); - - /** - * Check that success message - */ - $this->assertSessionMessages( - $this->equalTo(['We have updated your subscription.']), - \Magento\Framework\Message\MessageInterface::TYPE_SUCCESS - ); - } -} diff --git a/dev/tests/integration/testsuite/Magento/Newsletter/Controller/Subscriber/NewActionTest.php b/dev/tests/integration/testsuite/Magento/Newsletter/Controller/Subscriber/NewActionTest.php new file mode 100644 index 0000000000000..0f07d8b31d13b --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Newsletter/Controller/Subscriber/NewActionTest.php @@ -0,0 +1,255 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Newsletter\Controller\Subscriber; + +use Magento\Customer\Api\CustomerRepositoryInterface; +use Magento\Customer\Model\Session; +use Magento\Customer\Model\Url; +use Magento\Framework\App\Request\Http as HttpRequest; +use Magento\Newsletter\Model\ResourceModel\Subscriber as SubscriberResource; +use Magento\Newsletter\Model\ResourceModel\Subscriber\CollectionFactory; +use Magento\TestFramework\TestCase\AbstractController; +use Zend\Stdlib\Parameters; + +/** + * Class checks subscription behaviour from frontend + * + * @magentoDbIsolation enabled + * @see \Magento\Newsletter\Controller\Subscriber\NewAction + */ +class NewActionTest extends AbstractController +{ + /** @var Session */ + private $session; + + /** @var CollectionFactory */ + private $subscriberCollectionFactory; + + /** @var SubscriberResource */ + private $subscriberResource; + + /** @var string|null */ + private $subscriberToDelete; + + /** @var CustomerRepositoryInterface */ + private $customerRepository; + + /** @var Url */ + private $customerUrl; + + /** + * @inheritdoc + */ + protected function setUp() + { + parent::setUp(); + + $this->session = $this->_objectManager->get(Session::class); + $this->subscriberCollectionFactory = $this->_objectManager->get(CollectionFactory::class); + $this->subscriberResource = $this->_objectManager->get(SubscriberResource::class); + $this->customerRepository = $this->_objectManager->get(CustomerRepositoryInterface::class); + $this->customerUrl = $this->_objectManager->get(Url::class); + } + + /** + * @inheritdoc + */ + protected function tearDown() + { + if ($this->subscriberToDelete) { + $this->deleteSubscriber($this->subscriberToDelete); + } + + parent::tearDown(); + } + + /** + * @dataProvider subscribersDataProvider + * + * @param string $email + * @param string $expectedMessage + * @return void + */ + public function testNewAction(string $email, string $expectedMessage): void + { + $this->subscriberToDelete = $email ? $email : null; + $this->prepareRequest($email); + $this->dispatch('newsletter/subscriber/new'); + + $this->performAsserts($expectedMessage); + } + + /** + * @return array + */ + public function subscribersDataProvider(): array + { + return [ + 'without_email' => [ + 'email' => '', + 'message' => '', + ], + 'with_unused_email' => [ + 'email' => 'not_used@example.com', + 'message' => 'Thank you for your subscription.', + ], + 'with_invalid_email' => [ + 'email' => 'invalid_email.com', + 'message' => 'Please enter a valid email address.' + ], + ]; + } + + /** + * @magentoDataFixture Magento/Customer/_files/new_customer.php + * + * @return void + */ + public function testNewActionUsedEmail(): void + { + $this->prepareRequest('new_customer@example.com'); + $this->dispatch('newsletter/subscriber/new'); + + $this->performAsserts('Thank you for your subscription.'); + } + + /** + * @magentoDataFixture Magento/Customer/_files/new_customer.php + * + * @return void + */ + public function testNewActionOwnerEmail(): void + { + $this->prepareRequest('new_customer@example.com'); + $this->session->loginById(1); + $this->dispatch('newsletter/subscriber/new'); + + $this->performAsserts('Thank you for your subscription.'); + } + + /** + * @magentoDataFixture Magento/Newsletter/_files/customer_with_subscription.php + * + * @return void + */ + public function testAlreadyExistEmail(): void + { + $this->prepareRequest('new_customer@example.com'); + $this->dispatch('newsletter/subscriber/new'); + + $this->performAsserts('This email address is already subscribed.'); + } + + /** + * @magentoConfigFixture current_store newsletter/subscription/allow_guest_subscribe 0 + * + * @return void + */ + public function testWithNotAllowedGuestSubscription(): void + { + $message = sprintf( + 'Sorry, but the administrator denied subscription for guests. Please <a href="%s">register</a>.', + $this->customerUrl->getRegisterUrl() + ); + $this->subscriberToDelete = 'guest@example.com'; + $this->prepareRequest('guest@example.com'); + $this->dispatch('newsletter/subscriber/new'); + + $this->performAsserts($message); + } + + /** + * @magentoConfigFixture current_store newsletter/subscription/allow_guest_subscribe 0 + * + * @magentoDataFixture Magento/Customer/_files/new_customer.php + * + * @return void + */ + public function testCustomerSubscribeUnrelatedEmailWithNotAllowedGuestSubscription(): void + { + $this->markTestSkipped('Blocked by MC-31662'); + $this->subscriberToDelete = 'guest@example.com'; + $this->session->loginById($this->customerRepository->get('new_customer@example.com')->getId()); + $this->prepareRequest('guest@example.com'); + $this->dispatch('newsletter/subscriber/new'); + //ToDo message need to be specified after bug MC-31662 fixing + $this->performAsserts(''); + } + + /** + * @magentoConfigFixture current_store newsletter/subscription/confirm 1 + * + * @return void + */ + public function testWithRequiredConfirmation(): void + { + $this->subscriberToDelete = 'guest@example.com'; + $this->prepareRequest('guest@example.com'); + $this->dispatch('newsletter/subscriber/new'); + + $this->performAsserts('The confirmation request has been sent.'); + } + + /** + * @magentoDataFixture Magento/Newsletter/_files/three_subscribers.php + * + * @return void + */ + public function testWithEmailAssignedToAnotherCustomer(): void + { + $this->session->loginById(1); + $this->prepareRequest('customer2@search.example.com'); + $this->dispatch('newsletter/subscriber/new'); + + $this->performAsserts('This email address is already assigned to another user.'); + } + + /** + * Prepare request + * + * @param string $email + * @return void + */ + private function prepareRequest(string $email): void + { + $parameters = $this->_objectManager->create(Parameters::class); + $parameters->set('HTTP_REFERER', 'http://localhost/testRedirect'); + $this->getRequest()->setServer($parameters); + $this->getRequest()->setMethod(HttpRequest::METHOD_POST); + $this->getRequest()->setPostValue(['email' => $email]); + } + + /** + * Assert session message and expected redirect + * + * @param string $message + * @return void + */ + private function performAsserts(string $message): void + { + if ($message) { + $this->assertSessionMessages($this->equalTo([(string)__($message)])); + } + $this->assertRedirect($this->equalTo('http://localhost/testRedirect')); + } + + /** + * Delete subscribers by email + * + * @param string $email + * @return void + */ + private function deleteSubscriber(string $email): void + { + $collection = $this->subscriberCollectionFactory->create(); + $item = $collection->addFieldToFilter('subscriber_email', $email)->setPageSize(1)->getFirstItem(); + if ($item->getId()) { + $this->subscriberResource->delete($item); + } + } +} diff --git a/dev/tests/integration/testsuite/Magento/Newsletter/Controller/SubscriberTest.php b/dev/tests/integration/testsuite/Magento/Newsletter/Controller/SubscriberTest.php index bf19d6ddefc36..ec6ae77c385fd 100644 --- a/dev/tests/integration/testsuite/Magento/Newsletter/Controller/SubscriberTest.php +++ b/dev/tests/integration/testsuite/Magento/Newsletter/Controller/SubscriberTest.php @@ -23,59 +23,6 @@ */ class SubscriberTest extends AbstractController { - public function testNewAction() - { - $this->getRequest()->setMethod('POST'); - - $this->dispatch('newsletter/subscriber/new'); - - $this->assertSessionMessages($this->isEmpty()); - $this->assertRedirect($this->anything()); - } - - /** - * @magentoDbIsolation enabled - */ - public function testNewActionUnusedEmail() - { - $this->getRequest()->setMethod('POST'); - $this->getRequest()->setPostValue(['email' => 'not_used@example.com']); - - $this->dispatch('newsletter/subscriber/new'); - - $this->assertSessionMessages($this->equalTo(['Thank you for your subscription.'])); - $this->assertRedirect($this->anything()); - } - - /** - * @magentoDataFixture Magento/Customer/_files/customer.php - */ - public function testNewActionUsedEmail() - { - $this->getRequest()->setMethod('POST'); - $this->getRequest()->setPostValue(['email' => 'customer@example.com']); - - $this->dispatch('newsletter/subscriber/new'); - - $this->assertSessionMessages($this->equalTo(['Thank you for your subscription.'])); - $this->assertRedirect($this->anything()); - } - - /** - * @magentoDataFixture Magento/Customer/_files/customer.php - */ - public function testNewActionOwnerEmail() - { - $this->getRequest()->setMethod('POST'); - $this->getRequest()->setPostValue(['email' => 'customer@example.com']); - $this->login(1); - - $this->dispatch('newsletter/subscriber/new'); - - $this->assertSessionMessages($this->equalTo(['Thank you for your subscription.'])); - $this->assertRedirect($this->anything()); - } - /** * Check that Customer still subscribed for newsletters emails after registration. * @@ -149,18 +96,4 @@ private function fillRequestWithAccountDataAndFormKey($email) ->setPostValue('create_address', true) ->setParam('form_key', Bootstrap::getObjectManager()->get(FormKey::class)->getFormKey()); } - - /** - * Login the user - * - * @param string $customerId Customer to mark as logged in for the session - * @return void - */ - protected function login($customerId) - { - /** @var \Magento\Customer\Model\Session $session */ - $session = Bootstrap::getObjectManager() - ->get(\Magento\Customer\Model\Session::class); - $session->loginById($customerId); - } } diff --git a/dev/tests/integration/testsuite/Magento/Newsletter/Model/SubscriberTest.php b/dev/tests/integration/testsuite/Magento/Newsletter/Model/SubscriberTest.php index bdcbdc035d2b0..06c8902f45897 100644 --- a/dev/tests/integration/testsuite/Magento/Newsletter/Model/SubscriberTest.php +++ b/dev/tests/integration/testsuite/Magento/Newsletter/Model/SubscriberTest.php @@ -3,104 +3,175 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); + namespace Magento\Newsletter\Model; +use Magento\Customer\Api\CustomerRepositoryInterface; +use Magento\Framework\ObjectManagerInterface; +use Magento\TestFramework\Helper\Bootstrap; use Magento\TestFramework\Mail\Template\TransportBuilderMock; +use PHPUnit\Framework\TestCase; /** - * \Magento\Newsletter\Model\Subscriber tests + * Class checks subscription behavior. + * + * @see \Magento\Newsletter\Model\Subscriber */ -class SubscriberTest extends \PHPUnit\Framework\TestCase +class SubscriberTest extends TestCase { + /** @var ObjectManagerInterface */ + private $objectManager; + + /** @var SubscriberFactory */ + private $subscriberFactory; + + /** @var TransportBuilderMock */ + private $transportBuilder; + + /** @var CustomerRepositoryInterface */ + private $customerRepository; + /** - * @var Subscriber + * @inheritdoc */ - private $model; - protected function setUp() { - $this->model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( - \Magento\Newsletter\Model\Subscriber::class - ); + $this->objectManager = Bootstrap::getObjectManager(); + $this->subscriberFactory = $this->objectManager->get(SubscriberFactory::class); + $this->transportBuilder = $this->objectManager->get(TransportBuilderMock::class); + $this->customerRepository = $this->objectManager->get(CustomerRepositoryInterface::class); } /** - * @magentoDataFixture Magento/Newsletter/_files/subscribers.php * @magentoConfigFixture current_store newsletter/subscription/confirm 1 + * + * @magentoDataFixture Magento/Newsletter/_files/subscribers.php + * + * @return void */ - public function testEmailConfirmation() + public function testEmailConfirmation(): void { - $this->model->subscribe('customer_confirm@example.com'); - /** @var TransportBuilderMock $transportBuilder */ - $transportBuilder = \Magento\TestFramework\Helper\Bootstrap::getObjectManager() - ->get(\Magento\TestFramework\Mail\Template\TransportBuilderMock::class); + $subscriber = $this->subscriberFactory->create(); + $subscriber->subscribe('customer_confirm@example.com'); // confirmationCode 'ysayquyajua23iq29gxwu2eax2qb6gvy' is taken from fixture $this->assertContains( - '/newsletter/subscriber/confirm/id/' . $this->model->getSubscriberId() + '/newsletter/subscriber/confirm/id/' . $subscriber->getSubscriberId() . '/code/ysayquyajua23iq29gxwu2eax2qb6gvy', - $transportBuilder->getSentMessage()->getBody()->getParts()[0]->getRawContent() + $this->transportBuilder->getSentMessage()->getBody()->getParts()[0]->getRawContent() ); - $this->assertEquals(Subscriber::STATUS_NOT_ACTIVE, $this->model->getSubscriberStatus()); + $this->assertEquals(Subscriber::STATUS_NOT_ACTIVE, $subscriber->getSubscriberStatus()); } /** * @magentoDataFixture Magento/Newsletter/_files/subscribers.php + * + * @return void */ - public function testLoadByCustomerId() + public function testLoadByCustomerId(): void { - $this->assertSame($this->model, $this->model->loadByCustomerId(1)); - $this->assertEquals('customer@example.com', $this->model->getSubscriberEmail()); + $subscriber = $this->subscriberFactory->create(); + $this->assertSame($subscriber, $subscriber->loadByCustomerId(1)); + $this->assertEquals('customer@example.com', $subscriber->getSubscriberEmail()); } /** * @magentoDataFixture Magento/Newsletter/_files/subscribers.php - * @magentoAppArea frontend + * + * @magentoAppArea frontend + * + * @return void */ - public function testUnsubscribeSubscribe() + public function testUnsubscribeSubscribe(): void { - // Unsubscribe and verify - $this->assertSame($this->model, $this->model->loadByCustomerId(1)); - $this->assertEquals($this->model, $this->model->unsubscribe()); - $this->assertEquals(Subscriber::STATUS_UNSUBSCRIBED, $this->model->getSubscriberStatus()); - + $subscriber = $this->subscriberFactory->create(); + $this->assertSame($subscriber, $subscriber->loadByCustomerId(1)); + $this->assertEquals($subscriber, $subscriber->unsubscribe()); + $this->assertContains( + 'You have been unsubscribed from the newsletter.', + $this->transportBuilder->getSentMessage()->getRawMessage() + ); + $this->assertEquals(Subscriber::STATUS_UNSUBSCRIBED, $subscriber->getSubscriberStatus()); // Subscribe and verify - $this->assertEquals(Subscriber::STATUS_SUBSCRIBED, $this->model->subscribe('customer@example.com')); - $this->assertEquals(Subscriber::STATUS_SUBSCRIBED, $this->model->getSubscriberStatus()); + $this->assertEquals(Subscriber::STATUS_SUBSCRIBED, $subscriber->subscribe('customer@example.com')); + $this->assertEquals(Subscriber::STATUS_SUBSCRIBED, $subscriber->getSubscriberStatus()); + $this->assertContains( + 'You have been successfully subscribed to our newsletter.', + $this->transportBuilder->getSentMessage()->getRawMessage() + ); } /** * @magentoDataFixture Magento/Newsletter/_files/subscribers.php - * @magentoAppArea frontend + * + * @magentoAppArea frontend + * + * @return void */ - public function testUnsubscribeSubscribeByCustomerId() + public function testUnsubscribeSubscribeByCustomerId(): void { + $subscriber = $this->subscriberFactory->create(); // Unsubscribe and verify - $this->assertSame($this->model, $this->model->unsubscribeCustomerById(1)); - $this->assertEquals(Subscriber::STATUS_UNSUBSCRIBED, $this->model->getSubscriberStatus()); - + $this->assertSame($subscriber, $subscriber->unsubscribeCustomerById(1)); + $this->assertEquals(Subscriber::STATUS_UNSUBSCRIBED, $subscriber->getSubscriberStatus()); + $this->assertContains( + 'You have been unsubscribed from the newsletter.', + $this->transportBuilder->getSentMessage()->getRawMessage() + ); // Subscribe and verify - $this->assertSame($this->model, $this->model->subscribeCustomerById(1)); - $this->assertEquals(Subscriber::STATUS_SUBSCRIBED, $this->model->getSubscriberStatus()); + $this->assertSame($subscriber, $subscriber->subscribeCustomerById(1)); + $this->assertEquals(Subscriber::STATUS_SUBSCRIBED, $subscriber->getSubscriberStatus()); + $this->assertContains( + 'You have been successfully subscribed to our newsletter.', + $this->transportBuilder->getSentMessage()->getRawMessage() + ); } /** - * @magentoDataFixture Magento/Newsletter/_files/subscribers.php * @magentoConfigFixture current_store newsletter/subscription/confirm 1 + * + * @magentoDataFixture Magento/Newsletter/_files/subscribers.php + * + * @return void */ - public function testConfirm() + public function testConfirm(): void { + $subscriber = $this->subscriberFactory->create(); $customerEmail = 'customer_confirm@example.com'; - $this->model->subscribe($customerEmail); - $this->model->loadByEmail($customerEmail); - $this->model->confirm($this->model->getSubscriberConfirmCode()); - - $transportBuilder = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get( - \Magento\TestFramework\Mail\Template\TransportBuilderMock::class - ); - + $subscriber->subscribe($customerEmail); + $subscriber->loadByEmail($customerEmail); + $subscriber->confirm($subscriber->getSubscriberConfirmCode()); $this->assertContains( 'You have been successfully subscribed to our newsletter.', - $transportBuilder->getSentMessage()->getBody()->getParts()[0]->getRawContent() + $this->transportBuilder->getSentMessage()->getRawMessage() ); } + + /** + * @magentoDataFixture Magento/Customer/_files/customer_confirmation_config_enable.php + * @magentoDataFixture Magento/Newsletter/_files/newsletter_unconfirmed_customer.php + * + * @return void + */ + public function testSubscribeUnconfirmedCustomerWithSubscription(): void + { + $customer = $this->customerRepository->get('unconfirmedcustomer@example.com'); + $subscriber = $this->subscriberFactory->create(); + $subscriber->subscribeCustomerById($customer->getId()); + $this->assertEquals(Subscriber::STATUS_SUBSCRIBED, $subscriber->getStatus()); + } + + /** + * @magentoDataFixture Magento/Customer/_files/customer_confirmation_config_enable.php + * @magentoDataFixture Magento/Customer/_files/unconfirmed_customer.php + * + * @return void + */ + public function testSubscribeUnconfirmedCustomerWithoutSubscription(): void + { + $customer = $this->customerRepository->get('unconfirmedcustomer@example.com'); + $subscriber = $this->subscriberFactory->create(); + $subscriber->subscribeCustomerById($customer->getId()); + $this->assertEquals(Subscriber::STATUS_UNCONFIRMED, $subscriber->getStatus()); + } } diff --git a/dev/tests/integration/testsuite/Magento/Newsletter/_files/customer_with_subscription.php b/dev/tests/integration/testsuite/Magento/Newsletter/_files/customer_with_subscription.php new file mode 100644 index 0000000000000..f700889881e8d --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Newsletter/_files/customer_with_subscription.php @@ -0,0 +1,13 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Newsletter\Model\SubscriberFactory; + +require __DIR__ . '/../../../Magento/Customer/_files/new_customer.php'; + +$subscriberFactory = $objectManager->get(SubscriberFactory::class); +$subscriberFactory->create()->subscribe('new_customer@example.com'); diff --git a/dev/tests/integration/testsuite/Magento/Newsletter/_files/customer_with_subscription_rollback.php b/dev/tests/integration/testsuite/Magento/Newsletter/_files/customer_with_subscription_rollback.php new file mode 100644 index 0000000000000..145f6a9b43bbb --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Newsletter/_files/customer_with_subscription_rollback.php @@ -0,0 +1,8 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +require __DIR__ . '/../../../Magento/Customer/_files/new_customer_rollback.php'; diff --git a/dev/tests/integration/testsuite/Magento/Newsletter/_files/newsletter_unconfirmed_customer.php b/dev/tests/integration/testsuite/Magento/Newsletter/_files/newsletter_unconfirmed_customer.php new file mode 100644 index 0000000000000..405ac1c67bd7b --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Newsletter/_files/newsletter_unconfirmed_customer.php @@ -0,0 +1,14 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Newsletter\Model\SubscriberFactory; + +require __DIR__ . '/../../../Magento/Customer/_files/unconfirmed_customer.php'; + +/** @var SubscriberFactory $subscriberFactory */ +$subscriberFactory = $objectManager->get(SubscriberFactory::class); +$subscriberFactory->create()->subscribe('unconfirmedcustomer@example.com'); diff --git a/dev/tests/integration/testsuite/Magento/Newsletter/_files/newsletter_unconfirmed_customer_rollback.php b/dev/tests/integration/testsuite/Magento/Newsletter/_files/newsletter_unconfirmed_customer_rollback.php new file mode 100644 index 0000000000000..5742526988187 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Newsletter/_files/newsletter_unconfirmed_customer_rollback.php @@ -0,0 +1,8 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +require __DIR__ . '/../../../Magento/Customer/_files/unconfirmed_customer_rollback.php'; diff --git a/dev/tests/integration/testsuite/Magento/Paypal/Controller/Billing/AgreementTest.php b/dev/tests/integration/testsuite/Magento/Paypal/Controller/Billing/AgreementTest.php index fd8b4fd2efad5..6f192b6479acd 100644 --- a/dev/tests/integration/testsuite/Magento/Paypal/Controller/Billing/AgreementTest.php +++ b/dev/tests/integration/testsuite/Magento/Paypal/Controller/Billing/AgreementTest.php @@ -19,6 +19,7 @@ class AgreementTest extends \Magento\TestFramework\TestCase\AbstractController * * @magentoDataFixture Magento/Customer/_files/customer.php * @magentoDbIsolation enabled + * @magentoAppArea frontend */ public function testReturnWizardAction() { diff --git a/dev/tests/integration/testsuite/Magento/Sales/_files/orders_with_customer.php b/dev/tests/integration/testsuite/Magento/Sales/_files/orders_with_customer.php index 1a0a94b0ca951..4c962d5527c49 100644 --- a/dev/tests/integration/testsuite/Magento/Sales/_files/orders_with_customer.php +++ b/dev/tests/integration/testsuite/Magento/Sales/_files/orders_with_customer.php @@ -24,7 +24,6 @@ 'base_grand_total' => 120.00, 'store_id' => 1, 'website_id' => 1, - 'payment' => $payment ], [ 'increment_id' => '100000003', @@ -36,7 +35,6 @@ 'total_paid' => 130.00, 'store_id' => 0, 'website_id' => 0, - 'payment' => $payment ], [ 'increment_id' => '100000004', @@ -47,7 +45,6 @@ 'subtotal' => 140.00, 'store_id' => 1, 'website_id' => 1, - 'payment' => $payment ], [ 'increment_id' => '100000005', @@ -59,7 +56,6 @@ 'total_paid' => 150.00, 'store_id' => 1, 'website_id' => 1, - 'payment' => $payment ], [ 'increment_id' => '100000006', @@ -71,7 +67,6 @@ 'total_paid' => 160.00, 'store_id' => 1, 'website_id' => 1, - 'payment' => $payment ], ]; @@ -79,6 +74,8 @@ $orderRepository = $objectManager->create(OrderRepositoryInterface::class); /** @var array $orderData */ foreach ($orders as $orderData) { + $newPayment = clone $payment; + $newPayment->setId(null); /** @var $order \Magento\Sales\Model\Order */ $order = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create( \Magento\Sales\Model\Order::class @@ -108,7 +105,8 @@ ->setCustomerId(1) ->setCustomerEmail('customer@example.com') ->setBillingAddress($billingAddress) - ->setShippingAddress($shippingAddress); + ->setShippingAddress($shippingAddress) + ->setPayment($newPayment); $orderRepository->save($order); } diff --git a/dev/tests/integration/testsuite/Magento/Setup/Model/_files/testSkeleton/composer.lock b/dev/tests/integration/testsuite/Magento/Setup/Model/_files/testSkeleton/composer.lock index 48fa6d0d0cd34..c5529f75b9d05 100644 --- a/dev/tests/integration/testsuite/Magento/Setup/Model/_files/testSkeleton/composer.lock +++ b/dev/tests/integration/testsuite/Magento/Setup/Model/_files/testSkeleton/composer.lock @@ -887,10 +887,6 @@ "app/.htaccess", "app/.htaccess" ], - [ - "app/functions.php", - "app/functions.php" - ], [ "app/autoload.php", "app/autoload.php" diff --git a/dev/tests/integration/testsuite/Magento/Wishlist/Block/Account/LinkTest.php b/dev/tests/integration/testsuite/Magento/Wishlist/Block/Account/LinkTest.php new file mode 100644 index 0000000000000..f4d66b2ff8cde --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Wishlist/Block/Account/LinkTest.php @@ -0,0 +1,79 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Wishlist\Block\Account; + +use Magento\Framework\ObjectManagerInterface; +use Magento\Framework\View\Result\Page; +use Magento\TestFramework\Helper\Bootstrap; +use PHPUnit\Framework\TestCase; + +/** + * Checks My Wish List link displaying in account dashboard + * + * @magentoAppArea frontend + * @magentoDbIsolation enabled + * @magentoAppIsolation enabled + */ +class LinkTest extends TestCase +{ + /** @var ObjectManagerInterface */ + private $objectManager; + + /** @var Page */ + private $page; + + /** + * @inheritdoc + */ + protected function setUp() + { + parent::setUp(); + + $this->objectManager = Bootstrap::getObjectManager(); + $this->page = $this->objectManager->create(Page::class); + } + + /** + * @return void + */ + public function testNewsletterLink(): void + { + $this->preparePage(); + $block = $this->page->getLayout()->getBlock('customer-account-navigation-wish-list-link'); + $this->assertNotFalse($block); + $html = $block->toHtml(); + $this->assertContains('wishlist/', $html); + $this->assertEquals('My Wish List', strip_tags($html)); + } + + /** + * @magentoConfigFixture current_store wishlist/general/active 0 + * + * @return void + */ + public function testNewsletterLinkDisabled(): void + { + $this->preparePage(); + $block = $this->page->getLayout()->getBlock('customer-account-navigation-wish-list-link'); + $this->assertFalse($block); + } + + /** + * Prepare page before render + * + * @return void + */ + private function preparePage(): void + { + $this->page->addHandle([ + 'default', + 'customer_account', + ]); + $this->page->getLayout()->generateXml(); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Wishlist/Block/Catalog/Product/ProductList/Item/AddTo/WishlistTest.php b/dev/tests/integration/testsuite/Magento/Wishlist/Block/Catalog/Product/ProductList/Item/AddTo/WishlistTest.php new file mode 100644 index 0000000000000..36bd4dd4f312e --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Wishlist/Block/Catalog/Product/ProductList/Item/AddTo/WishlistTest.php @@ -0,0 +1,69 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Wishlist\Block\Catalog\Product\ProductList\Item\AddTo; + +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Framework\ObjectManagerInterface; +use Magento\Framework\View\LayoutInterface; +use Magento\TestFramework\Helper\Bootstrap; +use PHPUnit\Framework\TestCase; + +/** + * Checks add to wishlist button on category page. + * + * @magentoAppArea frontend + * @magentoDbIsolation enabled + * @magentoAppIsolation disabled + */ +class WishlistTest extends TestCase +{ + /** @var ObjectManagerInterface */ + private $objectManager; + + /** @var Wishlist */ + private $block; + + /** @var ProductRepositoryInterface */ + private $productRepository; + + /** + * @inheritdoc + */ + protected function setUp() + { + $this->objectManager = Bootstrap::getObjectManager(); + $this->productRepository = $this->objectManager->get(ProductRepositoryInterface::class); + $this->productRepository->cleanCache(); + $this->block = $this->objectManager->get(LayoutInterface::class) + ->createBlock(Wishlist::class)->setTemplate('Magento_Wishlist::catalog/product/list/addto/wishlist.phtml'); + } + + /** + * @magentoDataFixture Magento/Catalog/_files/second_product_simple.php + * + * @return void + */ + public function testAddToWishListVisible(): void + { + $product = $this->productRepository->get('simple2'); + $html = $this->block->setProduct($product)->toHtml(); + $this->assertEquals('Add to Wish List', trim(strip_tags($html))); + } + + /** + * @magentoConfigFixture current_store wishlist/general/active 0 + * @magentoDataFixture Magento/Catalog/_files/second_product_simple.php + * + * @return void + */ + public function testAddToWishListNotVisible(): void + { + $product = $this->productRepository->get('simple2'); + $this->assertEmpty($this->block->setProduct($product)->toHtml()); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Wishlist/Block/Catalog/Product/View/AddTo/WishlistTest.php b/dev/tests/integration/testsuite/Magento/Wishlist/Block/Catalog/Product/View/AddTo/WishlistTest.php new file mode 100644 index 0000000000000..8d0226bfe9a2b --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Wishlist/Block/Catalog/Product/View/AddTo/WishlistTest.php @@ -0,0 +1,108 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Wishlist\Block\Catalog\Product\View\AddTo; + +use Magento\Catalog\Api\Data\ProductInterface; +use Magento\Catalog\Api\ProductRepositoryInterface; +use Magento\Framework\ObjectManagerInterface; +use Magento\Framework\Registry; +use Magento\Framework\View\LayoutInterface; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\TestFramework\Helper\Xpath; +use PHPUnit\Framework\TestCase; + +/** + * Checks add to wishlist button on product page. + * + * @magentoAppArea frontend + * @magentoDbIsolation enabled + * @magentoAppIsolation disabled + */ +class WishlistTest extends TestCase +{ + private const ADD_TO_WISHLIST_XPATH = "//a[@data-action='add-to-wishlist']" + . "/span[contains(text(), 'Add to Wish List')]"; + + /** @var ObjectManagerInterface */ + private $objectManager; + + /** @var Registry */ + private $registry; + + /** @var Wishlist */ + private $block; + + /** @var ProductRepositoryInterface */ + private $productRepository; + + /** + * @inheritdoc + */ + protected function setUp() + { + $this->objectManager = Bootstrap::getObjectManager(); + $this->registry = $this->objectManager->get(Registry::class); + $this->productRepository = $this->objectManager->get(ProductRepositoryInterface::class); + $this->productRepository->cleanCache(); + $this->block = $this->objectManager->get(LayoutInterface::class) + ->createBlock(Wishlist::class)->setTemplate('Magento_Wishlist::catalog/product/view/addto/wishlist.phtml'); + } + + /** + * @inheritdoc + */ + protected function tearDown() + { + $this->registry->unregister('product'); + + parent::tearDown(); + } + + /** + * @magentoDataFixture Magento/Catalog/_files/second_product_simple.php + * + * @return void + */ + public function testAddToWishListVisible(): void + { + $product = $this->productRepository->get('simple2'); + $this->registerProduct($product); + $this->assertEquals( + 1, + Xpath::getElementsCountForXpath(self::ADD_TO_WISHLIST_XPATH, $this->block->toHtml()) + ); + } + + /** + * @magentoConfigFixture current_store wishlist/general/active 0 + * @magentoDataFixture Magento/Catalog/_files/second_product_simple.php + * + * @return void + */ + public function testAddToWishListNotVisible(): void + { + $product = $this->productRepository->get('simple2'); + $this->registerProduct($product); + $this->assertEquals( + 0, + Xpath::getElementsCountForXpath(self::ADD_TO_WISHLIST_XPATH, $this->block->toHtml()) + ); + } + + /** + * Register the product. + * + * @param ProductInterface $product + * @return void + */ + private function registerProduct(ProductInterface $product): void + { + $this->registry->unregister('product'); + $this->registry->register('product', $product); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Wishlist/Block/Customer/SidebarTest.php b/dev/tests/integration/testsuite/Magento/Wishlist/Block/Customer/SidebarTest.php new file mode 100644 index 0000000000000..6e6e88ab73019 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Wishlist/Block/Customer/SidebarTest.php @@ -0,0 +1,94 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Wishlist\Block\Customer; + +use Magento\Framework\App\ProductMetadata; +use Magento\Framework\App\ProductMetadataInterface; +use Magento\Framework\ObjectManagerInterface; +use Magento\Framework\View\Result\Page; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\TestFramework\Helper\Xpath; +use PHPUnit\Framework\TestCase; + +/** + * Class test sidebar wish list block. + * + * @magentoAppArea frontend + * @magentoDbIsolation enabled + * @magentoAppIsolation enabled + */ +class SidebarTest extends TestCase +{ + private const BLOCK_NAME = 'wishlist_sidebar'; + + /** @var ObjectManagerInterface */ + private $objectManager; + + /** @var Page */ + private $page; + + /** + * @inheritdoc + */ + protected function setUp() + { + $this->objectManager = Bootstrap::getObjectManager(); + $productMetadataInterface = $this->objectManager->get(ProductMetadataInterface::class); + if ($productMetadataInterface->getEdition() !== ProductMetadata::EDITION_NAME) { + $this->markTestSkipped('Skipped, because this logic is rewritten on EE.'); + } + $this->page = $this->objectManager->create(Page::class); + } + + /** + * @magentoConfigFixture current_store wishlist/general/show_in_sidebar 1 + * + * @return void + */ + public function testSidebarWishListVisible(): void + { + $this->preparePageLayout(); + $block = $this->page->getLayout()->getBlock(self::BLOCK_NAME); + $this->assertNotFalse($block); + $this->assertEquals( + 1, + Xpath::getElementsCountForXpath( + "//div[contains(@class, 'block-wishlist')]//strong[contains(text(), 'My Wish List')]", + $block->toHtml() + ) + ); + } + + /** + * @magentoConfigFixture current_store wishlist/general/show_in_sidebar 0 + * + * @return void + */ + public function testSidebarWishListNotVisible(): void + { + $this->preparePageLayout(); + $this->assertFalse( + $this->page->getLayout()->getBlock(self::BLOCK_NAME), + 'Sidebar wish list should not be visible.' + ); + } + + /** + * Prepare category page. + * + * @return void + */ + private function preparePageLayout(): void + { + $this->page->addHandle([ + 'default', + 'catalog_category_view', + ]); + $this->page->getLayout()->generateXml(); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Wishlist/Block/Customer/WishlistTest.php b/dev/tests/integration/testsuite/Magento/Wishlist/Block/Customer/WishlistTest.php new file mode 100644 index 0000000000000..944d2ac6faada --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Wishlist/Block/Customer/WishlistTest.php @@ -0,0 +1,108 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Wishlist\Block\Customer; + +use Magento\Customer\Model\Session; +use Magento\Framework\ObjectManagerInterface; +use Magento\Framework\View\Result\Page; +use Magento\TestFramework\Helper\Bootstrap; +use Magento\TestFramework\Helper\Xpath; +use PHPUnit\Framework\TestCase; + +/** + * Class test my wish list on customer account page. + * + * @magentoAppArea frontend + * @magentoDbIsolation enabled + * @magentoAppIsolation disabled + */ +class WishlistTest extends TestCase +{ + private const ITEMS_COUNT_XPATH = "//div[contains(@class, 'pager')]//span[contains(@class, 'toolbar-number')" + . " and contains(text(), '%s Item')]"; + + /** @var ObjectManagerInterface */ + private $objectManager; + + /** @var Page */ + private $page; + + /** @var Session */ + private $customerSession; + + /** + * @inheritdoc + */ + protected function setUp() + { + parent::setUp(); + + $this->objectManager = Bootstrap::getObjectManager(); + $this->page = $this->objectManager->create(Page::class); + $this->customerSession = $this->objectManager->get(Session::class); + } + + /** + * @inheritdoc + */ + protected function tearDown() + { + $this->customerSession->setCustomerId(null); + + parent::tearDown(); + } + + /** + * @magentoConfigFixture current_store wishlist/wishlist_link/use_qty 0 + * @magentoDataFixture Magento/Wishlist/_files/wishlist_with_product_qty_three.php + * + * @return void + */ + public function testDisplayNumberOfItemsInWishList(): void + { + $this->customerSession->setCustomerId(1); + $this->assertEquals( + 1, + Xpath::getElementsCountForXpath(sprintf(self::ITEMS_COUNT_XPATH, 1), $this->getWishListPagerBlockHtml()) + ); + } + + /** + * @magentoConfigFixture current_store wishlist/wishlist_link/use_qty 1 + * @magentoDataFixture Magento/Wishlist/_files/wishlist_with_product_qty_three.php + * + * @return void + */ + public function testDisplayItemQuantitiesInWishList(): void + { + $this->markTestSkipped('Test is blocked by issue MC-31595'); + $this->customerSession->setCustomerId(1); + $this->assertEquals( + 1, + Xpath::getElementsCountForXpath(sprintf(self::ITEMS_COUNT_XPATH, 3), $this->getWishListPagerBlockHtml()) + ); + } + + /** + * Get wish list pager block html. + * + * @return string + */ + private function getWishListPagerBlockHtml(): string + { + $this->page->addHandle([ + 'default', + 'wishlist_index_index', + ]); + $this->page->getLayout()->generateXml(); + /** @var Wishlist $customerWishlistBlock */ + $customerWishlistBlock = $this->page->getLayout()->getBlock('customer.wishlist'); + + return $customerWishlistBlock->getChildBlock('wishlist_item_pager')->toHtml(); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Wishlist/Block/LinkTest.php b/dev/tests/integration/testsuite/Magento/Wishlist/Block/LinkTest.php new file mode 100644 index 0000000000000..b7f124f7c1f6d --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Wishlist/Block/LinkTest.php @@ -0,0 +1,56 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Wishlist\Block; + +use Magento\Framework\ObjectManagerInterface; +use Magento\Framework\View\LayoutInterface; +use Magento\TestFramework\Helper\Bootstrap; +use PHPUnit\Framework\TestCase; + +/** + * Class test link my wish list in customer menu. + * + * @magentoAppArea frontend + * @magentoDbIsolation enabled + * @magentoAppIsolation disabled + */ +class LinkTest extends TestCase +{ + /** @var ObjectManagerInterface */ + private $objectManager; + + /** @var Link */ + private $block; + + /** + * @inheritdoc + */ + protected function setUp() + { + $this->objectManager = Bootstrap::getObjectManager(); + $this->block = $this->objectManager->get(LayoutInterface::class)->createBlock(Link::class); + } + + /** + * @return void + */ + public function testWishListLinkVisible(): void + { + $this->assertContains('My Wish List', strip_tags($this->block->toHtml())); + } + + /** + * @magentoConfigFixture current_store wishlist/general/active 0 + * + * @return void + */ + public function testWishListLinkNotVisible(): void + { + $this->assertEmpty($this->block->toHtml()); + } +} diff --git a/dev/tests/integration/testsuite/Magento/Wishlist/_files/wishlist_with_product_qty_three.php b/dev/tests/integration/testsuite/Magento/Wishlist/_files/wishlist_with_product_qty_three.php new file mode 100644 index 0000000000000..11752d5ba39f3 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Wishlist/_files/wishlist_with_product_qty_three.php @@ -0,0 +1,18 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +use Magento\Wishlist\Model\WishlistFactory; +use Magento\Framework\Serialize\SerializerInterface; + +require __DIR__ . '/../../../Magento/Customer/_files/customer.php'; +require __DIR__ . '/../../../Magento/Catalog/_files/product_simple.php'; + +$json = $objectManager->get(SerializerInterface::class); +$wishlistFactory = $objectManager->get(WishlistFactory::class); +$wishlist = $wishlistFactory->create(); +$wishlist->loadByCustomerId($customer->getId(), true); +$wishlist->addNewItem($product, $json->serialize(['qty' => 3])); diff --git a/dev/tests/integration/testsuite/Magento/Wishlist/_files/wishlist_with_product_qty_three_rollback.php b/dev/tests/integration/testsuite/Magento/Wishlist/_files/wishlist_with_product_qty_three_rollback.php new file mode 100644 index 0000000000000..24bbccd5739f4 --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Wishlist/_files/wishlist_with_product_qty_three_rollback.php @@ -0,0 +1,9 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +require __DIR__ . '/../../../Magento/Catalog/_files/product_simple_rollback.php'; +require __DIR__ . '/../../../Magento/Customer/_files/customer_rollback.php'; diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/frontend/js/model/messages.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/frontend/js/model/messages.test.js new file mode 100644 index 0000000000000..54134c5b3166c --- /dev/null +++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/frontend/js/model/messages.test.js @@ -0,0 +1,109 @@ +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +define([ + 'uiRegistry', + 'Magento_Ui/js/model/messages' +], function (registry, Constr) { + 'use strict'; + + describe('Magento_Ui/js/model/messages', function () { + + var obj, + errorMessageText, + successMessageText, + messageObj; + + beforeEach(function () { + obj = new Constr( + { + provider: 'provName', + name: '', + index: '' + }); + errorMessageText = 'Error message test'; + successMessageText = 'Success message test'; + + registry.set('provName', { + /** Stub */ + on: function () { + }, + + /** Stub */ + get: function () { + }, + + /** Stub */ + set: function () { + } + }); + }); + + it('adds massage without parameters', function () { + var type = []; + + messageObj = { + message: 'Message test' + }; + expect(obj.add(messageObj, type)).toEqual(true); + expect(type).toEqual([messageObj.message]); + }); + + it('add message with parameters', function () { + var returnedObj, + type = []; + + messageObj = { + message: 'Message test case %1, case %2 and case %3', + parameters: [ + 'one', + 'two', + 'three' + ] + }; + returnedObj = ['Message test case ' + messageObj.parameters[0] + ', case ' + + messageObj.parameters[1] + ' and case ' + messageObj.parameters[2]]; + + expect(obj.add(messageObj, type)).toEqual(true); + expect(type).toEqual(returnedObj); + }); + + it('add error message, get error message, verify has error message', function () { + messageObj = { + message: errorMessageText + }; + + expect(obj.hasMessages()).toEqual(false); + expect(obj.addErrorMessage(messageObj)).toEqual(true); + expect(obj.getErrorMessages()()).toEqual([errorMessageText]); + expect(obj.hasMessages()).toEqual(true); + }); + + it('add success message, get success message, verify has success message', function () { + messageObj = { + message: successMessageText + }; + + expect(obj.addSuccessMessage(messageObj)).toEqual(true); + expect(obj.getSuccessMessages()()).toEqual([successMessageText]); + expect(obj.hasMessages()).toEqual(true); + }); + + it('cleaning messages', function () { + messageObj = { + message: 'Message test case %1, case %2 and case %3', + parameters: [ + 'one', + 'two', + 'three' + ] + }; + expect(obj.addErrorMessage(messageObj)).toEqual(true); + obj.clear(); + expect(obj.getErrorMessages()()).toEqual([]); + expect(obj.hasMessages()).toEqual(false); + }); + }); +}); diff --git a/dev/tests/static/framework/Magento/Sniffs/Annotation/AnnotationFormatValidator.php b/dev/tests/static/framework/Magento/Sniffs/Annotation/AnnotationFormatValidator.php index 20442f9388235..cd4c8689ea004 100644 --- a/dev/tests/static/framework/Magento/Sniffs/Annotation/AnnotationFormatValidator.php +++ b/dev/tests/static/framework/Magento/Sniffs/Annotation/AnnotationFormatValidator.php @@ -94,7 +94,7 @@ private function validateSpacingBetweenShortAndLongDescriptions( && $tokens[$shortPtr]['line'] + 1 === $tokens[$shortPtrEnd]['line'] && $tokens[$shortPtrEnd]['code'] !== T_DOC_COMMENT_TAG ) { - $error = 'There must be exactly one blank line between lines'; + $error = 'There must be exactly one blank line between lines short and long descriptions'; $phpcsFile->addFixableError($error, $shortPtrEnd + 1, 'MethodAnnotation'); } if ($shortPtrEnd != $shortPtr) { diff --git a/dev/tests/static/framework/tests/unit/testsuite/Magento/Sniffs/Annotation/_files/class_annotation_nospacingbetweenLines_errors.txt b/dev/tests/static/framework/tests/unit/testsuite/Magento/Sniffs/Annotation/_files/class_annotation_nospacingbetweenLines_errors.txt index 01c145ad6c29f..0102ca7f79a1f 100644 --- a/dev/tests/static/framework/tests/unit/testsuite/Magento/Sniffs/Annotation/_files/class_annotation_nospacingbetweenLines_errors.txt +++ b/dev/tests/static/framework/tests/unit/testsuite/Magento/Sniffs/Annotation/_files/class_annotation_nospacingbetweenLines_errors.txt @@ -3,10 +3,10 @@ FILE: ...tation/_fixtures/ClassAnnotationNoSpacingBetweenLinesFixture.php\n ----------------------------------------------------------------------\n FOUND 1 ERROR AFFECTING 1 LINE\n ----------------------------------------------------------------------\n - 13 | ERROR | [x] There must be exactly one blank line between lines\n + 13 | ERROR | [x] There must be exactly one blank line between lines short and long descriptions\n ----------------------------------------------------------------------\n PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY\n ----------------------------------------------------------------------\n \n \n -' \ No newline at end of file +' diff --git a/dev/tests/static/testsuite/Magento/Test/Integrity/DependencyTest.php b/dev/tests/static/testsuite/Magento/Test/Integrity/DependencyTest.php index fa0d365061858..60855043a8c4e 100644 --- a/dev/tests/static/testsuite/Magento/Test/Integrity/DependencyTest.php +++ b/dev/tests/static/testsuite/Magento/Test/Integrity/DependencyTest.php @@ -154,6 +154,13 @@ class DependencyTest extends \PHPUnit\Framework\TestCase */ private static $routesWhitelist = null; + /** + * Redundant dependencies whitelist + * + * @var array|null + */ + private static $redundantDependenciesWhitelist = null; + /** * @var RouteMapper */ @@ -185,6 +192,7 @@ public static function setUpBeforeClass() self::_prepareMapLayoutHandles(); self::getLibraryWhiteLists(); + self::getRedundantDependenciesWhiteLists(); self::_initDependencies(); self::_initThemes(); @@ -206,6 +214,26 @@ private static function getLibraryWhiteLists() } } + /** + * Initialize redundant dependencies whitelist + * + * @return array + */ + private static function getRedundantDependenciesWhiteLists(): array + { + if (is_null(self::$redundantDependenciesWhitelist)) { + $redundantDependenciesWhitelistFilePattern = + realpath(__DIR__) . '/_files/dependency_test/whitelist/redundant_dependencies_*.php'; + $redundantDependenciesWhitelist = []; + foreach (glob($redundantDependenciesWhitelistFilePattern) as $fileName) { + //phpcs:ignore Magento2.Performance.ForeachArrayMerge + $redundantDependenciesWhitelist = array_merge($redundantDependenciesWhitelist, include $fileName); + } + self::$redundantDependenciesWhitelist = $redundantDependenciesWhitelist; + } + return self::$redundantDependenciesWhitelist; + } + /** * Initialize default themes */ @@ -532,6 +560,9 @@ public function testRedundant() foreach (array_keys(self::$mapDependencies) as $module) { $result = []; $redundant = $this->_getDependencies($module, self::TYPE_HARD, self::MAP_TYPE_REDUNDANT); + if (isset(self::$redundantDependenciesWhitelist[$module])) { + $redundant = array_diff($redundant, self::$redundantDependenciesWhitelist[$module]); + } if (!empty($redundant)) { $result[] = sprintf( "\r\nModule %s: %s [%s]", diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/autogenerated_class_not_in_constructor_whitelist.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/autogenerated_class_not_in_constructor_whitelist.php index ba8f7e3dd1420..f8979ef6ab15e 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/autogenerated_class_not_in_constructor_whitelist.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/autogenerated_class_not_in_constructor_whitelist.php @@ -9,5 +9,6 @@ 'Symfony\Component\Console\Application', 'Customer\Address\Attributes', 'Order\Address\Type', - 'Order\Address\Attributes' + 'Order\Address\Attributes', + 'This\Is\Another\Ns', ]; diff --git a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/copyright/blacklist.php b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/copyright/blacklist.php index 242e4ebb22a54..48eb64ffea27e 100644 --- a/dev/tests/static/testsuite/Magento/Test/Legacy/_files/copyright/blacklist.php +++ b/dev/tests/static/testsuite/Magento/Test/Legacy/_files/copyright/blacklist.php @@ -10,4 +10,5 @@ '/setup\/src\/Zend\/Mvc\/Controller\/LazyControllerAbstractFactory\.php/', '/app\/code\/(?!Magento)[^\/]*/', '#dev/tests/setup-integration/testsuite/Magento/Developer/_files/\S*\.xml$#', + '/lib\/internal\/Magento\/Framework\/File\/Test\/Unit\/_files\/blank.html$/' ]; diff --git a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpstan/blacklist/common.txt b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpstan/blacklist/common.txt index f54defbd57604..6a7c814f50524 100644 --- a/dev/tests/static/testsuite/Magento/Test/Php/_files/phpstan/blacklist/common.txt +++ b/dev/tests/static/testsuite/Magento/Test/Php/_files/phpstan/blacklist/common.txt @@ -14,3 +14,5 @@ dev/tests/api-functional/testsuite/Magento/Customer/Api/AddressRepositoryTest.ph dev/tests/api-functional/testsuite/Magento/Framework/Model/Entity/HydratorTest.php dev/tests/api-functional/testsuite/Magento/Integration/Model/AdminTokenServiceTest.php dev/tests/api-functional/testsuite/Magento/Integration/Model/CustomerTokenServiceTest.php +lib/internal/Magento/Framework/Storage/AdapterFactory/AwsS3Factory.php +lib/internal/Magento/Framework/Storage/AdapterFactory/AzureFactory.php diff --git a/lib/internal/Magento/Framework/App/Action/Action.php b/lib/internal/Magento/Framework/App/Action/Action.php index b68e7e873be6a..6a3b665c7d3ed 100644 --- a/lib/internal/Magento/Framework/App/Action/Action.php +++ b/lib/internal/Magento/Framework/App/Action/Action.php @@ -3,20 +3,29 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\App\Action; +use Magento\Framework\App\ActionFlag; use Magento\Framework\App\RequestInterface; +use Magento\Framework\App\Response\RedirectInterface; use Magento\Framework\App\ResponseInterface; -use Magento\Framework\Controller\ResultInterface; +use Magento\Framework\App\ViewInterface; +use Magento\Framework\Event\ManagerInterface as EventManagerInterface; use Magento\Framework\Exception\NotFoundException; +use Magento\Framework\Message\ManagerInterface as MessageManagerInterface; +use Magento\Framework\ObjectManagerInterface; +use Magento\Framework\Profiler; +use Magento\Framework\UrlInterface; /** * Extend from this class to create actions controllers in frontend area of your application. * It contains standard action behavior (event dispatching, flag checks) * Action classes that do not extend from this class will lose this behavior and might not function correctly * - * TODO: Remove this class. Allow implementation of Action Controllers by just implementing Action Interface. + * @deprecated Use \Magento\Framework\App\ActionInterface * + * phpcs:disable Magento2.Classes.AbstractApi * @api * @SuppressWarnings(PHPMD.CouplingBetweenObjects) * @SuppressWarnings(PHPMD.NumberOfChildren) @@ -24,7 +33,7 @@ abstract class Action extends AbstractAction { /** - * @var \Magento\Framework\ObjectManagerInterface + * @var ObjectManagerInterface */ protected $_objectManager; @@ -37,32 +46,32 @@ abstract class Action extends AbstractAction protected $_sessionNamespace; /** - * @var \Magento\Framework\Event\ManagerInterface + * @var EventManagerInterface */ protected $_eventManager; /** - * @var \Magento\Framework\App\ActionFlag + * @var ActionFlag */ protected $_actionFlag; /** - * @var \Magento\Framework\App\Response\RedirectInterface + * @var RedirectInterface */ protected $_redirect; /** - * @var \Magento\Framework\App\ViewInterface + * @var ViewInterface */ protected $_view; /** - * @var \Magento\Framework\UrlInterface + * @var UrlInterface */ protected $_url; /** - * @var \Magento\Framework\Message\ManagerInterface + * @var MessageManagerInterface */ protected $messageManager; @@ -92,35 +101,15 @@ public function dispatch(RequestInterface $request) { $this->_request = $request; $profilerKey = 'CONTROLLER_ACTION:' . $request->getFullActionName(); - $eventParameters = ['controller_action' => $this, 'request' => $request]; - $this->_eventManager->dispatch('controller_action_predispatch', $eventParameters); - $this->_eventManager->dispatch('controller_action_predispatch_' . $request->getRouteName(), $eventParameters); - $this->_eventManager->dispatch( - 'controller_action_predispatch_' . $request->getFullActionName(), - $eventParameters - ); - \Magento\Framework\Profiler::start($profilerKey); + Profiler::start($profilerKey); $result = null; if ($request->isDispatched() && !$this->_actionFlag->get('', self::FLAG_NO_DISPATCH)) { - \Magento\Framework\Profiler::start('action_body'); + Profiler::start('action_body'); $result = $this->execute(); - \Magento\Framework\Profiler::start('postdispatch'); - if (!$this->_actionFlag->get('', self::FLAG_NO_POST_DISPATCH)) { - $this->_eventManager->dispatch( - 'controller_action_postdispatch_' . $request->getFullActionName(), - $eventParameters - ); - $this->_eventManager->dispatch( - 'controller_action_postdispatch_' . $request->getRouteName(), - $eventParameters - ); - $this->_eventManager->dispatch('controller_action_postdispatch', $eventParameters); - } - \Magento\Framework\Profiler::stop('postdispatch'); - \Magento\Framework\Profiler::stop('action_body'); + Profiler::stop('action_body'); } - \Magento\Framework\Profiler::stop($profilerKey); + Profiler::stop($profilerKey); return $result ?: $this->_response; } @@ -159,9 +148,9 @@ protected function _forward($action, $controller = null, $module = null, array $ /** * Set redirect into response * - * @param string $path - * @param array $arguments - * @return ResponseInterface + * @param string $path + * @param array $arguments + * @return ResponseInterface */ protected function _redirect($path, $arguments = []) { @@ -170,6 +159,8 @@ protected function _redirect($path, $arguments = []) } /** + * Returns ActionFlag value + * * @return \Magento\Framework\App\ActionFlag */ public function getActionFlag() diff --git a/lib/internal/Magento/Framework/App/Action/Plugin/ActionFlagNoDispatchPlugin.php b/lib/internal/Magento/Framework/App/Action/Plugin/ActionFlagNoDispatchPlugin.php new file mode 100644 index 0000000000000..263e3663513d3 --- /dev/null +++ b/lib/internal/Magento/Framework/App/Action/Plugin/ActionFlagNoDispatchPlugin.php @@ -0,0 +1,53 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +namespace Magento\Framework\App\Action\Plugin; + +use Magento\Framework\App\ActionFlag; +use Magento\Framework\App\ActionInterface; +use Magento\Framework\App\ResponseInterface; + +/** + * Do not call Action::execute() if the action flag FLAG_NO_DISPATCH is set. + */ +class ActionFlagNoDispatchPlugin +{ + /** + * @var ActionFlag + */ + private $actionFlag; + + /** + * @var ResponseInterface + */ + private $response; + + /** + * @param ActionFlag $actionFlag + * @param ResponseInterface $response + */ + public function __construct(ActionFlag $actionFlag, ResponseInterface $response) + { + $this->actionFlag = $actionFlag; + $this->response = $response; + } + + /** + * Do not call proceed if the no dispatch action flag is set. + * + * @param ActionInterface $subject + * @param callable $proceed + * @return ResponseInterface + * + * @SuppressWarnings(PHPMD.UnusedFormalParameter) + */ + public function aroundExecute(ActionInterface $subject, callable $proceed) + { + return $this->actionFlag->get('', ActionInterface::FLAG_NO_DISPATCH) ? $this->response : $proceed(); + } +} diff --git a/lib/internal/Magento/Framework/App/Action/Plugin/EventDispatchPlugin.php b/lib/internal/Magento/Framework/App/Action/Plugin/EventDispatchPlugin.php new file mode 100644 index 0000000000000..7d07d1f4cf457 --- /dev/null +++ b/lib/internal/Magento/Framework/App/Action/Plugin/EventDispatchPlugin.php @@ -0,0 +1,138 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +declare(strict_types=1); + +namespace Magento\Framework\App\Action\Plugin; + +use Magento\Framework\App\Action\Action; +use Magento\Framework\App\ActionFlag; +use Magento\Framework\App\ActionInterface; +use Magento\Framework\App\Request\Http; +use Magento\Framework\App\RequestInterface; +use Magento\Framework\Controller\ResultInterface; +use Magento\Framework\Event\ManagerInterface; +use Magento\Framework\HTTP\PhpEnvironment\Response; +use Magento\Framework\Profiler; + +/** + * Dispatch the controller_action_predispatch and controller_action_post_dispatch events. + */ +class EventDispatchPlugin +{ + /** + * @var Http|RequestInterface + */ + private $request; + + /** + * @var ManagerInterface + */ + private $eventManager; + + /** + * @var ActionFlag + */ + private $actionFlag; + + /** + * @param RequestInterface $request + * @param ManagerInterface $eventManager + * @param ActionFlag $actionFlag + */ + public function __construct(RequestInterface $request, ManagerInterface $eventManager, ActionFlag $actionFlag) + { + $this->request = $request; + $this->eventManager = $eventManager; + $this->actionFlag = $actionFlag; + } + + /** + * Trigger the controller_action_predispatch events + * + * @param ActionInterface $subject + */ + public function beforeExecute(ActionInterface $subject) + { + $this->dispatchPreDispatchEvents($subject); + } + + /** + * Build the event parameter array + * + * @param ActionInterface $subject + * @return array + */ + private function getEventParameters(ActionInterface $subject): array + { + return ['controller_action' => $subject, 'request' => $this->request]; + } + + /** + * Trigger the controller_action_postdispatch events if the suppressing action flag is not set + * + * @param ActionInterface $subject + * @param ResultInterface|Response|null $result + * @return ResultInterface|Response|null + */ + public function afterExecute(ActionInterface $subject, $result) + { + if (!$this->isSetActionNoPostDispatchFlag()) { + $this->dispatchPostDispatchEvents($subject); + } + + return $result; + } + + /** + * Check if action flags are set that would suppress the post dispatch events. + * + * @return bool + */ + private function isSetActionNoPostDispatchFlag(): bool + { + return $this->actionFlag->get('', Action::FLAG_NO_DISPATCH) || + $this->actionFlag->get('', Action::FLAG_NO_POST_DISPATCH); + } + + /** + * Dispatch the controller_action_predispatch events. + * + * @param ActionInterface $action + */ + private function dispatchPreDispatchEvents(ActionInterface $action) + { + $this->eventManager->dispatch('controller_action_predispatch', $this->getEventParameters($action)); + $this->eventManager->dispatch( + 'controller_action_predispatch_' . $this->request->getRouteName(), + $this->getEventParameters($action) + ); + $this->eventManager->dispatch( + 'controller_action_predispatch_' . $this->request->getFullActionName(), + $this->getEventParameters($action) + ); + } + + /** + * Dispatch the controller_action_postdispatch events. + * + * @param ActionInterface $action + */ + private function dispatchPostDispatchEvents(ActionInterface $action) + { + Profiler::start('postdispatch'); + $this->eventManager->dispatch( + 'controller_action_postdispatch_' . $this->request->getFullActionName(), + $this->getEventParameters($action) + ); + $this->eventManager->dispatch( + 'controller_action_postdispatch_' . $this->request->getRouteName(), + $this->getEventParameters($action) + ); + $this->eventManager->dispatch('controller_action_postdispatch', $this->getEventParameters($action)); + Profiler::stop('postdispatch'); + } +} diff --git a/lib/internal/Magento/Framework/App/Action/Plugin/Design.php b/lib/internal/Magento/Framework/App/Action/Plugin/LoadDesignPlugin.php similarity index 53% rename from lib/internal/Magento/Framework/App/Action/Plugin/Design.php rename to lib/internal/Magento/Framework/App/Action/Plugin/LoadDesignPlugin.php index 2893f1209dc98..2cda49c43c2ce 100644 --- a/lib/internal/Magento/Framework/App/Action/Plugin/Design.php +++ b/lib/internal/Magento/Framework/App/Action/Plugin/LoadDesignPlugin.php @@ -3,29 +3,38 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Framework\App\Action\Plugin; +use Magento\Framework\App\ActionInterface; +use Magento\Framework\Config\Dom\ValidationException; +use Magento\Framework\Exception\LocalizedException; +use Magento\Framework\Message\ManagerInterface as MessageManagerInterface; use Magento\Framework\Message\MessageInterface; +use Magento\Framework\View\DesignLoader; -class Design +/** + * Handling Exceptions on Design Loading + */ +class LoadDesignPlugin { /** - * @var \Magento\Framework\View\DesignLoader + * @var DesignLoader */ protected $_designLoader; /** - * @var \Magento\Framework\Message\ManagerInterface + * @var MessageManagerInterface */ protected $messageManager; /** - * @param \Magento\Framework\View\DesignLoader $designLoader - * @param \Magento\Framework\Message\ManagerInterface $messageManager + * @param DesignLoader $designLoader + * @param MessageManagerInterface $messageManager */ public function __construct( - \Magento\Framework\View\DesignLoader $designLoader, - \Magento\Framework\Message\ManagerInterface $messageManager + DesignLoader $designLoader, + MessageManagerInterface $messageManager ) { $this->_designLoader = $designLoader; $this->messageManager = $messageManager; @@ -34,20 +43,16 @@ public function __construct( /** * Initialize design * - * @param \Magento\Framework\App\ActionInterface $subject - * @param \Magento\Framework\App\RequestInterface $request - * + * @param ActionInterface $subject * @return void * @SuppressWarnings(PHPMD.UnusedFormalParameter) */ - public function beforeDispatch( - \Magento\Framework\App\ActionInterface $subject, - \Magento\Framework\App\RequestInterface $request - ) { + public function beforeExecute(ActionInterface $subject) + { try { $this->_designLoader->load(); - } catch (\Magento\Framework\Exception\LocalizedException $e) { - if ($e->getPrevious() instanceof \Magento\Framework\Config\Dom\ValidationException) { + } catch (LocalizedException $e) { + if ($e->getPrevious() instanceof ValidationException) { /** @var MessageInterface $message */ $message = $this->messageManager ->createMessage(MessageInterface::TYPE_ERROR) diff --git a/lib/internal/Magento/Framework/App/ActionInterface.php b/lib/internal/Magento/Framework/App/ActionInterface.php index 921e1a2e16b1e..1501abe9eb956 100644 --- a/lib/internal/Magento/Framework/App/ActionInterface.php +++ b/lib/internal/Magento/Framework/App/ActionInterface.php @@ -25,8 +25,6 @@ interface ActionInterface /** * Execute action based on request and return result * - * Note: Request will be added as operation argument in future - * * @return \Magento\Framework\Controller\ResultInterface|ResponseInterface * @throws \Magento\Framework\Exception\NotFoundException */ diff --git a/lib/internal/Magento/Framework/App/Cache.php b/lib/internal/Magento/Framework/App/Cache.php index 34729df9f1e55..7a569e5409f7d 100644 --- a/lib/internal/Magento/Framework/App/Cache.php +++ b/lib/internal/Magento/Framework/App/Cache.php @@ -4,12 +4,11 @@ * See COPYING.txt for license details. */ -/** - * System cache model - * support id and tags prefix support, - */ namespace Magento\Framework\App; +/** + * System cache model support id and tags prefix support. + */ class Cache implements CacheInterface { /** @@ -30,12 +29,13 @@ class Cache implements CacheInterface protected $_frontend; /** - * @param \Magento\Framework\App\Cache\Frontend\Pool $frontendPool + * @param Cache\Frontend\Pool $frontendPool + * @param string|null $cacheIdentifier */ - public function __construct(\Magento\Framework\App\Cache\Frontend\Pool $frontendPool) + public function __construct(\Magento\Framework\App\Cache\Frontend\Pool $frontendPool, $cacheIdentifier = null) { $this->_frontendPool = $frontendPool; - $this->_frontend = $frontendPool->get($this->_frontendIdentifier); + $this->_frontend = $frontendPool->get($cacheIdentifier ?? $this->_frontendIdentifier); } /** diff --git a/lib/internal/Magento/Framework/App/Cache/Frontend/Pool.php b/lib/internal/Magento/Framework/App/Cache/Frontend/Pool.php index a4c9fb4380651..daa7cba20139d 100644 --- a/lib/internal/Magento/Framework/App/Cache/Frontend/Pool.php +++ b/lib/internal/Magento/Framework/App/Cache/Frontend/Pool.php @@ -152,6 +152,15 @@ public function get($identifier) if (isset($this->_instances[$identifier])) { return $this->_instances[$identifier]; } - throw new \InvalidArgumentException("Cache frontend '{$identifier}' is not recognized."); + + if (!isset($this->_instances[self::DEFAULT_FRONTEND_ID])) { + throw new \InvalidArgumentException( + "Cache frontend '{$identifier}' is not recognized. As well as " . + self::DEFAULT_FRONTEND_ID . + "cache is not configured" + ); + } + + return $this->_instances[self::DEFAULT_FRONTEND_ID]; } } diff --git a/lib/internal/Magento/Framework/App/Router/ActionList.php b/lib/internal/Magento/Framework/App/Router/ActionList.php index 1640d4a98d354..63a24d58a3c81 100644 --- a/lib/internal/Magento/Framework/App/Router/ActionList.php +++ b/lib/internal/Magento/Framework/App/Router/ActionList.php @@ -5,6 +5,8 @@ */ namespace Magento\Framework\App\Router; +use Magento\Framework\App\Filesystem\DirectoryList; +use Magento\Framework\App\State; use Magento\Framework\Serialize\SerializerInterface; use Magento\Framework\Serialize\Serializer\Serialize; use Magento\Framework\Module\Dir\Reader as ModuleReader; @@ -70,12 +72,26 @@ public function __construct( $this->reservedWords = array_merge($reservedWords, $this->reservedWords); $this->actionInterface = $actionInterface; $this->serializer = $serializer ?: \Magento\Framework\App\ObjectManager::getInstance()->get(Serialize::class); - $data = $cache->load($cacheKey); - if (!$data) { - $this->actions = $moduleReader->getActionFiles(); - $cache->save($this->serializer->serialize($this->actions), $cacheKey); + $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); + $state = $objectManager->get(State::class); + + if ($state->getMode() === State::MODE_PRODUCTION) { + $directoryList = $objectManager->get(DirectoryList::class); + $file = $directoryList->getPath(DirectoryList::GENERATED_METADATA) . '/' . $cacheKey . '.' . 'php'; + + if (file_exists($file)) { + $this->actions = (include $file) ?? $moduleReader->getActionFiles(); + } else { + $this->actions = $moduleReader->getActionFiles(); + } } else { - $this->actions = $this->serializer->unserialize($data); + $data = $cache->load($cacheKey); + if (!$data) { + $this->actions = $moduleReader->getActionFiles(); + $cache->save($this->serializer->serialize($this->actions), $cacheKey); + } else { + $this->actions = $this->serializer->unserialize($data); + } } } diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Action/ActionTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Action/ActionTest.php index ebd72f5badccf..c2d30187845a4 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/Action/ActionTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/Action/ActionTest.php @@ -8,95 +8,87 @@ use \Magento\Framework\App\Action\Action; +use Magento\Framework\App\ActionFlag; +use Magento\Framework\App\Request\Http as HttpRequest; +use Magento\Framework\App\Response\RedirectInterface; +use Magento\Framework\App\ResponseInterface; +use Magento\Framework\App\ViewInterface; +use Magento\Framework\Event\ManagerInterface; use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; +use Magento\Framework\View\Page\Config as PageConfig; +use PHPUnit\Framework\MockObject\MockObject; class ActionTest extends \PHPUnit\Framework\TestCase { - /** @var \Magento\Framework\App\Test\Unit\Action\ActionFake */ + /** + * @var ActionFake + */ protected $action; - /** @var ObjectManagerHelper */ + /** + * @var ObjectManagerHelper + */ protected $objectManagerHelper; /** - * @var \Magento\Framework\App\Request\Http|\PHPUnit_Framework_MockObject_MockObject + * @var HttpRequest|MockObject */ protected $_requestMock; /** - * @var \Magento\Framework\App\ResponseInterface|\PHPUnit_Framework_MockObject_MockObject + * @var ResponseInterface|MockObject */ protected $_responseMock; /** - * @var \Magento\Framework\Event\ManagerInterface|\PHPUnit_Framework_MockObject_MockObject + * @var ManagerInterface|MockObject */ protected $_eventManagerMock; /** - * @var \Magento\Framework\App\ActionFlag|\PHPUnit_Framework_MockObject_MockObject + * @var ActionFlag|MockObject */ protected $_actionFlagMock; /** - * @var \Magento\Framework\App\Response\RedirectInterface|\PHPUnit_Framework_MockObject_MockObject + * @var RedirectInterface|MockObject */ protected $_redirectMock; /** - * @var \Magento\Framework\App\ViewInterface|\PHPUnit_Framework_MockObject_MockObject + * @var ViewInterface|MockObject */ protected $viewMock; /** - * @var \Magento\Framework\View\Page\Config|\PHPUnit_Framework_MockObject_MockObject + * @var PageConfig|MockObject */ protected $pageConfigMock; - /** - * Full action name - */ - const FULL_ACTION_NAME = 'module/controller/someaction'; - - /** - * Route name - */ - const ROUTE_NAME = 'module/controller/actionroute'; - - /** - * Action name - */ - const ACTION_NAME = 'someaction'; - - /** - * Controller name - */ - const CONTROLLER_NAME = 'controller'; - - /** - * Module name - */ - const MODULE_NAME = 'module'; + public const FULL_ACTION_NAME = 'module/controller/someaction'; + public const ROUTE_NAME = 'module/controller/actionroute'; + public const ACTION_NAME = 'someaction'; + public const CONTROLLER_NAME = 'controller'; + public const MODULE_NAME = 'module'; public static $actionParams = ['param' => 'value']; protected function setUp() { - $this->_eventManagerMock = $this->createMock(\Magento\Framework\Event\ManagerInterface::class); - $this->_actionFlagMock = $this->createMock(\Magento\Framework\App\ActionFlag::class); - $this->_redirectMock = $this->createMock(\Magento\Framework\App\Response\RedirectInterface::class); - $this->_requestMock = $this->getMockBuilder(\Magento\Framework\App\Request\Http::class) - ->disableOriginalConstructor()->getMock(); - $this->_responseMock = $this->createMock(\Magento\Framework\App\ResponseInterface::class); - - $this->pageConfigMock = $this->createPartialMock(\Magento\Framework\View\Page\Config::class, ['getConfig']); - $this->viewMock = $this->createMock(\Magento\Framework\App\ViewInterface::class); + $this->_eventManagerMock = $this->createMock(ManagerInterface::class); + $this->_actionFlagMock = $this->createMock(ActionFlag::class); + $this->_redirectMock = $this->createMock(RedirectInterface::class); + $this->_requestMock = $this->createMock(HttpRequest::class); + $this->_responseMock = $this->createMock(ResponseInterface::class); + + $this->pageConfigMock = $this->createPartialMock(PageConfig::class, ['getConfig']); + $this->viewMock = $this->createMock(ViewInterface::class); $this->viewMock->expects($this->any())->method('getPage')->will($this->returnValue($this->pageConfigMock)); - $this->pageConfigMock->expects($this->any())->method('getConfig')->will($this->returnValue(1)); + $this->pageConfigMock->expects($this->any())->method('getConfig')->willReturn(1); $this->objectManagerHelper = new ObjectManagerHelper($this); $this->action = $this->objectManagerHelper->getObject( - \Magento\Framework\App\Test\Unit\Action\ActionFake::class, + ActionFake::class, [ 'request' => $this->_requestMock, 'response' => $this->_responseMock, @@ -111,29 +103,12 @@ protected function setUp() public function testDispatchPostDispatch() { - $this->_requestMock->expects($this->exactly(3))->method('getFullActionName')->will( - $this->returnValue(self::FULL_ACTION_NAME) - ); - $this->_requestMock->expects($this->exactly(2))->method('getRouteName')->will( - $this->returnValue(self::ROUTE_NAME) - ); - $expectedEventParameters = ['controller_action' => $this->action, 'request' => $this->_requestMock]; - $this->_eventManagerMock->expects($this->at(0))->method('dispatch')->with( - 'controller_action_predispatch', - $expectedEventParameters - ); - $this->_eventManagerMock->expects($this->at(1))->method('dispatch')->with( - 'controller_action_predispatch_' . self::ROUTE_NAME, - $expectedEventParameters - ); - $this->_eventManagerMock->expects($this->at(2))->method('dispatch')->with( - 'controller_action_predispatch_' . self::FULL_ACTION_NAME, - $expectedEventParameters - ); - - $this->_requestMock->expects($this->once())->method('isDispatched')->will($this->returnValue(true)); - $this->_actionFlagMock->expects($this->at(0))->method('get')->with('', Action::FLAG_NO_DISPATCH)->will( - $this->returnValue(false) + $this->_requestMock->method('getFullActionName')->willReturn(self::FULL_ACTION_NAME); + $this->_requestMock->method('getRouteName')->willReturn(self::ROUTE_NAME); + $this->_requestMock->method('isDispatched')->willReturn(true); + $this->_actionFlagMock->method('get')->willReturnMap( + ['', Action::FLAG_NO_DISPATCH, false], + ['', Action::FLAG_NO_POST_DISPATCH] ); // _forward expectations @@ -151,23 +126,6 @@ public function testDispatchPostDispatch() self::$actionParams ); - $this->_actionFlagMock->expects($this->at(1))->method('get')->with('', Action::FLAG_NO_POST_DISPATCH)->will( - $this->returnValue(false) - ); - - $this->_eventManagerMock->expects($this->at(3))->method('dispatch')->with( - 'controller_action_postdispatch_' . self::FULL_ACTION_NAME, - $expectedEventParameters - ); - $this->_eventManagerMock->expects($this->at(4))->method('dispatch')->with( - 'controller_action_postdispatch_' . self::ROUTE_NAME, - $expectedEventParameters - ); - $this->_eventManagerMock->expects($this->at(5))->method('dispatch')->with( - 'controller_action_postdispatch', - $expectedEventParameters - ); - $this->assertEquals($this->_responseMock, $this->action->dispatch($this->_requestMock)); } } diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Action/Plugin/DesignTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Action/Plugin/DesignTest.php deleted file mode 100644 index d5c7f4d0355ca..0000000000000 --- a/lib/internal/Magento/Framework/App/Test/Unit/Action/Plugin/DesignTest.php +++ /dev/null @@ -1,20 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Framework\App\Test\Unit\Action\Plugin; - -class DesignTest extends \PHPUnit\Framework\TestCase -{ - public function testAroundDispatch() - { - $subjectMock = $this->createMock(\Magento\Framework\App\Action\Action::class); - $designLoaderMock = $this->createMock(\Magento\Framework\View\DesignLoader::class); - $messageManagerMock = $this->createMock(\Magento\Framework\Message\ManagerInterface::class); - $requestMock = $this->createMock(\Magento\Framework\App\RequestInterface::class); - $plugin = new \Magento\Framework\App\Action\Plugin\Design($designLoaderMock, $messageManagerMock); - $designLoaderMock->expects($this->once())->method('load'); - $plugin->beforeDispatch($subjectMock, $requestMock); - } -} diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Action/Plugin/LoadDesignPluginTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Action/Plugin/LoadDesignPluginTest.php new file mode 100644 index 0000000000000..90acfde426931 --- /dev/null +++ b/lib/internal/Magento/Framework/App/Test/Unit/Action/Plugin/LoadDesignPluginTest.php @@ -0,0 +1,34 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Framework\App\Test\Unit\Action\Plugin; + +use Magento\Framework\App\Action\Action; +use Magento\Framework\App\Action\Plugin\LoadDesignPlugin; +use Magento\Framework\App\ActionInterface; +use Magento\Framework\Message\ManagerInterface; +use Magento\Framework\View\DesignLoader; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; + +class LoadDesignPluginTest extends TestCase +{ + public function testBeforeExecute() + { + /** @var MockObject|ActionInterface $actionMock */ + $actionMock = $this->createMock(Action::class); + + /** @var MockObject|DesignLoader $designLoaderMock */ + $designLoaderMock = $this->createMock(DesignLoader::class); + + /** @var MockObject|ManagerInterface $messageManagerMock */ + $messageManagerMock = $this->createMock(ManagerInterface::class); + + $plugin = new LoadDesignPlugin($designLoaderMock, $messageManagerMock); + + $designLoaderMock->expects($this->once())->method('load'); + $plugin->beforeExecute($actionMock); + } +} diff --git a/lib/internal/Magento/Framework/App/Test/Unit/Cache/Frontend/PoolTest.php b/lib/internal/Magento/Framework/App/Test/Unit/Cache/Frontend/PoolTest.php index 5ec3dd658737b..f6398f08ebf27 100644 --- a/lib/internal/Magento/Framework/App/Test/Unit/Cache/Frontend/PoolTest.php +++ b/lib/internal/Magento/Framework/App/Test/Unit/Cache/Frontend/PoolTest.php @@ -208,12 +208,8 @@ public function testGet() } } - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Cache frontend 'unknown' is not recognized - */ - public function testGetUnknownFrontendId() + public function testFallbackOnDefault() { - $this->_model->get('unknown'); + $this->assertSame($this->_frontendInstances[Pool::DEFAULT_FRONTEND_ID], $this->_model->get('unknown')); } } diff --git a/lib/internal/Magento/Framework/Cache/Backend/Redis.php b/lib/internal/Magento/Framework/Cache/Backend/Redis.php new file mode 100644 index 0000000000000..ed97cb9f50c3b --- /dev/null +++ b/lib/internal/Magento/Framework/Cache/Backend/Redis.php @@ -0,0 +1,83 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Framework\Cache\Backend; + +/** + * Redis wrapper to extend current implementation behaviour. + */ +class Redis extends \Cm_Cache_Backend_Redis +{ + /** + * Local state of preloaded keys. + * + * @var array + */ + private $preloadedData = []; + + /** + * Array of keys to be preloaded. + * + * @var array + */ + private $preloadKeys = []; + + /** + * @param array $options + */ + public function __construct($options = []) + { + $this->preloadKeys = $options['preload_keys'] ?? []; + parent::__construct($options); + } + + /** + * Load value with given id from cache + * + * @param string $id Cache id + * @param boolean $doNotTestCacheValidity If set to true, the cache validity won't be tested + * @return bool|string + */ + public function load($id, $doNotTestCacheValidity = false) + { + if (!empty($this->preloadKeys) && empty($this->preloadedData)) { + $redis = $this->_slave ?? $this->_redis; + $redis = $redis->pipeline(); + + foreach ($this->preloadKeys as $key) { + $redis->hGet(self::PREFIX_KEY . $key, self::FIELD_DATA); + } + + $this->preloadedData = array_filter(array_combine($this->preloadKeys, $redis->exec())); + } + + if (isset($this->preloadedData[$id])) { + return $this->_decodeData($this->preloadedData[$id]); + } + + return parent::load($id, $doNotTestCacheValidity); + } + + /** + * Cover errors on save operations, which may occurs when Redis cannot evict keys, which is expected in some cases. + * + * @param string $data + * @param string $id + * @param array $tags + * @param bool $specificLifetime + * @return bool + */ + public function save($data, $id, $tags = [], $specificLifetime = false) + { + try { + parent::save($data, $id, $tags, $specificLifetime); + } catch (\Throwable $exception) { + return false; + } + + return true; + } +} diff --git a/lib/internal/Magento/Framework/Cache/Backend/RemoteSynchronizedCache.php b/lib/internal/Magento/Framework/Cache/Backend/RemoteSynchronizedCache.php index 007f921259bed..90c1bf5808737 100644 --- a/lib/internal/Magento/Framework/Cache/Backend/RemoteSynchronizedCache.php +++ b/lib/internal/Magento/Framework/Cache/Backend/RemoteSynchronizedCache.php @@ -9,8 +9,10 @@ /** * Remote synchronized cache * - * This class created for correct work local caches with multiple web nodes, - * that will be check cache status from remote cache + * This class created for correct work witch local caches and multiple web nodes, + * in order to be sure that we always have up to date local version of cache. + * This class will be check cache version from remote cache and in case it newer + * than local one, it will update local one from remote cache a.k.a two level cache. */ class RemoteSynchronizedCache extends \Zend_Cache_Backend implements \Zend_Cache_Backend_ExtendedInterface { @@ -36,11 +38,15 @@ class RemoteSynchronizedCache extends \Zend_Cache_Backend implements \Zend_Cache protected $cacheInvalidationTime; /** - * {@inheritdoc} + * Suffix for hash to compare data version in cache storage. + */ + private const HASH_SUFFIX = ':hash'; + + /** + * @inheritdoc */ protected $_options = [ 'remote_backend' => '', - 'remote_backend_invalidation_time_id' => 'default_remote_backend_invalidation_time', 'remote_backend_custom_naming' => true, 'remote_backend_autoload' => true, 'remote_backend_options' => [], @@ -52,6 +58,7 @@ class RemoteSynchronizedCache extends \Zend_Cache_Backend implements \Zend_Cache /** * @param array $options + * @throws \Zend_Cache_Exception */ public function __construct(array $options = []) { @@ -97,76 +104,137 @@ public function __construct(array $options = []) } /** - * Update remote cache status info + * @inheritdoc + */ + public function setDirectives($directives) + { + return $this->local->setDirectives($directives); + } + + /** + * Return hash sign of the data. * - * @return void + * @param string $data + * @return string */ - private function updateRemoteCacheStatusInfo() + private function getDataVersion(string $data) { - $this->remote->save(time(), $this->_options['remote_backend_invalidation_time_id'], [], null); - $this->cacheInvalidationTime = null; + return \hash('sha256', $data); } /** - * {@inheritdoc} + * Load data version by id from remote. + * + * @param string $id + * @return false|string */ - public function setDirectives($directives) + private function loadRemoteDataVersion(string $id) { - return $this->local->setDirectives($directives); + return $this->remote->load( + $id . self::HASH_SUFFIX + ); } /** - * {@inheritdoc} + * Save new data version to remote. + * + * @param string $data + * @param string $id + * @param array $tags + * @param mixed $specificLifetime + * @return bool + */ + private function saveRemoteDataVersion(string $data, string $id, array $tags, $specificLifetime = false) + { + return $this->remote->save($this->getDataVersion($data), $id . self::HASH_SUFFIX, $tags, $specificLifetime); + } + + /** + * Remove remote data version. + * + * @param string $id + * @return bool + */ + private function removeRemoteDataVersion($id) + { + return $this->remote->remove($id . self::HASH_SUFFIX); + } + + /** + * @inheritdoc */ public function load($id, $doNotTestCacheValidity = false) { - $dataModificationTime = $this->local->test($id); - if ($this->cacheInvalidationTime === null) { - $this->cacheInvalidationTime = $this->remote->load($this->_options['remote_backend_invalidation_time_id']); - } - if ($dataModificationTime >= $this->cacheInvalidationTime) { - return $this->local->load($id, $doNotTestCacheValidity); + $localData = $this->local->load($id); + $remoteData = false; + + if (false === $localData) { + $remoteData = $this->remote->load($id); + + if (false === $remoteData) { + return false; + } } else { - return false; + if ($this->getDataVersion($localData) !== $this->loadRemoteDataVersion($id)) { + $localData = false; + $remoteData = $this->remote->load($id); + } } + + if ($remoteData !== false) { + $this->local->save($remoteData, $id); + $localData = $remoteData; + } + + return $localData; } /** - * {@inheritdoc} + * @inheritdoc */ public function test($id) { - return $this->local->test($id); + return $this->local->test($id) ?? $this->remote->test($id); } /** - * {@inheritdoc} + * @inheritdoc */ public function save($data, $id, $tags = [], $specificLifetime = false) { - return $this->local->save($data, $id, $tags, $specificLifetime); + $dataToSave = $data; + $remHash = $this->loadRemoteDataVersion($id); + + if ($remHash !== false) { + $dataToSave = $this->remote->load($id); + } else { + $this->remote->save($data, $id, $tags, $specificLifetime); + $this->saveRemoteDataVersion($data, $id, $tags, $specificLifetime); + } + + return $this->local->save($dataToSave, $id, [], $specificLifetime); } /** - * {@inheritdoc} + * @inheritdoc */ public function remove($id) { - $this->updateRemoteCacheStatusInfo(); - return $this->local->remove($id); + return $this->removeRemoteDataVersion($id) && + $this->remote->remove($id) && + $this->local->remove($id); } /** - * {@inheritdoc} + * @inheritdoc */ public function clean($mode = \Zend_Cache::CLEANING_MODE_ALL, $tags = []) { - $this->updateRemoteCacheStatusInfo(); - return $this->local->clean($mode, $tags); + return $this->remote->clean($mode, $tags); } /** - * {@inheritdoc} + * @inheritdoc */ public function getIds() { @@ -174,7 +242,7 @@ public function getIds() } /** - * {@inheritdoc} + * @inheritdoc */ public function getTags() { @@ -182,7 +250,7 @@ public function getTags() } /** - * {@inheritdoc} + * @inheritdoc */ public function getIdsMatchingTags($tags = []) { @@ -190,7 +258,7 @@ public function getIdsMatchingTags($tags = []) } /** - * {@inheritdoc} + * @inheritdoc */ public function getIdsNotMatchingTags($tags = []) { @@ -198,7 +266,7 @@ public function getIdsNotMatchingTags($tags = []) } /** - * {@inheritdoc} + * @inheritdoc */ public function getIdsMatchingAnyTags($tags = []) { @@ -206,7 +274,7 @@ public function getIdsMatchingAnyTags($tags = []) } /** - * {@inheritdoc} + * @inheritdoc */ public function getFillingPercentage() { @@ -214,7 +282,7 @@ public function getFillingPercentage() } /** - * {@inheritdoc} + * @inheritdoc */ public function getMetadatas($id) { @@ -222,7 +290,7 @@ public function getMetadatas($id) } /** - * {@inheritdoc} + * @inheritdoc */ public function touch($id, $extraLifetime) { @@ -230,7 +298,7 @@ public function touch($id, $extraLifetime) } /** - * {@inheritdoc} + * @inheritdoc */ public function getCapabilities() { diff --git a/lib/internal/Magento/Framework/Cache/LockGuardedCacheLoader.php b/lib/internal/Magento/Framework/Cache/LockGuardedCacheLoader.php index 216d8e9a0a01b..d15f23e0d7c0b 100644 --- a/lib/internal/Magento/Framework/Cache/LockGuardedCacheLoader.php +++ b/lib/internal/Magento/Framework/Cache/LockGuardedCacheLoader.php @@ -37,18 +37,33 @@ class LockGuardedCacheLoader private $delayTimeout; /** + * Timeout for information to be collected and saved. + * If timeout passed that means that data cannot be saved right now. + * And we will just return collected data. + * + * Value of the variable in milliseconds. + * + * @var int + */ + private $loadTimeout; + + /** + * LockGuardedCacheLoader constructor. * @param LockManagerInterface $locker * @param int $lockTimeout * @param int $delayTimeout + * @param int $loadTimeout */ public function __construct( LockManagerInterface $locker, int $lockTimeout = 10000, - int $delayTimeout = 20 + int $delayTimeout = 20, + int $loadTimeout = 10000 ) { $this->locker = $locker; $this->lockTimeout = $lockTimeout; $this->delayTimeout = $delayTimeout; + $this->loadTimeout = $loadTimeout; } /** @@ -67,21 +82,21 @@ public function lockedLoadData( callable $dataSaver ) { $cachedData = $dataLoader(); //optimistic read - - while ($cachedData === false && $this->locker->isLocked($lockName)) { - usleep($this->delayTimeout * 1000); - $cachedData = $dataLoader(); - } + $deadline = microtime(true) + $this->loadTimeout; while ($cachedData === false) { - try { - if ($this->locker->lock($lockName, $this->lockTimeout / 1000)) { + if ($deadline <= microtime(true)) { + return $dataCollector(); + } + + if ($this->locker->lock($lockName, $this->lockTimeout / 1000)) { + try { $data = $dataCollector(); $dataSaver($data); $cachedData = $data; + } finally { + $this->locker->unlock($lockName); } - } finally { - $this->locker->unlock($lockName); } if ($cachedData === false) { diff --git a/lib/internal/Magento/Framework/Cache/Test/Unit/Backend/RemoteSynchronizedCacheTest.php b/lib/internal/Magento/Framework/Cache/Test/Unit/Backend/RemoteSynchronizedCacheTest.php index 6aca2bedd4989..9a1afc2ebd6ea 100644 --- a/lib/internal/Magento/Framework/Cache/Test/Unit/Backend/RemoteSynchronizedCacheTest.php +++ b/lib/internal/Magento/Framework/Cache/Test/Unit/Backend/RemoteSynchronizedCacheTest.php @@ -6,6 +6,9 @@ namespace Magento\Framework\Cache\Test\Unit\Backend; +use Magento\Framework\Cache\Backend\Database; +use Magento\Framework\Cache\Backend\RemoteSynchronizedCache; + class RemoteSynchronizedCacheTest extends \PHPUnit\Framework\TestCase { /** @@ -13,9 +16,43 @@ class RemoteSynchronizedCacheTest extends \PHPUnit\Framework\TestCase */ protected $objectManager; + /** + * @var \Cm_Cache_Backend_File|\PHPUnit_Framework_MockObject_MockObject + */ + private $localCacheMockExample; + + /** + * @var Database|\PHPUnit_Framework_MockObject_MockObject + */ + private $remoteCacheMockExample; + + /** + * @var RemoteSynchronizedCache + */ + private $remoteSyncCacheInstance; + protected function setUp() { $this->objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this); + + $this->localCacheMockExample = $this->getMockBuilder(\Cm_Cache_Backend_File::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->remoteCacheMockExample = $this->getMockBuilder(\Magento\Framework\Cache\Backend\Database::class) + ->disableOriginalConstructor() + ->getMock(); + /** @var \Magento\Framework\Cache\Backend\Database $databaseCacheInstance */ + + $this->remoteSyncCacheInstance = $this->objectManager->getObject( + \Magento\Framework\Cache\Backend\RemoteSynchronizedCache::class, + [ + 'options' => [ + 'remote_backend' => $this->remoteCacheMockExample, + 'local_backend' => $this->localCacheMockExample, + ], + ] + ); } /** @@ -109,152 +146,135 @@ public function initializeWithOutExceptionDataProvider() } /** - * @param array $options - * @param bool|string $expected - * - * @dataProvider loadDataProvider + * Test that load will always return newest data. */ - public function testLoad($options, $expected) + public function testLoadWithLocalData() { - /** @var \Magento\Framework\Cache\Backend\Database $database */ - $database = $this->objectManager->getObject( - \Magento\Framework\Cache\Backend\RemoteSynchronizedCache::class, - [ - 'options' => $options, - ] - ); + $localData = 1; + $remoteData = 2; - $this->assertEquals($expected, $database->load(5)); - } + $this->localCacheMockExample + ->expects($this->at(0)) + ->method('load') + ->will($this->returnValue($localData)); - /** - * @return array - */ - public function loadDataProvider() - { - return [ - 'cacheInvalidationTime_is_less_than_that_dataModificationTime' => [ - 'options' => [ - 'remote_backend' => $this->getDatabaseMock(444), - 'local_backend' => $this->getFileMock(555, 'loaded_value'), - ], - 'expected' => 'loaded_value', - ], - 'cacheInvalidationTime_is_greater_than_that_dataModificationTime' => [ - 'options' => [ - 'remote_backend' => $this->getDatabaseMock(444), - 'local_backend' => $this->getFileMock(333, 'loaded_value'), - ], - 'expected' => false, - ], - 'cacheInvalidationTime_is_equal_to_the_dataModificationTime' => [ - 'options' => [ - 'remote_backend' => $this->getDatabaseMock(444), - 'local_backend' => $this->getFileMock(444, 'loaded_value'), - ], - 'expected' => 'loaded_value', - ], - ]; - } + $this->remoteCacheMockExample + ->expects($this->at(0)) + ->method('load') + ->will($this->returnValue(\hash('sha256', $remoteData))); - /** - * @param integer $cacheInvalidationTime - * @return \Magento\Framework\Cache\Backend\Database|\PHPUnit_Framework_MockObject_MockObject - */ - public function getDatabaseMock($cacheInvalidationTime) - { - $databaseMock = $this->getMockBuilder(\Magento\Framework\Cache\Backend\Database::class) - ->setMethods(['load']) - ->disableOriginalConstructor() - ->getMock(); - $databaseMock->expects($this->once()) + $this->remoteCacheMockExample + ->expects($this->at(1)) ->method('load') - ->will($this->returnValue($cacheInvalidationTime)); + ->will($this->returnValue($remoteData)); - return $databaseMock; + $this->localCacheMockExample + ->expects($this->atLeastOnce()) + ->method('save') + ->with($remoteData) + ->will($this->returnValue(true)); + + $this->assertEquals($remoteData, $this->remoteSyncCacheInstance->load(1)); } - /** - * @param integer $dataModificationTime - * @return \Cm_Cache_Backend_File|\PHPUnit_Framework_MockObject_MockObject - */ - public function getFileMock($dataModificationTime, $cacheResult) + public function testLoadWithNoLocalAndNoRemoteData() { - $fileMock = $this->getMockBuilder(\Cm_Cache_Backend_File::class) - ->setMethods(['test', 'load']) - ->disableOriginalConstructor() - ->getMock(); - $fileMock->expects($this->once()) - ->method('test') - ->will($this->returnValue($dataModificationTime)); - $fileMock->expects($this->any()) + $localData = false; + $remoteData = false; + + $this->localCacheMockExample + ->expects($this->at(0)) + ->method('load') + ->will($this->returnValue($localData)); + + $this->remoteCacheMockExample + ->expects($this->at(0)) ->method('load') - ->will($this->returnValue($cacheResult)); + ->will($this->returnValue($remoteData)); - return $fileMock; + $this->assertEquals($remoteData, $this->remoteSyncCacheInstance->load(1)); } - public function testRemove() + public function testLoadWithNoLocalAndRemoteData() { - $databaseMock = $this->getMockBuilder(\Magento\Framework\Cache\Backend\Database::class) - ->setMethods(['save']) - ->disableOriginalConstructor() - ->getMock(); - $databaseMock->expects($this->once()) + $localData = false; + $remoteData = 1; + + $this->localCacheMockExample + ->expects($this->atLeastOnce()) + ->method('load') + ->will($this->returnValue($localData)); + + $this->remoteCacheMockExample + ->expects($this->at(0)) + ->method('load') + ->will($this->returnValue($remoteData)); + + $this->localCacheMockExample + ->expects($this->atLeastOnce()) ->method('save') ->will($this->returnValue(true)); - $fileMock = $this->getMockBuilder(\Cm_Cache_Backend_File::class) - ->setMethods(['remove']) - ->disableOriginalConstructor() - ->getMock(); - $fileMock->expects($this->once()) + $this->assertEquals($remoteData, $this->remoteSyncCacheInstance->load(1)); + } + + public function testRemove() + { + $this->remoteCacheMockExample + ->expects($this->exactly(2)) ->method('remove') - ->will($this->returnValue(true)); + ->willReturn(true); - /** @var \Magento\Framework\Cache\Backend\Database $database */ - $database = $this->objectManager->getObject( - \Magento\Framework\Cache\Backend\RemoteSynchronizedCache::class, - [ - 'options' => [ - 'remote_backend' => $databaseMock, - 'local_backend' => $fileMock, - ] - ] - ); + $this->localCacheMockExample + ->expects($this->exactly(1)) + ->method('remove') + ->willReturn(true); - $this->assertEquals(true, $database->remove(5)); + $this->remoteSyncCacheInstance->remove(1); } public function testClean() { - $databaseMock = $this->getMockBuilder(\Magento\Framework\Cache\Backend\Database::class) - ->setMethods(['save']) - ->disableOriginalConstructor() - ->getMock(); - $databaseMock->expects($this->once()) + $this->remoteCacheMockExample + ->expects($this->exactly(1)) + ->method('clean') + ->willReturn(true); + + $this->remoteSyncCacheInstance->clean(); + } + + public function testSaveWithRemoteData() + { + $remoteData = 1; + + $this->remoteCacheMockExample + ->expects($this->at(0)) + ->method('load') + ->willReturn(\hash('sha256', $remoteData)); + + $this->remoteCacheMockExample + ->expects($this->at(1)) + ->method('load') + ->willReturn($remoteData); + + $this->localCacheMockExample + ->expects($this->once()) ->method('save') - ->will($this->returnValue(true)); + ->willReturn(true); - $fileMock = $this->getMockBuilder(\Cm_Cache_Backend_File::class) - ->setMethods(['clean']) - ->disableOriginalConstructor() - ->getMock(); - $fileMock->expects($this->once()) - ->method('clean') - ->will($this->returnValue(true)); + $this->remoteSyncCacheInstance->save($remoteData, 1); + } - /** @var \Magento\Framework\Cache\Backend\Database $database */ - $database = $this->objectManager->getObject( - \Magento\Framework\Cache\Backend\RemoteSynchronizedCache::class, - [ - 'options' => [ - 'remote_backend' => $databaseMock, - 'local_backend' => $fileMock, - ] - ] - ); + public function testSaveWithoutRemoteData() + { + $this->remoteCacheMockExample + ->expects($this->at(0)) + ->method('load') + ->willReturn(false); + + $this->remoteCacheMockExample->expects($this->exactly(2))->method('save'); + $this->localCacheMockExample->expects($this->once())->method('save'); - $this->assertEquals(true, $database->clean()); + $this->remoteSyncCacheInstance->save(1, 1); } } diff --git a/lib/internal/Magento/Framework/File/Mime.php b/lib/internal/Magento/Framework/File/Mime.php index ed370b1beae54..148f43d47cfd4 100644 --- a/lib/internal/Magento/Framework/File/Mime.php +++ b/lib/internal/Magento/Framework/File/Mime.php @@ -78,6 +78,18 @@ class Mime 'svg' => 'image/svg+xml', ]; + /** + * List of generic MIME types + * + * The file mime type should be detected by the file's extension if the native mime type is one of the listed below. + * + * @var array + */ + private $genericMimeTypes = [ + 'application/x-empty', + 'inode/x-empty', + ]; + /** * Get mime type of a file * @@ -120,7 +132,11 @@ private function getNativeMimeType(string $file): string $extension = $this->getFileExtension($file); $result = mime_content_type($file); if (isset($this->mimeTypes[$extension], $this->defineByExtensionList[$extension]) - && (strpos($result, 'text/') === 0 || strpos($result, 'image/svg') === 0) + && ( + strpos($result, 'text/') === 0 + || strpos($result, 'image/svg') === 0 + || in_array($result, $this->genericMimeTypes, true) + ) ) { $result = $this->mimeTypes[$extension]; } diff --git a/lib/internal/Magento/Framework/File/Test/Unit/MimeTest.php b/lib/internal/Magento/Framework/File/Test/Unit/MimeTest.php index 1a964c141dd34..0ae1542a2c0e1 100644 --- a/lib/internal/Magento/Framework/File/Test/Unit/MimeTest.php +++ b/lib/internal/Magento/Framework/File/Test/Unit/MimeTest.php @@ -5,6 +5,9 @@ */ namespace Magento\Framework\File\Test\Unit; +/** + * Test mime type utility for correct + */ class MimeTest extends \PHPUnit\Framework\TestCase { /** @@ -12,6 +15,9 @@ class MimeTest extends \PHPUnit\Framework\TestCase */ private $object; + /** + * @inheritDoc + */ protected function setUp() { $this->object = new \Magento\Framework\File\Mime(); @@ -42,12 +48,13 @@ public function testGetMimeType($file, $expectedType) /** * @return array */ - public function getMimeTypeDataProvider() + public function getMimeTypeDataProvider(): array { return [ 'javascript' => [__DIR__ . '/_files/javascript.js', 'application/javascript'], 'weird extension' => [__DIR__ . '/_files/file.weird', 'application/octet-stream'], 'weird uppercase extension' => [__DIR__ . '/_files/UPPERCASE.WEIRD', 'application/octet-stream'], + 'generic mime type' => [__DIR__ . '/_files/blank.html', 'text/html'], ]; } } diff --git a/lib/internal/Magento/Framework/File/Test/Unit/_files/blank.html b/lib/internal/Magento/Framework/File/Test/Unit/_files/blank.html new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/lib/internal/Magento/Framework/Filesystem/Directory/Write.php b/lib/internal/Magento/Framework/Filesystem/Directory/Write.php index f23ed87971a39..484eed347be0f 100644 --- a/lib/internal/Magento/Framework/Filesystem/Directory/Write.php +++ b/lib/internal/Magento/Framework/Filesystem/Directory/Write.php @@ -67,8 +67,8 @@ protected function assertWritable($path) */ protected function assertIsFile($path) { - clearstatcache(); $absolutePath = $this->driver->getAbsolutePath($this->path, $path); + clearstatcache(true, $absolutePath); if (!$this->driver->isFile($absolutePath)) { throw new FileSystemException( new \Magento\Framework\Phrase('The "%1" file doesn\'t exist.', [$absolutePath]) diff --git a/lib/internal/Magento/Framework/Filesystem/Driver/File.php b/lib/internal/Magento/Framework/Filesystem/Driver/File.php index 4d5ba7a1918ce..27df19f66c7aa 100644 --- a/lib/internal/Magento/Framework/Filesystem/Driver/File.php +++ b/lib/internal/Magento/Framework/Filesystem/Driver/File.php @@ -11,9 +11,12 @@ use Magento\Framework\Exception\FileSystemException; use Magento\Framework\Filesystem\DriverInterface; use Magento\Framework\Filesystem\Glob; +use Magento\Framework\Phrase; /** - * Driver file class + * Filesystem driver that uses the local filesystem. + * + * Assumed that stat cache is cleanup before test filesystem * * @SuppressWarnings(PHPMD.ExcessiveClassComplexity) */ @@ -47,11 +50,12 @@ protected function getWarningMessage() */ public function isExists($path) { - clearstatcache(); - $result = @file_exists($this->getScheme() . $path); + $filename = $this->getScheme() . $path; + clearstatcache(false, $filename); + $result = @file_exists($filename); if ($result === null) { throw new FileSystemException( - new \Magento\Framework\Phrase('An error occurred during "%1" execution.', [$this->getWarningMessage()]) + new Phrase('An error occurred during "%1" execution.', [$this->getWarningMessage()]) ); } return $result; @@ -66,11 +70,12 @@ public function isExists($path) */ public function stat($path) { - clearstatcache(); - $result = @stat($this->getScheme() . $path); + $filename = $this->getScheme() . $path; + clearstatcache(false, $filename); + $result = @stat($filename); if (!$result) { throw new FileSystemException( - new \Magento\Framework\Phrase('Cannot gather stats! %1', [$this->getWarningMessage()]) + new Phrase('Cannot gather stats! %1', [$this->getWarningMessage()]) ); } return $result; @@ -85,11 +90,12 @@ public function stat($path) */ public function isReadable($path) { - clearstatcache(); - $result = @is_readable($this->getScheme() . $path); + $filename = $this->getScheme() . $path; + clearstatcache(false, $filename); + $result = @is_readable($filename); if ($result === null) { throw new FileSystemException( - new \Magento\Framework\Phrase('An error occurred during "%1" execution.', [$this->getWarningMessage()]) + new Phrase('An error occurred during "%1" execution.', [$this->getWarningMessage()]) ); } return $result; @@ -104,11 +110,12 @@ public function isReadable($path) */ public function isFile($path) { - clearstatcache(); - $result = @is_file($this->getScheme() . $path); + $filename = $this->getScheme() . $path; + clearstatcache(false, $filename); + $result = @is_file($filename); if ($result === null) { throw new FileSystemException( - new \Magento\Framework\Phrase('An error occurred during "%1" execution.', [$this->getWarningMessage()]) + new Phrase('An error occurred during "%1" execution.', [$this->getWarningMessage()]) ); } return $result; @@ -123,11 +130,12 @@ public function isFile($path) */ public function isDirectory($path) { - clearstatcache(); - $result = @is_dir($this->getScheme() . $path); + $filename = $this->getScheme() . $path; + clearstatcache(false, $filename); + $result = @is_dir($filename); if ($result === null) { throw new FileSystemException( - new \Magento\Framework\Phrase('An error occurred during "%1" execution.', [$this->getWarningMessage()]) + new Phrase('An error occurred during "%1" execution.', [$this->getWarningMessage()]) ); } return $result; @@ -144,11 +152,12 @@ public function isDirectory($path) */ public function fileGetContents($path, $flag = null, $context = null) { - clearstatcache(); - $result = @file_get_contents($this->getScheme() . $path, $flag, $context); + $filename = $this->getScheme() . $path; + clearstatcache(false, $filename); + $result = @file_get_contents($filename, $flag, $context); if (false === $result) { throw new FileSystemException( - new \Magento\Framework\Phrase( + new Phrase( 'The contents from the "%1" file can\'t be read. %2', [$path, $this->getWarningMessage()] ) @@ -166,11 +175,12 @@ public function fileGetContents($path, $flag = null, $context = null) */ public function isWritable($path) { - clearstatcache(); - $result = @is_writable($this->getScheme() . $path); + $filename = $this->getScheme() . $path; + clearstatcache(false, $filename); + $result = @is_writable($filename); if ($result === null) { throw new FileSystemException( - new \Magento\Framework\Phrase('An error occurred during "%1" execution.', [$this->getWarningMessage()]) + new Phrase('An error occurred during "%1" execution.', [$this->getWarningMessage()]) ); } return $result; @@ -224,7 +234,7 @@ private function mkdirRecursive($path, $permissions = 0777) $result = true; } else { throw new FileSystemException( - new \Magento\Framework\Phrase( + new Phrase( 'Directory "%1" cannot be created %2', [$path, $this->getWarningMessage()] ) @@ -254,7 +264,7 @@ public function readDirectory($path) sort($result); return $result; } catch (\Exception $e) { - throw new FileSystemException(new \Magento\Framework\Phrase($e->getMessage()), $e); + throw new FileSystemException(new Phrase($e->getMessage()), $e); } } @@ -297,7 +307,7 @@ public function rename($oldPath, $newPath, DriverInterface $targetDriver = null) } if (!$result) { throw new FileSystemException( - new \Magento\Framework\Phrase( + new Phrase( 'The path "%1" cannot be renamed into "%2" %3', [$oldPath, $newPath, $this->getWarningMessage()] ) @@ -326,7 +336,7 @@ public function copy($source, $destination, DriverInterface $targetDriver = null } if (!$result) { throw new FileSystemException( - new \Magento\Framework\Phrase( + new Phrase( 'The file or directory "%1" cannot be copied to "%2" %3', [ $source, @@ -356,7 +366,7 @@ public function symlink($source, $destination, DriverInterface $targetDriver = n } if (!$result) { throw new FileSystemException( - new \Magento\Framework\Phrase( + new Phrase( 'A symlink for "%1" can\'t be created and placed to "%2". %3', [ $source, @@ -381,7 +391,7 @@ public function deleteFile($path) $result = @unlink($this->getScheme() . $path); if (!$result) { throw new FileSystemException( - new \Magento\Framework\Phrase( + new Phrase( 'The "%1" file can\'t be deleted. %2', [$path, $this->getWarningMessage()] ) @@ -417,7 +427,7 @@ public function deleteDirectory($path) if (!empty($exceptionMessages)) { throw new FileSystemException( - new \Magento\Framework\Phrase( + new Phrase( \implode(' ', $exceptionMessages) ) ); @@ -431,7 +441,7 @@ public function deleteDirectory($path) } if (!$result) { throw new FileSystemException( - new \Magento\Framework\Phrase( + new Phrase( 'The directory "%1" cannot be deleted %2', [$path, $this->getWarningMessage()] ) @@ -453,7 +463,7 @@ public function changePermissions($path, $permissions) $result = @chmod($this->getScheme() . $path, $permissions); if (!$result) { throw new FileSystemException( - new \Magento\Framework\Phrase( + new Phrase( 'The permissions can\'t be changed for the "%1" path. %2.', [$path, $this->getWarningMessage()] ) @@ -481,7 +491,7 @@ public function changePermissionsRecursively($path, $dirPermissions, $filePermis } if (!$result) { throw new FileSystemException( - new \Magento\Framework\Phrase( + new Phrase( 'The permissions can\'t be changed for the "%1" path. %2.', [$path, $this->getWarningMessage()] ) @@ -503,7 +513,7 @@ public function changePermissionsRecursively($path, $dirPermissions, $filePermis } if (!$result) { throw new FileSystemException( - new \Magento\Framework\Phrase( + new Phrase( 'The permissions can\'t be changed for the "%1" path. %2.', [$path, $this->getWarningMessage()] ) @@ -530,7 +540,7 @@ public function touch($path, $modificationTime = null) } if (!$result) { throw new FileSystemException( - new \Magento\Framework\Phrase( + new Phrase( 'The "%1" file or directory can\'t be touched. %2', [$path, $this->getWarningMessage()] ) @@ -553,7 +563,7 @@ public function filePutContents($path, $content, $mode = null) $result = @file_put_contents($this->getScheme() . $path, $content, $mode); if ($result === false) { throw new FileSystemException( - new \Magento\Framework\Phrase( + new Phrase( 'The specified "%1" file couldn\'t be written. %2', [$path, $this->getWarningMessage()] ) @@ -575,7 +585,7 @@ public function fileOpen($path, $mode) $result = @fopen($this->getScheme() . $path, $mode); if (!$result) { throw new FileSystemException( - new \Magento\Framework\Phrase('File "%1" cannot be opened %2', [$path, $this->getWarningMessage()]) + new Phrase('File "%1" cannot be opened %2', [$path, $this->getWarningMessage()]) ); } return $result; @@ -597,7 +607,7 @@ public function fileReadLine($resource, $length, $ending = null) // phpcs:enable if (false === $result) { throw new FileSystemException( - new \Magento\Framework\Phrase('File cannot be read %1', [$this->getWarningMessage()]) + new Phrase('File cannot be read %1', [$this->getWarningMessage()]) ); } @@ -617,7 +627,7 @@ public function fileRead($resource, $length) $result = @fread($resource, $length); if ($result === false) { throw new FileSystemException( - new \Magento\Framework\Phrase('File cannot be read %1', [$this->getWarningMessage()]) + new Phrase('File cannot be read %1', [$this->getWarningMessage()]) ); } return $result; @@ -639,7 +649,7 @@ public function fileGetCsv($resource, $length = 0, $delimiter = ',', $enclosure $result = @fgetcsv($resource, $length, $delimiter, $enclosure, $escape); if ($result === null) { throw new FileSystemException( - new \Magento\Framework\Phrase( + new Phrase( 'The "%1" CSV handle is incorrect. Verify the handle and try again.', [$this->getWarningMessage()] ) @@ -660,7 +670,7 @@ public function fileTell($resource) $result = @ftell($resource); if ($result === null) { throw new FileSystemException( - new \Magento\Framework\Phrase('An error occurred during "%1" execution.', [$this->getWarningMessage()]) + new Phrase('An error occurred during "%1" execution.', [$this->getWarningMessage()]) ); } return $result; @@ -680,7 +690,7 @@ public function fileSeek($resource, $offset, $whence = SEEK_SET) $result = @fseek($resource, $offset, $whence); if ($result === -1) { throw new FileSystemException( - new \Magento\Framework\Phrase( + new Phrase( 'An error occurred during "%1" fileSeek execution.', [$this->getWarningMessage()] ) @@ -712,7 +722,7 @@ public function fileClose($resource) $result = @fclose($resource); if (!$result) { throw new FileSystemException( - new \Magento\Framework\Phrase( + new Phrase( 'An error occurred during "%1" fileClose execution.', [$this->getWarningMessage()] ) @@ -758,7 +768,7 @@ public function fileWrite($resource, $data) */ private function fileSystemException($message, $arguments = []) { - throw new FileSystemException(new \Magento\Framework\Phrase($message, $arguments)); + throw new FileSystemException(new Phrase($message, $arguments)); } /** @@ -777,7 +787,7 @@ public function filePutCsv($resource, array $data, $delimiter = ',', $enclosure * Security enhancement for CSV data processing by Excel-like applications. * @see https://bugzilla.mozilla.org/show_bug.cgi?id=1054702 * - * @var $value string|\Magento\Framework\Phrase + * @var $value string|Phrase */ foreach ($data as $key => $value) { if (!is_string($value)) { @@ -791,7 +801,7 @@ public function filePutCsv($resource, array $data, $delimiter = ',', $enclosure $result = @fputcsv($resource, $data, $delimiter, $enclosure); if (!$result) { throw new FileSystemException( - new \Magento\Framework\Phrase( + new Phrase( 'An error occurred during "%1" filePutCsv execution.', [$this->getWarningMessage()] ) @@ -812,7 +822,7 @@ public function fileFlush($resource) $result = @fflush($resource); if (!$result) { throw new FileSystemException( - new \Magento\Framework\Phrase( + new Phrase( 'An error occurred during "%1" fileFlush execution.', [$this->getWarningMessage()] ) @@ -834,7 +844,7 @@ public function fileLock($resource, $lockMode = LOCK_EX) $result = @flock($resource, $lockMode); if (!$result) { throw new FileSystemException( - new \Magento\Framework\Phrase( + new Phrase( 'An error occurred during "%1" fileLock execution.', [$this->getWarningMessage()] ) @@ -855,7 +865,7 @@ public function fileUnlock($resource) $result = @flock($resource, LOCK_UN); if (!$result) { throw new FileSystemException( - new \Magento\Framework\Phrase( + new Phrase( 'An error occurred during "%1" fileUnlock execution.', [$this->getWarningMessage()] ) @@ -947,7 +957,7 @@ public function readDirectoryRecursively($path = null) $result[] = $file->getPathname(); } } catch (\Exception $e) { - throw new FileSystemException(new \Magento\Framework\Phrase($e->getMessage()), $e); + throw new FileSystemException(new Phrase($e->getMessage()), $e); } return $result; } diff --git a/lib/internal/Magento/Framework/Filesystem/Driver/Http.php b/lib/internal/Magento/Framework/Filesystem/Driver/Http.php index 0191d5d8a3040..273425183577e 100644 --- a/lib/internal/Magento/Framework/Filesystem/Driver/Http.php +++ b/lib/internal/Magento/Framework/Filesystem/Driver/Http.php @@ -11,7 +11,7 @@ use Magento\Framework\Exception\FileSystemException; /** - * Http driver file class. + * Allows interacting with http endpoint like with FileSystem */ class Http extends File { @@ -83,8 +83,9 @@ public function stat($path) */ public function fileGetContents($path, $flags = null, $context = null) { - clearstatcache(); - $result = @file_get_contents($this->getScheme() . $path, $flags, $context); + $fullPath = $this->getScheme() . $path; + clearstatcache(false, $fullPath); + $result = @file_get_contents($fullPath, $flags, $context); if (false === $result) { throw new FileSystemException( new \Magento\Framework\Phrase( diff --git a/lib/internal/Magento/Framework/Filesystem/Driver/StatefulFile.php b/lib/internal/Magento/Framework/Filesystem/Driver/StatefulFile.php new file mode 100644 index 0000000000000..beeb1e928262c --- /dev/null +++ b/lib/internal/Magento/Framework/Filesystem/Driver/StatefulFile.php @@ -0,0 +1,1007 @@ +<?php +/** + * Origin filesystem driver + * + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Framework\Filesystem\Driver; + +use Magento\Framework\Exception\FileSystemException; +use Magento\Framework\Filesystem\DriverInterface; +use Magento\Framework\Filesystem\Glob; +use Magento\Framework\Phrase; + +/** + * Filesystem driver that uses the local filesystem. + * + * Assumed that stat cache is cleanup by data modification methods + * + * @SuppressWarnings(PHPMD.ExcessiveClassComplexity) + */ +class StatefulFile implements DriverInterface +{ + /** + * @var string + */ + protected $scheme = ''; + + /** + * Returns last warning message string + * + * @return string + */ + protected function getWarningMessage() + { + $warning = error_get_last(); + if ($warning && $warning['type'] == E_WARNING) { + return 'Warning!' . $warning['message']; + } + return null; + } + + /** + * Is file or directory exist in file system + * + * @param string $path + * @return bool + * @throws FileSystemException + */ + public function isExists($path) + { + $result = @file_exists($this->getScheme() . $path); + if ($result === null) { + throw new FileSystemException( + new Phrase('An error occurred during "%1" execution.', [$this->getWarningMessage()]) + ); + } + return $result; + } + + /** + * Gathers the statistics of the given path + * + * @param string $path + * @return array + * @throws FileSystemException + */ + public function stat($path) + { + $result = @stat($this->getScheme() . $path); + if (!$result) { + throw new FileSystemException( + new Phrase('Cannot gather stats! %1', [$this->getWarningMessage()]) + ); + } + return $result; + } + + /** + * Check permissions for reading file or directory + * + * @param string $path + * @return bool + * @throws FileSystemException + */ + public function isReadable($path) + { + $result = @is_readable($this->getScheme() . $path); + if ($result === null) { + throw new FileSystemException( + new Phrase('An error occurred during "%1" execution.', [$this->getWarningMessage()]) + ); + } + return $result; + } + + /** + * Tells whether the filename is a regular file + * + * @param string $path + * @return bool + * @throws FileSystemException + */ + public function isFile($path) + { + $result = @is_file($this->getScheme() . $path); + if ($result === null) { + throw new FileSystemException( + new Phrase('An error occurred during "%1" execution.', [$this->getWarningMessage()]) + ); + } + return $result; + } + + /** + * Tells whether the filename is a regular directory + * + * @param string $path + * @return bool + * @throws FileSystemException + */ + public function isDirectory($path) + { + $result = @is_dir($this->getScheme() . $path); + if ($result === null) { + throw new FileSystemException( + new Phrase('An error occurred during "%1" execution.', [$this->getWarningMessage()]) + ); + } + return $result; + } + + /** + * Retrieve file contents from given path + * + * @param string $path + * @param string|null $flag + * @param resource|null $context + * @return string + * @throws FileSystemException + */ + public function fileGetContents($path, $flag = null, $context = null) + { + $result = @file_get_contents($this->getScheme() . $path, $flag, $context); + if (false === $result) { + throw new FileSystemException( + new Phrase( + 'The contents from the "%1" file can\'t be read. %2', + [$path, $this->getWarningMessage()] + ) + ); + } + return $result; + } + + /** + * Check if given path is writable + * + * @param string $path + * @return bool + * @throws FileSystemException + */ + public function isWritable($path) + { + $result = @is_writable($this->getScheme() . $path); + if ($result === null) { + throw new FileSystemException( + new Phrase('An error occurred during "%1" execution.', [$this->getWarningMessage()]) + ); + } + return $result; + } + + /** + * Returns parent directory's path + * + * @param string $path + * @return string + */ + public function getParentDirectory($path) + { + return dirname($this->getScheme() . $path); + } + + /** + * Create directory + * + * @param string $path + * @param int $permissions + * @return bool + * @throws FileSystemException + */ + public function createDirectory($path, $permissions = 0777) + { + clearstatcache(true, $path); + return $this->mkdirRecursive($path, $permissions); + } + + /** + * Create a directory recursively taking into account race conditions + * + * @param string $path + * @param int $permissions + * @return bool + * @throws FileSystemException + */ + private function mkdirRecursive($path, $permissions = 0777) + { + $path = $this->getScheme() . $path; + if (is_dir($path)) { + return true; + } + $parentDir = dirname($path); + while (!is_dir($parentDir)) { + $this->mkdirRecursive($parentDir, $permissions); + } + $result = @mkdir($path, $permissions); + clearstatcache(true, $path); + if (!$result) { + if (is_dir($path)) { + $result = true; + } else { + throw new FileSystemException( + new Phrase( + 'Directory "%1" cannot be created %2', + [$path, $this->getWarningMessage()] + ) + ); + } + } + return $result; + } + + /** + * Read directory + * + * @param string $path + * @return string[] + * @throws FileSystemException + */ + public function readDirectory($path) + { + try { + $flags = \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::UNIX_PATHS; + $iterator = new \FilesystemIterator($path, $flags); + $result = []; + /** @var \FilesystemIterator $file */ + foreach ($iterator as $file) { + $result[] = $file->getPathname(); + } + sort($result); + return $result; + } catch (\Exception $e) { + throw new FileSystemException(new Phrase($e->getMessage()), $e); + } + } + + /** + * Search paths by given regex + * + * @param string $pattern + * @param string $path + * @return string[] + * @throws FileSystemException + */ + public function search($pattern, $path) + { + $globPattern = rtrim($path, '/') . '/' . ltrim($pattern, '/'); + $result = Glob::glob($globPattern, Glob::GLOB_BRACE); + return is_array($result) ? $result : []; + } + + /** + * Renames a file or directory + * + * @param string $oldPath + * @param string $newPath + * @param DriverInterface|null $targetDriver + * @return bool + * @throws FileSystemException + */ + public function rename($oldPath, $newPath, DriverInterface $targetDriver = null) + { + $result = false; + $targetDriver = $targetDriver ?: $this; + if (get_class($targetDriver) == get_class($this)) { + $result = @rename($this->getScheme() . $oldPath, $newPath); + clearstatcache(true, $this->getScheme() . $oldPath); + clearstatcache(true, $newPath); + } else { + $content = $this->fileGetContents($oldPath); + if (false !== $targetDriver->filePutContents($newPath, $content)) { + $result = $this->deleteFile($newPath); + } + } + if (!$result) { + throw new FileSystemException( + new Phrase( + 'The path "%1" cannot be renamed into "%2" %3', + [$oldPath, $newPath, $this->getWarningMessage()] + ) + ); + } + return $result; + } + + /** + * Copy source into destination + * + * @param string $source + * @param string $destination + * @param DriverInterface|null $targetDriver + * @return bool + * @throws FileSystemException + */ + public function copy($source, $destination, DriverInterface $targetDriver = null) + { + $targetDriver = $targetDriver ?: $this; + if (get_class($targetDriver) == get_class($this)) { + $result = @copy($this->getScheme() . $source, $destination); + clearstatcache(true, $destination); + } else { + $content = $this->fileGetContents($source); + $result = $targetDriver->filePutContents($destination, $content); + } + if (!$result) { + throw new FileSystemException( + new Phrase( + 'The file or directory "%1" cannot be copied to "%2" %3', + [ + $source, + $destination, + $this->getWarningMessage() + ] + ) + ); + } + return $result; + } + + /** + * Create symlink on source and place it into destination + * + * @param string $source + * @param string $destination + * @param DriverInterface|null $targetDriver + * @return bool + * @throws FileSystemException + */ + public function symlink($source, $destination, DriverInterface $targetDriver = null) + { + $result = false; + if ($targetDriver === null || get_class($targetDriver) == get_class($this)) { + $result = @symlink($this->getScheme() . $source, $destination); + clearstatcache(true, $destination); + } + if (!$result) { + throw new FileSystemException( + new Phrase( + 'A symlink for "%1" can\'t be created and placed to "%2". %3', + [ + $source, + $destination, + $this->getWarningMessage() + ] + ) + ); + } + return $result; + } + + /** + * Delete file + * + * @param string $path + * @return bool + * @throws FileSystemException + */ + public function deleteFile($path) + { + $result = @unlink($this->getScheme() . $path); + clearstatcache(true, $this->getScheme() . $path); + if (!$result) { + throw new FileSystemException( + new Phrase( + 'The "%1" file can\'t be deleted. %2', + [$path, $this->getWarningMessage()] + ) + ); + } + return $result; + } + + /** + * Recursive delete directory + * + * @param string $path + * @return bool + * @throws FileSystemException + */ + public function deleteDirectory($path) + { + $exceptionMessages = []; + $flags = \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::UNIX_PATHS; + $iterator = new \FilesystemIterator($path, $flags); + /** @var \FilesystemIterator $entity */ + foreach ($iterator as $entity) { + try { + if ($entity->isDir()) { + $this->deleteDirectory($entity->getPathname()); + } else { + $this->deleteFile($entity->getPathname()); + } + } catch (FileSystemException $exception) { + $exceptionMessages[] = $exception->getMessage(); + } + } + + if (!empty($exceptionMessages)) { + throw new FileSystemException( + new Phrase( + \implode(' ', $exceptionMessages) + ) + ); + } + + $fullPath = $this->getScheme() . $path; + if (is_link($fullPath)) { + $result = @unlink($fullPath); + } else { + $result = @rmdir($fullPath); + } + clearstatcache(true, $fullPath); + if (!$result) { + throw new FileSystemException( + new Phrase( + 'The directory "%1" cannot be deleted %2', + [$path, $this->getWarningMessage()] + ) + ); + } + return $result; + } + + /** + * Change permissions of given path + * + * @param string $path + * @param int $permissions + * @return bool + * @throws FileSystemException + */ + public function changePermissions($path, $permissions) + { + $result = @chmod($this->getScheme() . $path, $permissions); + clearstatcache(false, $this->getScheme() . $path); + if (!$result) { + throw new FileSystemException( + new Phrase( + 'The permissions can\'t be changed for the "%1" path. %2.', + [$path, $this->getWarningMessage()] + ) + ); + } + return $result; + } + + /** + * Recursively change permissions of given path + * + * @param string $path + * @param int $dirPermissions + * @param int $filePermissions + * @return bool + * @throws FileSystemException + */ + public function changePermissionsRecursively($path, $dirPermissions, $filePermissions) + { + $result = true; + if ($this->isFile($path)) { + $result = @chmod($path, $filePermissions); + } else { + $result = @chmod($path, $dirPermissions); + } + clearstatcache(false, $this->getScheme() . $path); + + if (!$result) { + throw new FileSystemException( + new Phrase( + 'The permissions can\'t be changed for the "%1" path. %2.', + [$path, $this->getWarningMessage()] + ) + ); + } + + $flags = \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::UNIX_PATHS; + + $iterator = new \RecursiveIteratorIterator( + new \RecursiveDirectoryIterator($path, $flags), + \RecursiveIteratorIterator::CHILD_FIRST + ); + /** @var \FilesystemIterator $entity */ + foreach ($iterator as $entity) { + if ($entity->isDir()) { + $result = @chmod($entity->getPathname(), $dirPermissions); + } else { + $result = @chmod($entity->getPathname(), $filePermissions); + } + if (!$result) { + throw new FileSystemException( + new Phrase( + 'The permissions can\'t be changed for the "%1" path. %2.', + [$path, $this->getWarningMessage()] + ) + ); + } + } + return $result; + } + + /** + * Sets access and modification time of file. + * + * @param string $path + * @param int|null $modificationTime + * @return bool + * @throws FileSystemException + */ + public function touch($path, $modificationTime = null) + { + if (!$modificationTime) { + $result = @touch($this->getScheme() . $path); + } else { + $result = @touch($this->getScheme() . $path, $modificationTime); + } + clearstatcache(true, $this->getScheme() . $path); + if (!$result) { + throw new FileSystemException( + new Phrase( + 'The "%1" file or directory can\'t be touched. %2', + [$path, $this->getWarningMessage()] + ) + ); + } + return $result; + } + + /** + * Write contents to file in given path + * + * @param string $path + * @param string $content + * @param string|null $mode + * @return int The number of bytes that were written. + * @throws FileSystemException + */ + public function filePutContents($path, $content, $mode = null) + { + $result = @file_put_contents($this->getScheme() . $path, $content, $mode); + clearstatcache(true, $this->getScheme() . $path); + if (!$result) { + throw new FileSystemException( + new Phrase( + 'The specified "%1" file couldn\'t be written. %2', + [$path, $this->getWarningMessage()] + ) + ); + } + return $result; + } + + /** + * Open file + * + * @param string $path + * @param string $mode + * @return resource file + * @throws FileSystemException + */ + public function fileOpen($path, $mode) + { + $result = @fopen($this->getScheme() . $path, $mode); + clearstatcache(true, $this->getScheme() . $path); + if (!$result) { + throw new FileSystemException( + new Phrase('File "%1" cannot be opened %2', [$path, $this->getWarningMessage()]) + ); + } + return $result; + } + + /** + * Reads the line content from file pointer (with specified number of bytes from the current position). + * + * @param resource $resource + * @param int $length + * @param string $ending [optional] + * @return string + * @throws FileSystemException + */ + public function fileReadLine($resource, $length, $ending = null) + { + // phpcs:disable + $result = @stream_get_line($resource, $length, $ending); + // phpcs:enable + if (false === $result) { + throw new FileSystemException( + new Phrase('File cannot be read %1', [$this->getWarningMessage()]) + ); + } + return $result; + } + + /** + * Reads the specified number of bytes from the current position. + * + * @param resource $resource + * @param int $length + * @return string + * @throws FileSystemException + */ + public function fileRead($resource, $length) + { + $result = @fread($resource, $length); + if ($result === false) { + throw new FileSystemException( + new Phrase('File cannot be read %1', [$this->getWarningMessage()]) + ); + } + return $result; + } + + /** + * Reads one CSV row from the file + * + * @param resource $resource + * @param int $length [optional] + * @param string $delimiter [optional] + * @param string $enclosure [optional] + * @param string $escape [optional] + * @return array|bool|null + * @throws FileSystemException + */ + public function fileGetCsv($resource, $length = 0, $delimiter = ',', $enclosure = '"', $escape = '\\') + { + $result = @fgetcsv($resource, $length, $delimiter, $enclosure, $escape); + if ($result === null) { + throw new FileSystemException( + new Phrase( + 'The "%1" CSV handle is incorrect. Verify the handle and try again.', + [$this->getWarningMessage()] + ) + ); + } + return $result; + } + + /** + * Returns position of read/write pointer + * + * @param resource $resource + * @return int + * @throws FileSystemException + */ + public function fileTell($resource) + { + $result = @ftell($resource); + if ($result === null) { + throw new FileSystemException( + new Phrase('An error occurred during "%1" execution.', [$this->getWarningMessage()]) + ); + } + return $result; + } + + /** + * Seeks to the specified offset + * + * @param resource $resource + * @param int $offset + * @param int $whence + * @return int + * @throws FileSystemException + */ + public function fileSeek($resource, $offset, $whence = SEEK_SET) + { + $result = @fseek($resource, $offset, $whence); + if ($result === -1) { + throw new FileSystemException( + new Phrase( + 'An error occurred during "%1" fileSeek execution.', + [$this->getWarningMessage()] + ) + ); + } + return $result; + } + + /** + * Returns true if pointer at the end of file or in case of exception + * + * @param resource $resource + * @return boolean + */ + public function endOfFile($resource) + { + return feof($resource); + } + + /** + * Close file + * + * @param resource $resource + * @return boolean + * @throws FileSystemException + */ + public function fileClose($resource) + { + $result = @fclose($resource); + if (!$result) { + throw new FileSystemException( + new Phrase( + 'An error occurred during "%1" fileClose execution.', + [$this->getWarningMessage()] + ) + ); + } + return $result; + } + + /** + * Writes data to file + * + * @param resource $resource + * @param string $data + * @return int + * @throws FileSystemException + */ + public function fileWrite($resource, $data) + { + $lenData = strlen($data); + for ($result = 0; $result < $lenData; $result += $fwrite) { + $fwrite = @fwrite($resource, substr($data, $result)); + if (0 === $fwrite) { + $this->fileSystemException('Unable to write'); + } + if (false === $fwrite) { + $this->fileSystemException( + 'An error occurred during "%1" fileWrite execution.', + [$this->getWarningMessage()] + ); + } + } + + return $result; + } + + /** + * Throw a FileSystemException with a Phrase of message and optional arguments + * + * @param string $message + * @param array $arguments + * @return void + * @throws FileSystemException + */ + private function fileSystemException($message, $arguments = []) + { + throw new FileSystemException(new Phrase($message, $arguments)); + } + + /** + * Writes one CSV row to the file. + * + * @param resource $resource + * @param array $data + * @param string $delimiter + * @param string $enclosure + * @return int + * @throws FileSystemException + */ + public function filePutCsv($resource, array $data, $delimiter = ',', $enclosure = '"') + { + /** + * Security enhancement for CSV data processing by Excel-like applications. + * @see https://bugzilla.mozilla.org/show_bug.cgi?id=1054702 + * + * @var $value string|Phrase + */ + foreach ($data as $key => $value) { + if (!is_string($value)) { + $value = (string)$value; + } + if (isset($value[0]) && in_array($value[0], ['=', '+', '-'])) { + $data[$key] = ' ' . $value; + } + } + + $result = @fputcsv($resource, $data, $delimiter, $enclosure); + if (!$result) { + throw new FileSystemException( + new Phrase( + 'An error occurred during "%1" filePutCsv execution.', + [$this->getWarningMessage()] + ) + ); + } + return $result; + } + + /** + * Flushes the output + * + * @param resource $resource + * @return bool + * @throws FileSystemException + */ + public function fileFlush($resource) + { + $result = @fflush($resource); + if (!$result) { + throw new FileSystemException( + new Phrase( + 'An error occurred during "%1" fileFlush execution.', + [$this->getWarningMessage()] + ) + ); + } + return $result; + } + + /** + * Lock file in selected mode + * + * @param resource $resource + * @param int $lockMode + * @return bool + * @throws FileSystemException + */ + public function fileLock($resource, $lockMode = LOCK_EX) + { + $result = @flock($resource, $lockMode); + if (!$result) { + throw new FileSystemException( + new Phrase( + 'An error occurred during "%1" fileLock execution.', + [$this->getWarningMessage()] + ) + ); + } + return $result; + } + + /** + * Unlock file + * + * @param resource $resource + * @return bool + * @throws FileSystemException + */ + public function fileUnlock($resource) + { + $result = @flock($resource, LOCK_UN); + if (!$result) { + throw new FileSystemException( + new Phrase( + 'An error occurred during "%1" fileUnlock execution.', + [$this->getWarningMessage()] + ) + ); + } + return $result; + } + + /** + * Returns an absolute path for the given one. + * + * @param string $basePath + * @param string $path + * @param string|null $scheme + * @return string + */ + public function getAbsolutePath($basePath, $path, $scheme = null) + { + // check if the path given is already an absolute path containing the + // basepath. so if the basepath starts at position 0 in the path, we + // must not concatinate them again because path is already absolute. + if (0 === strpos($path, $basePath)) { + return $this->getScheme($scheme) . $path; + } + + return $this->getScheme($scheme) . $basePath . ltrim($this->fixSeparator($path), '/'); + } + + /** + * Retrieves relative path + * + * @param string $basePath + * @param string $path + * @return string + */ + public function getRelativePath($basePath, $path = null) + { + $path = $this->fixSeparator($path); + if (strpos($path, $basePath) === 0 || $basePath == $path . '/') { + $result = substr($path, strlen($basePath)); + } else { + $result = $path; + } + return $result; + } + + /** + * Fixes path separator. + * + * Utility method. + * + * @param string $path + * @return string + */ + protected function fixSeparator($path) + { + return str_replace('\\', '/', $path); + } + + /** + * Return path with scheme + * + * @param null|string $scheme + * @return string + */ + protected function getScheme($scheme = null) + { + return $scheme ? $scheme . '://' : ''; + } + + /** + * Read directory recursively + * + * @param string $path + * @return string[] + * @throws FileSystemException + */ + public function readDirectoryRecursively($path = null) + { + $result = []; + $flags = \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::UNIX_PATHS; + try { + $iterator = new \RecursiveIteratorIterator( + new \RecursiveDirectoryIterator($path, $flags), + \RecursiveIteratorIterator::CHILD_FIRST + ); + /** @var \FilesystemIterator $file */ + foreach ($iterator as $file) { + $result[] = $file->getPathname(); + } + } catch (\Exception $e) { + throw new FileSystemException(new Phrase($e->getMessage()), $e); + } + return $result; + } + + /** + * Get real path + * + * @param string $path + * + * @return string|bool + */ + public function getRealPath($path) + { + return realpath($path); + } + + /** + * Return correct path for link + * + * @param string $path + * @return mixed + */ + public function getRealPathSafety($path) + { + if (strpos($path, DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR) === false) { + return $path; + } + + //Removing redundant directory separators. + $path = preg_replace( + '/\\' . DIRECTORY_SEPARATOR . '\\' . DIRECTORY_SEPARATOR . '+/', + DIRECTORY_SEPARATOR, + $path + ); + $pathParts = explode(DIRECTORY_SEPARATOR, $path); + $realPath = []; + foreach ($pathParts as $pathPart) { + if ($pathPart == '.') { + continue; + } + if ($pathPart == '..') { + array_pop($realPath); + continue; + } + $realPath[] = $pathPart; + } + return implode(DIRECTORY_SEPARATOR, $realPath); + } +} diff --git a/lib/internal/Magento/Framework/HTTP/PhpEnvironment/Response.php b/lib/internal/Magento/Framework/HTTP/PhpEnvironment/Response.php index dc3e63fcc7df8..2adff8162e5a3 100644 --- a/lib/internal/Magento/Framework/HTTP/PhpEnvironment/Response.php +++ b/lib/internal/Magento/Framework/HTTP/PhpEnvironment/Response.php @@ -19,6 +19,11 @@ class Response extends \Zend\Http\PhpEnvironment\Response implements \Magento\Fr */ protected $isRedirect = false; + /** + * @var bool + */ + private $headersSent; + /** * @inheritdoc */ @@ -28,6 +33,10 @@ public function getHeader($name) $headers = $this->getHeaders(); if ($headers->has($name)) { $header = $headers->get($name); + // zend-http >= 2.10.11 can return \ArrayIterator instead of a single Header + if ($header instanceof \ArrayIterator) { + $header = $header->current(); + } } return $header; } diff --git a/lib/internal/Magento/Framework/Image/Adapter/Gd2.php b/lib/internal/Magento/Framework/Image/Adapter/Gd2.php index caa080c02e255..df236faf8173b 100644 --- a/lib/internal/Magento/Framework/Image/Adapter/Gd2.php +++ b/lib/internal/Magento/Framework/Image/Adapter/Gd2.php @@ -75,16 +75,6 @@ public function open($filename) $this->_getCallback('create', null, sprintf('Unsupported image format. File: %s', $this->_fileName)), $this->_fileName ); - $fileType = $this->getImageType(); - if (in_array($fileType, [IMAGETYPE_PNG, IMAGETYPE_GIF])) { - $this->_keepTransparency = true; - if ($this->_imageHandler) { - $isAlpha = $this->checkAlpha($this->_fileName); - if ($isAlpha) { - $this->_fillBackgroundColor($this->_imageHandler); - } - } - } } /** diff --git a/lib/internal/Magento/Framework/Interception/Config/Config.php b/lib/internal/Magento/Framework/Interception/Config/Config.php index 3f16e9275bd08..abf2a6d9d57b7 100644 --- a/lib/internal/Magento/Framework/Interception/Config/Config.php +++ b/lib/internal/Magento/Framework/Interception/Config/Config.php @@ -187,8 +187,6 @@ public function hasPlugins($type) */ private function initializeUncompiled($classDefinitions = []) { - $this->cacheManager->clean($this->_cacheId); - $this->generateIntercepted($classDefinitions); $this->cacheManager->save($this->_cacheId, $this->_intercepted); diff --git a/lib/internal/Magento/Framework/Lock/Backend/Cache.php b/lib/internal/Magento/Framework/Lock/Backend/Cache.php index dfe6bbb828352..1bfc7fdeda255 100644 --- a/lib/internal/Magento/Framework/Lock/Backend/Cache.php +++ b/lib/internal/Magento/Framework/Lock/Backend/Cache.php @@ -37,6 +37,10 @@ public function __construct(FrontendInterface $cache) */ public function lock(string $name, int $timeout = -1): bool { + if ((bool)$this->cache->test($this->getIdentifier($name))) { + return false; + } + return $this->cache->save('1', $this->getIdentifier($name), [], $timeout); } diff --git a/lib/internal/Magento/Framework/Lock/Backend/FileLock.php b/lib/internal/Magento/Framework/Lock/Backend/FileLock.php index d168e910a4ab7..dd8eda9621667 100644 --- a/lib/internal/Magento/Framework/Lock/Backend/FileLock.php +++ b/lib/internal/Magento/Framework/Lock/Backend/FileLock.php @@ -91,6 +91,7 @@ public function lock(string $name, int $timeout = -1): bool while (!$this->tryToLock($fileResource)) { if (!$skipDeadline && $deadline <= microtime(true)) { + $this->tryToUnlock($fileResource); $this->fileDriver->fileClose($fileResource); return false; } @@ -124,6 +125,7 @@ public function isLocked(string $name): bool } else { $result = true; } + $this->tryToUnlock($fileResource); $this->fileDriver->fileClose($fileResource); } } catch (FileSystemException $exception) { diff --git a/lib/internal/Magento/Framework/Storage/AdapterFactory/AdapterFactoryInterface.php b/lib/internal/Magento/Framework/Storage/AdapterFactory/AdapterFactoryInterface.php new file mode 100644 index 0000000000000..56794bbd29fcf --- /dev/null +++ b/lib/internal/Magento/Framework/Storage/AdapterFactory/AdapterFactoryInterface.php @@ -0,0 +1,25 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Framework\Storage\AdapterFactory; + +use League\Flysystem\AdapterInterface; + +/** + * Storage adapter factory + * + * A storage adapter should have a factory implementing this interface in order to be supported by Magento. + * A new factory should be registered in \Magento\Framework\Storage\StorageProvider::$storageAdapters via di.xml. + */ +interface AdapterFactoryInterface +{ + /** + * Create instance of a storage adapter + * + * @param array $options + * @return AdapterInterface + */ + public function create(array $options): AdapterInterface; +} diff --git a/lib/internal/Magento/Framework/Storage/AdapterFactory/AwsS3Factory.php b/lib/internal/Magento/Framework/Storage/AdapterFactory/AwsS3Factory.php new file mode 100644 index 0000000000000..719c85b6f7f9d --- /dev/null +++ b/lib/internal/Magento/Framework/Storage/AdapterFactory/AwsS3Factory.php @@ -0,0 +1,31 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Framework\Storage\AdapterFactory; + +use Aws\S3\S3Client; +use League\Flysystem\AdapterInterface; +use League\Flysystem\AwsS3v3\AwsS3Adapter; +use Magento\Framework\Storage\InvalidStorageConfigurationException; + +/** + * Factory for AWS S3 storage adapter + */ +class AwsS3Factory implements AdapterFactoryInterface +{ + /** + * @inheritdoc + */ + public function create(array $options): AdapterInterface + { + if (empty($options['client']) || empty($options['bucket'])) { + throw new InvalidStorageConfigurationException( + "Can't create AWS S3 adapter: required 'client' and/or 'bucket' options are absent" + ); + } + $client = new S3Client($options['client']); + return new AwsS3Adapter($client, $options['bucket'], $options['prefix'] ?? ''); + } +} diff --git a/lib/internal/Magento/Framework/Storage/AdapterFactory/AzureFactory.php b/lib/internal/Magento/Framework/Storage/AdapterFactory/AzureFactory.php new file mode 100644 index 0000000000000..1d548151cb95a --- /dev/null +++ b/lib/internal/Magento/Framework/Storage/AdapterFactory/AzureFactory.php @@ -0,0 +1,32 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Framework\Storage\AdapterFactory; + +use League\Flysystem\AdapterInterface; +use League\Flysystem\AzureBlobStorage\AzureBlobStorageAdapter; +use Magento\Framework\Storage\InvalidStorageConfigurationException; +use MicrosoftAzure\Storage\Blob\BlobRestProxy; + +/** + * Factory for Azure storage adapter + */ +class AzureFactory implements AdapterFactoryInterface +{ + /** + * @inheritdoc + */ + public function create(array $options): AdapterInterface + { + if (empty($options['connection_string']) || empty($options['container_name'])) { + throw new InvalidStorageConfigurationException( + "Can't create Azure Blob storage adapter: " . + "required 'connection_string' and/or 'container_name' options are absent" + ); + } + $client = BlobRestProxy::createBlobService($options['connection_string']); + return new AzureBlobStorageAdapter($client, $options['container_name'], $options['prefix'] ?? null); + } +} diff --git a/lib/internal/Magento/Framework/Storage/AdapterFactory/LocalFactory.php b/lib/internal/Magento/Framework/Storage/AdapterFactory/LocalFactory.php new file mode 100644 index 0000000000000..edf6535f372f9 --- /dev/null +++ b/lib/internal/Magento/Framework/Storage/AdapterFactory/LocalFactory.php @@ -0,0 +1,31 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Framework\Storage\AdapterFactory; + +use League\Flysystem\Adapter\Local; +use League\Flysystem\AdapterInterface; +use Magento\Framework\Storage\InvalidStorageConfigurationException; + +/** + * Factory for local filesystem storage adapter + */ +class LocalFactory implements AdapterFactoryInterface +{ + public const ADAPTER_NAME = 'local'; + + /** + * @inheritdoc + */ + public function create(array $options): AdapterInterface + { + if (empty($options['root'])) { + throw new InvalidStorageConfigurationException( + "Can't create local filesystem storage adapter: required 'root' option is absent" + ); + } + return new Local($options['root']); + } +} diff --git a/lib/internal/Magento/Framework/Storage/FileNotFoundException.php b/lib/internal/Magento/Framework/Storage/FileNotFoundException.php new file mode 100644 index 0000000000000..540fc332130e8 --- /dev/null +++ b/lib/internal/Magento/Framework/Storage/FileNotFoundException.php @@ -0,0 +1,17 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Framework\Storage; + +/** + * Exception: FileNotFoundException + * + * Exception to be thrown when the a requested file does not exists + */ +class FileNotFoundException extends \RuntimeException +{ +} diff --git a/lib/internal/Magento/Framework/Storage/InvalidStorageConfigurationException.php b/lib/internal/Magento/Framework/Storage/InvalidStorageConfigurationException.php new file mode 100644 index 0000000000000..6f388103bfe21 --- /dev/null +++ b/lib/internal/Magento/Framework/Storage/InvalidStorageConfigurationException.php @@ -0,0 +1,14 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ + +namespace Magento\Framework\Storage; + +/** + * Exception to be thrown in a case when storage is configured incorrectly + */ +class InvalidStorageConfigurationException extends \RuntimeException +{ +} diff --git a/lib/internal/Magento/Framework/Storage/README.md b/lib/internal/Magento/Framework/Storage/README.md new file mode 100644 index 0000000000000..4cd276df8808f --- /dev/null +++ b/lib/internal/Magento/Framework/Storage/README.md @@ -0,0 +1,121 @@ +The Storage library provides abstraction over different file storage providers. + +## Usage + +A module that needs file storage, it can be configured via `\Magento\Framework\Storage\StorageProvider` in `di.xml`: + +```xml +<type name="Magento\Framework\Storage\StorageProvider"> + <arguments> + <argument name="storage" xsi:type="array"> + <item name="storage-name" xsi:type="string">default/location</item> + </argument> + </arguments> +</type> +``` + +`default/location` is a default path in local filesystem, relative to Magento root. + +Now, in a PHP class that uses the declared storage, use the same `\Magento\Framework\Storage\StorageProvider` to get it: + +```php +/** + * @var \Magento\Framework\Storage\StorageProvider + */ +private $storageProvider; + +public function doSomething() +{ + $storage = $this->storageProvider->get('storage-name') + $storage->put('path.txt', $content); +} +``` + +## Configuring Storage + +A storage can be configured in `env.php`: + +```php +'storage' => [ + 'storage-name' => [ + 'adapter' => 'aws_s3', + 'options' => [ + 'client' => [ + 'credentials' => [ + 'key' => '<key>', + 'secret' => '<secret>' + ], + 'region' => '<region>', + 'version' => 'latest', + ], + 'bucket' => '<bucket>', + ], + ], + 'media' => [ + // this is default configuration, so it doesn't need to be configured explicitly like so + 'adapter' => 'local', + 'options' => [ + 'root' => 'pub/media' + ] + ] +] +``` + +Different providers have different `options` available for configuration. +Under the hood, Magento Storage relies on [Flysystem](https://github.com/thephpleague/flysystem) library, so`options` might reflect options required by a corresponding storage adapter implemented for Flysystem. + +## Storage Providers + +By default, Magento Storage provides support for the following storage providers: + +* Local filesystem (based on `\League\Flysystem\Adapter\Local`) + * Adapter name: `local` + * Options: + ```php + [ + 'root' => 'path/relative/to/magento/root' + ] + ``` +* AWS S3 V3 (based on `\League\Flysystem\AwsS3v3\AwsS3Adapter`) + * Adapter name: `aws_s3` + * Options: + ```php + [ + 'client' => [ + 'credentials' => [ + 'key' => '<key>', + 'secret' => '<secret>' + ], + 'region' => '<region>', + 'version' => 'latest', + ], + 'bucket' => '<bucket>', + 'prefix' => '<prefix>', + ] + ``` +* Azure Blob storage (based on `\League\Flysystem\AzureBlobStorage\AzureBlobStorageAdapter`) + * Adapter name: `ms_azure` + * Options: + ```php + [ + 'connection_string' => '<connection-string>', + 'container_name' => '<container-name>', + 'prefix' => '<prefix>', + ] + ``` + +Additional adapters can be added by: +1. Creating an adapter factory implementing `\Magento\Framework\Storage\AdapterFactory\AdapterFactoryInterface` +2. Registering the factory in `Magento\Framework\Storage\StorageProvider` via `di.xml`: + ```xml + <type name="Magento\Framework\Storage\StorageProvider"> + <arguments> + <argument name="storageAdapters" xsi:type="array"> + <item name="custom_adapter" xsi:type="string">My\Storage\AdapterFactory</item> + </argument> + </arguments> + </type> + ``` + +The factory is registered as a "string" (name of the class). +That's because in most cases only a few adapters will be really created for a single application, and we don't want to create unnecessary factory instances. diff --git a/lib/internal/Magento/Framework/Storage/RootViolationException.php b/lib/internal/Magento/Framework/Storage/RootViolationException.php new file mode 100644 index 0000000000000..3ea41bfb57073 --- /dev/null +++ b/lib/internal/Magento/Framework/Storage/RootViolationException.php @@ -0,0 +1,17 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Framework\Storage; + +/** + * Exception: RootViolationException + * + * Exception to be thrown when the a directory root not specified + */ +class RootViolationException extends \RuntimeException +{ +} diff --git a/lib/internal/Magento/Framework/Storage/Storage.php b/lib/internal/Magento/Framework/Storage/Storage.php new file mode 100644 index 0000000000000..fd0eaac008368 --- /dev/null +++ b/lib/internal/Magento/Framework/Storage/Storage.php @@ -0,0 +1,77 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Framework\Storage; + +use League\Flysystem\Filesystem; + +/** + * File storage abstraction + */ +class Storage implements StorageInterface +{ + + /** + * @var Filesystem + */ + private $filesystem; + + /** + * Storage constructor. + * + * @param Filesystem $filesystem + */ + public function __construct(Filesystem $filesystem) + { + $this->filesystem = $filesystem; + } + + /** + * @inheritDoc + */ + public function put($path, $contents, array $config = []): bool + { + return $this->filesystem->put($path, $contents, $config); + } + + /** + * @inheritDoc + */ + public function deleteDir($dirname): bool + { + try { + $result = $this->filesystem->deleteDir($dirname); + } catch (\League\Flysystem\RootViolationException $exception) { + throw new \Magento\Framework\Storage\RootViolationException($exception->getMessage()); + } + return $result; + } + + /** + * @inheritDoc + */ + public function getMetadata($path): ?array + { + try { + $metadata = $this->filesystem->getMetadata($path); + } catch (\League\Flysystem\FileNotFoundException $exception) { + throw new \Magento\Framework\Storage\FileNotFoundException( + $exception->getMessage() + ); + } + if ($metadata === false) { + $metadata = null; + } + return $metadata; + } + + /** + * @inheritDoc + */ + public function has($path): bool + { + return $this->filesystem->has($path); + } +} diff --git a/lib/internal/Magento/Framework/Storage/StorageAdapterProvider.php b/lib/internal/Magento/Framework/Storage/StorageAdapterProvider.php new file mode 100644 index 0000000000000..bcd5fe806c0c3 --- /dev/null +++ b/lib/internal/Magento/Framework/Storage/StorageAdapterProvider.php @@ -0,0 +1,63 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Framework\Storage; + +use League\Flysystem\AdapterInterface; +use Magento\Framework\ObjectManagerInterface; +use Magento\Framework\Storage\AdapterFactory\AdapterFactoryInterface; + +/** + * Provider of storage adapters based on storage name + */ +class StorageAdapterProvider +{ + /** + * @var ObjectManagerInterface + */ + private $objectManager; + + /** + * @var array + */ + private $config; + + /** + * Constructor + * + * @param ObjectManagerInterface $objectManager + * @param array $config + */ + public function __construct(ObjectManagerInterface $objectManager, array $config) + { + $this->objectManager = $objectManager; + $this->config = $config; + } + + /** + * Create storage adapter based on its name with provided options + * + * @param string $adapterName + * @param array $options + * @return AdapterInterface|null + */ + public function create(string $adapterName, array $options) :? AdapterInterface + { + if (!isset($this->config[$adapterName])) { + throw new InvalidStorageConfigurationException( + "Configured adapter '$adapterName' is not supported" + ); + } + $adapterFactoryClass = $this->config[$adapterName]; + $adapterFactory = $this->objectManager->get($adapterFactoryClass); + if (!$adapterFactory instanceof AdapterFactoryInterface) { + throw new InvalidStorageConfigurationException( + "Configured storage adapter factory '$adapterFactory' must implement " . + "'\Magento\Framework\Storage\AdapterFactory\AdapterFactoryInterface'" + ); + } + return $adapterFactory->create($options); + } +} diff --git a/lib/internal/Magento/Framework/Storage/StorageInterface.php b/lib/internal/Magento/Framework/Storage/StorageInterface.php new file mode 100644 index 0000000000000..4cf965b2287cd --- /dev/null +++ b/lib/internal/Magento/Framework/Storage/StorageInterface.php @@ -0,0 +1,57 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Framework\Storage; + +/** + * Storage interface to be used by client code to manipulate objects in the storage + * + * Retrieve a real instance of storage via $storageProvider->get('<your-storage-name>'), + * where $storageProvider is an instance of \Magento\Framework\Storage\StorageProvider + */ +interface StorageInterface +{ + /** + * Create a file or update if exists. + * + * @param string $path The path to the file. + * @param string $contents The file contents. + * @param array $config An optional configuration array. + * + * @return bool True on success, false on failure. + */ + public function put($path, $contents, array $config = []): bool; + + /** + * Delete a directory. + * + * @param string $dirname + * + * @throws RootViolationException Thrown if $dirname is empty. + * + * @return bool True on success, false on failure. + */ + public function deleteDir($dirname): bool; + + /** + * Get a file's metadata. + * + * @param string $path The path to the file. + * + * @throws FileNotFoundException + * + * @return array|false The file metadata or false on failure. + */ + public function getMetadata($path): ?array; + + /** + * Check whether a file exists. + * + * @param string $path + * + * @return bool + */ + public function has($path): bool; +} diff --git a/lib/internal/Magento/Framework/Storage/StorageProvider.php b/lib/internal/Magento/Framework/Storage/StorageProvider.php new file mode 100644 index 0000000000000..bad0813f33002 --- /dev/null +++ b/lib/internal/Magento/Framework/Storage/StorageProvider.php @@ -0,0 +1,102 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Framework\Storage; + +use Magento\Framework\App\DeploymentConfig; +use Magento\Framework\Storage\AdapterFactory\LocalFactory; +use Magento\Framework\Storage\StorageFactory; +use League\Flysystem\FilesystemFactory; + +/** + * Main entry point for accessing file storage + * + * See README.md for usage details + */ +class StorageProvider +{ + private $storageConfig = []; + + private $storage = []; + + /** + * @var StorageFactory + */ + private $storageFactory; + + /** + * @var StorageAdapterProvider + */ + private $adapterProvider; + + /** + * @var FilesystemFactory + */ + private $filesystemFactory; + + /** + * StorageProvider constructor. + * @param StorageAdapterProvider $adapterProvider + * @param \Magento\Framework\Storage\StorageFactory $storageFactory + * @param array $storage + * @param DeploymentConfig $envConfig + * @param FilesystemFactory $filesystemFactory + * @throws \Magento\Framework\Exception\FileSystemException + * @throws \Magento\Framework\Exception\RuntimeException + */ + public function __construct( + StorageAdapterProvider $adapterProvider, + StorageFactory $storageFactory, + array $storage, + DeploymentConfig $envConfig, + FilesystemFactory $filesystemFactory + ) { + foreach ($storage as $storageName => $localPath) { + $this->storageConfig[$storageName] = [ + 'adapter' => LocalFactory::ADAPTER_NAME, + 'options' => [ + 'root' => BP . '/' . $localPath, + ], + ]; + $envStorageConfig = $envConfig->get('storage/' . $storageName); + if ($envStorageConfig) { + $this->storageConfig[$storageName] = array_replace( + $this->storageConfig[$storageName], + $envStorageConfig + ); + } + } + $this->filesystemFactory = $filesystemFactory; + $this->storageFactory = $storageFactory; + $this->adapterProvider = $adapterProvider; + } + + /** + * Get storage by its name + * + * @param string $storageName + * @return StorageInterface + */ + public function get(string $storageName): StorageInterface + { + if (!isset($this->storage[$storageName])) { + if (isset($this->storageConfig[$storageName])) { + $config = $this->storageConfig[$storageName]; + if (empty($config['adapter']) || empty($config['options'])) { + throw new InvalidStorageConfigurationException( + "Incorrect configuration for storage '$storageName': required field " . + "'adapter' and/or 'options' is not defined" + ); + } + $adapter = $this->adapterProvider->create($config['adapter'], $config['options']); + $filesystem = $this->filesystemFactory->create(['adapter' => $adapter]); + $this->storage[$storageName] = $this->storageFactory->create(['filesystem' => $filesystem]); + } else { + throw new UnsupportedStorageException("No storage with name '$storageName' is declared"); + } + } + return $this->storage[$storageName]; + } +} diff --git a/lib/internal/Magento/Framework/Storage/UnsupportedStorageException.php b/lib/internal/Magento/Framework/Storage/UnsupportedStorageException.php new file mode 100644 index 0000000000000..8267fea85319e --- /dev/null +++ b/lib/internal/Magento/Framework/Storage/UnsupportedStorageException.php @@ -0,0 +1,13 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Framework\Storage; + +/** + * Exception to be thrown when unsupported (undeclared) storage is requested + */ +class UnsupportedStorageException extends \RuntimeException +{ +} diff --git a/lib/web/css/source/lib/_resets.less b/lib/web/css/source/lib/_resets.less index a680c91af3dbe..4c3d4476c2c80 100644 --- a/lib/web/css/source/lib/_resets.less +++ b/lib/web/css/source/lib/_resets.less @@ -48,14 +48,14 @@ } img { + max-width: 100%; + height: auto; border: 0; } - img, - object, video, - embed { - max-height: 100%; + embed, + object { max-width: 100%; } diff --git a/setup/src/Magento/Setup/Console/Command/DiCompileCommand.php b/setup/src/Magento/Setup/Console/Command/DiCompileCommand.php index 014d699cb239d..56a4a85b17d99 100644 --- a/setup/src/Magento/Setup/Console/Command/DiCompileCommand.php +++ b/setup/src/Magento/Setup/Console/Command/DiCompileCommand.php @@ -260,9 +260,12 @@ private function getExcludedModulePaths(array $modulePaths) */ private function getExcludedLibraryPaths(array $libraryPaths) { - $libraryPaths = array_map(function ($libraryPath) { - return preg_quote($libraryPath, '#'); - }, $libraryPaths); + $libraryPaths = array_map( + function ($libraryPath) { + return preg_quote($libraryPath, '#'); + }, + $libraryPaths + ); $excludedLibraryPaths = [ '#^(?:' . join('|', $libraryPaths) . ')/([\\w]+/)?Test#', @@ -395,7 +398,8 @@ private function getOperationsConfiguration( $compiledPathsList['application'], $compiledPathsList['library'], $compiledPathsList['generated_helpers'], - ] + ], + OperationFactory::APPLICATION_ACTION_LIST_GENERATOR => [], ]; return $operations; diff --git a/setup/src/Magento/Setup/Module/Di/App/Task/Operation/AppActionListGenerator.php b/setup/src/Magento/Setup/Module/Di/App/Task/Operation/AppActionListGenerator.php new file mode 100644 index 0000000000000..c3426dd0d9205 --- /dev/null +++ b/setup/src/Magento/Setup/Module/Di/App/Task/Operation/AppActionListGenerator.php @@ -0,0 +1,58 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +namespace Magento\Setup\Module\Di\App\Task\Operation; + +use Magento\Setup\Module\Di\App\Task\OperationInterface; +use Magento\Framework\Module\Dir\Reader as ModuleReader; +use Magento\Framework\App\ObjectManager\ConfigWriterInterface; + +/** + * Pregenerates actions for Magento + */ +class AppActionListGenerator implements OperationInterface +{ + /** + * @var ModuleReader + */ + private $moduleReader; + + /** + * @var \Magento\Framework\App\ObjectManager\ConfigWriterInterface + */ + private $configWriter; + + /** + * @param ModuleReader $moduleReader + * @param ConfigWriterInterface $configWriter + */ + public function __construct( + ModuleReader $moduleReader, + ConfigWriterInterface $configWriter + ) { + $this->moduleReader = $moduleReader; + $this->configWriter = $configWriter; + } + + /** + * @inheritDoc + */ + public function doOperation() + { + $actionList = $this->moduleReader->getActionFiles(); + $this->configWriter->write( + 'app_action_list', + $actionList + ); + } + + /** + * @inheritDoc + */ + public function getName() + { + return 'App action list generation'; + } +} diff --git a/setup/src/Magento/Setup/Module/Di/App/Task/OperationFactory.php b/setup/src/Magento/Setup/Module/Di/App/Task/OperationFactory.php index 8b423a0adef83..607790e41421c 100644 --- a/setup/src/Magento/Setup/Module/Di/App/Task/OperationFactory.php +++ b/setup/src/Magento/Setup/Module/Di/App/Task/OperationFactory.php @@ -5,6 +5,12 @@ */ namespace Magento\Setup\Module\Di\App\Task; +use Magento\Setup\Module\Di\App\Task\Operation\AppActionListGenerator; +use Magento\Setup\Module\Di\App\Task\Operation\PluginListGenerator; + +/** + * Factory that creates list of OperationInterface classes + */ class OperationFactory { /** @@ -47,6 +53,11 @@ class OperationFactory */ const APPLICATION_CODE_GENERATOR = 'application_code_generator'; + /** + * Application action list generator + */ + const APPLICATION_ACTION_LIST_GENERATOR = 'application_action_list_generator'; + /** * Operations definitions * @@ -61,6 +72,7 @@ class OperationFactory self::INTERCEPTION_CACHE => \Magento\Setup\Module\Di\App\Task\Operation\InterceptionCache::class, self::REPOSITORY_GENERATOR => \Magento\Setup\Module\Di\App\Task\Operation\RepositoryGenerator::class, self::PROXY_GENERATOR => \Magento\Setup\Module\Di\App\Task\Operation\ProxyGenerator::class, + self::APPLICATION_ACTION_LIST_GENERATOR => AppActionListGenerator::class, ]; /** diff --git a/setup/src/Magento/Setup/Module/Di/Code/Reader/ClassesScanner.php b/setup/src/Magento/Setup/Module/Di/Code/Reader/ClassesScanner.php index b3a2f14aa922a..ae957adb09d17 100644 --- a/setup/src/Magento/Setup/Module/Di/Code/Reader/ClassesScanner.php +++ b/setup/src/Magento/Setup/Module/Di/Code/Reader/ClassesScanner.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace Magento\Setup\Module\Di\Code\Reader; @@ -12,8 +13,6 @@ /** * Class ClassesScanner - * - * @package Magento\Setup\Module\Di\Code\Reader */ class ClassesScanner implements ClassesScannerInterface { @@ -100,7 +99,7 @@ public function getList($path) */ private function extract(\RecursiveIteratorIterator $recursiveIterator) { - $classes = [[]]; + $classes = []; foreach ($recursiveIterator as $fileItem) { /** @var $fileItem \SplFileInfo */ if ($fileItem->isDir() || $fileItem->getExtension() !== 'php' || $fileItem->getBasename()[0] == '.') { @@ -113,28 +112,29 @@ private function extract(\RecursiveIteratorIterator $recursiveIterator) } } $fileScanner = new FileClassScanner($fileItemPath); - $classNames = $fileScanner->getClassNames(); - $this->includeClasses($classNames, $fileItemPath); - $classes [] = $classNames; + $className = $fileScanner->getClassName(); + if (!empty($className)) { + $this->includeClass($className, $fileItemPath); + $classes[] = $className; + } } - return array_merge(...$classes); + + return $classes; } /** - * Include classes from file path + * Include class from file path. * - * @param array $classNames + * @param string $className * @param string $fileItemPath * @return bool Whether the class is included or not */ - private function includeClasses(array $classNames, $fileItemPath) + private function includeClass(string $className, string $fileItemPath): bool { - foreach ($classNames as $className) { - if (!class_exists($className)) { - // phpcs:ignore - require_once $fileItemPath; - return true; - } + if (!class_exists($className)) { + // phpcs:ignore + require_once $fileItemPath; + return true; } return false; } diff --git a/setup/src/Magento/Setup/Module/Di/Code/Reader/FileClassScanner.php b/setup/src/Magento/Setup/Module/Di/Code/Reader/FileClassScanner.php index 9a91006564d7f..c5e5230d253cc 100644 --- a/setup/src/Magento/Setup/Module/Di/Code/Reader/FileClassScanner.php +++ b/setup/src/Magento/Setup/Module/Di/Code/Reader/FileClassScanner.php @@ -3,13 +3,12 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ +declare(strict_types=1); namespace Magento\Setup\Module\Di\Code\Reader; /** * Class FileClassScanner - * - * @package Magento\Setup\Module\Di\Code\Reader */ class FileClassScanner { @@ -20,9 +19,10 @@ class FileClassScanner ]; private const ALLOWED_OPEN_BRACES_TOKENS = [ - T_CURLY_OPEN => true, + T_CURLY_OPEN => true, T_DOLLAR_OPEN_CURLY_BRACES => true, - T_STRING_VARNAME => true]; + T_STRING_VARNAME => true + ]; /** * The filename of the file to introspect @@ -32,11 +32,11 @@ class FileClassScanner private $filename; /** - * The list of classes found in the file. + * The class name found in the file. * * @var bool */ - private $classNames = false; + private $className = false; /** * @var array @@ -75,6 +75,19 @@ public function getFileContents() return file_get_contents($this->filename); } + /** + * Retrieves the first class found in a class file. + * + * @return string + */ + public function getClassName(): string + { + if ($this->className === false) { + $this->className = $this->extract(); + } + return $this->className; + } + /** * Extracts the fully qualified class name from a file. * @@ -85,11 +98,10 @@ public function getFileContents() * * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) - * @return array + * @return string */ - private function extract() + private function extract(): string { - $classes = []; $namespaceParts = []; $class = ''; $triggerClass = false; @@ -117,6 +129,9 @@ private function extract() } $namespaceParts[] = $token[1]; + // `class` token is not used with a valid class name + } elseif ($triggerClass && !$tokenIsArray) { + $triggerClass = false; // The class keyword was found in the last loop } elseif ($triggerClass && $token[0] === T_STRING) { $triggerClass = false; @@ -125,27 +140,26 @@ private function extract() switch ($token[0]) { case T_NAMESPACE: - // Current loop contains the namespace keyword. Between this and the semicolon is the namespace + // Current loop contains the namespace keyword. Between this and the semicolon is the namespace $triggerNamespace = true; $namespaceParts = []; $bracedNamespace = $this->isBracedNamespace($index); break; case T_CLASS: - // Current loop contains the class keyword. Next loop will have the class name itself. + // Current loop contains the class keyword. Next loop will have the class name itself. if ($braceLevel == 0 || ($bracedNamespace && $braceLevel == 1)) { $triggerClass = true; } break; } - // We have a class name, let's concatenate and store it! + // We have a class name, let's concatenate and return it! if ($class !== '') { $fqClassName = trim(join('', $namespaceParts)) . trim($class); - $classes[] = $fqClassName; - $class = ''; + return $fqClassName; } } - return $classes; + return $class; } /** @@ -173,19 +187,4 @@ private function isBracedNamespace($index) } throw new InvalidFileException('Could not find namespace termination'); } - - /** - * Retrieves the first class found in a class file. - * - * The return value is in an array format so it retains the same usage as the FileScanner. - * - * @return array - */ - public function getClassNames() - { - if ($this->classNames === false) { - $this->classNames = $this->extract(); - } - return $this->classNames; - } } diff --git a/setup/src/Magento/Setup/Test/Unit/Console/Command/DiCompileCommandTest.php b/setup/src/Magento/Setup/Test/Unit/Console/Command/DiCompileCommandTest.php index ca94a1b6fd559..1eb2388fe1d53 100644 --- a/setup/src/Magento/Setup/Test/Unit/Console/Command/DiCompileCommandTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Console/Command/DiCompileCommandTest.php @@ -143,7 +143,7 @@ public function testExecute() ->with(\Symfony\Component\Console\Helper\ProgressBar::class) ->willReturn($progressBar); - $this->managerMock->expects($this->exactly(7))->method('addOperation') + $this->managerMock->expects($this->exactly(8))->method('addOperation') ->withConsecutive( [OperationFactory::PROXY_GENERATOR, []], [OperationFactory::REPOSITORY_GENERATOR, $this->anything()], @@ -160,7 +160,8 @@ public function testExecute() })], [OperationFactory::INTERCEPTION, $this->anything()], [OperationFactory::AREA_CONFIG_GENERATOR, $this->anything()], - [OperationFactory::INTERCEPTION_CACHE, $this->anything()] + [OperationFactory::INTERCEPTION_CACHE, $this->anything()], + [OperationFactory::APPLICATION_ACTION_LIST_GENERATOR, $this->anything()] ) ; diff --git a/setup/src/Magento/Setup/Test/Unit/Module/Di/Code/Reader/FileClassScannerTest.php b/setup/src/Magento/Setup/Test/Unit/Module/Di/Code/Reader/FileClassScannerTest.php index 5bc7fd82b3251..c50c024aefe8f 100644 --- a/setup/src/Magento/Setup/Test/Unit/Module/Di/Code/Reader/FileClassScannerTest.php +++ b/setup/src/Magento/Setup/Test/Unit/Module/Di/Code/Reader/FileClassScannerTest.php @@ -7,23 +7,22 @@ use Magento\Setup\Module\Di\Code\Reader\FileClassScanner; use Magento\Setup\Module\Di\Code\Reader\InvalidFileException; +use PHPUnit\Framework\MockObject\MockObject; class FileClassScannerTest extends \PHPUnit\Framework\TestCase { - public function testInvalidFileThrowsException() { $this->expectException(InvalidFileException::class); - new FileClassScanner(false); + new FileClassScanner(''); } public function testEmptyArrayForFileWithoutNamespaceOrClass() { - $scanner = $this->getMockBuilder(FileClassScanner::class)->disableOriginalConstructor()->setMethods([ - 'getFileContents' - ])->getMock(); - $scanner->expects(self::once())->method('getFileContents')->willReturn( - <<<PHP + $scanner = $this->getScannerMockObject(); + $scanner->expects(self::once()) + ->method('getFileContents') + ->willReturn(<<<PHP <?php echo 'hello world'; @@ -35,17 +34,16 @@ public function testEmptyArrayForFileWithoutNamespaceOrClass() ); /** @var $scanner FileClassScanner */ - $result = $scanner->getClassNames(); - self::assertCount(0, $result); + $result = $scanner->getClassName(); + self::assertEmpty($result); } public function testGetClassName() { - $scanner = $this->getMockBuilder(FileClassScanner::class)->disableOriginalConstructor()->setMethods([ - 'getFileContents' - ])->getMock(); - $scanner->expects(self::once())->method('getFileContents')->willReturn( - <<<PHP + $scanner = $this->getScannerMockObject(); + $scanner->expects(self::once()) + ->method('getFileContents') + ->willReturn(<<<PHP <?php class ThisIsATest { @@ -53,21 +51,18 @@ class ThisIsATest { } PHP ); - /** @var $scanner FileClassScanner */ - - $result = $scanner->getClassNames(); - self::assertCount(1, $result); - self::assertContains('ThisIsATest', $result); + /** @var $scanner FileClassScanner */ + $result = $scanner->getClassName(); + self::assertEquals('ThisIsATest', $result); } public function testGetClassNameAndSingleNamespace() { - $scanner = $this->getMockBuilder(FileClassScanner::class)->disableOriginalConstructor()->setMethods([ - 'getFileContents' - ])->getMock(); - $scanner->expects(self::once())->method('getFileContents')->willReturn( - <<<PHP + $scanner = $this->getScannerMockObject(); + $scanner->expects(self::once()) + ->method('getFileContents') + ->willReturn(<<<PHP <?php namespace NS; @@ -77,21 +72,18 @@ class ThisIsMyTest { } PHP ); - /** @var $scanner FileClassScanner */ - $result = $scanner->getClassNames(); - - self::assertCount(1, $result); - self::assertContains('NS\ThisIsMyTest', $result); + /** @var $scanner FileClassScanner */ + $result = $scanner->getClassName(); + self::assertEquals('NS\ThisIsMyTest', $result); } public function testGetClassNameAndMultiNamespace() { - $scanner = $this->getMockBuilder(FileClassScanner::class)->disableOriginalConstructor()->setMethods([ - 'getFileContents' - ])->getMock(); - $scanner->expects(self::once())->method('getFileContents')->willReturn( - <<<PHP + $scanner = $this->getScannerMockObject(); + $scanner->expects(self::once()) + ->method('getFileContents') + ->willReturn(<<<PHP <?php namespace This\Is\My\Ns; @@ -102,29 +94,26 @@ public function __construct() { \This\Is\Another\Ns::class; } - + public function test() { - + } } PHP ); - /** @var $scanner FileClassScanner */ - - $result = $scanner->getClassNames(); - self::assertCount(1, $result); - self::assertContains('This\Is\My\Ns\ThisIsMyTest', $result); + /** @var $scanner FileClassScanner */ + $result = $scanner->getClassName(); + self::assertEquals('This\Is\My\Ns\ThisIsMyTest', $result); } public function testGetMultiClassNameAndMultiNamespace() { - $scanner = $this->getMockBuilder(FileClassScanner::class)->disableOriginalConstructor()->setMethods([ - 'getFileContents' - ])->getMock(); - $scanner->expects(self::once())->method('getFileContents')->willReturn( - <<<PHP + $scanner = $this->getScannerMockObject(); + $scanner->expects(self::once()) + ->method('getFileContents') + ->willReturn(<<<PHP <?php namespace This\Is\My\Ns; @@ -136,10 +125,10 @@ public function __construct() \$this->get(\This\Is\Another\Ns::class)->method(); self:: class; } - + public function test() { - + } } @@ -149,37 +138,34 @@ class ThisIsForBreaking { PHP ); - /** @var $scanner FileClassScanner */ - $result = $scanner->getClassNames(); - - self::assertCount(2, $result); - self::assertContains('This\Is\My\Ns\ThisIsMyTest', $result); - self::assertContains('This\Is\My\Ns\ThisIsForBreaking', $result); + /** @var $scanner FileClassScanner */ + $result = $scanner->getClassName(); + // only a single class should be in the file + self::assertEquals('This\Is\My\Ns\ThisIsMyTest', $result); } public function testBracketedNamespacesAndClasses() { - $scanner = $this->getMockBuilder(FileClassScanner::class)->disableOriginalConstructor()->setMethods([ - 'getFileContents' - ])->getMock(); - $scanner->expects(self::once())->method('getFileContents')->willReturn( - <<<PHP + $scanner = $this->getScannerMockObject(); + $scanner->expects(self::once()) + ->method('getFileContents') + ->willReturn(<<<PHP <?php namespace This\Is\My\Ns { class ThisIsMyTest { - + public function __construct() { \This\Is\Another\Ns::class; self:: class; } - + } - + class ThisIsForBreaking { } @@ -189,27 +175,24 @@ class ThisIsForBreaking class ThisIsNotMyTest { - } + } } PHP ); - /** @var $scanner FileClassScanner */ - - $result = $scanner->getClassNames(); - self::assertCount(3, $result); - self::assertContains('This\Is\My\Ns\ThisIsMyTest', $result); - self::assertContains('This\Is\My\Ns\ThisIsForBreaking', $result); - self::assertContains('This\Is\Not\My\Ns\ThisIsNotMyTest', $result); + /** @var $scanner FileClassScanner */ + $result = $scanner->getClassName(); + // only a single class should in the file + self::assertEquals('This\Is\My\Ns\ThisIsMyTest', $result); } public function testMultipleClassKeywordsInMiddleOfFileWithStringVariableParsing() { - $scanner = $this->getMockBuilder(FileClassScanner::class)->disableOriginalConstructor()->setMethods([ - 'getFileContents' - ])->getMock(); - $scanner->expects(self::once())->method('getFileContents')->willReturn(<<<'PHP' + $scanner = $this->getScannerMockObject(); + $scanner->expects(self::once()) + ->method('getFileContents') + ->willReturn(<<<'PHP' <?php namespace This\Is\My\Ns; @@ -236,22 +219,20 @@ protected function secondMethod() ); /* @var $scanner FileClassScanner */ - $result = $scanner->getClassNames(); - - self::assertCount(1, $result); + $result = $scanner->getClassName(); + self::assertEquals('This\Is\My\Ns\ThisIsMyTest', $result); } public function testInvalidPHPCodeThrowsExceptionWhenCannotDetermineBraceOrSemiColon() { $this->expectException(InvalidFileException::class); - $scanner = $this->getMockBuilder(FileClassScanner::class)->disableOriginalConstructor()->setMethods([ - 'getFileContents' - ])->getMock(); - $scanner->expects(self::once())->method('getFileContents')->willReturn( - <<<PHP + $scanner = $this->getScannerMockObject(); + $scanner->expects(self::once()) + ->method('getFileContents') + ->willReturn(<<<PHP <?php -namespace This\Is\My\Ns +namespace This\Is\My\Ns class ThisIsMyTest { @@ -259,8 +240,89 @@ class ThisIsMyTest PHP ); + /** @var $scanner FileClassScanner */ + $scanner->getClassName(); + } + + /** + * Checks a case when file with class also contains `class_alias` function for backward compatibility. + */ + public function testFileContainsClassAliasFunction(): void + { + $scanner = $this->getScannerMockObject(); + $scanner->expects(self::once()) + ->method('getFileContents') + ->willReturn(<<<'PHP' +<?php + +namespace This\Is\My\Ns; + +use stdClass; + +class ThisIsMyTest +{ + public function doMethod() + { + $className = stdClass::class; + return $className; + } + + public function secondMethod() + { + $this->doMethod(); + } +} + +class_alias(\This\Is\My\Ns\ThisIsMyTest::class, stdClass::class); + +PHP + ); + + /* @var $scanner FileClassScanner */ + $result = $scanner->getClassName(); + self::assertEquals('This\Is\My\Ns\ThisIsMyTest', $result); + } + + /** + * Checks a case when file with class also contains `class_exists` function. + */ + public function testFileContainsClassExistsFunction(): void + { + $scanner = $this->getScannerMockObject(); + $scanner->expects(self::once()) + ->method('getFileContents') + ->willReturn(<<<PHP +<?php + +namespace This\Is\My\Ns; + +if (false) { + class ThisIsMyTest {} +} + +class_exists(\This\Is\My\Ns\ThisIsMySecondTest::class); +trigger_error('This class is does not supported'); +PHP + ); + + /* @var $scanner FileClassScanner */ + $result = $scanner->getClassName(); + self::assertEmpty($result); + } + + /** + * Creates file class scanner mock object. + * + * @return MockObject + */ + private function getScannerMockObject(): MockObject + { + $scanner = $this->getMockBuilder(FileClassScanner::class) + ->disableOriginalConstructor() + ->setMethods(['getFileContents']) + ->getMock(); - $scanner->getClassNames(); + return $scanner; } } diff --git a/setup/src/Magento/Setup/Test/Unit/Module/I18n/ContextTest.php b/setup/src/Magento/Setup/Test/Unit/Module/I18n/ContextTest.php deleted file mode 100644 index 1917d7aef5d13..0000000000000 --- a/setup/src/Magento/Setup/Test/Unit/Module/I18n/ContextTest.php +++ /dev/null @@ -1,153 +0,0 @@ -<?php -/** - * Copyright © Magento, Inc. All rights reserved. - * See COPYING.txt for license details. - */ -namespace Magento\Setup\Test\Unit\Module\I18n; - -use Magento\Framework\Component\ComponentRegistrar; -use \Magento\Setup\Module\I18n\Context; - -class ContextTest extends \PHPUnit\Framework\TestCase -{ - /** - * @var \Magento\Setup\Module\I18n\Context - */ - protected $context; - - /** - * @var \Magento\Framework\Component\ComponentRegistrar|\PHPUnit_Framework_MockObject_MockObject - */ - protected $componentRegistrar; - - protected function setUp() - { - $this->componentRegistrar = $this->createMock(\Magento\Framework\Component\ComponentRegistrar::class); - } - - /** - * @param array $context - * @param string $path - * @param array $pathValues - * @dataProvider dataProviderContextByPath - */ - public function testGetContextByPath($context, $path, $pathValues) - { - $this->componentRegistrar->expects($this->any()) - ->method('getPaths') - ->willReturnMap($pathValues); - $this->context = new Context($this->componentRegistrar); - $this->assertEquals($context, $this->context->getContextByPath($path)); - } - - /** - * @return array - */ - public function dataProviderContextByPath() - { - return [ - [ - [Context::CONTEXT_TYPE_MODULE, 'Magento_Module'], - '/app/code/Magento/Module/Block/Test.php', - [ - [Context::CONTEXT_TYPE_MODULE, ['Magento_Module' => '/app/code/Magento/Module']], - [Context::CONTEXT_TYPE_THEME, []], - ] - ], - [ - [Context::CONTEXT_TYPE_THEME, 'frontend/Some/theme'], - '/app/design/area/theme/test.phtml', - [ - [Context::CONTEXT_TYPE_MODULE, []], - [Context::CONTEXT_TYPE_THEME, ['frontend/Some/theme' => '/app/design/area/theme']], - ] - ], - [ - [Context::CONTEXT_TYPE_LIB, 'lib/web/module/test.phtml'], - '/lib/web/module/test.phtml', - [ - [Context::CONTEXT_TYPE_MODULE, []], - [Context::CONTEXT_TYPE_THEME, []], - ] - ], - ]; - } - - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Invalid path given: "invalid_path". - */ - public function testGetContextByPathWithInvalidPath() - { - $this->componentRegistrar->expects($this->any()) - ->method('getPaths') - ->willReturnMap([ - [ComponentRegistrar::MODULE, ['/path/to/module']], - [ComponentRegistrar::THEME, ['/path/to/theme']] - ]); - $this->context = new Context($this->componentRegistrar); - $this->context->getContextByPath('invalid_path'); - } - - /** - * @param string $path - * @param array $context - * @param array $registrar - * @dataProvider dataProviderPathToLocaleDirectoryByContext - */ - public function testBuildPathToLocaleDirectoryByContext($path, $context, $registrar) - { - $paths = []; - foreach ($registrar as $module) { - $paths[$module[1]] = $module[2]; - } - $this->componentRegistrar->expects($this->any()) - ->method('getPath') - ->willReturnMap($registrar); - $this->context = new Context($this->componentRegistrar); - $this->assertEquals($path, $this->context->buildPathToLocaleDirectoryByContext($context[0], $context[1])); - } - - /** - * @return array - */ - public function dataProviderPathToLocaleDirectoryByContext() - { - return [ - [ - BP . '/app/code/Magento/Module/i18n/', - [Context::CONTEXT_TYPE_MODULE, 'Magento_Module'], - [[ComponentRegistrar::MODULE, 'Magento_Module', BP . '/app/code/Magento/Module']] - ], - [ - BP . '/app/design/frontend/Magento/luma/i18n/', - [Context::CONTEXT_TYPE_THEME, 'frontend/Magento/luma'], - [[ComponentRegistrar::THEME, 'frontend/Magento/luma', BP . '/app/design/frontend/Magento/luma']] - ], - - [ - null, - [Context::CONTEXT_TYPE_MODULE, 'Unregistered_Module'], - [[ComponentRegistrar::MODULE, 'Unregistered_Module', null]] - ], - [ - null, - [Context::CONTEXT_TYPE_THEME, 'frontend/Magento/unregistered'], - [[ComponentRegistrar::THEME, 'frontend/Magento/unregistered', null]] - ], - [BP . '/lib/web/i18n/', [Context::CONTEXT_TYPE_LIB, 'lib/web/module/test.phtml'], []], - ]; - } - - /** - * @expectedException \InvalidArgumentException - * @expectedExceptionMessage Invalid context given: "invalid_type". - */ - public function testBuildPathToLocaleDirectoryByContextWithInvalidType() - { - $this->componentRegistrar->expects($this->never()) - ->method('getPath'); - $this->context = new Context($this->componentRegistrar); - $this->context->buildPathToLocaleDirectoryByContext('invalid_type', 'Magento_Module'); - } -}