From a4c74d8fd1cb4a67faee123607dab819bea54f04 Mon Sep 17 00:00:00 2001 From: Rudolf Vince Date: Mon, 30 Mar 2020 10:32:44 +0200 Subject: [PATCH 01/31] Implement ActionInterface for Wishlist/Shared --- .../Wishlist/Controller/Shared/Allcart.php | 49 ++++++++++++------- 1 file changed, 31 insertions(+), 18 deletions(-) diff --git a/app/code/Magento/Wishlist/Controller/Shared/Allcart.php b/app/code/Magento/Wishlist/Controller/Shared/Allcart.php index 6300b14dcf515..8d160d270a6f0 100644 --- a/app/code/Magento/Wishlist/Controller/Shared/Allcart.php +++ b/app/code/Magento/Wishlist/Controller/Shared/Allcart.php @@ -3,55 +3,68 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + +declare(strict_types=1); + namespace Magento\Wishlist\Controller\Shared; -use Magento\Framework\App\Action\Context; -use Magento\Wishlist\Model\ItemCarrier; +use Magento\Framework\App\Action\HttpGetActionInterface; +use Magento\Framework\App\RequestInterface; use Magento\Framework\Controller\ResultFactory; +use Magento\Framework\Controller\Result\Forward; +use Magento\Framework\Controller\Result\Redirect; +use Magento\Wishlist\Model\ItemCarrier; -class Allcart extends \Magento\Framework\App\Action\Action +class Allcart implements HttpGetActionInterface { + /** + * @var ItemCarrier + */ + private $itemCarrier; + /** * @var WishlistProvider */ - protected $wishlistProvider; + private $wishlistProvider; /** - * @var \Magento\Wishlist\Model\ItemCarrier + * @var RequestInterface */ - protected $itemCarrier; + private $request; /** - * @param Context $context - * @param WishlistProvider $wishlistProvider - * @param ItemCarrier $itemCarrier + * @var ResultFactory */ + private $resultFactory; + public function __construct( - Context $context, - WishlistProvider $wishlistProvider, - ItemCarrier $itemCarrier + ItemCarrier $itemCarrier, + RequestInterface $request, + ResultFactory $resultFactory, + WishlistProvider $wishlistProvider ) { - $this->wishlistProvider = $wishlistProvider; $this->itemCarrier = $itemCarrier; - parent::__construct($context); + $this->request = $request; + $this->resultFactory = $resultFactory; + $this->wishlistProvider = $wishlistProvider; } /** * Add all items from wishlist to shopping cart * - * @return \Magento\Framework\Controller\ResultInterface + * @inheritDoc */ public function execute() { $wishlist = $this->wishlistProvider->getWishlist(); if (!$wishlist) { - /** @var \Magento\Framework\Controller\Result\Forward $resultForward */ + /** @var Forward $resultForward */ $resultForward = $this->resultFactory->create(ResultFactory::TYPE_FORWARD); $resultForward->forward('noroute'); return $resultForward; } - $redirectUrl = $this->itemCarrier->moveAllToCart($wishlist, $this->getRequest()->getParam('qty')); - /** @var \Magento\Framework\Controller\Result\Redirect $resultRedirect */ + $redirectUrl = $this->itemCarrier->moveAllToCart($wishlist, $this->request->getParam('qty')); + /** @var Redirect $resultRedirect */ $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT); $resultRedirect->setUrl($redirectUrl); return $resultRedirect; From 18e7519bb69cd05bb73a9c0afb8d4948850b9f9a Mon Sep 17 00:00:00 2001 From: Rudolf Vince Date: Mon, 30 Mar 2020 10:56:02 +0200 Subject: [PATCH 02/31] Unit test for Wishlist/Shared Controller --- .../Unit/Controller/Shared/AllcartTest.php | 72 +++++++++---------- 1 file changed, 33 insertions(+), 39 deletions(-) diff --git a/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/AllcartTest.php b/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/AllcartTest.php index d5ac5e9485424..4422c13a72e60 100644 --- a/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/AllcartTest.php +++ b/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/AllcartTest.php @@ -5,82 +5,86 @@ */ namespace Magento\Wishlist\Test\Unit\Controller\Shared; -use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; +use Magento\Framework\App\Action\Context; +use Magento\Framework\App\Request\Http; +use Magento\Framework\Controller\Result\Forward; +use Magento\Framework\Controller\Result\Redirect; use Magento\Framework\Controller\ResultFactory; - -class AllcartTest extends \PHPUnit\Framework\TestCase +use Magento\Wishlist\Controller\Shared\Allcart; +use Magento\Wishlist\Controller\Shared\WishlistProvider; +use Magento\Wishlist\Model\ItemCarrier; +use Magento\Wishlist\Model\Wishlist; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; + +class AllcartTest extends TestCase { /** - * @var \Magento\Wishlist\Controller\Shared\Allcart + * @var Allcart */ protected $allcartController; /** - * @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager - */ - protected $objectManagerHelper; - - /** - * @var \Magento\Framework\App\Action\Context + * @var Context */ protected $context; /** - * @var \Magento\Wishlist\Controller\Shared\WishlistProvider|\PHPUnit\Framework\MockObject\MockObject + * @var WishlistProvider|MockObject */ protected $wishlistProviderMock; /** - * @var \Magento\Wishlist\Model\ItemCarrier|\PHPUnit\Framework\MockObject\MockObject + * @var ItemCarrier|MockObject */ protected $itemCarrierMock; /** - * @var \Magento\Wishlist\Model\Wishlist|\PHPUnit\Framework\MockObject\MockObject + * @var Wishlist|MockObject */ protected $wishlistMock; /** - * @var \Magento\Framework\App\Request\Http|\PHPUnit\Framework\MockObject\MockObject + * @var Http|MockObject */ protected $requestMock; /** - * @var \Magento\Framework\Controller\ResultFactory|\PHPUnit\Framework\MockObject\MockObject + * @var ResultFactory|MockObject */ protected $resultFactoryMock; /** - * @var \Magento\Framework\Controller\Result\Redirect|\PHPUnit\Framework\MockObject\MockObject + * @var Redirect|MockObject */ protected $resultRedirectMock; /** - * @var \Magento\Framework\Controller\Result\Forward|\PHPUnit\Framework\MockObject\MockObject + * @var Forward|MockObject */ protected $resultForwardMock; protected function setUp() { - $this->wishlistProviderMock = $this->getMockBuilder(\Magento\Wishlist\Controller\Shared\WishlistProvider::class) + $this->wishlistProviderMock = $this->getMockBuilder(WishlistProvider::class) ->disableOriginalConstructor() ->getMock(); - $this->itemCarrierMock = $this->getMockBuilder(\Magento\Wishlist\Model\ItemCarrier::class) + $this->itemCarrierMock = $this->getMockBuilder(ItemCarrier::class) ->disableOriginalConstructor() ->getMock(); - $this->wishlistMock = $this->getMockBuilder(\Magento\Wishlist\Model\Wishlist::class) + $this->wishlistMock = $this->getMockBuilder(Wishlist::class) ->disableOriginalConstructor() ->getMock(); - $this->requestMock = $this->getMockBuilder(\Magento\Framework\App\Request\Http::class) + $this->requestMock = $this->getMockBuilder(Http::class) ->disableOriginalConstructor() ->getMock(); - $this->resultFactoryMock = $this->getMockBuilder(\Magento\Framework\Controller\ResultFactory::class) + $this->resultFactoryMock = $this->getMockBuilder(ResultFactory::class) ->disableOriginalConstructor() ->getMock(); - $this->resultRedirectMock = $this->getMockBuilder(\Magento\Framework\Controller\Result\Redirect::class) + $this->resultRedirectMock = $this->getMockBuilder(Redirect::class) ->disableOriginalConstructor() ->getMock(); - $this->resultForwardMock = $this->getMockBuilder(\Magento\Framework\Controller\Result\Forward::class) + $this->resultForwardMock = $this->getMockBuilder(Forward::class) ->disableOriginalConstructor() ->getMock(); @@ -93,21 +97,11 @@ protected function setUp() ] ); - $this->objectManagerHelper = new ObjectManagerHelper($this); - $this->context = $this->objectManagerHelper->getObject( - \Magento\Framework\App\Action\Context::class, - [ - 'request' => $this->requestMock, - 'resultFactory' => $this->resultFactoryMock - ] - ); - $this->allcartController = $this->objectManagerHelper->getObject( - \Magento\Wishlist\Controller\Shared\Allcart::class, - [ - 'context' => $this->context, - 'wishlistProvider' => $this->wishlistProviderMock, - 'itemCarrier' => $this->itemCarrierMock - ] + $this->allcartController = new Allcart( + $this->itemCarrierMock, + $this->requestMock, + $this->resultFactoryMock, + $this->wishlistProviderMock ); } From a002bf27f2a680bde1d13f82fb867a8bbb65a372 Mon Sep 17 00:00:00 2001 From: Rudolf Vince Date: Mon, 30 Mar 2020 11:05:56 +0200 Subject: [PATCH 03/31] PSR2 linted --- app/code/Magento/Wishlist/Controller/Shared/Allcart.php | 2 +- .../Wishlist/Test/Unit/Controller/Shared/AllcartTest.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Wishlist/Controller/Shared/Allcart.php b/app/code/Magento/Wishlist/Controller/Shared/Allcart.php index 8d160d270a6f0..89c1b88d9568e 100644 --- a/app/code/Magento/Wishlist/Controller/Shared/Allcart.php +++ b/app/code/Magento/Wishlist/Controller/Shared/Allcart.php @@ -15,7 +15,7 @@ use Magento\Framework\Controller\Result\Redirect; use Magento\Wishlist\Model\ItemCarrier; -class Allcart implements HttpGetActionInterface +class Allcart implements HttpGetActionInterface { /** * @var ItemCarrier diff --git a/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/AllcartTest.php b/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/AllcartTest.php index 4422c13a72e60..9b931290befbd 100644 --- a/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/AllcartTest.php +++ b/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/AllcartTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Wishlist\Test\Unit\Controller\Shared; use Magento\Framework\App\Action\Context; From df2c759db53ef19d4f1d37bfdca6a02a76fde27c Mon Sep 17 00:00:00 2001 From: Rudolf Vince Date: Mon, 30 Mar 2020 12:32:26 +0200 Subject: [PATCH 04/31] Implement ActionInterface for Wishlist/Shared/Cart + unit test --- .../Wishlist/Controller/Shared/Cart.php | 64 ++++++++++----- .../Test/Unit/Controller/Shared/CartTest.php | 81 ++++++++++--------- 2 files changed, 88 insertions(+), 57 deletions(-) diff --git a/app/code/Magento/Wishlist/Controller/Shared/Cart.php b/app/code/Magento/Wishlist/Controller/Shared/Cart.php index 38f100602972a..77dc52e05f077 100644 --- a/app/code/Magento/Wishlist/Controller/Shared/Cart.php +++ b/app/code/Magento/Wishlist/Controller/Shared/Cart.php @@ -3,16 +3,22 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + +declare(strict_types=1); + namespace Magento\Wishlist\Controller\Shared; use Magento\Catalog\Model\Product\Exception as ProductException; use Magento\Checkout\Helper\Cart as CartHelper; use Magento\Checkout\Model\Cart as CustomerCart; -use Magento\Framework\App\Action\Context as ActionContext; use Magento\Framework\App\Action\HttpGetActionInterface; +use Magento\Framework\App\RequestInterface; use Magento\Framework\Controller\ResultFactory; +use Magento\Framework\Controller\Result\Redirect as ResultRedirect; use Magento\Framework\Escaper; use Magento\Framework\Exception\LocalizedException; +use Magento\Framework\Message\ManagerInterface as MessageManagerInterface; +use Magento\Framework\App\Response\RedirectInterface; use Magento\Wishlist\Model\Item; use Magento\Wishlist\Model\Item\OptionFactory; use Magento\Wishlist\Model\ItemFactory; @@ -23,55 +29,73 @@ * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class Cart extends \Magento\Framework\App\Action\Action implements HttpGetActionInterface +class Cart implements HttpGetActionInterface { /** * @var CustomerCart */ - protected $cart; + private $cart; /** * @var OptionFactory */ - protected $optionFactory; + private $optionFactory; /** * @var ItemFactory */ - protected $itemFactory; + private $itemFactory; /** * @var CartHelper */ - protected $cartHelper; + private $cartHelper; /** * @var Escaper */ - protected $escaper; + private $escaper; + + /** + * @var RequestInterface + */ + private $request; + + /** + * @var RedirectInterface + */ + private $redirect; + + /** + * @var MessageManagerInterface + */ + private $messageManager; /** - * @param ActionContext $context - * @param CustomerCart $cart - * @param OptionFactory $optionFactory - * @param ItemFactory $itemFactory - * @param CartHelper $cartHelper - * @param Escaper $escaper + * @var ResultFactory */ + private $resultFactory; + public function __construct( - ActionContext $context, CustomerCart $cart, OptionFactory $optionFactory, ItemFactory $itemFactory, CartHelper $cartHelper, - Escaper $escaper + Escaper $escaper, + RequestInterface $request, + RedirectInterface $redirect, + MessageManagerInterface $messageManager, + ResultFactory $resultFactory ) { $this->cart = $cart; $this->optionFactory = $optionFactory; $this->itemFactory = $itemFactory; $this->cartHelper = $cartHelper; $this->escaper = $escaper; - parent::__construct($context); + $this->request = $request; + $this->redirect = $redirect; + $this->messageManager = $messageManager; + $this->resultFactory = $resultFactory; } /** @@ -80,17 +104,17 @@ public function __construct( * If Product has required options - redirect * to product view page with message about needed defined required options * - * @return \Magento\Framework\Controller\Result\Redirect + * @inheritDoc */ public function execute() { - $itemId = (int)$this->getRequest()->getParam('item'); + $itemId = (int)$this->request->getParam('item'); /* @var $item Item */ $item = $this->itemFactory->create() ->load($itemId); - $redirectUrl = $this->_redirect->getRefererUrl(); + $redirectUrl = $this->redirect->getRefererUrl(); try { /** @var OptionCollection $options */ @@ -120,7 +144,7 @@ public function execute() } catch (\Exception $e) { $this->messageManager->addExceptionMessage($e, __('We can\'t add the item to the cart right now.')); } - /** @var \Magento\Framework\Controller\Result\Redirect $resultRedirect */ + /** @var ResultRedirect $resultRedirect */ $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT); $resultRedirect->setUrl($redirectUrl); return $resultRedirect; diff --git a/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/CartTest.php b/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/CartTest.php index eba5666114139..c495ea6651342 100644 --- a/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/CartTest.php +++ b/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/CartTest.php @@ -3,9 +3,11 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + namespace Magento\Wishlist\Test\Unit\Controller\Shared; use Magento\Catalog\Model\Product; +use Magento\Catalog\Model\Product\Exception; use Magento\Checkout\Helper\Cart as CartHelper; use Magento\Checkout\Model\Cart; use Magento\Framework\App\Action\Context as ActionContext; @@ -23,80 +25,82 @@ use Magento\Wishlist\Model\Item\OptionFactory; use Magento\Wishlist\Model\ItemFactory; use Magento\Wishlist\Model\ResourceModel\Item\Option\Collection as OptionCollection; +use PHPUnit\Framework\MockObject\MockObject; +use PHPUnit\Framework\TestCase; /** * @SuppressWarnings(PHPMD.TooManyFields) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class CartTest extends \PHPUnit\Framework\TestCase +class CartTest extends TestCase { - /** @var SharedCart|\PHPUnit\Framework\MockObject\MockObject */ + /** @var SharedCart|MockObject */ protected $model; - /** @var RequestInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var RequestInterface|MockObject */ protected $request; - /** @var ManagerInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var ManagerInterface|MockObject */ protected $messageManager; - /** @var ActionContext|\PHPUnit\Framework\MockObject\MockObject */ + /** @var ActionContext|MockObject */ protected $context; - /** @var Cart|\PHPUnit\Framework\MockObject\MockObject */ + /** @var Cart|MockObject */ protected $cart; - /** @var CartHelper|\PHPUnit\Framework\MockObject\MockObject */ + /** @var CartHelper|MockObject */ protected $cartHelper; - /** @var Quote|\PHPUnit\Framework\MockObject\MockObject */ + /** @var Quote|MockObject */ protected $quote; - /** @var OptionCollection|\PHPUnit\Framework\MockObject\MockObject */ + /** @var OptionCollection|MockObject */ protected $optionCollection; - /** @var OptionFactory|\PHPUnit\Framework\MockObject\MockObject */ + /** @var OptionFactory|MockObject */ protected $optionFactory; - /** @var Option|\PHPUnit\Framework\MockObject\MockObject */ + /** @var Option|MockObject */ protected $option; - /** @var ItemFactory|\PHPUnit\Framework\MockObject\MockObject */ + /** @var ItemFactory|MockObject */ protected $itemFactory; - /** @var Item|\PHPUnit\Framework\MockObject\MockObject */ + /** @var Item|MockObject */ protected $item; - /** @var Escaper|\PHPUnit\Framework\MockObject\MockObject */ + /** @var Escaper|MockObject */ protected $escaper; - /** @var RedirectInterface|\PHPUnit\Framework\MockObject\MockObject */ + /** @var RedirectInterface|MockObject */ protected $redirect; - /** @var ResultFactory|\PHPUnit\Framework\MockObject\MockObject */ + /** @var ResultFactory|MockObject */ protected $resultFactory; - /** @var Redirect|\PHPUnit\Framework\MockObject\MockObject */ + /** @var Redirect|MockObject */ protected $resultRedirect; - /** @var Product|\PHPUnit\Framework\MockObject\MockObject */ + /** @var Product|MockObject */ protected $product; protected function setUp() { - $this->request = $this->getMockBuilder(\Magento\Framework\App\RequestInterface::class) + $this->request = $this->getMockBuilder(RequestInterface::class) ->getMockForAbstractClass(); - $this->redirect = $this->getMockBuilder(\Magento\Framework\App\Response\RedirectInterface::class) + $this->redirect = $this->getMockBuilder(RedirectInterface::class) ->getMockForAbstractClass(); - $this->messageManager = $this->getMockBuilder(\Magento\Framework\Message\ManagerInterface::class) + $this->messageManager = $this->getMockBuilder(ManagerInterface::class) ->getMockForAbstractClass(); - $this->resultRedirect = $this->getMockBuilder(\Magento\Framework\Controller\Result\Redirect::class) + $this->resultRedirect = $this->getMockBuilder(Redirect::class) ->disableOriginalConstructor() ->getMock(); - $this->resultFactory = $this->getMockBuilder(\Magento\Framework\Controller\ResultFactory::class) + $this->resultFactory = $this->getMockBuilder(ResultFactory::class) ->disableOriginalConstructor() ->getMock(); $this->resultFactory->expects($this->once()) @@ -104,7 +108,7 @@ protected function setUp() ->with(ResultFactory::TYPE_REDIRECT) ->willReturn($this->resultRedirect); - $this->context = $this->getMockBuilder(\Magento\Framework\App\Action\Context::class) + $this->context = $this->getMockBuilder(ActionContext::class) ->disableOriginalConstructor() ->getMock(); $this->context->expects($this->any()) @@ -120,28 +124,28 @@ protected function setUp() ->method('getResultFactory') ->willReturn($this->resultFactory); - $this->cart = $this->getMockBuilder(\Magento\Checkout\Model\Cart::class) + $this->cart = $this->getMockBuilder(Cart::class) ->disableOriginalConstructor() ->getMock(); - $this->cartHelper = $this->getMockBuilder(\Magento\Checkout\Helper\Cart::class) + $this->cartHelper = $this->getMockBuilder(CartHelper::class) ->disableOriginalConstructor() ->getMock(); - $this->quote = $this->getMockBuilder(\Magento\Quote\Model\Quote::class) + $this->quote = $this->getMockBuilder(Quote::class) ->disableOriginalConstructor() ->setMethods(['getHasError']) ->getMock(); $this->optionCollection = $this->getMockBuilder( - \Magento\Wishlist\Model\ResourceModel\Item\Option\Collection::class + OptionCollection::class )->disableOriginalConstructor()->getMock(); - $this->option = $this->getMockBuilder(\Magento\Wishlist\Model\Item\Option::class) + $this->option = $this->getMockBuilder(Option::class) ->disableOriginalConstructor() ->getMock(); - $this->optionFactory = $this->getMockBuilder(\Magento\Wishlist\Model\Item\OptionFactory::class) + $this->optionFactory = $this->getMockBuilder(OptionFactory::class) ->disableOriginalConstructor() ->setMethods(['create']) ->getMock(); @@ -149,11 +153,11 @@ protected function setUp() ->method('create') ->willReturn($this->option); - $this->item = $this->getMockBuilder(\Magento\Wishlist\Model\Item::class) + $this->item = $this->getMockBuilder(Item::class) ->disableOriginalConstructor() ->getMock(); - $this->itemFactory = $this->getMockBuilder(\Magento\Wishlist\Model\ItemFactory::class) + $this->itemFactory = $this->getMockBuilder(ItemFactory::class) ->disableOriginalConstructor() ->setMethods(['create']) ->getMock(); @@ -161,21 +165,24 @@ protected function setUp() ->method('create') ->willReturn($this->item); - $this->escaper = $this->getMockBuilder(\Magento\Framework\Escaper::class) + $this->escaper = $this->getMockBuilder(Escaper::class) ->disableOriginalConstructor() ->getMock(); - $this->product = $this->getMockBuilder(\Magento\Catalog\Model\Product::class) + $this->product = $this->getMockBuilder(Product::class) ->disableOriginalConstructor() ->getMock(); $this->model = new SharedCart( - $this->context, $this->cart, $this->optionFactory, $this->itemFactory, $this->cartHelper, - $this->escaper + $this->escaper, + $this->request, + $this->redirect, + $this->messageManager, + $this->resultFactory ); } @@ -353,7 +360,7 @@ public function testExecuteProductException() $this->option->expects($this->once()) ->method('getCollection') - ->willThrowException(new \Magento\Catalog\Model\Product\Exception(__('LocalizedException'))); + ->willThrowException(new Exception(__('LocalizedException'))); $this->resultRedirect->expects($this->once()) ->method('setUrl') From 3ac458b2e4442d4b0fc3e7de672d7562c1c85607 Mon Sep 17 00:00:00 2001 From: Rudolf Vince Date: Wed, 13 May 2020 15:06:54 +0200 Subject: [PATCH 05/31] Static test fixes --- .../Magento/Wishlist/Controller/Shared/Allcart.php | 8 +++++++- app/code/Magento/Wishlist/Controller/Shared/Cart.php | 11 +++++++++++ .../Wishlist/Test/Unit/Controller/Shared/CartTest.php | 1 + 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Wishlist/Controller/Shared/Allcart.php b/app/code/Magento/Wishlist/Controller/Shared/Allcart.php index 89c1b88d9568e..b6e93d7047c76 100644 --- a/app/code/Magento/Wishlist/Controller/Shared/Allcart.php +++ b/app/code/Magento/Wishlist/Controller/Shared/Allcart.php @@ -37,6 +37,12 @@ class Allcart implements HttpGetActionInterface */ private $resultFactory; + /** + * @param ItemCarrier $itemCarrier + * @param RequestInterface $request + * @param ResultFactory $resultFactory + * @param WishlistProvider $wishlistProvider + */ public function __construct( ItemCarrier $itemCarrier, RequestInterface $request, @@ -52,7 +58,7 @@ public function __construct( /** * Add all items from wishlist to shopping cart * - * @inheritDoc + * {@inheritDoc} */ public function execute() { diff --git a/app/code/Magento/Wishlist/Controller/Shared/Cart.php b/app/code/Magento/Wishlist/Controller/Shared/Cart.php index 77dc52e05f077..df023ffc01ddf 100644 --- a/app/code/Magento/Wishlist/Controller/Shared/Cart.php +++ b/app/code/Magento/Wishlist/Controller/Shared/Cart.php @@ -76,6 +76,17 @@ class Cart implements HttpGetActionInterface */ private $resultFactory; + /** + * @param CustomerCart $cart + * @param OptionFactory $optionFactory + * @param ItemFactory $itemFactory + * @param CartHelper $cartHelper + * @param Escaper $escaper + * @param RequestInterface $request + * @param RedirectInterface $redirect + * @param MessageManagerInterface $messageManager + * @param ResultFactory $resultFactory + */ public function __construct( CustomerCart $cart, OptionFactory $optionFactory, diff --git a/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/CartTest.php b/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/CartTest.php index c495ea6651342..43f82c1722bde 100644 --- a/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/CartTest.php +++ b/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/CartTest.php @@ -85,6 +85,7 @@ class CartTest extends TestCase /** @var Product|MockObject */ protected $product; + // phpcs:ignore Generic.Files.LineLength.TooLong protected function setUp() { $this->request = $this->getMockBuilder(RequestInterface::class) From f4744395fa245230386c65d00405dfba665dc868 Mon Sep 17 00:00:00 2001 From: Rudolf Vince Date: Wed, 13 May 2020 16:14:53 +0200 Subject: [PATCH 06/31] suppress ExcessiveMethodLength notice --- .../Magento/Wishlist/Test/Unit/Controller/Shared/CartTest.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/CartTest.php b/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/CartTest.php index 76ac73d837f77..0c284d1c917b9 100644 --- a/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/CartTest.php +++ b/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/CartTest.php @@ -86,7 +86,9 @@ class CartTest extends TestCase /** @var Product|MockObject */ protected $product; - // phpcs:ignore Generic.Files.LineLength.TooLong + /** + * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + */ protected function setUp(): void { $this->request = $this->getMockBuilder(RequestInterface::class) From 204d0c3528fabf95c0554731dc37351bbeb26cc9 Mon Sep 17 00:00:00 2001 From: Ynhockey Date: Thu, 4 Jun 2020 16:41:27 +0300 Subject: [PATCH 07/31] Grammar fixes in Registry.php --- lib/internal/Magento/Framework/Registry.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/Magento/Framework/Registry.php b/lib/internal/Magento/Framework/Registry.php index d1bc227437d5f..b642ffd1f957f 100644 --- a/lib/internal/Magento/Framework/Registry.php +++ b/lib/internal/Magento/Framework/Registry.php @@ -9,7 +9,7 @@ * Registry model. Used to manage values in registry * * Registry usage as a shared service introduces temporal, hard to detect coupling into system. - * It's usage should be avoid. Use service classes or data providers instead. + * Its usage should be avoided. Use service classes or data providers instead. * * @api * @deprecated From eface05ef1d45660670c2b1bab2cb791235cd91c Mon Sep 17 00:00:00 2001 From: Sascha Date: Fri, 5 Jun 2020 11:48:30 +0200 Subject: [PATCH 08/31] Use Variable for border-radius The border-radius was hard coded, so i changed it to: @button__border-radius --- app/design/frontend/Magento/blank/web/css/source/_extends.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/design/frontend/Magento/blank/web/css/source/_extends.less b/app/design/frontend/Magento/blank/web/css/source/_extends.less index 5bdaa4c3c35a3..690b89f42b419 100644 --- a/app/design/frontend/Magento/blank/web/css/source/_extends.less +++ b/app/design/frontend/Magento/blank/web/css/source/_extends.less @@ -1110,7 +1110,7 @@ .abs-shopping-cart-items { .action { &.continue { - border-radius: 3px; + border-radius: @button__border-radius; font-weight: @font-weight__bold; .lib-link-as-button(); .lib-button( From 2dfa2218604b370840935e65e982eac02f8afa68 Mon Sep 17 00:00:00 2001 From: Savvas Radevic Date: Fri, 19 Jun 2020 18:19:47 +0200 Subject: [PATCH 09/31] #28802: Fix typo retires => retries #28802: Fix typo retires => retries --- setup/src/Magento/Setup/Model/ConfigOptionsList/Session.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup/src/Magento/Setup/Model/ConfigOptionsList/Session.php b/setup/src/Magento/Setup/Model/ConfigOptionsList/Session.php index e864a81ffcc0e..4a3a02b37a6ab 100644 --- a/setup/src/Magento/Setup/Model/ConfigOptionsList/Session.php +++ b/setup/src/Magento/Setup/Model/ConfigOptionsList/Session.php @@ -40,7 +40,7 @@ class Session implements ConfigOptionsListInterface const INPUT_KEY_SESSION_REDIS_SENTINEL_SERVERS = 'session-save-redis-sentinel-servers'; const INPUT_KEY_SESSION_REDIS_SENTINEL_MASTER = 'session-save-redis-sentinel-master'; const INPUT_KEY_SESSION_REDIS_SENTINEL_VERIFY_MASTER = 'session-save-redis-sentinel-verify-master'; - const INPUT_KEY_SESSION_REDIS_SENTINEL_CONNECT_RETRIES = 'session-save-redis-sentinel-connect-retires'; + const INPUT_KEY_SESSION_REDIS_SENTINEL_CONNECT_RETRIES = 'session-save-redis-sentinel-connect-retries'; const CONFIG_PATH_SESSION_REDIS = 'session/redis'; const CONFIG_PATH_SESSION_REDIS_HOST = 'session/redis/host'; From 4a8536439280fe98692020ce570e64b32555764d Mon Sep 17 00:00:00 2001 From: Rudolf Vince Date: Fri, 26 Jun 2020 11:57:18 +0200 Subject: [PATCH 10/31] added extend Action back, updated tests --- .../Magento/Wishlist/Controller/Shared/Allcart.php | 9 +++++++-- app/code/Magento/Wishlist/Controller/Shared/Cart.php | 11 ++++++++--- .../Test/Unit/Controller/Shared/AllcartTest.php | 12 ++++++++---- .../Test/Unit/Controller/Shared/CartTest.php | 1 + 4 files changed, 24 insertions(+), 9 deletions(-) diff --git a/app/code/Magento/Wishlist/Controller/Shared/Allcart.php b/app/code/Magento/Wishlist/Controller/Shared/Allcart.php index b6e93d7047c76..17ee92e8c1307 100644 --- a/app/code/Magento/Wishlist/Controller/Shared/Allcart.php +++ b/app/code/Magento/Wishlist/Controller/Shared/Allcart.php @@ -8,14 +8,16 @@ namespace Magento\Wishlist\Controller\Shared; +use Magento\Framework\App\Action\Action; +use Magento\Framework\App\Action\Context; use Magento\Framework\App\Action\HttpGetActionInterface; use Magento\Framework\App\RequestInterface; -use Magento\Framework\Controller\ResultFactory; use Magento\Framework\Controller\Result\Forward; use Magento\Framework\Controller\Result\Redirect; +use Magento\Framework\Controller\ResultFactory; use Magento\Wishlist\Model\ItemCarrier; -class Allcart implements HttpGetActionInterface +class Allcart extends Action implements HttpGetActionInterface { /** * @var ItemCarrier @@ -38,12 +40,14 @@ class Allcart implements HttpGetActionInterface private $resultFactory; /** + * @param Context $context * @param ItemCarrier $itemCarrier * @param RequestInterface $request * @param ResultFactory $resultFactory * @param WishlistProvider $wishlistProvider */ public function __construct( + Context $context, ItemCarrier $itemCarrier, RequestInterface $request, ResultFactory $resultFactory, @@ -53,6 +57,7 @@ public function __construct( $this->request = $request; $this->resultFactory = $resultFactory; $this->wishlistProvider = $wishlistProvider; + parent::__construct($context); } /** diff --git a/app/code/Magento/Wishlist/Controller/Shared/Cart.php b/app/code/Magento/Wishlist/Controller/Shared/Cart.php index df023ffc01ddf..b6e7904ae412c 100644 --- a/app/code/Magento/Wishlist/Controller/Shared/Cart.php +++ b/app/code/Magento/Wishlist/Controller/Shared/Cart.php @@ -11,14 +11,16 @@ use Magento\Catalog\Model\Product\Exception as ProductException; use Magento\Checkout\Helper\Cart as CartHelper; use Magento\Checkout\Model\Cart as CustomerCart; +use Magento\Framework\App\Action\Action; +use Magento\Framework\App\Action\Context as ActionContext; use Magento\Framework\App\Action\HttpGetActionInterface; use Magento\Framework\App\RequestInterface; -use Magento\Framework\Controller\ResultFactory; +use Magento\Framework\App\Response\RedirectInterface; use Magento\Framework\Controller\Result\Redirect as ResultRedirect; +use Magento\Framework\Controller\ResultFactory; use Magento\Framework\Escaper; use Magento\Framework\Exception\LocalizedException; use Magento\Framework\Message\ManagerInterface as MessageManagerInterface; -use Magento\Framework\App\Response\RedirectInterface; use Magento\Wishlist\Model\Item; use Magento\Wishlist\Model\Item\OptionFactory; use Magento\Wishlist\Model\ItemFactory; @@ -29,7 +31,7 @@ * * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ -class Cart implements HttpGetActionInterface +class Cart extends Action implements HttpGetActionInterface { /** * @var CustomerCart @@ -77,6 +79,7 @@ class Cart implements HttpGetActionInterface private $resultFactory; /** + * @param ActionContext $context * @param CustomerCart $cart * @param OptionFactory $optionFactory * @param ItemFactory $itemFactory @@ -88,6 +91,7 @@ class Cart implements HttpGetActionInterface * @param ResultFactory $resultFactory */ public function __construct( + ActionContext $context, CustomerCart $cart, OptionFactory $optionFactory, ItemFactory $itemFactory, @@ -107,6 +111,7 @@ public function __construct( $this->redirect = $redirect; $this->messageManager = $messageManager; $this->resultFactory = $resultFactory; + parent::__construct($context); } /** diff --git a/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/AllcartTest.php b/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/AllcartTest.php index 239f65f50c424..e80404b55ffdb 100644 --- a/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/AllcartTest.php +++ b/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/AllcartTest.php @@ -27,14 +27,14 @@ class AllcartTest extends TestCase protected $allcartController; /** - * @var Context + * @var WishlistProvider|MockObject */ - protected $context; + protected $wishlistProviderMock; /** - * @var WishlistProvider|MockObject + * @var Context|MockObject */ - protected $wishlistProviderMock; + protected $contextMock; /** * @var ItemCarrier|MockObject @@ -74,6 +74,9 @@ protected function setUp(): void $this->itemCarrierMock = $this->getMockBuilder(ItemCarrier::class) ->disableOriginalConstructor() ->getMock(); + $this->contextMock = $this->getMockBuilder(Context::class) + ->disableOriginalConstructor() + ->getMock(); $this->wishlistMock = $this->getMockBuilder(Wishlist::class) ->disableOriginalConstructor() ->getMock(); @@ -100,6 +103,7 @@ protected function setUp(): void ); $this->allcartController = new Allcart( + $this->contextMock, $this->itemCarrierMock, $this->requestMock, $this->resultFactoryMock, diff --git a/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/CartTest.php b/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/CartTest.php index 0c284d1c917b9..c0181ab061529 100644 --- a/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/CartTest.php +++ b/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/CartTest.php @@ -178,6 +178,7 @@ protected function setUp(): void ->getMock(); $this->model = new SharedCart( + $this->context, $this->cart, $this->optionFactory, $this->itemFactory, From 979ab1f1c37e4e6534a0a9905e166218d792722f Mon Sep 17 00:00:00 2001 From: Rudolf Vince Date: Mon, 29 Jun 2020 10:30:29 +0200 Subject: [PATCH 11/31] removed unnecessary properties --- .../Wishlist/Controller/Shared/Allcart.php | 19 +-------- .../Wishlist/Controller/Shared/Cart.php | 41 ++----------------- 2 files changed, 4 insertions(+), 56 deletions(-) diff --git a/app/code/Magento/Wishlist/Controller/Shared/Allcart.php b/app/code/Magento/Wishlist/Controller/Shared/Allcart.php index 17ee92e8c1307..96b3102a6f443 100644 --- a/app/code/Magento/Wishlist/Controller/Shared/Allcart.php +++ b/app/code/Magento/Wishlist/Controller/Shared/Allcart.php @@ -11,7 +11,6 @@ use Magento\Framework\App\Action\Action; use Magento\Framework\App\Action\Context; use Magento\Framework\App\Action\HttpGetActionInterface; -use Magento\Framework\App\RequestInterface; use Magento\Framework\Controller\Result\Forward; use Magento\Framework\Controller\Result\Redirect; use Magento\Framework\Controller\ResultFactory; @@ -29,33 +28,17 @@ class Allcart extends Action implements HttpGetActionInterface */ private $wishlistProvider; - /** - * @var RequestInterface - */ - private $request; - - /** - * @var ResultFactory - */ - private $resultFactory; - /** * @param Context $context * @param ItemCarrier $itemCarrier - * @param RequestInterface $request - * @param ResultFactory $resultFactory * @param WishlistProvider $wishlistProvider */ public function __construct( Context $context, ItemCarrier $itemCarrier, - RequestInterface $request, - ResultFactory $resultFactory, WishlistProvider $wishlistProvider ) { $this->itemCarrier = $itemCarrier; - $this->request = $request; - $this->resultFactory = $resultFactory; $this->wishlistProvider = $wishlistProvider; parent::__construct($context); } @@ -74,7 +57,7 @@ public function execute() $resultForward->forward('noroute'); return $resultForward; } - $redirectUrl = $this->itemCarrier->moveAllToCart($wishlist, $this->request->getParam('qty')); + $redirectUrl = $this->itemCarrier->moveAllToCart($wishlist, $this->getRequest()->getParam('qty')); /** @var Redirect $resultRedirect */ $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT); $resultRedirect->setUrl($redirectUrl); diff --git a/app/code/Magento/Wishlist/Controller/Shared/Cart.php b/app/code/Magento/Wishlist/Controller/Shared/Cart.php index b6e7904ae412c..9fdadb917a920 100644 --- a/app/code/Magento/Wishlist/Controller/Shared/Cart.php +++ b/app/code/Magento/Wishlist/Controller/Shared/Cart.php @@ -14,13 +14,10 @@ use Magento\Framework\App\Action\Action; use Magento\Framework\App\Action\Context as ActionContext; use Magento\Framework\App\Action\HttpGetActionInterface; -use Magento\Framework\App\RequestInterface; -use Magento\Framework\App\Response\RedirectInterface; use Magento\Framework\Controller\Result\Redirect as ResultRedirect; use Magento\Framework\Controller\ResultFactory; use Magento\Framework\Escaper; use Magento\Framework\Exception\LocalizedException; -use Magento\Framework\Message\ManagerInterface as MessageManagerInterface; use Magento\Wishlist\Model\Item; use Magento\Wishlist\Model\Item\OptionFactory; use Magento\Wishlist\Model\ItemFactory; @@ -58,26 +55,6 @@ class Cart extends Action implements HttpGetActionInterface */ private $escaper; - /** - * @var RequestInterface - */ - private $request; - - /** - * @var RedirectInterface - */ - private $redirect; - - /** - * @var MessageManagerInterface - */ - private $messageManager; - - /** - * @var ResultFactory - */ - private $resultFactory; - /** * @param ActionContext $context * @param CustomerCart $cart @@ -85,10 +62,6 @@ class Cart extends Action implements HttpGetActionInterface * @param ItemFactory $itemFactory * @param CartHelper $cartHelper * @param Escaper $escaper - * @param RequestInterface $request - * @param RedirectInterface $redirect - * @param MessageManagerInterface $messageManager - * @param ResultFactory $resultFactory */ public function __construct( ActionContext $context, @@ -96,21 +69,13 @@ public function __construct( OptionFactory $optionFactory, ItemFactory $itemFactory, CartHelper $cartHelper, - Escaper $escaper, - RequestInterface $request, - RedirectInterface $redirect, - MessageManagerInterface $messageManager, - ResultFactory $resultFactory + Escaper $escaper ) { $this->cart = $cart; $this->optionFactory = $optionFactory; $this->itemFactory = $itemFactory; $this->cartHelper = $cartHelper; $this->escaper = $escaper; - $this->request = $request; - $this->redirect = $redirect; - $this->messageManager = $messageManager; - $this->resultFactory = $resultFactory; parent::__construct($context); } @@ -124,13 +89,13 @@ public function __construct( */ public function execute() { - $itemId = (int)$this->request->getParam('item'); + $itemId = (int)$this->getRequest()->getParam('item'); /* @var $item Item */ $item = $this->itemFactory->create() ->load($itemId); - $redirectUrl = $this->redirect->getRefererUrl(); + $redirectUrl = $this->_redirect->getRefererUrl(); try { /** @var OptionCollection $options */ From 6d8f77c7ffe52075d0b5ff117b39100bd06e1474 Mon Sep 17 00:00:00 2001 From: Rudolf Vince Date: Mon, 29 Jun 2020 12:10:08 +0200 Subject: [PATCH 12/31] fixed tests --- .../Wishlist/Test/Unit/Controller/Shared/AllcartTest.php | 2 -- .../Wishlist/Test/Unit/Controller/Shared/CartTest.php | 6 +----- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/AllcartTest.php b/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/AllcartTest.php index e80404b55ffdb..f44fdf1b6568b 100644 --- a/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/AllcartTest.php +++ b/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/AllcartTest.php @@ -105,8 +105,6 @@ protected function setUp(): void $this->allcartController = new Allcart( $this->contextMock, $this->itemCarrierMock, - $this->requestMock, - $this->resultFactoryMock, $this->wishlistProviderMock ); } diff --git a/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/CartTest.php b/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/CartTest.php index c0181ab061529..cee4b39ecfc2f 100644 --- a/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/CartTest.php +++ b/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/CartTest.php @@ -183,11 +183,7 @@ protected function setUp(): void $this->optionFactory, $this->itemFactory, $this->cartHelper, - $this->escaper, - $this->request, - $this->redirect, - $this->messageManager, - $this->resultFactory + $this->escaper ); } From 2616ba14c89b3cb85a88399bca245b7ea764f4e2 Mon Sep 17 00:00:00 2001 From: Rudolf Vince Date: Mon, 29 Jun 2020 12:29:13 +0200 Subject: [PATCH 13/31] fixed tests --- .../Unit/Controller/Shared/AllcartTest.php | 24 ------------------- .../Test/Unit/Controller/Shared/CartTest.php | 3 --- 2 files changed, 27 deletions(-) diff --git a/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/AllcartTest.php b/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/AllcartTest.php index f44fdf1b6568b..6c96cefe8f92f 100644 --- a/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/AllcartTest.php +++ b/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/AllcartTest.php @@ -77,30 +77,6 @@ protected function setUp(): void $this->contextMock = $this->getMockBuilder(Context::class) ->disableOriginalConstructor() ->getMock(); - $this->wishlistMock = $this->getMockBuilder(Wishlist::class) - ->disableOriginalConstructor() - ->getMock(); - $this->requestMock = $this->getMockBuilder(Http::class) - ->disableOriginalConstructor() - ->getMock(); - $this->resultFactoryMock = $this->getMockBuilder(ResultFactory::class) - ->disableOriginalConstructor() - ->getMock(); - $this->resultRedirectMock = $this->getMockBuilder(Redirect::class) - ->disableOriginalConstructor() - ->getMock(); - $this->resultForwardMock = $this->getMockBuilder(Forward::class) - ->disableOriginalConstructor() - ->getMock(); - - $this->resultFactoryMock->expects($this->any()) - ->method('create') - ->willReturnMap( - [ - [ResultFactory::TYPE_REDIRECT, [], $this->resultRedirectMock], - [ResultFactory::TYPE_FORWARD, [], $this->resultForwardMock] - ] - ); $this->allcartController = new Allcart( $this->contextMock, diff --git a/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/CartTest.php b/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/CartTest.php index cee4b39ecfc2f..da9c2d536830f 100644 --- a/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/CartTest.php +++ b/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/CartTest.php @@ -173,9 +173,6 @@ protected function setUp(): void ->disableOriginalConstructor() ->getMock(); - $this->product = $this->getMockBuilder(Product::class) - ->disableOriginalConstructor() - ->getMock(); $this->model = new SharedCart( $this->context, From e2db162bb51e794809dbc402a7e52c21e7c43c04 Mon Sep 17 00:00:00 2001 From: Rudolf Vince Date: Tue, 30 Jun 2020 15:23:49 +0200 Subject: [PATCH 14/31] reverted fixed tests --- .../Test/Unit/Controller/Shared/AllcartTest.php | 15 +++++++++++++++ .../Test/Unit/Controller/Shared/CartTest.php | 3 +++ 2 files changed, 18 insertions(+) diff --git a/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/AllcartTest.php b/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/AllcartTest.php index 6c96cefe8f92f..4c2175a55ce9d 100644 --- a/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/AllcartTest.php +++ b/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/AllcartTest.php @@ -77,6 +77,21 @@ protected function setUp(): void $this->contextMock = $this->getMockBuilder(Context::class) ->disableOriginalConstructor() ->getMock(); + $this->wishlistMock = $this->getMockBuilder(Wishlist::class) + ->disableOriginalConstructor() + ->getMock(); + $this->requestMock = $this->getMockBuilder(Http::class) + ->disableOriginalConstructor() + ->getMock(); + $this->resultFactoryMock = $this->getMockBuilder(ResultFactory::class) + ->disableOriginalConstructor() + ->getMock(); + $this->resultRedirectMock = $this->getMockBuilder(Redirect::class) + ->disableOriginalConstructor() + ->getMock(); + $this->resultForwardMock = $this->getMockBuilder(Forward::class) + ->disableOriginalConstructor() + ->getMock(); $this->allcartController = new Allcart( $this->contextMock, diff --git a/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/CartTest.php b/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/CartTest.php index da9c2d536830f..cee4b39ecfc2f 100644 --- a/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/CartTest.php +++ b/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/CartTest.php @@ -173,6 +173,9 @@ protected function setUp(): void ->disableOriginalConstructor() ->getMock(); + $this->product = $this->getMockBuilder(Product::class) + ->disableOriginalConstructor() + ->getMock(); $this->model = new SharedCart( $this->context, From 2f080644f1f1f7cfed677a9eb3008932fcef9a2c Mon Sep 17 00:00:00 2001 From: Rudolf Vince Date: Tue, 30 Jun 2020 17:07:06 +0200 Subject: [PATCH 15/31] objectmanager added to test --- .../Unit/Controller/Shared/AllcartTest.php | 31 ++++++++++++++++--- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/AllcartTest.php b/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/AllcartTest.php index 4c2175a55ce9d..5fa5eb748ac65 100644 --- a/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/AllcartTest.php +++ b/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/AllcartTest.php @@ -12,6 +12,7 @@ use Magento\Framework\Controller\Result\Forward; use Magento\Framework\Controller\Result\Redirect; use Magento\Framework\Controller\ResultFactory; +use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; use Magento\Wishlist\Controller\Shared\Allcart; use Magento\Wishlist\Controller\Shared\WishlistProvider; use Magento\Wishlist\Model\ItemCarrier; @@ -26,6 +27,11 @@ class AllcartTest extends TestCase */ protected $allcartController; + /** + * @var ObjectManagerHelper + */ + protected $objectManagerHelper; + /** * @var WishlistProvider|MockObject */ @@ -34,7 +40,7 @@ class AllcartTest extends TestCase /** * @var Context|MockObject */ - protected $contextMock; + protected $context; /** * @var ItemCarrier|MockObject @@ -74,9 +80,6 @@ protected function setUp(): void $this->itemCarrierMock = $this->getMockBuilder(ItemCarrier::class) ->disableOriginalConstructor() ->getMock(); - $this->contextMock = $this->getMockBuilder(Context::class) - ->disableOriginalConstructor() - ->getMock(); $this->wishlistMock = $this->getMockBuilder(Wishlist::class) ->disableOriginalConstructor() ->getMock(); @@ -93,8 +96,26 @@ protected function setUp(): void ->disableOriginalConstructor() ->getMock(); + $this->resultFactoryMock->expects($this->any()) + ->method('create') + ->willReturnMap( + [ + [ResultFactory::TYPE_REDIRECT, [], $this->resultRedirectMock], + [ResultFactory::TYPE_FORWARD, [], $this->resultForwardMock] + ] + ); + + $this->objectManagerHelper = new ObjectManagerHelper($this); + $this->context = $this->objectManagerHelper->getObject( + Context::class, + [ + 'request' => $this->requestMock, + 'resultFactory' => $this->resultFactoryMock + ] + ); + $this->allcartController = new Allcart( - $this->contextMock, + $this->context, $this->itemCarrierMock, $this->wishlistProviderMock ); From 21f9fa4e30295d3e2e5d3c548922aa7e57421dce Mon Sep 17 00:00:00 2001 From: "vadim.malesh" Date: Fri, 3 Jul 2020 12:02:18 +0300 Subject: [PATCH 16/31] impr --- .../Wishlist/Controller/Shared/Allcart.php | 20 +- .../Wishlist/Controller/Shared/Cart.php | 11 +- .../Unit/Controller/Shared/AllcartTest.php | 86 ++++----- .../Test/Unit/Controller/Shared/CartTest.php | 178 ++++++++---------- 4 files changed, 134 insertions(+), 161 deletions(-) diff --git a/app/code/Magento/Wishlist/Controller/Shared/Allcart.php b/app/code/Magento/Wishlist/Controller/Shared/Allcart.php index 96b3102a6f443..c1e908cc0f49e 100644 --- a/app/code/Magento/Wishlist/Controller/Shared/Allcart.php +++ b/app/code/Magento/Wishlist/Controller/Shared/Allcart.php @@ -16,30 +16,33 @@ use Magento\Framework\Controller\ResultFactory; use Magento\Wishlist\Model\ItemCarrier; +/** + * Wishlist Allcart Controller + */ class Allcart extends Action implements HttpGetActionInterface { /** - * @var ItemCarrier + * @var WishlistProvider */ - private $itemCarrier; + protected $wishlistProvider; /** - * @var WishlistProvider + * @var ItemCarrier */ - private $wishlistProvider; + protected $itemCarrier; /** * @param Context $context - * @param ItemCarrier $itemCarrier * @param WishlistProvider $wishlistProvider + * @param ItemCarrier $itemCarrier */ public function __construct( Context $context, - ItemCarrier $itemCarrier, - WishlistProvider $wishlistProvider + WishlistProvider $wishlistProvider, + ItemCarrier $itemCarrier ) { - $this->itemCarrier = $itemCarrier; $this->wishlistProvider = $wishlistProvider; + $this->itemCarrier = $itemCarrier; parent::__construct($context); } @@ -61,6 +64,7 @@ public function execute() /** @var Redirect $resultRedirect */ $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT); $resultRedirect->setUrl($redirectUrl); + return $resultRedirect; } } diff --git a/app/code/Magento/Wishlist/Controller/Shared/Cart.php b/app/code/Magento/Wishlist/Controller/Shared/Cart.php index 9fdadb917a920..bee1e187be648 100644 --- a/app/code/Magento/Wishlist/Controller/Shared/Cart.php +++ b/app/code/Magento/Wishlist/Controller/Shared/Cart.php @@ -33,27 +33,27 @@ class Cart extends Action implements HttpGetActionInterface /** * @var CustomerCart */ - private $cart; + protected $cart; /** * @var OptionFactory */ - private $optionFactory; + protected $optionFactory; /** * @var ItemFactory */ - private $itemFactory; + protected $itemFactory; /** * @var CartHelper */ - private $cartHelper; + protected $cartHelper; /** * @var Escaper */ - private $escaper; + protected $escaper; /** * @param ActionContext $context @@ -128,6 +128,7 @@ public function execute() /** @var ResultRedirect $resultRedirect */ $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT); $resultRedirect->setUrl($redirectUrl); + return $resultRedirect; } } diff --git a/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/AllcartTest.php b/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/AllcartTest.php index 5fa5eb748ac65..d9339af8144f4 100644 --- a/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/AllcartTest.php +++ b/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/AllcartTest.php @@ -3,6 +3,7 @@ * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ + declare(strict_types=1); namespace Magento\Wishlist\Test\Unit\Controller\Shared; @@ -20,83 +21,60 @@ use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; +/** + * Test for \Magento\Wishlist\Controller\Shared\Allcart. + */ class AllcartTest extends TestCase { /** * @var Allcart */ - protected $allcartController; - - /** - * @var ObjectManagerHelper - */ - protected $objectManagerHelper; + private $allcartController; /** * @var WishlistProvider|MockObject */ - protected $wishlistProviderMock; - - /** - * @var Context|MockObject - */ - protected $context; + private $wishlistProviderMock; /** * @var ItemCarrier|MockObject */ - protected $itemCarrierMock; + private $itemCarrierMock; /** * @var Wishlist|MockObject */ - protected $wishlistMock; + private $wishlistMock; /** * @var Http|MockObject */ - protected $requestMock; - - /** - * @var ResultFactory|MockObject - */ - protected $resultFactoryMock; + private $requestMock; /** * @var Redirect|MockObject */ - protected $resultRedirectMock; + private $resultRedirectMock; /** * @var Forward|MockObject */ - protected $resultForwardMock; + private $resultForwardMock; + /** + * @inheritDoc + */ protected function setUp(): void { - $this->wishlistProviderMock = $this->getMockBuilder(WishlistProvider::class) - ->disableOriginalConstructor() - ->getMock(); - $this->itemCarrierMock = $this->getMockBuilder(ItemCarrier::class) - ->disableOriginalConstructor() - ->getMock(); - $this->wishlistMock = $this->getMockBuilder(Wishlist::class) - ->disableOriginalConstructor() - ->getMock(); - $this->requestMock = $this->getMockBuilder(Http::class) - ->disableOriginalConstructor() - ->getMock(); - $this->resultFactoryMock = $this->getMockBuilder(ResultFactory::class) - ->disableOriginalConstructor() - ->getMock(); - $this->resultRedirectMock = $this->getMockBuilder(Redirect::class) - ->disableOriginalConstructor() - ->getMock(); - $this->resultForwardMock = $this->getMockBuilder(Forward::class) - ->disableOriginalConstructor() - ->getMock(); - - $this->resultFactoryMock->expects($this->any()) + $this->wishlistProviderMock = $this->createMock(WishlistProvider::class); + $this->itemCarrierMock = $this->createMock(ItemCarrier::class); + $this->wishlistMock = $this->createMock(Wishlist::class); + $this->requestMock = $this->createMock(Http::class); + $resultFactoryMock = $this->createMock(ResultFactory::class); + $this->resultRedirectMock = $this->createMock(Redirect::class); + $this->resultForwardMock = $this->createMock(Forward::class); + + $resultFactoryMock->expects($this->any()) ->method('create') ->willReturnMap( [ @@ -105,19 +83,21 @@ protected function setUp(): void ] ); - $this->objectManagerHelper = new ObjectManagerHelper($this); - $this->context = $this->objectManagerHelper->getObject( + $objectManagerHelper = new ObjectManagerHelper($this); + $context = $objectManagerHelper->getObject( Context::class, [ 'request' => $this->requestMock, - 'resultFactory' => $this->resultFactoryMock + 'resultFactory' => $resultFactoryMock ] ); - - $this->allcartController = new Allcart( - $this->context, - $this->itemCarrierMock, - $this->wishlistProviderMock + $this->allcartController = $objectManagerHelper->getObject( + Allcart::class, + [ + 'context' => $context, + 'wishlistProvider' => $this->wishlistProviderMock, + 'itemCarrier' => $this->itemCarrierMock + ] ); } diff --git a/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/CartTest.php b/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/CartTest.php index cee4b39ecfc2f..e6a127457a6c6 100644 --- a/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/CartTest.php +++ b/app/code/Magento/Wishlist/Test/Unit/Controller/Shared/CartTest.php @@ -30,158 +30,146 @@ use PHPUnit\Framework\TestCase; /** + * Test for \Magento\Wishlist\Controller\Shared\Cart. + * * @SuppressWarnings(PHPMD.TooManyFields) * @SuppressWarnings(PHPMD.CouplingBetweenObjects) */ class CartTest extends TestCase { - /** @var SharedCart|MockObject */ - protected $model; - - /** @var RequestInterface|MockObject */ - protected $request; - - /** @var ManagerInterface|MockObject */ - protected $messageManager; - - /** @var ActionContext|MockObject */ - protected $context; - - /** @var Cart|MockObject */ - protected $cart; + /** + * @var SharedCart|MockObject + */ + private $model; - /** @var CartHelper|MockObject */ - protected $cartHelper; + /** + * @var RequestInterface|MockObject + */ + private $request; - /** @var Quote|MockObject */ - protected $quote; + /** + * @var ManagerInterface|MockObject + */ + private $messageManager; - /** @var OptionCollection|MockObject */ - protected $optionCollection; + /** + * @var Cart|MockObject + */ + private $cart; - /** @var OptionFactory|MockObject */ - protected $optionFactory; + /** + * @var CartHelper|MockObject + */ + private $cartHelper; - /** @var Option|MockObject */ - protected $option; + /** + * @var Quote|MockObject + */ + private $quote; - /** @var ItemFactory|MockObject */ - protected $itemFactory; + /** + * @var OptionCollection|MockObject + */ + private $optionCollection; - /** @var Item|MockObject */ - protected $item; + /** + * @var Option|MockObject + */ + private $option; - /** @var Escaper|MockObject */ - protected $escaper; + /** + * @var Item|MockObject + */ + private $item; - /** @var RedirectInterface|MockObject */ - protected $redirect; + /** + * @var Escaper|MockObject + */ + private $escaper; - /** @var ResultFactory|MockObject */ - protected $resultFactory; + /** + * @var RedirectInterface|MockObject + */ + private $redirect; - /** @var Redirect|MockObject */ - protected $resultRedirect; + /** + * @var Redirect|MockObject + */ + private $resultRedirect; - /** @var Product|MockObject */ - protected $product; + /** + * @var Product|MockObject + */ + private $product; /** - * @SuppressWarnings(PHPMD.ExcessiveMethodLength) + * @inheritDoc */ protected function setUp(): void { - $this->request = $this->getMockBuilder(RequestInterface::class) - ->getMockForAbstractClass(); - - $this->redirect = $this->getMockBuilder(RedirectInterface::class) - ->getMockForAbstractClass(); + $this->request = $this->getMockForAbstractClass(RequestInterface::class); + $this->redirect = $this->getMockForAbstractClass(RedirectInterface::class); + $this->messageManager = $this->getMockForAbstractClass(ManagerInterface::class); + $this->resultRedirect = $this->createMock(Redirect::class); - $this->messageManager = $this->getMockBuilder(ManagerInterface::class) - ->getMockForAbstractClass(); - - $this->resultRedirect = $this->getMockBuilder(Redirect::class) - ->disableOriginalConstructor() - ->getMock(); - - $this->resultFactory = $this->getMockBuilder(ResultFactory::class) - ->disableOriginalConstructor() - ->getMock(); - $this->resultFactory->expects($this->once()) + $resultFactory = $this->createMock(ResultFactory::class); + $resultFactory->expects($this->once()) ->method('create') ->with(ResultFactory::TYPE_REDIRECT) ->willReturn($this->resultRedirect); - $this->context = $this->getMockBuilder(ActionContext::class) + /** @var ActionContext|MockObject $context */ + $context = $this->getMockBuilder(ActionContext::class) ->disableOriginalConstructor() ->getMock(); - $this->context->expects($this->any()) + $context->expects($this->any()) ->method('getRequest') ->willReturn($this->request); - $this->context->expects($this->any()) + $context->expects($this->any()) ->method('getRedirect') ->willReturn($this->redirect); - $this->context->expects($this->any()) + $context->expects($this->any()) ->method('getMessageManager') ->willReturn($this->messageManager); - $this->context->expects($this->any()) + $context->expects($this->any()) ->method('getResultFactory') - ->willReturn($this->resultFactory); - - $this->cart = $this->getMockBuilder(Cart::class) - ->disableOriginalConstructor() - ->getMock(); + ->willReturn($resultFactory); - $this->cartHelper = $this->getMockBuilder(CartHelper::class) - ->disableOriginalConstructor() - ->getMock(); + $this->cart = $this->createMock(Cart::class); + $this->cartHelper = $this->createMock(CartHelper::class); $this->quote = $this->getMockBuilder(Quote::class) ->disableOriginalConstructor() - ->setMethods(['getHasError']) + ->addMethods(['getHasError']) ->getMock(); - $this->optionCollection = $this->getMockBuilder( - OptionCollection::class - )->disableOriginalConstructor()->getMock(); + $this->optionCollection = $this->createMock(OptionCollection::class); $this->option = $this->getMockBuilder(Option::class) ->disableOriginalConstructor() ->getMock(); - $this->optionFactory = $this->getMockBuilder(OptionFactory::class) - ->disableOriginalConstructor() - ->setMethods(['create']) - ->getMock(); - $this->optionFactory->expects($this->once()) + /** @var OptionFactory|MockObject $optionFactory */ + $optionFactory = $this->createMock(OptionFactory::class); + $optionFactory->expects($this->once()) ->method('create') ->willReturn($this->option); - $this->item = $this->getMockBuilder(Item::class) - ->disableOriginalConstructor() - ->getMock(); + $this->item = $this->createMock(Item::class); - $this->itemFactory = $this->getMockBuilder(ItemFactory::class) - ->disableOriginalConstructor() - ->setMethods(['create']) - ->getMock(); - $this->itemFactory->expects($this->once()) + $itemFactory = $this->createMock(ItemFactory::class); + $itemFactory->expects($this->once()) ->method('create') ->willReturn($this->item); - $this->escaper = $this->getMockBuilder(Escaper::class) - ->disableOriginalConstructor() - ->getMock(); - - $this->product = $this->getMockBuilder(Product::class) - ->disableOriginalConstructor() - ->getMock(); + $this->escaper = $this->createMock(Escaper::class); + $this->product = $this->createMock(Product::class); $this->model = new SharedCart( - $this->context, + $context, $this->cart, - $this->optionFactory, - $this->itemFactory, + $optionFactory, + $itemFactory, $this->cartHelper, $this->escaper ); From 1b0f8df856aedb16d2afd731638fa9d2677cad45 Mon Sep 17 00:00:00 2001 From: Dmitry Tsymbal Date: Wed, 8 Jul 2020 17:13:05 +0300 Subject: [PATCH 17/31] Enabling Email To Friend Functionality --- ...gateToEmailToFriendSettingsActionGroup.xml | 15 ++++++++ ...ailToFriendOptionsAvailableActionGroup.xml | 18 ++++++++++ .../AdminConfigurationEmailToFriendPage.xml | 14 ++++++++ .../AdminCatalogEmailToFriendSettingsTest.xml | 34 +++++++++++++++++++ .../Section/AdminEmailToFriendSection.xml | 20 +++++++++++ 5 files changed, 101 insertions(+) create mode 100644 app/code/Magento/Backend/Test/Mftf/ActionGroup/AdminNavigateToEmailToFriendSettingsActionGroup.xml create mode 100644 app/code/Magento/Backend/Test/Mftf/ActionGroup/AssertAdminEmailToFriendOptionsAvailableActionGroup.xml create mode 100644 app/code/Magento/Backend/Test/Mftf/Page/AdminConfigurationEmailToFriendPage.xml create mode 100644 app/code/Magento/Backend/Test/Mftf/Test/AdminCatalogEmailToFriendSettingsTest.xml create mode 100644 app/code/Magento/Config/Test/Mftf/Section/AdminEmailToFriendSection.xml diff --git a/app/code/Magento/Backend/Test/Mftf/ActionGroup/AdminNavigateToEmailToFriendSettingsActionGroup.xml b/app/code/Magento/Backend/Test/Mftf/ActionGroup/AdminNavigateToEmailToFriendSettingsActionGroup.xml new file mode 100644 index 0000000000000..05903581747d9 --- /dev/null +++ b/app/code/Magento/Backend/Test/Mftf/ActionGroup/AdminNavigateToEmailToFriendSettingsActionGroup.xml @@ -0,0 +1,15 @@ + + + + + + + + + diff --git a/app/code/Magento/Backend/Test/Mftf/ActionGroup/AssertAdminEmailToFriendOptionsAvailableActionGroup.xml b/app/code/Magento/Backend/Test/Mftf/ActionGroup/AssertAdminEmailToFriendOptionsAvailableActionGroup.xml new file mode 100644 index 0000000000000..88152a2cb4f73 --- /dev/null +++ b/app/code/Magento/Backend/Test/Mftf/ActionGroup/AssertAdminEmailToFriendOptionsAvailableActionGroup.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + diff --git a/app/code/Magento/Backend/Test/Mftf/Page/AdminConfigurationEmailToFriendPage.xml b/app/code/Magento/Backend/Test/Mftf/Page/AdminConfigurationEmailToFriendPage.xml new file mode 100644 index 0000000000000..14bd514f1a16f --- /dev/null +++ b/app/code/Magento/Backend/Test/Mftf/Page/AdminConfigurationEmailToFriendPage.xml @@ -0,0 +1,14 @@ + + + + + +
+ + diff --git a/app/code/Magento/Backend/Test/Mftf/Test/AdminCatalogEmailToFriendSettingsTest.xml b/app/code/Magento/Backend/Test/Mftf/Test/AdminCatalogEmailToFriendSettingsTest.xml new file mode 100644 index 0000000000000..79150854c5939 --- /dev/null +++ b/app/code/Magento/Backend/Test/Mftf/Test/AdminCatalogEmailToFriendSettingsTest.xml @@ -0,0 +1,34 @@ + + + + + + + + + + <description value="Admin should be able to enable Email To A Friend functionality in Magento Admin backend and see additional options"/> + <group value="backend"/> + </annotations> + + <before> + <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/> + <magentoCLI stepKey="enableSendFriend" command="config:set sendfriend/email/enabled 1"/> + <magentoCLI stepKey="cacheClean" command="cache:clean config"/> + </before> + <after> + <magentoCLI stepKey="disableSendFriend" command="config:set sendfriend/email/enabled 0"/> + <magentoCLI stepKey="cacheClean" command="cache:clean config"/> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> + </after> + + <actionGroup ref="AdminNavigateToEmailToFriendSettingsActionGroup" stepKey="navigateToSendFriendSettings"/> + <actionGroup ref="AssertAdminEmailToFriendOptionsAvailableActionGroup" stepKey="assertOptions"/> + </test> +</tests> diff --git a/app/code/Magento/Config/Test/Mftf/Section/AdminEmailToFriendSection.xml b/app/code/Magento/Config/Test/Mftf/Section/AdminEmailToFriendSection.xml new file mode 100644 index 0000000000000..956316ed5cb46 --- /dev/null +++ b/app/code/Magento/Config/Test/Mftf/Section/AdminEmailToFriendSection.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + /** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +--> + +<sections xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd"> + <section name="AdminEmailToFriendSection"> + <element name="DefaultLayoutsTab" type="button" selector=".entry-edit-head-link"/> + <element name="CheckIfTabExpand" type="button" selector=".entry-edit-head-link:not(.open)"/> + <element name="emailTemplate" type="input" selector="#sendfriend_email_template"/> + <element name="allowForGuests" type="input" selector="#sendfriend_email_allow_guest"/> + <element name="maxRecipients" type="input" selector="#sendfriend_email_max_recipients"/> + <element name="maxPerHour" type="input" selector="#sendfriend_email_max_per_hour"/> + <element name="limitSendingBy" type="input" selector="#sendfriend_email_check_by"/> + </section> +</sections> From 680ca2b76e5f64c1b629052930fe9663ca01e7a1 Mon Sep 17 00:00:00 2001 From: Alexander Steshuk <grp-engcom-vendorworker-Kilo@adobe.com> Date: Wed, 15 Jul 2020 14:41:57 +0300 Subject: [PATCH 18/31] Added testCaseId to MFTF test. --- .../Test/Mftf/Test/AdminCatalogEmailToFriendSettingsTest.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Backend/Test/Mftf/Test/AdminCatalogEmailToFriendSettingsTest.xml b/app/code/Magento/Backend/Test/Mftf/Test/AdminCatalogEmailToFriendSettingsTest.xml index 79150854c5939..559c2d13218d1 100644 --- a/app/code/Magento/Backend/Test/Mftf/Test/AdminCatalogEmailToFriendSettingsTest.xml +++ b/app/code/Magento/Backend/Test/Mftf/Test/AdminCatalogEmailToFriendSettingsTest.xml @@ -15,6 +15,7 @@ <title value="Admin should be able to manage settings of Email To A Friend Functionality"/> <description value="Admin should be able to enable Email To A Friend functionality in Magento Admin backend and see additional options"/> <group value="backend"/> + <testCaseId value="MC-35895"/> </annotations> <before> From 44a650422ffebb6a33c92988c341e324f2d6f5b3 Mon Sep 17 00:00:00 2001 From: Dmitry Tsymbal <d.tsymbal@atwix.com> Date: Fri, 17 Jul 2020 11:22:52 +0300 Subject: [PATCH 19/31] Severity adding --- .../Test/Mftf/Test/AdminCatalogEmailToFriendSettingsTest.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Backend/Test/Mftf/Test/AdminCatalogEmailToFriendSettingsTest.xml b/app/code/Magento/Backend/Test/Mftf/Test/AdminCatalogEmailToFriendSettingsTest.xml index 79150854c5939..6aa5b103b8017 100644 --- a/app/code/Magento/Backend/Test/Mftf/Test/AdminCatalogEmailToFriendSettingsTest.xml +++ b/app/code/Magento/Backend/Test/Mftf/Test/AdminCatalogEmailToFriendSettingsTest.xml @@ -15,6 +15,7 @@ <title value="Admin should be able to manage settings of Email To A Friend Functionality"/> <description value="Admin should be able to enable Email To A Friend functionality in Magento Admin backend and see additional options"/> <group value="backend"/> + <severity value="MINOR"></severity> </annotations> <before> From 83b40124d87c7904d062577f21566eabdec15f8a Mon Sep 17 00:00:00 2001 From: Oleh Usik <o.usik@atwix.com> Date: Mon, 10 Aug 2020 20:59:46 +0300 Subject: [PATCH 20/31] Add action group for click edit link --- ...stomerClickFirstRowEditLinkActionGroup.xml | 19 +++++++++++++++++++ ...eateCustomerRetailerWithoutAddressTest.xml | 3 +-- ...minCreateCustomerWithCountryPolandTest.xml | 6 ++---- .../AdminCreateCustomerWithCountryUSATest.xml | 6 ++---- ...AdminCreateCustomerWithCustomGroupTest.xml | 3 +-- .../AdminCreateCustomerWithPrefixTest.xml | 3 +-- .../AdminCreateCustomerWithoutAddressTest.xml | 3 +-- ...stomerOnStorefrontSignupNewsletterTest.xml | 3 +-- .../Mftf/Test/AdminCreateNewCustomerTest.xml | 3 +-- ...tomerSubscribeNewsletterPerWebsiteTest.xml | 3 +-- ...ableProductToOrderFromShoppingCartTest.xml | 3 +-- ...mpleProductToOrderFromShoppingCartTest.xml | 3 +-- ...eredConfigurableProductOnOrderPageTest.xml | 3 +-- ...astOrderedSimpleProductOnOrderPageTest.xml | 3 +-- ...iewedBundleFixedProductOnOrderPageTest.xml | 3 +-- ...ewedConfigurableProductOnOrderPageTest.xml | 3 +-- .../AdminSetUpWatermarkForSwatchImageTest.xml | 3 +-- 17 files changed, 37 insertions(+), 36 deletions(-) create mode 100644 app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminCustomerClickFirstRowEditLinkActionGroup.xml diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminCustomerClickFirstRowEditLinkActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminCustomerClickFirstRowEditLinkActionGroup.xml new file mode 100644 index 0000000000000..1c5c29b855bf5 --- /dev/null +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminCustomerClickFirstRowEditLinkActionGroup.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="AdminCustomerClickFirstRowEditLinkActionGroup"> + <annotations> + <description>Click edit link for first row on the grid.</description> + </annotations> + + <click selector="{{AdminCustomerGridSection.firstRowEditLink}}" stepKey="clickOnEditLink"/> + <waitForPageLoad stepKey="waitForPageLoading"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerRetailerWithoutAddressTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerRetailerWithoutAddressTest.xml index c8e3bc10cc769..98b488c63a1e0 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerRetailerWithoutAddressTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerRetailerWithoutAddressTest.xml @@ -50,8 +50,7 @@ <see userInput="{{CustomerEntityOne.email}}" selector="{{AdminCustomerGridSection.customerGrid}}" stepKey="assertEmail"/> <!--Assert Customer Form --> - <click selector="{{AdminCustomerGridSection.firstRowEditLink}}" stepKey="clickOnEditButton1"/> - <waitForPageLoad stepKey="waitForCustomerEditPageToLoad1"/> + <actionGroup ref="AdminCustomerClickFirstRowEditLinkActionGroup" stepKey="clickOnEditButton1"/> <click selector="{{AdminCustomerAccountInformationSection.accountInformationButton}}" stepKey="clickOnAccountInformation"/> <waitForPageLoad stepKey="waitForCustomerInformationPageToLoad"/> <see selector="{{AdminCustomerAccountInformationSection.groupIdValue}}" userInput="Retailer" stepKey="seeCustomerGroup1"/> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithCountryPolandTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithCountryPolandTest.xml index 5f496e2c5fba3..7d76b79b97279 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithCountryPolandTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithCountryPolandTest.xml @@ -31,8 +31,7 @@ <actionGroup ref="AdminFilterCustomerByEmail" stepKey="filterTheCustomerByEmail"> <argument name="email" value="$$createCustomer.email$$"/> </actionGroup> - <click selector="{{AdminCustomerGridSection.firstRowEditLink}}" stepKey="clickOnEditButton"/> - <waitForPageLoad stepKey="waitForCustomerEditPageToLoad"/> + <actionGroup ref="AdminCustomerClickFirstRowEditLinkActionGroup" stepKey="clickOnEditButton"/> <!-- Add the Address --> <click selector="{{AdminEditCustomerAddressesSection.addresses}}" stepKey="selectAddress"/> @@ -67,8 +66,7 @@ <see userInput="{{PolandAddress.telephone}}" selector="{{AdminCustomerGridSection.customerGrid}}" stepKey="assertPhoneNumber"/> <!--Assert Customer Form --> - <click selector="{{AdminCustomerGridSection.firstRowEditLink}}" stepKey="clickOnEditButton1"/> - <waitForPageLoad stepKey="waitForCustomerEditPageToLoad1"/> + <actionGroup ref="AdminCustomerClickFirstRowEditLinkActionGroup" stepKey="clickOnEditButton1"/> <click selector="{{AdminCustomerAccountInformationSection.accountInformationButton}}" stepKey="clickOnAccountInformation"/> <waitForPageLoad stepKey="waitForCustomerInformationPageToLoad"/> <seeInField selector="{{AdminCustomerAccountInformationSection.firstName}}" userInput="$$createCustomer.firstname$$" stepKey="seeCustomerFirstName"/> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithCountryUSATest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithCountryUSATest.xml index da2eed2006434..7eecdf67d58b1 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithCountryUSATest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithCountryUSATest.xml @@ -31,8 +31,7 @@ <actionGroup ref="AdminFilterCustomerByEmail" stepKey="filterTheCustomerByEmail"> <argument name="email" value="$$createCustomer.email$$"/> </actionGroup> - <click selector="{{AdminCustomerGridSection.firstRowEditLink}}" stepKey="clickOnEditButton"/> - <waitForPageLoad stepKey="waitForCustomerEditPageToLoad"/> + <actionGroup ref="AdminCustomerClickFirstRowEditLinkActionGroup" stepKey="clickOnEditButton"/> <!-- Add the Address --> <click selector="{{AdminEditCustomerAddressesSection.addresses}}" stepKey="selectAddress"/> @@ -67,8 +66,7 @@ <see userInput="{{US_Address_CA.telephone}}" selector="{{AdminCustomerGridSection.customerGrid}}" stepKey="assertPhoneNumber"/> <!--Assert Customer Form --> - <click selector="{{AdminCustomerGridSection.firstRowEditLink}}" stepKey="clickOnEditButton1"/> - <waitForPageLoad stepKey="waitForCustomerEditPageToLoad1"/> + <actionGroup ref="AdminCustomerClickFirstRowEditLinkActionGroup" stepKey="clickOnEditButton1"/> <click selector="{{AdminCustomerAccountInformationSection.accountInformationButton}}" stepKey="clickOnAccountInformation"/> <waitForPageLoad stepKey="waitForCustomerInformationPageToLoad"/> <seeInField selector="{{AdminCustomerAccountInformationSection.firstName}}" userInput="$$createCustomer.firstname$$" stepKey="seeCustomerFirstName"/> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithCustomGroupTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithCustomGroupTest.xml index 8afd1648d26e0..84d6d5df5f8f3 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithCustomGroupTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithCustomGroupTest.xml @@ -54,8 +54,7 @@ <see userInput="{{CustomerEntityOne.email}}" selector="{{AdminCustomerGridSection.customerGrid}}" stepKey="assertEmail"/> <!--Assert Customer Form --> - <click selector="{{AdminCustomerGridSection.firstRowEditLink}}" stepKey="clickOnEditButton1"/> - <waitForPageLoad stepKey="waitForCustomerEditPageToLoad1"/> + <actionGroup ref="AdminCustomerClickFirstRowEditLinkActionGroup" stepKey="clickOnEditButton1"/> <click selector="{{AdminCustomerAccountInformationSection.accountInformationButton}}" stepKey="clickOnAccountInformation"/> <waitForPageLoad stepKey="waitForCustomerInformationPageToLoad"/> <see selector="{{AdminCustomerAccountInformationSection.groupIdValue}}" userInput="$$customerGroup.code$$" stepKey="seeCustomerGroup1"/> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithPrefixTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithPrefixTest.xml index e9250be637534..a03855b9e90c9 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithPrefixTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithPrefixTest.xml @@ -56,8 +56,7 @@ <see userInput="Male" selector="{{AdminCustomerGridSection.customerGrid}}" stepKey="assertGender"/> <!--Assert Customer Form --> - <click selector="{{AdminCustomerGridSection.firstRowEditLink}}" stepKey="clickOnEditButton1"/> - <waitForPageLoad stepKey="waitForCustomerEditPageToLoad1"/> + <actionGroup ref="AdminCustomerClickFirstRowEditLinkActionGroup" stepKey="clickOnEditButton1"/> <click selector="{{AdminCustomerAccountInformationSection.accountInformationButton}}" stepKey="clickOnAccountInformation"/> <waitForPageLoad stepKey="waitForCustomerInformationPageToLoad"/> <seeInField selector="{{AdminCustomerAccountInformationSection.namePrefix}}" userInput="{{CustomerEntityOne.prefix}}" stepKey="seeCustomerNamePrefix"/> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithoutAddressTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithoutAddressTest.xml index 5033f2882af42..c707c322529b9 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithoutAddressTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithoutAddressTest.xml @@ -49,8 +49,7 @@ <see userInput="{{CustomerEntityOne.email}}" selector="{{AdminCustomerGridSection.customerGrid}}" stepKey="assertEmail"/> <!--Assert Customer Form --> - <click selector="{{AdminCustomerGridSection.firstRowEditLink}}" stepKey="clickOnEditButton1"/> - <waitForPageLoad stepKey="waitForCustomerEditPageToLoad1"/> + <actionGroup ref="AdminCustomerClickFirstRowEditLinkActionGroup" stepKey="clickOnEditButton1"/> <click selector="{{AdminCustomerAccountInformationSection.accountInformationButton}}" stepKey="clickOnAccountInformation"/> <waitForPageLoad stepKey="waitForCustomerInformationPageToLoad"/> <seeInField selector="{{AdminCustomerAccountInformationSection.firstName}}" userInput="{{CustomerEntityOne.firstname}}" stepKey="seeCustomerFirstName"/> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateNewCustomerOnStorefrontSignupNewsletterTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateNewCustomerOnStorefrontSignupNewsletterTest.xml index 5440339e3a95e..67546a88425b3 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateNewCustomerOnStorefrontSignupNewsletterTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateNewCustomerOnStorefrontSignupNewsletterTest.xml @@ -45,8 +45,7 @@ <see selector="{{AdminCustomerGridSection.customerGrid}}" userInput="{{CustomerEntityOne.email}}" stepKey="seeAssertCustomerEmailInGrid"/> <!--Assert verify created new customer is subscribed to newsletter--> - <click selector="{{AdminCustomerGridSection.firstRowEditLink}}" stepKey="clickFirstRowEditLink"/> - <waitForPageLoad stepKey="waitForEditLinkLoad"/> + <actionGroup ref="AdminCustomerClickFirstRowEditLinkActionGroup" stepKey="clickFirstRowEditLink"/> <click selector="{{AdminEditCustomerInformationSection.newsLetter}}" stepKey="clickNewsLetter"/> <waitForPageLoad stepKey="waitForNewsletterTabToOpen"/> <seeCheckboxIsChecked selector="{{AdminEditCustomerNewsletterSection.subscribedStatus('1')}}" stepKey="seeAssertSubscribedToNewsletterCheckboxIsChecked"/> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateNewCustomerTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateNewCustomerTest.xml index 6b484e857d276..9583e5d6109c5 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateNewCustomerTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateNewCustomerTest.xml @@ -42,8 +42,7 @@ <argument name="email" value="{{CustomerEntityOne.email}}"/> </actionGroup> <waitForPageLoad stepKey="waitForPageToLoad"/> - <click selector="{{AdminCustomerGridSection.firstRowEditLink}}" stepKey="clickOnEditButton1"/> - <waitForPageLoad stepKey="waitForCustomerEditPageToLoad"/> + <actionGroup ref="AdminCustomerClickFirstRowEditLinkActionGroup" stepKey="clickOnEditButton1"/> <!-- Assert Customer Title --> <click selector="{{AdminCustomerAccountInformationSection.accountInformationButton}}" stepKey="clickOnAccountInformation"/> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCustomerSubscribeNewsletterPerWebsiteTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCustomerSubscribeNewsletterPerWebsiteTest.xml index a8391458a1a50..ffcc543609e37 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminCustomerSubscribeNewsletterPerWebsiteTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCustomerSubscribeNewsletterPerWebsiteTest.xml @@ -53,8 +53,7 @@ <actionGroup ref="AdminFilterCustomerByEmail" stepKey="filterCustomerGrid"> <argument name="email" value="{{CustomerEntityOne.email}}"/> </actionGroup> - <click selector="{{AdminCustomerGridSection.firstRowEditLink}}" stepKey="clickToEditCustomerPage"/> - <waitForPageLoad stepKey="waitForOpenCustomerPage"/> + <actionGroup ref="AdminCustomerClickFirstRowEditLinkActionGroup" stepKey="clickToEditCustomerPage"/> <grabFromCurrentUrl regex="~(\d+)/~" stepKey="grabCustomerId"/> <!-- Assert that created customer is subscribed to newsletter on the new Store View --> <actionGroup ref="AdminAssertCustomerIsSubscribedToNewslettersAndSelectedStoreView" stepKey="assertSubscribedToNewsletter"> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AddConfigurableProductToOrderFromShoppingCartTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AddConfigurableProductToOrderFromShoppingCartTest.xml index 6f4073bf70f46..45bd7ee3e0deb 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AddConfigurableProductToOrderFromShoppingCartTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AddConfigurableProductToOrderFromShoppingCartTest.xml @@ -97,8 +97,7 @@ <actionGroup ref="AdminFilterCustomerByEmail" stepKey="filterCreatedCustomer"> <argument name="email" value="$$createCustomer.email$$"/> </actionGroup> - <click selector="{{AdminCustomerGridSection.firstRowEditLink}}" stepKey="clickEditButton"/> - <waitForPageLoad stepKey="waitForPageLoad"/> + <actionGroup ref="AdminCustomerClickFirstRowEditLinkActionGroup" stepKey="clickEditButton"/> <!-- Click create order --> <click selector="{{AdminCustomerMainActionsSection.createOrderBtn}}" stepKey="clickCreateOrder"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AddSimpleProductToOrderFromShoppingCartTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AddSimpleProductToOrderFromShoppingCartTest.xml index d8a9effa56dac..60c33d68354ce 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AddSimpleProductToOrderFromShoppingCartTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AddSimpleProductToOrderFromShoppingCartTest.xml @@ -58,8 +58,7 @@ <actionGroup ref="AdminFilterCustomerByEmail" stepKey="filterCreatedCustomer"> <argument name="email" value="$$createCustomer.email$$"/> </actionGroup> - <click selector="{{AdminCustomerGridSection.firstRowEditLink}}" stepKey="clickEditButton"/> - <waitForPageLoad stepKey="waitForPageLoad"/> + <actionGroup ref="AdminCustomerClickFirstRowEditLinkActionGroup" stepKey="clickEditButton"/> <!-- Click create order --> <click selector="{{AdminCustomerMainActionsSection.createOrderBtn}}" stepKey="clickCreateOrder"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/MoveLastOrderedConfigurableProductOnOrderPageTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/MoveLastOrderedConfigurableProductOnOrderPageTest.xml index c635e6b0ad6b2..3d5b54daa7c8f 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/MoveLastOrderedConfigurableProductOnOrderPageTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/MoveLastOrderedConfigurableProductOnOrderPageTest.xml @@ -96,8 +96,7 @@ <actionGroup ref="AdminFilterCustomerByEmail" stepKey="filterCreatedCustomer"> <argument name="email" value="$$createCustomer.email$$"/> </actionGroup> - <click selector="{{AdminCustomerGridSection.firstRowEditLink}}" stepKey="clickEditButton"/> - <waitForPageLoad stepKey="waitForPageLoad"/> + <actionGroup ref="AdminCustomerClickFirstRowEditLinkActionGroup" stepKey="clickEditButton"/> <!-- Click create order --> <click selector="{{AdminCustomerMainActionsSection.createOrderBtn}}" stepKey="clickCreateOrder"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/MoveLastOrderedSimpleProductOnOrderPageTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/MoveLastOrderedSimpleProductOnOrderPageTest.xml index eb28ebfd068da..8faedb24e600e 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/MoveLastOrderedSimpleProductOnOrderPageTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/MoveLastOrderedSimpleProductOnOrderPageTest.xml @@ -46,8 +46,7 @@ <actionGroup ref="AdminFilterCustomerByEmail" stepKey="filterCreatedCustomer"> <argument name="email" value="$$createCustomer.email$$"/> </actionGroup> - <click selector="{{AdminCustomerGridSection.firstRowEditLink}}" stepKey="clickEditButton"/> - <waitForPageLoad stepKey="waitForPageLoad"/> + <actionGroup ref="AdminCustomerClickFirstRowEditLinkActionGroup" stepKey="clickEditButton"/> <!-- Click create order --> <click selector="{{AdminCustomerMainActionsSection.createOrderBtn}}" stepKey="clickCreateOrder"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/MoveRecentlyViewedBundleFixedProductOnOrderPageTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/MoveRecentlyViewedBundleFixedProductOnOrderPageTest.xml index c3fc7a4952143..980bc272c3643 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/MoveRecentlyViewedBundleFixedProductOnOrderPageTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/MoveRecentlyViewedBundleFixedProductOnOrderPageTest.xml @@ -96,8 +96,7 @@ <actionGroup ref="AdminFilterCustomerByEmail" stepKey="filterCreatedCustomer"> <argument name="email" value="$$createCustomer.email$$"/> </actionGroup> - <click selector="{{AdminCustomerGridSection.firstRowEditLink}}" stepKey="clickEditButton"/> - <waitForPageLoad stepKey="waitForCustomerPageLoad"/> + <actionGroup ref="AdminCustomerClickFirstRowEditLinkActionGroup" stepKey="clickEditButton"/> <!-- Click create order --> <click selector="{{AdminCustomerMainActionsSection.createOrderBtn}}" stepKey="clickCreateOrder"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/MoveRecentlyViewedConfigurableProductOnOrderPageTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/MoveRecentlyViewedConfigurableProductOnOrderPageTest.xml index 0e021600ab3e3..0bff169c4a68e 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/MoveRecentlyViewedConfigurableProductOnOrderPageTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/MoveRecentlyViewedConfigurableProductOnOrderPageTest.xml @@ -99,8 +99,7 @@ <actionGroup ref="AdminFilterCustomerByEmail" stepKey="filterCreatedCustomer"> <argument name="email" value="$$createCustomer.email$$"/> </actionGroup> - <click selector="{{AdminCustomerGridSection.firstRowEditLink}}" stepKey="clickEditButton"/> - <waitForPageLoad stepKey="waitForCustomerPageLoad"/> + <actionGroup ref="AdminCustomerClickFirstRowEditLinkActionGroup" stepKey="clickEditButton"/> <!-- Click create order --> <click selector="{{AdminCustomerMainActionsSection.createOrderBtn}}" stepKey="clickCreateOrder"/> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/AdminSetUpWatermarkForSwatchImageTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/AdminSetUpWatermarkForSwatchImageTest.xml index d56572afd8847..d615c1478d6d7 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/AdminSetUpWatermarkForSwatchImageTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/AdminSetUpWatermarkForSwatchImageTest.xml @@ -38,8 +38,7 @@ </actionGroup> <!-- Select Edit next to the Default Store View --> <comment userInput="Select Edit next to the Default Store View" stepKey="commentEditDefaultView"/> - <click selector="{{AdminCustomerGridSection.firstRowEditLink}}" stepKey="clickToEditDefaultStoreView"/> - <waitForPageLoad stepKey="waitForDefaultStorePage"/> + <actionGroup ref="AdminCustomerClickFirstRowEditLinkActionGroup" stepKey="clickToEditDefaultStoreView"/> <!-- Expand the Product Image Watermarks section--> <comment userInput="Expand the Product Image Watermarks section" stepKey="commentOpenWatermarksSection"/> <click selector="{{AdminDesignConfigSection.watermarkSectionHeader}}" stepKey="clickToProductImageWatermarks"/> From 1b39196a80c9c4a3d229c121b647b82ae242193d Mon Sep 17 00:00:00 2001 From: "vadim.malesh" <engcom-vendorworker-charlie@adobe.com> Date: Tue, 11 Aug 2020 15:53:48 +0300 Subject: [PATCH 21/31] fix store website name rewrites --- .../Listing/Column/Store/Options.php | 33 ++--- .../Listing/Column/Store/OptionsTest.php | 114 ++++++++++++++++++ 2 files changed, 131 insertions(+), 16 deletions(-) create mode 100644 dev/tests/integration/testsuite/Magento/Store/Ui/Component/Listing/Column/Store/OptionsTest.php diff --git a/app/code/Magento/Store/Ui/Component/Listing/Column/Store/Options.php b/app/code/Magento/Store/Ui/Component/Listing/Column/Store/Options.php index 907eb74e20fa2..f8aa09cb20a61 100644 --- a/app/code/Magento/Store/Ui/Component/Listing/Column/Store/Options.php +++ b/app/code/Magento/Store/Ui/Component/Listing/Column/Store/Options.php @@ -10,7 +10,7 @@ use Magento\Store\Model\System\Store as SystemStore; /** - * Class Options + * Ui stores options */ class Options implements OptionSourceInterface { @@ -93,37 +93,38 @@ protected function sanitizeName($name) * * @return void */ - protected function generateCurrentOptions() + protected function generateCurrentOptions(): void { $websiteCollection = $this->systemStore->getWebsiteCollection(); $groupCollection = $this->systemStore->getGroupCollection(); $storeCollection = $this->systemStore->getStoreCollection(); - /** @var \Magento\Store\Model\Website $website */ + foreach ($websiteCollection as $website) { $groups = []; - /** @var \Magento\Store\Model\Group $group */ foreach ($groupCollection as $group) { - if ($group->getWebsiteId() == $website->getId()) { + if ($group->getWebsiteId() === $website->getId()) { $stores = []; - /** @var \Magento\Store\Model\Store $store */ foreach ($storeCollection as $store) { - if ($store->getGroupId() == $group->getId()) { - $name = $this->sanitizeName($store->getName()); - $stores[$name]['label'] = str_repeat(' ', 8) . $name; - $stores[$name]['value'] = $store->getId(); + if ($store->getGroupId() === $group->getId()) { + $stores[] = [ + 'label' => str_repeat(' ', 8) . $this->sanitizeName($store->getName()), + 'value' => $store->getId(), + ]; } } if (!empty($stores)) { - $name = $this->sanitizeName($group->getName()); - $groups[$name]['label'] = str_repeat(' ', 4) . $name; - $groups[$name]['value'] = array_values($stores); + $groups[] = [ + 'label' => str_repeat(' ', 4) . $this->sanitizeName($group->getName()), + 'value' => array_values($stores), + ]; } } } if (!empty($groups)) { - $name = $this->sanitizeName($website->getName()); - $this->currentOptions[$name]['label'] = $name; - $this->currentOptions[$name]['value'] = array_values($groups); + $this->currentOptions[] = [ + 'label' => $this->sanitizeName($website->getName()), + 'value' => array_values($groups), + ]; } } } diff --git a/dev/tests/integration/testsuite/Magento/Store/Ui/Component/Listing/Column/Store/OptionsTest.php b/dev/tests/integration/testsuite/Magento/Store/Ui/Component/Listing/Column/Store/OptionsTest.php new file mode 100644 index 0000000000000..e13c4a427464f --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Store/Ui/Component/Listing/Column/Store/OptionsTest.php @@ -0,0 +1,114 @@ +<?php +/** + * Copyright © Magento, Inc. All rights reserved. + * See COPYING.txt for license details. + */ +declare(strict_types=1); + +namespace Magento\Store\Ui\Component\Listing\Column\Store; + +use Magento\Store\Model\ResourceModel\Group as GroupResource; +use Magento\Store\Model\ResourceModel\Store as StoreResource; +use Magento\Store\Model\ResourceModel\Website as WebsiteResource; +use Magento\Store\Model\StoreManagerInterface; +use Magento\TestFramework\Helper\Bootstrap; +use PHPUnit\Framework\TestCase; + +/** + * Test for \Magento\Store\Ui\Component\Listing\Column\Store\Options. + */ +class OptionsTest extends TestCase +{ + private const DEFAULT_WEBSITE_NAME = 'Main Website'; + private const DEFAULT_STORE_GROUP_NAME = 'Main Website Store'; + private const DEFAULT_STORE_NAME = 'Default Store View'; + + /** + * @var OptionsFactory + */ + private $modelFactory; + + /** + * @var StoreManagerInterface + */ + private $storeManager; + + /** + * @var WebsiteResource + */ + private $websiteResource; + + /** + * @var StoreResource + */ + private $storeResource; + + /** + * @var GroupResource + */ + private $groupResource; + + /** + * @return void + */ + protected function setUp(): void + { + $objectManager = Bootstrap::getObjectManager(); + + $this->modelFactory = $objectManager->get(OptionsFactory::class); + $this->storeManager = $objectManager->get(StoreManagerInterface::class); + + $this->websiteResource = $objectManager->get(WebsiteResource::class); + $this->groupResource = $objectManager->get(GroupResource::class); + $this->storeResource = $objectManager->get(StoreResource::class); + } + + /** + * To option array test with duplicate website, store group, store view names + * + * @magentoDataFixture Magento/Store/_files/second_website_with_store_group_and_store.php + * + * @return void + */ + public function testToOptionArray(): void + { + $website = $this->storeManager->getWebsite('test'); + $this->websiteResource->save($website->setName(self::DEFAULT_WEBSITE_NAME)); + + $storeGroup = current($website->getGroups()); + $this->groupResource->save($storeGroup->setName(self::DEFAULT_STORE_GROUP_NAME)); + + $store = current($website->getStores()); + $this->storeResource->save($store->setName(self::DEFAULT_STORE_NAME)); + + $model = $this->modelFactory->create(); + $storeIds = [$this->storeManager->getStore('default')->getId(), $store->getId()]; + + $this->assertEquals($this->getExpectedOptions($storeIds), $model->toOptionArray()); + } + + /** + * Returns expected options + * + * @param array $storeIds + * @return array + */ + private function getExpectedOptions(array $storeIds): array + { + $expectedOptions = []; + foreach ($storeIds as $storeId) { + $expectedOptions[] = [ + 'label' => self::DEFAULT_WEBSITE_NAME, + 'value' => [[ + 'label' => str_repeat(' ', 4) . self::DEFAULT_STORE_GROUP_NAME, + 'value' => [[ + 'label' => str_repeat(' ', 8) . self::DEFAULT_STORE_NAME, + 'value' => $storeId, + ]], + ]], + ]; + } + + return $expectedOptions; + } +} From c5f6a1f4a70e979f2fc31a8c4d714c713bd9e650 Mon Sep 17 00:00:00 2001 From: "vadim.malesh" <engcom-vendorworker-charlie@adobe.com> Date: Wed, 12 Aug 2020 12:41:19 +0300 Subject: [PATCH 22/31] fix http action --- app/code/Magento/Wishlist/Controller/Shared/Allcart.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Wishlist/Controller/Shared/Allcart.php b/app/code/Magento/Wishlist/Controller/Shared/Allcart.php index c1e908cc0f49e..1c504a7a8a80d 100644 --- a/app/code/Magento/Wishlist/Controller/Shared/Allcart.php +++ b/app/code/Magento/Wishlist/Controller/Shared/Allcart.php @@ -10,7 +10,7 @@ use Magento\Framework\App\Action\Action; use Magento\Framework\App\Action\Context; -use Magento\Framework\App\Action\HttpGetActionInterface; +use Magento\Framework\App\Action\HttpPostActionInterface; use Magento\Framework\Controller\Result\Forward; use Magento\Framework\Controller\Result\Redirect; use Magento\Framework\Controller\ResultFactory; @@ -19,7 +19,7 @@ /** * Wishlist Allcart Controller */ -class Allcart extends Action implements HttpGetActionInterface +class Allcart extends Action implements HttpPostActionInterface { /** * @var WishlistProvider From a7da7fd6ff08388b1a2364c23710f303e82b33bf Mon Sep 17 00:00:00 2001 From: "vadim.malesh" <engcom-vendorworker-charlie@adobe.com> Date: Wed, 12 Aug 2020 16:28:32 +0300 Subject: [PATCH 23/31] add get --- app/code/Magento/Wishlist/Controller/Shared/Allcart.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Wishlist/Controller/Shared/Allcart.php b/app/code/Magento/Wishlist/Controller/Shared/Allcart.php index 1c504a7a8a80d..89413eff8323f 100644 --- a/app/code/Magento/Wishlist/Controller/Shared/Allcart.php +++ b/app/code/Magento/Wishlist/Controller/Shared/Allcart.php @@ -10,6 +10,7 @@ use Magento\Framework\App\Action\Action; use Magento\Framework\App\Action\Context; +use Magento\Framework\App\Action\HttpGetActionInterface; use Magento\Framework\App\Action\HttpPostActionInterface; use Magento\Framework\Controller\Result\Forward; use Magento\Framework\Controller\Result\Redirect; @@ -19,7 +20,7 @@ /** * Wishlist Allcart Controller */ -class Allcart extends Action implements HttpPostActionInterface +class Allcart extends Action implements HttpGetActionInterface, HttpPostActionInterface { /** * @var WishlistProvider From 1a7c8cd619b4936fd544ac669bf4f5e66bcc7d34 Mon Sep 17 00:00:00 2001 From: Shankar Konar <konar.shankar2013@gmail.com> Date: Thu, 13 Aug 2020 10:51:33 +0530 Subject: [PATCH 24/31] Fixed the resending Newsletter confirmation issue --- app/code/Magento/Newsletter/Model/SubscriptionManager.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Newsletter/Model/SubscriptionManager.php b/app/code/Magento/Newsletter/Model/SubscriptionManager.php index 846d095625e0c..eac43e1bcea5f 100644 --- a/app/code/Magento/Newsletter/Model/SubscriptionManager.php +++ b/app/code/Magento/Newsletter/Model/SubscriptionManager.php @@ -200,6 +200,7 @@ private function saveSubscriber( && (int)$subscriber->getCustomerId() === (int)$customer->getId() && (int)$subscriber->getStoreId() === $storeId && !$emailChanged + && $status !== Subscriber::STATUS_NOT_ACTIVE ) { return false; } @@ -220,10 +221,10 @@ private function saveSubscriber( /** * If the subscriber is waiting to confirm from the customer - * and customer changed the email + * or customer changed the email * than need to send confirmation letter to the new email */ - return $status === Subscriber::STATUS_NOT_ACTIVE && $emailChanged; + return $status === Subscriber::STATUS_NOT_ACTIVE || $emailChanged; } /** From 6e53e0d90b3cbc86ee368c35605615d713fe9682 Mon Sep 17 00:00:00 2001 From: Shankar Konar <konar.shankar2013@gmail.com> Date: Fri, 14 Aug 2020 11:04:05 +0530 Subject: [PATCH 25/31] Fixed Unit Tests --- .../Newsletter/Test/Unit/Model/SubscriptionManagerTest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Newsletter/Test/Unit/Model/SubscriptionManagerTest.php b/app/code/Magento/Newsletter/Test/Unit/Model/SubscriptionManagerTest.php index 4e1f18a26a95a..6139d86191f44 100644 --- a/app/code/Magento/Newsletter/Test/Unit/Model/SubscriptionManagerTest.php +++ b/app/code/Magento/Newsletter/Test/Unit/Model/SubscriptionManagerTest.php @@ -454,7 +454,7 @@ public function subscribeCustomerDataProvider(): array 'subscriber_status' => Subscriber::STATUS_SUBSCRIBED, 'subscriber_confirm_code' => '', ], - 'needToSendEmail' => false, + 'needToSendEmail' => true, ], 'Update subscription data: subscription confirm required ' => [ 'subscriber_data' => [ @@ -618,7 +618,7 @@ public function unsubscribeCustomerDataProvider(): array 'subscriber_status' => Subscriber::STATUS_NOT_ACTIVE, 'subscriber_confirm_code' => '', ], - 'needToSendEmail' => false, + 'needToSendEmail' => true, ], 'Update subscription data' => [ 'subscriber_data' => [ @@ -642,7 +642,7 @@ public function unsubscribeCustomerDataProvider(): array 'subscriber_status' => Subscriber::STATUS_UNSUBSCRIBED, 'subscriber_confirm_code' => '', ], - 'needToSendEmail' => false, + 'needToSendEmail' => true, ], ]; } From 9a980484c23a78f888708223df55f56090b970c9 Mon Sep 17 00:00:00 2001 From: "taras.gamanov" <engcom-vendorworker-hotel@adobe.com> Date: Tue, 18 Aug 2020 12:00:32 +0300 Subject: [PATCH 26/31] MFTF has been added. --- .../Section/AdminProductGridFilterSection.xml | 1 + .../AdminCheckStoreViewOptionsActionGroup.xml | 24 ++++++++ .../Store/Test/Mftf/Data/StoreData.xml | 19 +++++++ .../AdminStoresGridSection.xml | 1 + .../AdminCreateDuplicateNameStoreViewTest.xml | 55 +++++++++++++++++++ 5 files changed, 100 insertions(+) create mode 100644 app/code/Magento/Store/Test/Mftf/ActionGroup/AdminCheckStoreViewOptionsActionGroup.xml create mode 100644 app/code/Magento/Store/Test/Mftf/Test/AdminCreateDuplicateNameStoreViewTest.xml diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductGridFilterSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductGridFilterSection.xml index 4e86f14611c24..201affacd9adb 100644 --- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductGridFilterSection.xml +++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminProductGridFilterSection.xml @@ -38,5 +38,6 @@ <element name="storeViewDropdown" type="text" selector="//select[@name='store_id']/option[contains(.,'{{storeView}}')]" parameterized="true"/> <element name="inputByCodeRangeFrom" type="input" selector="input.admin__control-text[name='{{code}}[from]']" parameterized="true"/> <element name="inputByCodeRangeTo" type="input" selector="input.admin__control-text[name='{{code}}[to]']" parameterized="true"/> + <element name="storeViewOptions" type="text" selector=".admin__data-grid-outer-wrap select[name='store_id'] > option[value='{{value}}']" parameterized="true"/> </section> </sections> diff --git a/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminCheckStoreViewOptionsActionGroup.xml b/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminCheckStoreViewOptionsActionGroup.xml new file mode 100644 index 0000000000000..ba96633a621c2 --- /dev/null +++ b/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminCheckStoreViewOptionsActionGroup.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="AdminCheckStoreViewOptionsActionGroup"> + <annotations> + <description>Goes to the Catalog->Product filters and check store view options at the Store View dropdown</description> + </annotations> + <arguments> + <argument name="storeViewId" type="string"/> + </arguments> + <amOnPage url="{{ProductCatalogPage.url}}" stepKey="OpenProductCatalogPage"/> + <waitForPageLoad stepKey="waitForProductCatalogPage"/> + <click selector="{{AdminProductGridFilterSection.filters}}" stepKey="clickFiltersButton"/> + <click selector="{{AdminProductFiltersSection.storeViewDropDown}}" stepKey="clickStoreViewSwitchDropdown"/> + <waitForElementVisible selector="{{AdminProductFiltersSection.storeViewDropDown}}" stepKey="waitForWebsiteAreVisible"/> + <seeElement selector="{{AdminProductGridFilterSection.storeViewOptions(storeViewId)}}" stepKey="seeStoreViewOption"/> + </actionGroup> +</actionGroups> diff --git a/app/code/Magento/Store/Test/Mftf/Data/StoreData.xml b/app/code/Magento/Store/Test/Mftf/Data/StoreData.xml index bdb1842cf2959..39664ae10a07d 100644 --- a/app/code/Magento/Store/Test/Mftf/Data/StoreData.xml +++ b/app/code/Magento/Store/Test/Mftf/Data/StoreData.xml @@ -206,4 +206,23 @@ <data key="store_type">store</data> <data key="store_action">add</data> </entity> + <!--Stores views with same name--> + <entity name="customStoreViewSameNameFirst" type="store"> + <data key="name">sameNameStoreView</data> + <data key="code" unique="suffix">storeViewCode</data> + <data key="is_active">1</data> + <data key="store_id">null</data> + <data key="store_action">add</data> + <data key="store_type">store</data> + <requiredEntity type="storeGroup">customStoreGroup</requiredEntity> + </entity> + <entity name="customStoreViewSameNameSecond" type="store"> + <data key="name">sameNameStoreView</data> + <data key="code" unique="suffix">storeViewCode</data> + <data key="is_active">1</data> + <data key="store_id">null</data> + <data key="store_action">add</data> + <data key="store_type">store</data> + <requiredEntity type="storeGroup">customStoreGroup</requiredEntity> + </entity> </entities> diff --git a/app/code/Magento/Store/Test/Mftf/Section/AdminStoresGridSection/AdminStoresGridSection.xml b/app/code/Magento/Store/Test/Mftf/Section/AdminStoresGridSection/AdminStoresGridSection.xml index e56836c491276..cd7f180d0bb0e 100644 --- a/app/code/Magento/Store/Test/Mftf/Section/AdminStoresGridSection/AdminStoresGridSection.xml +++ b/app/code/Magento/Store/Test/Mftf/Section/AdminStoresGridSection/AdminStoresGridSection.xml @@ -22,5 +22,6 @@ <element name="emptyText" type="text" selector="//tr[@class='data-grid-tr-no-data even']/td[@class='empty-text']"/> <element name="websiteName" type="text" selector="//td[@class='a-left col-website_title ']/a[contains(.,'{{websiteName}}')]" parameterized="true"/> <element name="gridCell" type="text" selector="//table[@class='data-grid']//tr[{{row}}]//td[count(//table[@class='data-grid']//tr//th[contains(., '{{column}}')]/preceding-sibling::th) +1 ]" parameterized="true"/> + <element name="storeViewLinkInNthRow" type="text" selector="tr:nth-of-type({{row}}) > .col-store_title > a" parameterized="true"/> </section> </sections> diff --git a/app/code/Magento/Store/Test/Mftf/Test/AdminCreateDuplicateNameStoreViewTest.xml b/app/code/Magento/Store/Test/Mftf/Test/AdminCreateDuplicateNameStoreViewTest.xml new file mode 100644 index 0000000000000..46caf5b37f4f2 --- /dev/null +++ b/app/code/Magento/Store/Test/Mftf/Test/AdminCreateDuplicateNameStoreViewTest.xml @@ -0,0 +1,55 @@ +<?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="AdminCreateDuplicateNameStoreViewTest"> + <annotations> + <features value="Store"/> + <stories value="Create a store view in admin"/> + <title value="Admin should be able to create a Store View with the same name"/> + <description value="Admin should be able to create a Store View with the same name"/> + <group value="storeView"/> + <severity value="AVERAGE"/> + </annotations> + <before> + <!--Create two store views with same name, but different codes--> + <actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/> + <actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createFirstStoreView"> + <argument name="StoreGroup" value="_defaultStoreGroup"/> + <argument name="customStore" value="customStoreViewSameNameFirst"/> + </actionGroup> + <actionGroup ref="AdminCreateStoreViewActionGroup" stepKey="createSecondStoreView"> + <argument name="StoreGroup" value="_defaultStoreGroup"/> + <argument name="customStore" value="customStoreViewSameNameSecond"/> + </actionGroup> + </before> + <after> + <!--Delete both store views--> + <actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteFirstStoreView"> + <argument name="customStore" value="customStoreViewSameNameFirst"/> + </actionGroup> + <actionGroup ref="AdminDeleteStoreViewActionGroup" stepKey="deleteSecondStoreView"> + <argument name="customStore" value="customStoreViewSameNameSecond"/> + </actionGroup> + <actionGroup ref="AdminLogoutActionGroup" stepKey="logout"/> + </after> + <!--Get Id of store views--> + <amOnPage url="{{AdminSystemStorePage.url}}" stepKey="navigateToStoreViews"/> + <click selector="{{AdminStoresGridSection.storeViewLinkInNthRow('2')}}" stepKey="openFirstViewPAge" /> + <grabFromCurrentUrl stepKey="getStoreViewIdFirst" regex="~/store_id/(\d+)/~"/> + <amOnPage url="{{AdminSystemStorePage.url}}" stepKey="navigateToStoreViewsAgain"/> + <click selector="{{AdminStoresGridSection.storeViewLinkInNthRow('3')}}" stepKey="openSecondViewPAge" /> + <grabFromCurrentUrl stepKey="getStoreViewIdSecond" regex="~/store_id/(\d+)/~"/> + <!--Go to catalog -> product grid, open the filter and check the listed store view--> + <actionGroup ref="AdminCheckStoreViewOptionsActionGroup" stepKey="checkFirstStoreView"> + <argument name="storeViewId" value="{$getStoreViewIdFirst}"/> + </actionGroup> + <actionGroup ref="AdminCheckStoreViewOptionsActionGroup" stepKey="checkSecondStoreView"> + <argument name="storeViewId" value="{$getStoreViewIdSecond}"/> + </actionGroup> + </test> +</tests> From ea584f9815ec3b119e9ac73ccc773435c7727960 Mon Sep 17 00:00:00 2001 From: Shankar Konar <konar.shankar2013@gmail.com> Date: Wed, 19 Aug 2020 11:01:04 +0530 Subject: [PATCH 27/31] Fixed cyclomatic complexity --- .../Newsletter/Model/SubscriptionManager.php | 41 +++++++++++++++---- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/app/code/Magento/Newsletter/Model/SubscriptionManager.php b/app/code/Magento/Newsletter/Model/SubscriptionManager.php index eac43e1bcea5f..f01b4784581c3 100644 --- a/app/code/Magento/Newsletter/Model/SubscriptionManager.php +++ b/app/code/Magento/Newsletter/Model/SubscriptionManager.php @@ -195,13 +195,14 @@ private function saveSubscriber( ): bool { $statusChanged = (int)$subscriber->getStatus() !== $status; $emailChanged = $subscriber->getEmail() !== $customer->getEmail(); - if ($subscriber->getId() - && !$statusChanged - && (int)$subscriber->getCustomerId() === (int)$customer->getId() - && (int)$subscriber->getStoreId() === $storeId - && !$emailChanged - && $status !== Subscriber::STATUS_NOT_ACTIVE - ) { + if ($this->dontNeedToSaveSubscriber( + $subscriber, + $customer, + $statusChanged, + $storeId, + $status, + $emailChanged + )) { return false; } @@ -227,6 +228,32 @@ private function saveSubscriber( return $status === Subscriber::STATUS_NOT_ACTIVE || $emailChanged; } + /** + * + * @param Subscriber $subscriber + * @param CustomerInterface $customer + * @param bool $statusChanged + * @param int $storeId + * @param int $status + * @param bool $emailChanged + * @return bool + */ + private function dontNeedToSaveSubscriber( + Subscriber $subscriber, + CustomerInterface $customer, + bool $statusChanged, + int $storeId, + int $status, + bool $emailChanged + ): bool { + return $subscriber->getId() + && !$statusChanged + && (int)$subscriber->getCustomerId() === (int)$customer->getId() + && (int)$subscriber->getStoreId() === $storeId + && !$emailChanged + && $status !== Subscriber::STATUS_NOT_ACTIVE; + } + /** * Get new subscription status * From ab3db167e1594e935350d4be6494ce1f56c48b4f Mon Sep 17 00:00:00 2001 From: Shankar Konar <konar.shankar2013@gmail.com> Date: Wed, 19 Aug 2020 12:30:25 +0530 Subject: [PATCH 28/31] Fixed static test --- app/code/Magento/Newsletter/Model/SubscriptionManager.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Newsletter/Model/SubscriptionManager.php b/app/code/Magento/Newsletter/Model/SubscriptionManager.php index f01b4784581c3..57c6cd8b843a7 100644 --- a/app/code/Magento/Newsletter/Model/SubscriptionManager.php +++ b/app/code/Magento/Newsletter/Model/SubscriptionManager.php @@ -229,6 +229,7 @@ private function saveSubscriber( } /** + * Don't need to save subscriber model * * @param Subscriber $subscriber * @param CustomerInterface $customer From 152c29b6b28a21df854d2924c9cb7b92bde190bc Mon Sep 17 00:00:00 2001 From: Oleh Usik <o.usik@atwix.com> Date: Wed, 19 Aug 2020 15:08:18 +0300 Subject: [PATCH 29/31] rename action group --- ...> AdminClickFirstRowEditLinkOnCustomerGridActionGroup.xml} | 2 +- .../Test/AdminCreateCustomerRetailerWithoutAddressTest.xml | 2 +- .../Mftf/Test/AdminCreateCustomerWithCountryPolandTest.xml | 4 ++-- .../Test/Mftf/Test/AdminCreateCustomerWithCountryUSATest.xml | 4 ++-- .../Test/Mftf/Test/AdminCreateCustomerWithCustomGroupTest.xml | 2 +- .../Test/Mftf/Test/AdminCreateCustomerWithPrefixTest.xml | 2 +- .../Test/Mftf/Test/AdminCreateCustomerWithoutAddressTest.xml | 2 +- ...AdminCreateNewCustomerOnStorefrontSignupNewsletterTest.xml | 2 +- .../Customer/Test/Mftf/Test/AdminCreateNewCustomerTest.xml | 2 +- .../Test/AdminCustomerSubscribeNewsletterPerWebsiteTest.xml | 2 +- .../AddConfigurableProductToOrderFromShoppingCartTest.xml | 2 +- .../Mftf/Test/AddSimpleProductToOrderFromShoppingCartTest.xml | 2 +- .../MoveLastOrderedConfigurableProductOnOrderPageTest.xml | 2 +- .../Mftf/Test/MoveLastOrderedSimpleProductOnOrderPageTest.xml | 2 +- .../MoveRecentlyViewedBundleFixedProductOnOrderPageTest.xml | 2 +- .../MoveRecentlyViewedConfigurableProductOnOrderPageTest.xml | 2 +- .../Test/Mftf/Test/AdminSetUpWatermarkForSwatchImageTest.xml | 2 +- 17 files changed, 19 insertions(+), 19 deletions(-) rename app/code/Magento/Customer/Test/Mftf/ActionGroup/{AdminCustomerClickFirstRowEditLinkActionGroup.xml => AdminClickFirstRowEditLinkOnCustomerGridActionGroup.xml} (89%) diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminCustomerClickFirstRowEditLinkActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminClickFirstRowEditLinkOnCustomerGridActionGroup.xml similarity index 89% rename from app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminCustomerClickFirstRowEditLinkActionGroup.xml rename to app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminClickFirstRowEditLinkOnCustomerGridActionGroup.xml index 1c5c29b855bf5..0cfe9f80d1619 100644 --- a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminCustomerClickFirstRowEditLinkActionGroup.xml +++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminClickFirstRowEditLinkOnCustomerGridActionGroup.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="AdminCustomerClickFirstRowEditLinkActionGroup"> + <actionGroup name="AdminClickFirstRowEditLinkOnCustomerGridActionGroup"> <annotations> <description>Click edit link for first row on the grid.</description> </annotations> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerRetailerWithoutAddressTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerRetailerWithoutAddressTest.xml index 98b488c63a1e0..9f6d8d645e5f4 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerRetailerWithoutAddressTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerRetailerWithoutAddressTest.xml @@ -50,7 +50,7 @@ <see userInput="{{CustomerEntityOne.email}}" selector="{{AdminCustomerGridSection.customerGrid}}" stepKey="assertEmail"/> <!--Assert Customer Form --> - <actionGroup ref="AdminCustomerClickFirstRowEditLinkActionGroup" stepKey="clickOnEditButton1"/> + <actionGroup ref="AdminClickFirstRowEditLinkOnCustomerGridActionGroup" stepKey="clickOnEditButton1"/> <click selector="{{AdminCustomerAccountInformationSection.accountInformationButton}}" stepKey="clickOnAccountInformation"/> <waitForPageLoad stepKey="waitForCustomerInformationPageToLoad"/> <see selector="{{AdminCustomerAccountInformationSection.groupIdValue}}" userInput="Retailer" stepKey="seeCustomerGroup1"/> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithCountryPolandTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithCountryPolandTest.xml index 7d76b79b97279..782c1599bf489 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithCountryPolandTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithCountryPolandTest.xml @@ -31,7 +31,7 @@ <actionGroup ref="AdminFilterCustomerByEmail" stepKey="filterTheCustomerByEmail"> <argument name="email" value="$$createCustomer.email$$"/> </actionGroup> - <actionGroup ref="AdminCustomerClickFirstRowEditLinkActionGroup" stepKey="clickOnEditButton"/> + <actionGroup ref="AdminClickFirstRowEditLinkOnCustomerGridActionGroup" stepKey="clickOnEditButton"/> <!-- Add the Address --> <click selector="{{AdminEditCustomerAddressesSection.addresses}}" stepKey="selectAddress"/> @@ -66,7 +66,7 @@ <see userInput="{{PolandAddress.telephone}}" selector="{{AdminCustomerGridSection.customerGrid}}" stepKey="assertPhoneNumber"/> <!--Assert Customer Form --> - <actionGroup ref="AdminCustomerClickFirstRowEditLinkActionGroup" stepKey="clickOnEditButton1"/> + <actionGroup ref="AdminClickFirstRowEditLinkOnCustomerGridActionGroup" stepKey="clickOnEditButton1"/> <click selector="{{AdminCustomerAccountInformationSection.accountInformationButton}}" stepKey="clickOnAccountInformation"/> <waitForPageLoad stepKey="waitForCustomerInformationPageToLoad"/> <seeInField selector="{{AdminCustomerAccountInformationSection.firstName}}" userInput="$$createCustomer.firstname$$" stepKey="seeCustomerFirstName"/> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithCountryUSATest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithCountryUSATest.xml index 7eecdf67d58b1..304d545fb4c93 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithCountryUSATest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithCountryUSATest.xml @@ -31,7 +31,7 @@ <actionGroup ref="AdminFilterCustomerByEmail" stepKey="filterTheCustomerByEmail"> <argument name="email" value="$$createCustomer.email$$"/> </actionGroup> - <actionGroup ref="AdminCustomerClickFirstRowEditLinkActionGroup" stepKey="clickOnEditButton"/> + <actionGroup ref="AdminClickFirstRowEditLinkOnCustomerGridActionGroup" stepKey="clickOnEditButton"/> <!-- Add the Address --> <click selector="{{AdminEditCustomerAddressesSection.addresses}}" stepKey="selectAddress"/> @@ -66,7 +66,7 @@ <see userInput="{{US_Address_CA.telephone}}" selector="{{AdminCustomerGridSection.customerGrid}}" stepKey="assertPhoneNumber"/> <!--Assert Customer Form --> - <actionGroup ref="AdminCustomerClickFirstRowEditLinkActionGroup" stepKey="clickOnEditButton1"/> + <actionGroup ref="AdminClickFirstRowEditLinkOnCustomerGridActionGroup" stepKey="clickOnEditButton1"/> <click selector="{{AdminCustomerAccountInformationSection.accountInformationButton}}" stepKey="clickOnAccountInformation"/> <waitForPageLoad stepKey="waitForCustomerInformationPageToLoad"/> <seeInField selector="{{AdminCustomerAccountInformationSection.firstName}}" userInput="$$createCustomer.firstname$$" stepKey="seeCustomerFirstName"/> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithCustomGroupTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithCustomGroupTest.xml index 84d6d5df5f8f3..7cffd5f304e31 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithCustomGroupTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithCustomGroupTest.xml @@ -54,7 +54,7 @@ <see userInput="{{CustomerEntityOne.email}}" selector="{{AdminCustomerGridSection.customerGrid}}" stepKey="assertEmail"/> <!--Assert Customer Form --> - <actionGroup ref="AdminCustomerClickFirstRowEditLinkActionGroup" stepKey="clickOnEditButton1"/> + <actionGroup ref="AdminClickFirstRowEditLinkOnCustomerGridActionGroup" stepKey="clickOnEditButton1"/> <click selector="{{AdminCustomerAccountInformationSection.accountInformationButton}}" stepKey="clickOnAccountInformation"/> <waitForPageLoad stepKey="waitForCustomerInformationPageToLoad"/> <see selector="{{AdminCustomerAccountInformationSection.groupIdValue}}" userInput="$$customerGroup.code$$" stepKey="seeCustomerGroup1"/> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithPrefixTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithPrefixTest.xml index a03855b9e90c9..eaa3a11edb74e 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithPrefixTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithPrefixTest.xml @@ -56,7 +56,7 @@ <see userInput="Male" selector="{{AdminCustomerGridSection.customerGrid}}" stepKey="assertGender"/> <!--Assert Customer Form --> - <actionGroup ref="AdminCustomerClickFirstRowEditLinkActionGroup" stepKey="clickOnEditButton1"/> + <actionGroup ref="AdminClickFirstRowEditLinkOnCustomerGridActionGroup" stepKey="clickOnEditButton1"/> <click selector="{{AdminCustomerAccountInformationSection.accountInformationButton}}" stepKey="clickOnAccountInformation"/> <waitForPageLoad stepKey="waitForCustomerInformationPageToLoad"/> <seeInField selector="{{AdminCustomerAccountInformationSection.namePrefix}}" userInput="{{CustomerEntityOne.prefix}}" stepKey="seeCustomerNamePrefix"/> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithoutAddressTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithoutAddressTest.xml index c707c322529b9..98826b147ad81 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithoutAddressTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithoutAddressTest.xml @@ -49,7 +49,7 @@ <see userInput="{{CustomerEntityOne.email}}" selector="{{AdminCustomerGridSection.customerGrid}}" stepKey="assertEmail"/> <!--Assert Customer Form --> - <actionGroup ref="AdminCustomerClickFirstRowEditLinkActionGroup" stepKey="clickOnEditButton1"/> + <actionGroup ref="AdminClickFirstRowEditLinkOnCustomerGridActionGroup" stepKey="clickOnEditButton1"/> <click selector="{{AdminCustomerAccountInformationSection.accountInformationButton}}" stepKey="clickOnAccountInformation"/> <waitForPageLoad stepKey="waitForCustomerInformationPageToLoad"/> <seeInField selector="{{AdminCustomerAccountInformationSection.firstName}}" userInput="{{CustomerEntityOne.firstname}}" stepKey="seeCustomerFirstName"/> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateNewCustomerOnStorefrontSignupNewsletterTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateNewCustomerOnStorefrontSignupNewsletterTest.xml index 67546a88425b3..683b275ca1ed6 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateNewCustomerOnStorefrontSignupNewsletterTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateNewCustomerOnStorefrontSignupNewsletterTest.xml @@ -45,7 +45,7 @@ <see selector="{{AdminCustomerGridSection.customerGrid}}" userInput="{{CustomerEntityOne.email}}" stepKey="seeAssertCustomerEmailInGrid"/> <!--Assert verify created new customer is subscribed to newsletter--> - <actionGroup ref="AdminCustomerClickFirstRowEditLinkActionGroup" stepKey="clickFirstRowEditLink"/> + <actionGroup ref="AdminClickFirstRowEditLinkOnCustomerGridActionGroup" stepKey="clickFirstRowEditLink"/> <click selector="{{AdminEditCustomerInformationSection.newsLetter}}" stepKey="clickNewsLetter"/> <waitForPageLoad stepKey="waitForNewsletterTabToOpen"/> <seeCheckboxIsChecked selector="{{AdminEditCustomerNewsletterSection.subscribedStatus('1')}}" stepKey="seeAssertSubscribedToNewsletterCheckboxIsChecked"/> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateNewCustomerTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateNewCustomerTest.xml index 9583e5d6109c5..5edb9d08da46d 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateNewCustomerTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateNewCustomerTest.xml @@ -42,7 +42,7 @@ <argument name="email" value="{{CustomerEntityOne.email}}"/> </actionGroup> <waitForPageLoad stepKey="waitForPageToLoad"/> - <actionGroup ref="AdminCustomerClickFirstRowEditLinkActionGroup" stepKey="clickOnEditButton1"/> + <actionGroup ref="AdminClickFirstRowEditLinkOnCustomerGridActionGroup" stepKey="clickOnEditButton1"/> <!-- Assert Customer Title --> <click selector="{{AdminCustomerAccountInformationSection.accountInformationButton}}" stepKey="clickOnAccountInformation"/> diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCustomerSubscribeNewsletterPerWebsiteTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCustomerSubscribeNewsletterPerWebsiteTest.xml index ffcc543609e37..87111ec6fba1a 100644 --- a/app/code/Magento/Customer/Test/Mftf/Test/AdminCustomerSubscribeNewsletterPerWebsiteTest.xml +++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCustomerSubscribeNewsletterPerWebsiteTest.xml @@ -53,7 +53,7 @@ <actionGroup ref="AdminFilterCustomerByEmail" stepKey="filterCustomerGrid"> <argument name="email" value="{{CustomerEntityOne.email}}"/> </actionGroup> - <actionGroup ref="AdminCustomerClickFirstRowEditLinkActionGroup" stepKey="clickToEditCustomerPage"/> + <actionGroup ref="AdminClickFirstRowEditLinkOnCustomerGridActionGroup" stepKey="clickToEditCustomerPage"/> <grabFromCurrentUrl regex="~(\d+)/~" stepKey="grabCustomerId"/> <!-- Assert that created customer is subscribed to newsletter on the new Store View --> <actionGroup ref="AdminAssertCustomerIsSubscribedToNewslettersAndSelectedStoreView" stepKey="assertSubscribedToNewsletter"> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AddConfigurableProductToOrderFromShoppingCartTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AddConfigurableProductToOrderFromShoppingCartTest.xml index 45bd7ee3e0deb..127fd1dd4e006 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AddConfigurableProductToOrderFromShoppingCartTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AddConfigurableProductToOrderFromShoppingCartTest.xml @@ -97,7 +97,7 @@ <actionGroup ref="AdminFilterCustomerByEmail" stepKey="filterCreatedCustomer"> <argument name="email" value="$$createCustomer.email$$"/> </actionGroup> - <actionGroup ref="AdminCustomerClickFirstRowEditLinkActionGroup" stepKey="clickEditButton"/> + <actionGroup ref="AdminClickFirstRowEditLinkOnCustomerGridActionGroup" stepKey="clickEditButton"/> <!-- Click create order --> <click selector="{{AdminCustomerMainActionsSection.createOrderBtn}}" stepKey="clickCreateOrder"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AddSimpleProductToOrderFromShoppingCartTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AddSimpleProductToOrderFromShoppingCartTest.xml index 60c33d68354ce..701b7ebe4a958 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/AddSimpleProductToOrderFromShoppingCartTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/AddSimpleProductToOrderFromShoppingCartTest.xml @@ -58,7 +58,7 @@ <actionGroup ref="AdminFilterCustomerByEmail" stepKey="filterCreatedCustomer"> <argument name="email" value="$$createCustomer.email$$"/> </actionGroup> - <actionGroup ref="AdminCustomerClickFirstRowEditLinkActionGroup" stepKey="clickEditButton"/> + <actionGroup ref="AdminClickFirstRowEditLinkOnCustomerGridActionGroup" stepKey="clickEditButton"/> <!-- Click create order --> <click selector="{{AdminCustomerMainActionsSection.createOrderBtn}}" stepKey="clickCreateOrder"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/MoveLastOrderedConfigurableProductOnOrderPageTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/MoveLastOrderedConfigurableProductOnOrderPageTest.xml index 3d5b54daa7c8f..8e9e117d2d995 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/MoveLastOrderedConfigurableProductOnOrderPageTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/MoveLastOrderedConfigurableProductOnOrderPageTest.xml @@ -96,7 +96,7 @@ <actionGroup ref="AdminFilterCustomerByEmail" stepKey="filterCreatedCustomer"> <argument name="email" value="$$createCustomer.email$$"/> </actionGroup> - <actionGroup ref="AdminCustomerClickFirstRowEditLinkActionGroup" stepKey="clickEditButton"/> + <actionGroup ref="AdminClickFirstRowEditLinkOnCustomerGridActionGroup" stepKey="clickEditButton"/> <!-- Click create order --> <click selector="{{AdminCustomerMainActionsSection.createOrderBtn}}" stepKey="clickCreateOrder"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/MoveLastOrderedSimpleProductOnOrderPageTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/MoveLastOrderedSimpleProductOnOrderPageTest.xml index 8faedb24e600e..71da699e533bc 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/MoveLastOrderedSimpleProductOnOrderPageTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/MoveLastOrderedSimpleProductOnOrderPageTest.xml @@ -46,7 +46,7 @@ <actionGroup ref="AdminFilterCustomerByEmail" stepKey="filterCreatedCustomer"> <argument name="email" value="$$createCustomer.email$$"/> </actionGroup> - <actionGroup ref="AdminCustomerClickFirstRowEditLinkActionGroup" stepKey="clickEditButton"/> + <actionGroup ref="AdminClickFirstRowEditLinkOnCustomerGridActionGroup" stepKey="clickEditButton"/> <!-- Click create order --> <click selector="{{AdminCustomerMainActionsSection.createOrderBtn}}" stepKey="clickCreateOrder"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/MoveRecentlyViewedBundleFixedProductOnOrderPageTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/MoveRecentlyViewedBundleFixedProductOnOrderPageTest.xml index 980bc272c3643..452d65ea5ae57 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/MoveRecentlyViewedBundleFixedProductOnOrderPageTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/MoveRecentlyViewedBundleFixedProductOnOrderPageTest.xml @@ -96,7 +96,7 @@ <actionGroup ref="AdminFilterCustomerByEmail" stepKey="filterCreatedCustomer"> <argument name="email" value="$$createCustomer.email$$"/> </actionGroup> - <actionGroup ref="AdminCustomerClickFirstRowEditLinkActionGroup" stepKey="clickEditButton"/> + <actionGroup ref="AdminClickFirstRowEditLinkOnCustomerGridActionGroup" stepKey="clickEditButton"/> <!-- Click create order --> <click selector="{{AdminCustomerMainActionsSection.createOrderBtn}}" stepKey="clickCreateOrder"/> diff --git a/app/code/Magento/Sales/Test/Mftf/Test/MoveRecentlyViewedConfigurableProductOnOrderPageTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/MoveRecentlyViewedConfigurableProductOnOrderPageTest.xml index 0bff169c4a68e..4d1ebddc7c2b3 100644 --- a/app/code/Magento/Sales/Test/Mftf/Test/MoveRecentlyViewedConfigurableProductOnOrderPageTest.xml +++ b/app/code/Magento/Sales/Test/Mftf/Test/MoveRecentlyViewedConfigurableProductOnOrderPageTest.xml @@ -99,7 +99,7 @@ <actionGroup ref="AdminFilterCustomerByEmail" stepKey="filterCreatedCustomer"> <argument name="email" value="$$createCustomer.email$$"/> </actionGroup> - <actionGroup ref="AdminCustomerClickFirstRowEditLinkActionGroup" stepKey="clickEditButton"/> + <actionGroup ref="AdminClickFirstRowEditLinkOnCustomerGridActionGroup" stepKey="clickEditButton"/> <!-- Click create order --> <click selector="{{AdminCustomerMainActionsSection.createOrderBtn}}" stepKey="clickCreateOrder"/> diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/AdminSetUpWatermarkForSwatchImageTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/AdminSetUpWatermarkForSwatchImageTest.xml index d615c1478d6d7..07ce30b702f91 100644 --- a/app/code/Magento/Swatches/Test/Mftf/Test/AdminSetUpWatermarkForSwatchImageTest.xml +++ b/app/code/Magento/Swatches/Test/Mftf/Test/AdminSetUpWatermarkForSwatchImageTest.xml @@ -38,7 +38,7 @@ </actionGroup> <!-- Select Edit next to the Default Store View --> <comment userInput="Select Edit next to the Default Store View" stepKey="commentEditDefaultView"/> - <actionGroup ref="AdminCustomerClickFirstRowEditLinkActionGroup" stepKey="clickToEditDefaultStoreView"/> + <actionGroup ref="AdminClickFirstRowEditLinkOnCustomerGridActionGroup" stepKey="clickToEditDefaultStoreView"/> <!-- Expand the Product Image Watermarks section--> <comment userInput="Expand the Product Image Watermarks section" stepKey="commentOpenWatermarksSection"/> <click selector="{{AdminDesignConfigSection.watermarkSectionHeader}}" stepKey="clickToProductImageWatermarks"/> From 55653494828cc444d846f79838c72b568aee4484 Mon Sep 17 00:00:00 2001 From: Alexander Steshuk <60192090+engcom-Kilo@users.noreply.github.com> Date: Thu, 20 Aug 2020 15:45:52 +0300 Subject: [PATCH 30/31] Update AdminCreateDuplicateNameStoreViewTest.xml Added testCaseId --- .../Test/Mftf/Test/AdminCreateDuplicateNameStoreViewTest.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Store/Test/Mftf/Test/AdminCreateDuplicateNameStoreViewTest.xml b/app/code/Magento/Store/Test/Mftf/Test/AdminCreateDuplicateNameStoreViewTest.xml index 46caf5b37f4f2..ec81424b1acfa 100644 --- a/app/code/Magento/Store/Test/Mftf/Test/AdminCreateDuplicateNameStoreViewTest.xml +++ b/app/code/Magento/Store/Test/Mftf/Test/AdminCreateDuplicateNameStoreViewTest.xml @@ -14,6 +14,7 @@ <description value="Admin should be able to create a Store View with the same name"/> <group value="storeView"/> <severity value="AVERAGE"/> + <testCaseId value="MC-36863"/> </annotations> <before> <!--Create two store views with same name, but different codes--> From 01e90b12be723c1b64e10c8aa7028bfbe7263015 Mon Sep 17 00:00:00 2001 From: Andrii Beziazychnyi <a.beziazychnyi@atwix.com> Date: Thu, 20 Aug 2020 20:04:56 +0300 Subject: [PATCH 31/31] Fixed bad code style in return type declaration --- app/code/Magento/Captcha/CustomerData/Captcha.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Captcha/CustomerData/Captcha.php b/app/code/Magento/Captcha/CustomerData/Captcha.php index e07bf953abaa3..901477c75610b 100644 --- a/app/code/Magento/Captcha/CustomerData/Captcha.php +++ b/app/code/Magento/Captcha/CustomerData/Captcha.php @@ -58,7 +58,7 @@ public function __construct( /** * @inheritdoc */ - public function getSectionData() :array + public function getSectionData(): array { $data = [];