From cfab7825e1d5ce33d38bc81963ee60d3dd04f41a Mon Sep 17 00:00:00 2001
From: korostii <24894168+korostii@users.noreply.github.com>
Date: Tue, 17 Dec 2019 14:29:37 +0000
Subject: [PATCH 001/119] Fix #26080
---
app/code/Magento/MessageQueue/etc/di.xml | 1 -
app/etc/di.xml | 1 +
2 files changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/code/Magento/MessageQueue/etc/di.xml b/app/code/Magento/MessageQueue/etc/di.xml
index f60eb5fbc20df..b283280dc4580 100644
--- a/app/code/Magento/MessageQueue/etc/di.xml
+++ b/app/code/Magento/MessageQueue/etc/di.xml
@@ -6,7 +6,6 @@
*/
-->
-
diff --git a/app/etc/di.xml b/app/etc/di.xml
index dfbf4f2373ac5..3a094477e35be 100644
--- a/app/etc/di.xml
+++ b/app/etc/di.xml
@@ -187,6 +187,7 @@
+
From a4c74d8fd1cb4a67faee123607dab819bea54f04 Mon Sep 17 00:00:00 2001
From: Rudolf Vince
Date: Mon, 30 Mar 2020 10:32:44 +0200
Subject: [PATCH 002/119] 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 003/119] 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 004/119] 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 005/119] 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 a9ca0f632da13071b9f44f706fda8740809e29d9 Mon Sep 17 00:00:00 2001
From: "v.prokopov"
Date: Fri, 10 Apr 2020 16:27:39 +0300
Subject: [PATCH 006/119] fixed condition when can show password input. Fixed
logic for pulling email value from persistent storage
---
.../Checkout/view/frontend/web/js/view/form/element/email.js | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/app/code/Magento/Checkout/view/frontend/web/js/view/form/element/email.js b/app/code/Magento/Checkout/view/frontend/web/js/view/form/element/email.js
index c570bda51a80e..8311d97522980 100644
--- a/app/code/Magento/Checkout/view/frontend/web/js/view/form/element/email.js
+++ b/app/code/Magento/Checkout/view/frontend/web/js/view/form/element/email.js
@@ -113,6 +113,7 @@ define([
$.when(this.isEmailCheckComplete).done(function () {
this.isPasswordVisible(false);
+ checkoutData.setCheckedEmailValue('');
}.bind(this)).fail(function () {
this.isPasswordVisible(true);
checkoutData.setCheckedEmailValue(this.email());
@@ -192,7 +193,7 @@ define([
* @returns {Boolean} - initial visibility state.
*/
resolveInitialPasswordVisibility: function () {
- if (checkoutData.getInputFieldEmailValue() !== '' && checkoutData.getCheckedEmailValue() === '') {
+ if (checkoutData.getInputFieldEmailValue() !== '' && checkoutData.getCheckedEmailValue() !== '') {
return true;
}
From 28d1af5276caa759139299096e0cbc40f4618da2 Mon Sep 17 00:00:00 2001
From: Mateusz Krzeszowiak
Date: Fri, 10 Apr 2020 17:15:35 +0200
Subject: [PATCH 007/119] Initialize inline translations module only when they
are enabled
---
.../view/frontend/requirejs-config.js | 1 -
lib/web/mage/translate-inline.js | 62 ++++++++-----------
lib/web/mage/utils/misc.js | 20 ++++--
3 files changed, 42 insertions(+), 41 deletions(-)
diff --git a/app/code/Magento/Translation/view/frontend/requirejs-config.js b/app/code/Magento/Translation/view/frontend/requirejs-config.js
index b5351b9d471cf..cb1088ec49b50 100644
--- a/app/code/Magento/Translation/view/frontend/requirejs-config.js
+++ b/app/code/Magento/Translation/view/frontend/requirejs-config.js
@@ -13,7 +13,6 @@ var config = {
}
},
deps: [
- 'mage/translate-inline',
'mageTranslationDictionary'
]
};
diff --git a/lib/web/mage/translate-inline.js b/lib/web/mage/translate-inline.js
index 56acef5a49a42..8f460c31aafae 100644
--- a/lib/web/mage/translate-inline.js
+++ b/lib/web/mage/translate-inline.js
@@ -6,9 +6,10 @@
define([
'jquery',
'mage/template',
+ 'mage/utils/misc',
+ 'mage/translate',
'jquery-ui-modules/dialog',
- 'mage/translate'
-], function ($, mageTemplate) {
+], function ($, mageTemplate, miscUtils) {
'use strict';
$.widget('mage.translateInline', $.ui.dialog, {
@@ -59,11 +60,12 @@ define([
* Open.
*/
open: function () {
- var topMargin;
+ var $uiDialog = $(this).closest('.ui-dialog'),
+ topMargin = $uiDialog.children('.ui-dialog-titlebar').outerHeight() + 45;
- $(this).closest('.ui-dialog').addClass('ui-dialog-active');
- topMargin = jQuery(this).closest('.ui-dialog').children('.ui-dialog-titlebar').outerHeight() + 45;
- jQuery(this).closest('.ui-dialog').css('margin-top', topMargin);
+ $uiDialog
+ .addClass('ui-dialog-active')
+ .css('margin-top', topMargin)
},
/**
@@ -79,11 +81,15 @@ define([
* @protected
*/
_create: function () {
+ var $translateArea = $(this.options.translateArea);
+
+ if (!$translateArea.length) {
+ $translateArea = $('body');
+ }
+ $translateArea.on('edit.editTrigger', $.proxy(this._onEdit, this));
+
this.tmpl = mageTemplate(this.options.translateForm.template);
- (this.options.translateArea && $(this.options.translateArea).length ?
- $(this.options.translateArea) :
- this.element.closest('body'))
- .on('edit.editTrigger', $.proxy(this._onEdit, this));
+
this._super();
},
@@ -95,7 +101,7 @@ define([
_prepareContent: function (templateData) {
var data = $.extend({
items: templateData,
- escape: $.mage.escapeHTML
+ escape: miscUtils.escape,
}, this.options.translateForm.data);
this.data = data;
@@ -131,16 +137,14 @@ define([
* @protected
*/
_formSubmit: function () {
- var parameters;
+ var parameters = $.param({
+ area: this.options.area
+ }) + '&' + $('#' + this.options.translateForm.data.id).serialize();
this.formIsSubmitted = true;
- parameters = $.param({
- area: this.options.area
- }) + '&' + $('#' + this.options.translateForm.data.id).serialize();
- $.ajax({
+ $.post({
url: this.options.ajaxUrl,
- type: 'POST',
data: parameters,
loaderContext: this.element,
showLoader: true
@@ -162,11 +166,13 @@ define([
* @private
*/
_updatePlaceholder: function (newValue) {
- var target = jQuery(this.target);
+ var $target = $(this.target),
+ translateObject = $target.data('translate')[0];
+
+ translateObject.shown = newValue;
+ translateObject.translated = newValue;
- target.data('translate')[0].shown = newValue;
- target.data('translate')[0].translated = newValue;
- target.html(newValue);
+ $target.html(newValue);
},
/**
@@ -177,20 +183,6 @@ define([
this._super();
}
});
- // @TODO move the "escapeHTML" method into the file with global utility functions
- $.extend(true, $, {
- mage: {
- /**
- * @param {String} str
- * @return {Boolean}
- */
- escapeHTML: function (str) {
- return str ?
- jQuery('').text(str).html().replace(/"/g, '"') :
- false;
- }
- }
- });
return $.mage.translateInline;
});
diff --git a/lib/web/mage/utils/misc.js b/lib/web/mage/utils/misc.js
index 3829f5ed467e2..46261ff490114 100644
--- a/lib/web/mage/utils/misc.js
+++ b/lib/web/mage/utils/misc.js
@@ -6,8 +6,8 @@
define([
'underscore',
'jquery',
- 'FormData'
-], function (_, $) {
+ 'mage/utils/objects'
+], function (_, $, utils) {
'use strict';
var defaultAttributes,
@@ -120,7 +120,7 @@ define([
*/
submit: function (options, attrs) {
var form = document.createElement('form'),
- data = this.serialize(options.data),
+ data = utils.serialize(options.data),
attributes = _.extend({}, defaultAttributes, attrs || {});
if (!attributes.action) {
@@ -205,11 +205,11 @@ define([
if (type === 'default') {
formData = new FormData();
- _.each(this.serialize(data), function (val, name) {
+ _.each(utils.serialize(data), function (val, name) {
formData.append(name, val);
});
} else if (type === 'simple') {
- formData = this.serialize(data);
+ formData = utils.serialize(data);
}
return formData;
@@ -242,6 +242,16 @@ define([
return data;
},
+ /**
+ * Replaces special characters with their corresponding HTML entities.
+ *
+ * @param {String} string Text to escape.
+ * @returns {String} Escaped text.
+ */
+ escape: function (string) {
+ return string ? $('').text(str).html().replace(/"/g, '"') : string;
+ },
+
/**
* Replaces symbol codes with their unescaped counterparts.
*
From b842083a7b6e08418f5bbb16f0a90abaf1bd8b44 Mon Sep 17 00:00:00 2001
From: Mateusz Krzeszowiak
Date: Fri, 10 Apr 2020 17:47:26 +0200
Subject: [PATCH 008/119] Fix static tests
---
lib/web/mage/translate-inline.js | 6 +++---
lib/web/mage/utils/misc.js | 6 +++---
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/lib/web/mage/translate-inline.js b/lib/web/mage/translate-inline.js
index 8f460c31aafae..a559426ed41d2 100644
--- a/lib/web/mage/translate-inline.js
+++ b/lib/web/mage/translate-inline.js
@@ -8,7 +8,7 @@ define([
'mage/template',
'mage/utils/misc',
'mage/translate',
- 'jquery-ui-modules/dialog',
+ 'jquery-ui-modules/dialog'
], function ($, mageTemplate, miscUtils) {
'use strict';
@@ -65,7 +65,7 @@ define([
$uiDialog
.addClass('ui-dialog-active')
- .css('margin-top', topMargin)
+ .css('margin-top', topMargin);
},
/**
@@ -101,7 +101,7 @@ define([
_prepareContent: function (templateData) {
var data = $.extend({
items: templateData,
- escape: miscUtils.escape,
+ escape: miscUtils.escape
}, this.options.translateForm.data);
this.data = data;
diff --git a/lib/web/mage/utils/misc.js b/lib/web/mage/utils/misc.js
index 46261ff490114..b1c0c33324c28 100644
--- a/lib/web/mage/utils/misc.js
+++ b/lib/web/mage/utils/misc.js
@@ -244,12 +244,12 @@ define([
/**
* Replaces special characters with their corresponding HTML entities.
- *
- * @param {String} string Text to escape.
+ *
+ * @param {String} string - Text to escape.
* @returns {String} Escaped text.
*/
escape: function (string) {
- return string ? $('').text(str).html().replace(/"/g, '"') : string;
+ return string ? $('').text(string).html().replace(/"/g, '"') : string;
},
/**
From fc1a6c5264353b9e5adc9fb84851ea2d1b4c063f Mon Sep 17 00:00:00 2001
From: "v.prokopov"
Date: Sat, 11 Apr 2020 16:02:36 +0300
Subject: [PATCH 009/119] added mftf test for case if on checkout page entered
unregistered email
---
...UnregisteredEmailOnCheckoutActionGroup.xml | 19 +++++++
...refrontOpenCheckoutCartPageActionGroup.xml | 21 ++++++++
...ieldForUnregisteredEmailOnCheckoutTest.xml | 50 +++++++++++++++++++
3 files changed, 90 insertions(+)
create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertStorefrontVisiblePasswordFieldForUnregisteredEmailOnCheckoutActionGroup.xml
create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontOpenCheckoutCartPageActionGroup.xml
create mode 100644 app/code/Magento/Checkout/Test/Mftf/Test/StorefrontVisiblePasswordFieldForUnregisteredEmailOnCheckoutTest.xml
diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertStorefrontVisiblePasswordFieldForUnregisteredEmailOnCheckoutActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertStorefrontVisiblePasswordFieldForUnregisteredEmailOnCheckoutActionGroup.xml
new file mode 100644
index 0000000000000..8210fe1df73ba
--- /dev/null
+++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/AssertStorefrontVisiblePasswordFieldForUnregisteredEmailOnCheckoutActionGroup.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+ Checks if visible password field for unregistered email on checkout page
+
+
+
+
+
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontOpenCheckoutCartPageActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontOpenCheckoutCartPageActionGroup.xml
new file mode 100644
index 0000000000000..958e4ad5b45fb
--- /dev/null
+++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontOpenCheckoutCartPageActionGroup.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+ Goes to the Storefront Checkout Cart page.
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontVisiblePasswordFieldForUnregisteredEmailOnCheckoutTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontVisiblePasswordFieldForUnregisteredEmailOnCheckoutTest.xml
new file mode 100644
index 0000000000000..ca9f81a0e418a
--- /dev/null
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontVisiblePasswordFieldForUnregisteredEmailOnCheckoutTest.xml
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
From c412681b7f9fac6e70120cf51ada319dabd510bd Mon Sep 17 00:00:00 2001
From: "v.prokopov"
Date: Sat, 11 Apr 2020 21:08:31 +0300
Subject: [PATCH 010/119] apply code review recommendations
---
...refrontOpenCheckoutCartPageActionGroup.xml | 21 -------------------
...ieldForUnregisteredEmailOnCheckoutTest.xml | 15 +++----------
2 files changed, 3 insertions(+), 33 deletions(-)
delete mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontOpenCheckoutCartPageActionGroup.xml
diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontOpenCheckoutCartPageActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontOpenCheckoutCartPageActionGroup.xml
deleted file mode 100644
index 958e4ad5b45fb..0000000000000
--- a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontOpenCheckoutCartPageActionGroup.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
-
- Goes to the Storefront Checkout Cart page.
-
-
-
-
-
-
-
-
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontVisiblePasswordFieldForUnregisteredEmailOnCheckoutTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontVisiblePasswordFieldForUnregisteredEmailOnCheckoutTest.xml
index ca9f81a0e418a..41b5f734d0096 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontVisiblePasswordFieldForUnregisteredEmailOnCheckoutTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontVisiblePasswordFieldForUnregisteredEmailOnCheckoutTest.xml
@@ -14,36 +14,27 @@
-
-
-
+
-
-
-
-
-
-
-
-
+
+
From fe00511295cbd814f4a852729fbdc89dcc7fb4a6 Mon Sep 17 00:00:00 2001
From: Mateusz Krzeszowiak
Date: Sat, 18 Apr 2020 16:18:21 +0200
Subject: [PATCH 011/119] Fix static tests
---
lib/web/mage/translate-inline.js | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/web/mage/translate-inline.js b/lib/web/mage/translate-inline.js
index a559426ed41d2..2407a64e5e0d1 100644
--- a/lib/web/mage/translate-inline.js
+++ b/lib/web/mage/translate-inline.js
@@ -143,8 +143,9 @@ define([
this.formIsSubmitted = true;
- $.post({
+ $.ajax({
url: this.options.ajaxUrl,
+ type: 'POST',
data: parameters,
loaderContext: this.element,
showLoader: true
From d64eaf403c059e306756b39f24a0645e3ef96cb4 Mon Sep 17 00:00:00 2001
From: Mateusz Krzeszowiak
Date: Mon, 20 Apr 2020 18:39:05 +0200
Subject: [PATCH 012/119] Fix mage utils dependencies
---
lib/web/mage/utils/objects.js | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/lib/web/mage/utils/objects.js b/lib/web/mage/utils/objects.js
index 83711c43d2d1b..82866c0f2a6ad 100644
--- a/lib/web/mage/utils/objects.js
+++ b/lib/web/mage/utils/objects.js
@@ -5,8 +5,9 @@
define([
'ko',
'jquery',
- 'underscore'
-], function (ko, $, _) {
+ 'underscore',
+ 'mage/utils/strings'
+], function (ko, $, _, stringUtils) {
'use strict';
var primitives = [
@@ -217,7 +218,7 @@ define([
data = this.flatten(data);
_.each(data, function (value, keys) {
- keys = this.serializeName(keys);
+ keys = stringUtils.serializeName(keys);
value = _.isUndefined(value) ? '' : value;
result[keys] = value;
From 85b6d054008a84a7b7a3439f66ee6d6aec925c17 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bart=C5=82omiej=20Szubert?=
Date: Fri, 8 May 2020 15:06:36 +0200
Subject: [PATCH 013/119] Fix #13401 - Multi-Store: "Store View" sort order
values are not reflected in front-end store-switcher
---
app/code/Magento/Store/Block/Switcher.php | 5 +
.../Store/Test/Unit/Block/SwitcherTest.php | 163 +++++++++++++-----
2 files changed, 126 insertions(+), 42 deletions(-)
diff --git a/app/code/Magento/Store/Block/Switcher.php b/app/code/Magento/Store/Block/Switcher.php
index f15349f11066d..df8eaa1cf85da 100644
--- a/app/code/Magento/Store/Block/Switcher.php
+++ b/app/code/Magento/Store/Block/Switcher.php
@@ -193,7 +193,12 @@ public function getStores()
$stores = [];
} else {
$stores = $rawStores[$groupId];
+
+ uasort($stores, static function ($itemA, $itemB) {
+ return (int)$itemA->getSortOrder() <=> (int)$itemB->getSortOrder();
+ });
}
+
$this->setData('stores', $stores);
}
return $this->getData('stores');
diff --git a/app/code/Magento/Store/Test/Unit/Block/SwitcherTest.php b/app/code/Magento/Store/Test/Unit/Block/SwitcherTest.php
index aca3525a4400e..60c69834f6aa6 100644
--- a/app/code/Magento/Store/Test/Unit/Block/SwitcherTest.php
+++ b/app/code/Magento/Store/Test/Unit/Block/SwitcherTest.php
@@ -3,84 +3,163 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
+declare(strict_types=1);
namespace Magento\Store\Test\Unit\Block;
+use Magento\Directory\Helper\Data;
+use Magento\Framework\App\Config\ScopeConfigInterface;
+use Magento\Framework\Data\Helper\PostHelper;
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
+use Magento\Framework\UrlInterface;
+use Magento\Framework\View\Element\Template\Context;
+use Magento\Store\Api\Data\StoreInterface;
+use Magento\Store\Block\Switcher;
+use Magento\Store\Model\ScopeInterface;
+use Magento\Store\Model\Store;
+use Magento\Store\Model\StoreManagerInterface;
+use Magento\Store\Model\Website;
+use PHPUnit\Framework\MockObject\MockObject;
+use PHPUnit\Framework\TestCase;
-class SwitcherTest extends \PHPUnit\Framework\TestCase
+/**
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
+ */
+class SwitcherTest extends TestCase
{
- /** @var \Magento\Store\Block\Switcher */
- protected $switcher;
-
- /** @var \Magento\Framework\View\Element\Template\Context|\PHPUnit_Framework_MockObject_MockObject */
- protected $context;
+ /**
+ * @var Switcher
+ */
+ private $switcher;
- /** @var \Magento\Framework\Data\Helper\PostHelper|\PHPUnit_Framework_MockObject_MockObject */
- protected $corePostDataHelper;
+ /**
+ * @var PostHelper|MockObject
+ */
+ private $corePostDataHelperMock;
- /** @var \Magento\Store\Model\StoreManagerInterface|\PHPUnit_Framework_MockObject_MockObject */
- protected $storeManager;
+ /**
+ * @var StoreManagerInterface|MockObject
+ */
+ private $storeManagerMock;
- /** @var \Magento\Framework\UrlInterface|\PHPUnit_Framework_MockObject_MockObject */
- protected $urlBuilder;
+ /**
+ * @var UrlInterface|MockObject
+ */
+ private $urlBuilderMock;
- /** @var \Magento\Store\Api\Data\StoreInterface|\PHPUnit_Framework_MockObject_MockObject */
- private $store;
+ /**
+ * @var ScopeConfigInterface|MockObject
+ */
+ private $scopeConfigMock;
/**
* @return void
*/
- protected function setUp()
+ protected function setUp(): void
{
- $this->storeManager = $this->getMockBuilder(\Magento\Store\Model\StoreManagerInterface::class)->getMock();
- $this->urlBuilder = $this->createMock(\Magento\Framework\UrlInterface::class);
- $this->context = $this->createMock(\Magento\Framework\View\Element\Template\Context::class);
- $this->context->expects($this->any())->method('getStoreManager')->will($this->returnValue($this->storeManager));
- $this->context->expects($this->any())->method('getUrlBuilder')->will($this->returnValue($this->urlBuilder));
- $this->corePostDataHelper = $this->createMock(\Magento\Framework\Data\Helper\PostHelper::class);
- $this->store = $this->getMockBuilder(\Magento\Store\Api\Data\StoreInterface::class)
- ->disableOriginalConstructor()
- ->getMockForAbstractClass();
+ $this->storeManagerMock = $this->getMockBuilder(StoreManagerInterface::class)->getMock();
+ $this->urlBuilderMock = $this->createMock(UrlInterface::class);
+ $this->scopeConfigMock = $this->createMock(ScopeConfigInterface::class);
+ $contextMock = $this->createMock(Context::class);
+ $contextMock->method('getStoreManager')->willReturn($this->storeManagerMock);
+ $contextMock->method('getUrlBuilder')->willReturn($this->urlBuilderMock);
+ $contextMock->method('getScopeConfig')->willReturn($this->scopeConfigMock);
+ $this->corePostDataHelperMock = $this->createMock(PostHelper::class);
$this->switcher = (new ObjectManager($this))->getObject(
- \Magento\Store\Block\Switcher::class,
+ Switcher::class,
[
- 'context' => $this->context,
- 'postDataHelper' => $this->corePostDataHelper,
+ 'context' => $contextMock,
+ 'postDataHelper' => $this->corePostDataHelperMock,
]
);
}
+ public function testGetStoresSortOrder()
+ {
+ $groupId = 1;
+ $storesSortOrder = [
+ 1 => 2,
+ 2 => 4,
+ 3 => 1,
+ 4 => 3
+ ];
+
+ $currentStoreMock = $this->getMockBuilder(Store::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $currentStoreMock->method('getGroupId')->willReturn($groupId);
+ $currentStoreMock->method('isUseStoreInUrl')->willReturn(false);
+ $this->storeManagerMock->method('getStore')
+ ->willReturn($currentStoreMock);
+
+ $currentWebsiteMock = $this->getMockBuilder(Website::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->storeManagerMock->method('getWebsite')
+ ->willReturn($currentWebsiteMock);
+
+ $stores = [];
+ foreach ($storesSortOrder as $storeId => $sortOrder) {
+ $storeMock = $this->getMockBuilder(Store::class)
+ ->disableOriginalConstructor()
+ ->setMethods(['getId', 'getGroupId', 'getSortOrder', 'isActive', 'getUrl'])
+ ->getMock();
+ $storeMock->method('getId')->willReturn($storeId);
+ $storeMock->method('getGroupId')->willReturn($groupId);
+ $storeMock->method('getSortOrder')->willReturn($sortOrder);
+ $storeMock->method('isActive')->willReturn(true);
+ $storeMock->method('getUrl')->willReturn('https://example.org');
+ $stores[] = $storeMock;
+ }
+
+ $scopeConfigMap = array_map(static function ($item) {
+ return [
+ Data::XML_PATH_DEFAULT_LOCALE,
+ ScopeInterface::SCOPE_STORE,
+ $item,
+ 'en_US'
+ ];
+ }, $stores);
+ $this->scopeConfigMock->method('getValue')
+ ->willReturnMap($scopeConfigMap);
+
+ $currentWebsiteMock->method('getStores')
+ ->willReturn($stores);
+
+ $this->assertEquals([3, 1, 4, 2], array_keys($this->switcher->getStores()));
+ }
+
/**
* @return void
*/
public function testGetTargetStorePostData()
{
- $store = $this->getMockBuilder(\Magento\Store\Model\Store::class)
+ $storeMock = $this->getMockBuilder(Store::class)
->disableOriginalConstructor()
->getMock();
- $store->expects($this->any())
- ->method('getCode')
+ $oldStoreMock = $this->getMockBuilder(StoreInterface::class)
+ ->disableOriginalConstructor()
+ ->getMockForAbstractClass();
+ $storeMock->method('getCode')
->willReturn('new-store');
$storeSwitchUrl = 'http://domain.com/stores/store/redirect';
- $store->expects($this->atLeastOnce())
+ $storeMock->expects($this->atLeastOnce())
->method('getCurrentUrl')
->with(false)
->willReturn($storeSwitchUrl);
- $this->storeManager->expects($this->once())
+ $this->storeManagerMock->expects($this->once())
->method('getStore')
- ->willReturn($this->store);
- $this->store->expects($this->once())
+ ->willReturn($oldStoreMock);
+ $oldStoreMock->expects($this->once())
->method('getCode')
->willReturn('old-store');
- $this->urlBuilder->expects($this->once())
+ $this->urlBuilderMock->expects($this->once())
->method('getUrl')
->willReturn($storeSwitchUrl);
- $this->corePostDataHelper->expects($this->any())
- ->method('getPostData')
+ $this->corePostDataHelperMock->method('getPostData')
->with($storeSwitchUrl, ['___store' => 'new-store', 'uenc' => null, '___from_store' => 'old-store']);
- $this->switcher->getTargetStorePostData($store);
+ $this->switcher->getTargetStorePostData($storeMock);
}
/**
@@ -89,11 +168,11 @@ public function testGetTargetStorePostData()
*/
public function testIsStoreInUrl($isUseStoreInUrl)
{
- $storeMock = $this->createMock(\Magento\Store\Model\Store::class);
+ $storeMock = $this->createMock(Store::class);
- $storeMock->expects($this->once())->method('isUseStoreInUrl')->will($this->returnValue($isUseStoreInUrl));
+ $storeMock->expects($this->once())->method('isUseStoreInUrl')->willReturn($isUseStoreInUrl);
- $this->storeManager->expects($this->any())->method('getStore')->will($this->returnValue($storeMock));
+ $this->storeManagerMock->method('getStore')->willReturn($storeMock);
$this->assertEquals($this->switcher->isStoreInUrl(), $isUseStoreInUrl);
// check value is cached
$this->assertEquals($this->switcher->isStoreInUrl(), $isUseStoreInUrl);
@@ -103,7 +182,7 @@ public function testIsStoreInUrl($isUseStoreInUrl)
* @see self::testIsStoreInUrlDataProvider()
* @return array
*/
- public function isStoreInUrlDataProvider()
+ public function isStoreInUrlDataProvider(): array
{
return [[true], [false]];
}
From 3ac458b2e4442d4b0fc3e7de672d7562c1c85607 Mon Sep 17 00:00:00 2001
From: Rudolf Vince
Date: Wed, 13 May 2020 15:06:54 +0200
Subject: [PATCH 014/119] 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 015/119] 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 e87199eac6a845ec198d3209ca7fc6ecde0e199e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bart=C5=82omiej=20Szubert?=
Date: Sat, 16 May 2020 23:59:41 +0200
Subject: [PATCH 016/119] Fix #13401 - Set sort order for stores same as for
store views
---
app/code/Magento/Store/Block/Switcher.php | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/app/code/Magento/Store/Block/Switcher.php b/app/code/Magento/Store/Block/Switcher.php
index df8eaa1cf85da..a924805fcba90 100644
--- a/app/code/Magento/Store/Block/Switcher.php
+++ b/app/code/Magento/Store/Block/Switcher.php
@@ -170,9 +170,15 @@ public function getGroups()
if ($store) {
$group->setHomeUrl($store->getHomeUrl());
+ $group->setSortOrder($store->getSortOrder());
$groups[] = $group;
}
}
+
+ usort($groups, static function ($itemA, $itemB) {
+ return (int)$itemA->getSortOrder() <=> (int)$itemB->getSortOrder();
+ });
+
$this->setData('groups', $groups);
}
return $this->getData('groups');
From 52432e5dff93fd23383ab1a8aa6409113b8e2d41 Mon Sep 17 00:00:00 2001
From: Mateusz Krzeszowiak
Date: Sun, 24 May 2020 10:26:53 +0200
Subject: [PATCH 017/119] Fix incorrect MFTF selector
---
.../Test/Mftf/Section/AdminCategorySidebarTreeSection.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategorySidebarTreeSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategorySidebarTreeSection.xml
index c35e775152ac9..49e0d3eb4e0d7 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategorySidebarTreeSection.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategorySidebarTreeSection.xml
@@ -12,7 +12,7 @@
-
+
From d2883edd660d86437dfb4f6b177ec9b57f9e33bb Mon Sep 17 00:00:00 2001
From: Mateusz Krzeszowiak
Date: Wed, 27 May 2020 16:50:02 +0200
Subject: [PATCH 018/119] Properly escape dot in CSS selector for test
---
.../Test/Mftf/Section/AdminCategorySidebarTreeSection.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategorySidebarTreeSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategorySidebarTreeSection.xml
index 49e0d3eb4e0d7..5c7bae5392403 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategorySidebarTreeSection.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategorySidebarTreeSection.xml
@@ -12,7 +12,7 @@
-
+
From 217e993560cb2db16a76bf29797e649ca6d2d678 Mon Sep 17 00:00:00 2001
From: Mateusz Krzeszowiak
Date: Thu, 28 May 2020 09:42:57 +0200
Subject: [PATCH 019/119] Fix selector once again
---
.../Test/Mftf/Section/AdminCategorySidebarTreeSection.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategorySidebarTreeSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategorySidebarTreeSection.xml
index 5c7bae5392403..498321b9f3d81 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategorySidebarTreeSection.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategorySidebarTreeSection.xml
@@ -12,7 +12,7 @@
-
+
From 703add17b4fd31607fc6aa0ad3b0c41c72ec43b9 Mon Sep 17 00:00:00 2001
From: Mateusz Krzeszowiak
Date: Fri, 29 May 2020 09:17:42 +0200
Subject: [PATCH 020/119] Fix syntax error in test selector
---
.../Test/Mftf/Section/AdminCategorySidebarTreeSection.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategorySidebarTreeSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategorySidebarTreeSection.xml
index 498321b9f3d81..c94bca1ca5c13 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategorySidebarTreeSection.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Section/AdminCategorySidebarTreeSection.xml
@@ -12,7 +12,7 @@
-
+
From 204d0c3528fabf95c0554731dc37351bbeb26cc9 Mon Sep 17 00:00:00 2001
From: Ynhockey
Date: Thu, 4 Jun 2020 16:41:27 +0300
Subject: [PATCH 021/119] 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 022/119] 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 023/119] #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 024/119] 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 025/119] 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 026/119] 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 027/119] 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 028/119] 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 029/119] 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 030/119] 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 031/119] 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 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
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 @@
+
+
+
+
+
+
From 680ca2b76e5f64c1b629052930fe9663ca01e7a1 Mon Sep 17 00:00:00 2001
From: Alexander Steshuk
Date: Wed, 15 Jul 2020 14:41:57 +0300
Subject: [PATCH 032/119] 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 @@
+
From 44a650422ffebb6a33c92988c341e324f2d6f5b3 Mon Sep 17 00:00:00 2001
From: Dmitry Tsymbal
Date: Fri, 17 Jul 2020 11:22:52 +0300
Subject: [PATCH 033/119] 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 @@
+
From 82d60a3c1f7b08702f3701485d92411e4a309138 Mon Sep 17 00:00:00 2001
From: Wout Kramer
Date: Mon, 20 Jul 2020 11:36:23 +0200
Subject: [PATCH 034/119] Use static font name instead of variable when loading
fonts, because changing the variable's value (e.g. in a child theme) can
result in loading open sans under a wrong name
---
.../Magento/blank/web/css/source/_typography.less | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/app/design/frontend/Magento/blank/web/css/source/_typography.less b/app/design/frontend/Magento/blank/web/css/source/_typography.less
index 6807c0f692af8..02ccd90d4655d 100644
--- a/app/design/frontend/Magento/blank/web/css/source/_typography.less
+++ b/app/design/frontend/Magento/blank/web/css/source/_typography.less
@@ -9,7 +9,7 @@
& when (@media-common = true) {
.lib-font-face(
- @family-name: @font-family-name__base,
+ @family-name: 'Open Sans',
@font-path: '@{baseDir}fonts/opensans/light/opensans-300',
@font-weight: 300,
@font-style: normal,
@@ -17,7 +17,7 @@
);
.lib-font-face(
- @family-name: @font-family-name__base,
+ @family-name: 'Open Sans',
@font-path: '@{baseDir}fonts/opensans/regular/opensans-400',
@font-weight: 400,
@font-style: normal,
@@ -25,7 +25,7 @@
);
.lib-font-face(
- @family-name: @font-family-name__base,
+ @family-name: 'Open Sans',
@font-path: '@{baseDir}fonts/opensans/semibold/opensans-600',
@font-weight: 600,
@font-style: normal,
@@ -33,7 +33,7 @@
);
.lib-font-face(
- @family-name: @font-family-name__base,
+ @family-name: 'Open Sans',
@font-path: '@{baseDir}fonts/opensans/bold/opensans-700',
@font-weight: 700,
@font-style: normal,
From 67a4be3c2d31abb4b0198069e89589780c11fae6 Mon Sep 17 00:00:00 2001
From: ralbin
Date: Fri, 24 Jul 2020 16:53:15 -0500
Subject: [PATCH 035/119] Issue 25595 - multiple address virtual product error
at checkout fixed by adding a default message
---
app/code/Magento/Multishipping/etc/config.xml | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/app/code/Magento/Multishipping/etc/config.xml b/app/code/Magento/Multishipping/etc/config.xml
index aee4199ed4757..e7f247b5afba5 100644
--- a/app/code/Magento/Multishipping/etc/config.xml
+++ b/app/code/Magento/Multishipping/etc/config.xml
@@ -13,5 +13,10 @@
100
+
+
+ All shippable products have been removed from your order
+
+
From 8e1e390569f5d5d5fc27a2116f35faa1b7a55a2c Mon Sep 17 00:00:00 2001
From: joweecaquicla
Date: Wed, 5 Aug 2020 22:53:45 +0800
Subject: [PATCH 036/119] magento/adobe-stock-integration#1523: Switching
between Views does not change the selected folder. [Media Gallery] - modified
function to select folder when switching view
---
.../web/js/directory/directoryTree.js | 28 ++++++++-----------
1 file changed, 11 insertions(+), 17 deletions(-)
diff --git a/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/directory/directoryTree.js b/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/directory/directoryTree.js
index decc337e1b83c..f8d129e9d0489 100644
--- a/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/directory/directoryTree.js
+++ b/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/directory/directoryTree.js
@@ -26,7 +26,7 @@ define([
filterChips: '${ $.filterChipsProvider }'
},
listens: {
- '${ $.provider }:params.filters.path': 'clearFiltersHandle'
+ '${ $.provider }:params.filters.path': 'updateSelectedDirectory'
},
viewConfig: [{
component: 'Magento_MediaGalleryUi/js/directory/directories',
@@ -220,7 +220,7 @@ define([
this.firejsTreeEvents();
}.bind(this));
} else {
- this.checkChipFiltersState();
+ this.updateSelectedDirectory();
}
}.bind(this));
}.bind(this));
@@ -239,7 +239,7 @@ define([
}.bind(this));
$(this.directoryTreeSelector).on('loaded.jstree', function () {
- this.checkChipFiltersState();
+ this.updateSelectedDirectory();
}.bind(this));
},
@@ -247,7 +247,7 @@ define([
/**
* Verify directory filter on init event, select folder per directory filter state
*/
- checkChipFiltersState: function () {
+ updateSelectedDirectory: function () {
var currentFilterPath = this.filterChips().filters.path,
isMediaBrowser = !_.isUndefined(window.MediabrowserUtility),
currentTreePath;
@@ -260,6 +260,12 @@ define([
} else {
this.selectStorageRoot();
}
+
+ if (_.isUndefined(currentFilterPath)) {
+ $(this.directoryTreeSelector).jstree('deselect_all');
+ this.activeNode(null);
+ this.directories().setInActive();
+ }
},
/**
@@ -281,8 +287,7 @@ define([
* @param {String} currentFilterPath
*/
isFiltersApplied: function (currentFilterPath) {
- return !_.isUndefined(currentFilterPath) && currentFilterPath !== '' &&
- currentFilterPath !== 'wysiwyg' && currentFilterPath !== 'catalog/category';
+ return !_.isUndefined(currentFilterPath);
},
/**
@@ -302,17 +307,6 @@ define([
},
- /**
- * Listener to clear filters event
- */
- clearFiltersHandle: function () {
- if (_.isUndefined(this.filterChips().filters.path)) {
- $(this.directoryTreeSelector).jstree('deselect_all');
- this.activeNode(null);
- this.directories().setInActive();
- }
- },
-
/**
* Set active node filter, or deselect if the same node clicked
*
From ee2ab23e86b9e2ed06d3ddd96e8c82fc0877363f Mon Sep 17 00:00:00 2001
From: joweecaquicla
Date: Thu, 6 Aug 2020 01:05:56 +0800
Subject: [PATCH 037/119] magento/adobe-stock-integration#1523: Switching
between Views does not change the selected folder. [Media Gallery] - modified
functions
---
.../web/js/directory/directoryTree.js | 29 +++++++++++--------
1 file changed, 17 insertions(+), 12 deletions(-)
diff --git a/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/directory/directoryTree.js b/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/directory/directoryTree.js
index f8d129e9d0489..5981a7f09355d 100644
--- a/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/directory/directoryTree.js
+++ b/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/directory/directoryTree.js
@@ -252,19 +252,17 @@ define([
isMediaBrowser = !_.isUndefined(window.MediabrowserUtility),
currentTreePath;
- currentTreePath = this.isFiltersApplied(currentFilterPath) || !isMediaBrowser ? currentFilterPath :
- Base64.idDecode(window.MediabrowserUtility.pathId);
-
- if (this.folderExistsInTree(currentTreePath)) {
- this.locateNode(currentTreePath);
+ if (_.isUndefined(currentFilterPath)) {
+ this.clearFiltersHandle();
} else {
- this.selectStorageRoot();
- }
+ currentTreePath = this.isFiltersApplied(currentFilterPath) || !isMediaBrowser ? currentFilterPath :
+ Base64.idDecode(window.MediabrowserUtility.pathId);
- if (_.isUndefined(currentFilterPath)) {
- $(this.directoryTreeSelector).jstree('deselect_all');
- this.activeNode(null);
- this.directories().setInActive();
+ if (this.folderExistsInTree(currentTreePath)) {
+ this.locateNode(currentTreePath);
+ } else {
+ this.selectStorageRoot();
+ }
}
},
@@ -287,7 +285,8 @@ define([
* @param {String} currentFilterPath
*/
isFiltersApplied: function (currentFilterPath) {
- return !_.isUndefined(currentFilterPath);
+ return !_.isUndefined(currentFilterPath) && currentFilterPath !== ''
+ && currentFilterPath !== 'catalog/category';
},
/**
@@ -307,6 +306,12 @@ define([
},
+ clearFiltersHandle: function () {
+ $(this.directoryTreeSelector).jstree('deselect_all');
+ this.activeNode(null);
+ this.directories().setInActive();
+ },
+
/**
* Set active node filter, or deselect if the same node clicked
*
From 20dc8155942a7f3965f405074c03483032115a16 Mon Sep 17 00:00:00 2001
From: joweecaquicla
Date: Fri, 7 Aug 2020 04:15:43 +0800
Subject: [PATCH 038/119] magento/adobe-stock-integration#1523: Switching
between Views does not change the selected folder. [Media Gallery] -
implement request change and mftf test
---
.../AssertFolderIsChangedActionGroup.xml | 25 ++++++++
...nMediaGallerySwitchingBetweenViewsTest.xml | 63 +++++++++++++++++++
.../web/js/directory/directoryTree.js | 23 ++++---
3 files changed, 101 insertions(+), 10 deletions(-)
create mode 100644 app/code/Magento/MediaGalleryUi/Test/Mftf/ActionGroup/AssertFolderIsChangedActionGroup.xml
create mode 100644 app/code/Magento/MediaGalleryUi/Test/Mftf/Test/AdminMediaGallerySwitchingBetweenViewsTest.xml
diff --git a/app/code/Magento/MediaGalleryUi/Test/Mftf/ActionGroup/AssertFolderIsChangedActionGroup.xml b/app/code/Magento/MediaGalleryUi/Test/Mftf/ActionGroup/AssertFolderIsChangedActionGroup.xml
new file mode 100644
index 0000000000000..090dbed8b4f78
--- /dev/null
+++ b/app/code/Magento/MediaGalleryUi/Test/Mftf/ActionGroup/AssertFolderIsChangedActionGroup.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+ Assert that folder is changed
+
+
+
+
+
+
+
+ {{newSelectedFolder}}
+ {{oldSelectedFolder}}
+
+
+
diff --git a/app/code/Magento/MediaGalleryUi/Test/Mftf/Test/AdminMediaGallerySwitchingBetweenViewsTest.xml b/app/code/Magento/MediaGalleryUi/Test/Mftf/Test/AdminMediaGallerySwitchingBetweenViewsTest.xml
new file mode 100644
index 0000000000000..01b8c27b7371d
--- /dev/null
+++ b/app/code/Magento/MediaGalleryUi/Test/Mftf/Test/AdminMediaGallerySwitchingBetweenViewsTest.xml
@@ -0,0 +1,63 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/directory/directoryTree.js b/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/directory/directoryTree.js
index 5981a7f09355d..a0959fa90c7ba 100644
--- a/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/directory/directoryTree.js
+++ b/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/directory/directoryTree.js
@@ -254,15 +254,16 @@ define([
if (_.isUndefined(currentFilterPath)) {
this.clearFiltersHandle();
- } else {
- currentTreePath = this.isFiltersApplied(currentFilterPath) || !isMediaBrowser ? currentFilterPath :
- Base64.idDecode(window.MediabrowserUtility.pathId);
+ return;
+ }
- if (this.folderExistsInTree(currentTreePath)) {
- this.locateNode(currentTreePath);
- } else {
- this.selectStorageRoot();
- }
+ currentTreePath = this.isFiltersApplied(currentFilterPath) || !isMediaBrowser ? currentFilterPath :
+ Base64.idDecode(window.MediabrowserUtility.pathId);
+
+ if (this.folderExistsInTree(currentTreePath)) {
+ this.locateNode(currentTreePath);
+ } else {
+ this.selectStorageRoot();
}
},
@@ -285,8 +286,7 @@ define([
* @param {String} currentFilterPath
*/
isFiltersApplied: function (currentFilterPath) {
- return !_.isUndefined(currentFilterPath) && currentFilterPath !== ''
- && currentFilterPath !== 'catalog/category';
+ return !_.isUndefined(currentFilterPath) && currentFilterPath !== '';
},
/**
@@ -306,6 +306,9 @@ define([
},
+ /**
+ * Clear filters
+ */
clearFiltersHandle: function () {
$(this.directoryTreeSelector).jstree('deselect_all');
this.activeNode(null);
From a78ddde117df894ddab53c9f0d436a017b4da465 Mon Sep 17 00:00:00 2001
From: engcom-Echo
Date: Thu, 6 Aug 2020 16:14:51 +0300
Subject: [PATCH 039/119] add MFTF
---
.../Mftf/Section/StorefrontFooterSection.xml | 1 +
...reateStoreViewFillSortOrderActionGroup.xml | 21 ++++++
.../StorefrontCheckSortOrderStoreViewTest.xml | 72 +++++++++++++++++++
3 files changed, 94 insertions(+)
create mode 100644 app/code/Magento/Store/Test/Mftf/ActionGroup/AdminCreateStoreViewFillSortOrderActionGroup.xml
create mode 100644 app/code/Magento/Store/Test/Mftf/Test/StorefrontCheckSortOrderStoreViewTest.xml
diff --git a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontFooterSection.xml b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontFooterSection.xml
index 1c937637ad823..a7dd622c56a7f 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontFooterSection.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Section/StorefrontFooterSection.xml
@@ -9,6 +9,7 @@
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Page/etc/SectionObject.xsd">
diff --git a/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminCreateStoreViewFillSortOrderActionGroup.xml b/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminCreateStoreViewFillSortOrderActionGroup.xml
new file mode 100644
index 0000000000000..1b9b147209c66
--- /dev/null
+++ b/app/code/Magento/Store/Test/Mftf/ActionGroup/AdminCreateStoreViewFillSortOrderActionGroup.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+ Fill 'Sort Order' field
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Store/Test/Mftf/Test/StorefrontCheckSortOrderStoreViewTest.xml b/app/code/Magento/Store/Test/Mftf/Test/StorefrontCheckSortOrderStoreViewTest.xml
new file mode 100644
index 0000000000000..442ee99e12793
--- /dev/null
+++ b/app/code/Magento/Store/Test/Mftf/Test/StorefrontCheckSortOrderStoreViewTest.xml
@@ -0,0 +1,72 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{SecondStoreGroupUnique.name}}
+ $grabSwatchFirstOption
+
+
+ {{customStoreGroup.name}}
+ $grabSwatchSecondOption
+
+
+
From 58efb76acfb4f2f534ff73accee9fc1d0a7ad20f Mon Sep 17 00:00:00 2001
From: joweecaquicla
Date: Fri, 7 Aug 2020 22:17:49 +0800
Subject: [PATCH 040/119] magento/adobe-stock-integration#1523: Switching
between Views does not change the selected folder. [Media Gallery] - fix
failed static test
---
.../view/adminhtml/web/js/directory/directoryTree.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/directory/directoryTree.js b/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/directory/directoryTree.js
index a0959fa90c7ba..7f0973a543761 100644
--- a/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/directory/directoryTree.js
+++ b/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/directory/directoryTree.js
@@ -254,6 +254,7 @@ define([
if (_.isUndefined(currentFilterPath)) {
this.clearFiltersHandle();
+
return;
}
From 83b40124d87c7904d062577f21566eabdec15f8a Mon Sep 17 00:00:00 2001
From: Oleh Usik
Date: Mon, 10 Aug 2020 20:59:46 +0300
Subject: [PATCH 041/119] 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 @@
+
+
+
+
+
+
+ Click edit link for first row on the grid.
+
+
+
+
+
+
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 @@
-
-
+
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 @@
-
-
+
@@ -67,8 +66,7 @@
-
-
+
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 @@
-
-
+
@@ -67,8 +66,7 @@
-
-
+
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 @@
-
-
+
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 @@
-
-
+
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 @@
-
-
+
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 @@
-
-
+
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 @@
-
-
+
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 @@
-
-
+
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 @@
-
-
+
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 @@
-
-
+
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 @@
-
-
+
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 @@
-
-
+
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 @@
-
-
+
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 @@
-
-
+
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 @@
-
-
+
From 1b39196a80c9c4a3d229c121b647b82ae242193d Mon Sep 17 00:00:00 2001
From: "vadim.malesh"
Date: Tue, 11 Aug 2020 15:53:48 +0300
Subject: [PATCH 042/119] 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 @@
+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 3a1df1d28f8087ca12f3248c1fa359fc8a43272a Mon Sep 17 00:00:00 2001
From: ralbin
Date: Tue, 11 Aug 2020 09:21:51 -0500
Subject: [PATCH 043/119] Issue 25595 - Adding an entry in i18n for translation
---
app/code/Magento/Multishipping/i18n/en_US.csv | 1 +
1 file changed, 1 insertion(+)
diff --git a/app/code/Magento/Multishipping/i18n/en_US.csv b/app/code/Magento/Multishipping/i18n/en_US.csv
index f9ab587c65fa3..ad3e968d88cd5 100644
--- a/app/code/Magento/Multishipping/i18n/en_US.csv
+++ b/app/code/Magento/Multishipping/i18n/en_US.csv
@@ -92,3 +92,4 @@ Options,Options
"Error:","Error:"
"We are unable to process your request. Please, try again later.","We are unable to process your request. Please, try again later."
"Quote address for failed order ID "%1" not found.","Quote address for failed order ID "%1" not found."
+"All shippable products have been removed from your order","All shippable products have been removed from your order"
\ No newline at end of file
From c9f95060af1a600385e211727827579be8b512af Mon Sep 17 00:00:00 2001
From: Oleh Usik
Date: Tue, 11 Aug 2020 18:56:35 +0300
Subject: [PATCH 044/119] Add MFtf test for AdminAnalytics
---
.../Test/AdminAnalyticsCheckTrackingTest.xml | 33 +++++++++++++++++++
1 file changed, 33 insertions(+)
create mode 100644 app/code/Magento/AdminAnalytics/Test/Mftf/Test/AdminAnalyticsCheckTrackingTest.xml
diff --git a/app/code/Magento/AdminAnalytics/Test/Mftf/Test/AdminAnalyticsCheckTrackingTest.xml b/app/code/Magento/AdminAnalytics/Test/Mftf/Test/AdminAnalyticsCheckTrackingTest.xml
new file mode 100644
index 0000000000000..1de1a19f33f5f
--- /dev/null
+++ b/app/code/Magento/AdminAnalytics/Test/Mftf/Test/AdminAnalyticsCheckTrackingTest.xml
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
From db43cb8549d60f1eb7d2fcc4d80aec34bdc40fd4 Mon Sep 17 00:00:00 2001
From: Oleh Usik
Date: Tue, 11 Aug 2020 20:52:19 +0300
Subject: [PATCH 045/119] rename test
---
...eckTrackingTest.xml => AdminCheckAnalyticsTrackingTest.xml} | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
rename app/code/Magento/AdminAnalytics/Test/Mftf/Test/{AdminAnalyticsCheckTrackingTest.xml => AdminCheckAnalyticsTrackingTest.xml} (93%)
diff --git a/app/code/Magento/AdminAnalytics/Test/Mftf/Test/AdminAnalyticsCheckTrackingTest.xml b/app/code/Magento/AdminAnalytics/Test/Mftf/Test/AdminCheckAnalyticsTrackingTest.xml
similarity index 93%
rename from app/code/Magento/AdminAnalytics/Test/Mftf/Test/AdminAnalyticsCheckTrackingTest.xml
rename to app/code/Magento/AdminAnalytics/Test/Mftf/Test/AdminCheckAnalyticsTrackingTest.xml
index 1de1a19f33f5f..cd79851d16b96 100644
--- a/app/code/Magento/AdminAnalytics/Test/Mftf/Test/AdminAnalyticsCheckTrackingTest.xml
+++ b/app/code/Magento/AdminAnalytics/Test/Mftf/Test/AdminCheckAnalyticsTrackingTest.xml
@@ -8,11 +8,12 @@
-
+
+
From 88b21156b826141789d925f3f5c41cb7aa68e066 Mon Sep 17 00:00:00 2001
From: eduard13
Date: Wed, 15 Jul 2020 13:15:07 +0300
Subject: [PATCH 046/119] Updating the Wishlist GraphQl implementation
---
.../Product/BundleOptionDataProvider.php | 148 ++++++++++++++++++
.../Model/Resolver/AddProductsToWishlist.php | 2 +-
.../Resolver/CustomerWishlistResolver.php | 2 +-
.../Model/Resolver/CustomerWishlists.php | 102 ++++++++++++
.../Model/Resolver/ProductResolver.php | 7 +-
.../Resolver/RemoveProductsFromWishlist.php | 2 +-
.../Resolver/Type/Bundle/BundleOptions.php | 54 +++++++
.../Resolver/Type/Configurable/ChildSku.php | 43 +++++
.../Type/Configurable/ConfigurableOptions.php | 67 ++++++++
.../Resolver/Type/Downloadable/Links.php | 66 ++++++++
.../Model/Resolver/Type/WishlistItemType.php | 59 +++++++
.../Resolver/UpdateProductsInWishlist.php | 2 +-
.../Model/Resolver/WishlistById.php | 115 ++++++++++++++
.../Model/Resolver/WishlistItems.php | 98 ++++++++++++
.../Model/Resolver/WishlistItemsResolver.php | 2 +-
.../Model/Resolver/WishlistResolver.php | 2 +-
.../Magento/WishlistGraphQl/composer.json | 3 +
app/code/Magento/WishlistGraphQl/etc/di.xml | 21 +++
.../WishlistGraphQl/etc/schema.graphqls | 66 ++++++--
.../AddBundleProductToWishlistTest.php | 32 +++-
.../AddConfigurableProductToWishlistTest.php | 38 +++--
.../AddDownloadableProductToWishlistTest.php | 96 +++++++-----
.../GraphQl/Wishlist/CustomerWishlistTest.php | 2 +-
.../Wishlist/CustomerWishlistsTest.php | 142 +++++++++++++++++
.../DeleteProductsFromWishlistTest.php | 20 +--
... GetCustomOptionsWithUidForQueryBySku.php} | 6 +-
.../UpdateProductsFromWishlistTest.php | 22 +--
27 files changed, 1116 insertions(+), 103 deletions(-)
create mode 100644 app/code/Magento/Wishlist/Model/Product/BundleOptionDataProvider.php
create mode 100644 app/code/Magento/WishlistGraphQl/Model/Resolver/CustomerWishlists.php
create mode 100644 app/code/Magento/WishlistGraphQl/Model/Resolver/Type/Bundle/BundleOptions.php
create mode 100644 app/code/Magento/WishlistGraphQl/Model/Resolver/Type/Configurable/ChildSku.php
create mode 100644 app/code/Magento/WishlistGraphQl/Model/Resolver/Type/Configurable/ConfigurableOptions.php
create mode 100644 app/code/Magento/WishlistGraphQl/Model/Resolver/Type/Downloadable/Links.php
create mode 100644 app/code/Magento/WishlistGraphQl/Model/Resolver/Type/WishlistItemType.php
create mode 100644 app/code/Magento/WishlistGraphQl/Model/Resolver/WishlistById.php
create mode 100644 app/code/Magento/WishlistGraphQl/Model/Resolver/WishlistItems.php
create mode 100644 app/code/Magento/WishlistGraphQl/etc/di.xml
create mode 100644 dev/tests/api-functional/testsuite/Magento/GraphQl/Wishlist/CustomerWishlistsTest.php
rename dev/tests/api-functional/testsuite/Magento/GraphQl/Wishlist/{GetCustomOptionsWithIDV2ForQueryBySku.php => GetCustomOptionsWithUidForQueryBySku.php} (95%)
diff --git a/app/code/Magento/Wishlist/Model/Product/BundleOptionDataProvider.php b/app/code/Magento/Wishlist/Model/Product/BundleOptionDataProvider.php
new file mode 100644
index 0000000000000..406524c7a189d
--- /dev/null
+++ b/app/code/Magento/Wishlist/Model/Product/BundleOptionDataProvider.php
@@ -0,0 +1,148 @@
+pricingHelper = $pricingHelper;
+ $this->serializer = $serializer;
+ $this->configuration = $configuration;
+ }
+
+ /**
+ * Extract data for a bundled wishlist item
+ *
+ * @param Item $item
+ *
+ * @return array
+ */
+ public function getData(Item $item): array
+ {
+ $options = [];
+ $product = $item->getProduct();
+ $optionsQuoteItemOption = $item->getOptionByCode('bundle_option_ids');
+ $bundleOptionsIds = $optionsQuoteItemOption
+ ? $this->serializer->unserialize($optionsQuoteItemOption->getValue())
+ : [];
+
+ /** @var Type $typeInstance */
+ $typeInstance = $product->getTypeInstance();
+
+ if ($bundleOptionsIds) {
+ $selectionsQuoteItemOption = $item->getOptionByCode('bundle_selection_ids');
+ $optionsCollection = $typeInstance->getOptionsByIds($bundleOptionsIds, $product);
+ $bundleSelectionIds = $this->serializer->unserialize($selectionsQuoteItemOption->getValue());
+
+ if (!empty($bundleSelectionIds)) {
+ $selectionsCollection = $typeInstance->getSelectionsByIds($bundleSelectionIds, $product);
+ $bundleOptions = $optionsCollection->appendSelections($selectionsCollection, true);
+
+ $options = $this->buildBundleOptions($bundleOptions, $item);
+ }
+ }
+
+ return $options;
+ }
+
+ /**
+ * Build bundle product options based on current selection
+ *
+ * @param Option[] $bundleOptions
+ * @param Item $item
+ *
+ * @return array
+ */
+ private function buildBundleOptions(array $bundleOptions, Item $item): array
+ {
+ $options = [];
+ foreach ($bundleOptions as $bundleOption) {
+ if (!$bundleOption->getSelections()) {
+ continue;
+ }
+
+ $options[] = [
+ 'id' => $bundleOption->getId(),
+ 'label' => $bundleOption->getTitle(),
+ 'type' => $bundleOption->getType(),
+ 'values' => $this->buildBundleOptionValues($bundleOption->getSelections(), $item),
+ ];
+ }
+
+ return $options;
+ }
+
+ /**
+ * Build bundle product option values based on current selection
+ *
+ * @param Product[] $selections
+ * @param Item $item
+ *
+ * @return array
+ *
+ * @throws LocalizedException
+ */
+ private function buildBundleOptionValues(array $selections, Item $item): array
+ {
+ $product = $item->getProduct();
+ $values = [];
+
+ foreach ($selections as $selection) {
+ $qty = (float) $this->configuration->getSelectionQty($product, $selection->getSelectionId());
+ if (!$qty) {
+ continue;
+ }
+
+ $selectionPrice = $this->configuration->getSelectionFinalPrice($item, $selection);
+ $values[] = [
+ 'label' => $selection->getName(),
+ 'id' => $selection->getSelectionId(),
+ 'quantity' => $qty,
+ 'price' => $this->pricingHelper->currency($selectionPrice, false, false),
+ ];
+ }
+
+ return $values;
+ }
+}
diff --git a/app/code/Magento/WishlistGraphQl/Model/Resolver/AddProductsToWishlist.php b/app/code/Magento/WishlistGraphQl/Model/Resolver/AddProductsToWishlist.php
index 11c8446a72a9d..fdfc2c373aa42 100644
--- a/app/code/Magento/WishlistGraphQl/Model/Resolver/AddProductsToWishlist.php
+++ b/app/code/Magento/WishlistGraphQl/Model/Resolver/AddProductsToWishlist.php
@@ -83,7 +83,7 @@ public function resolve(
array $args = null
) {
if (!$this->wishlistConfig->isEnabled()) {
- throw new GraphQlInputException(__('The wishlist is not currently available.'));
+ throw new GraphQlInputException(__('The wishlist configuration is currently disabled.'));
}
$customerId = $context->getUserId();
diff --git a/app/code/Magento/WishlistGraphQl/Model/Resolver/CustomerWishlistResolver.php b/app/code/Magento/WishlistGraphQl/Model/Resolver/CustomerWishlistResolver.php
index cad574ef56ed2..b73afe27883dd 100644
--- a/app/code/Magento/WishlistGraphQl/Model/Resolver/CustomerWishlistResolver.php
+++ b/app/code/Magento/WishlistGraphQl/Model/Resolver/CustomerWishlistResolver.php
@@ -54,7 +54,7 @@ public function resolve(
array $args = null
) {
if (!$this->wishlistConfig->isEnabled()) {
- throw new GraphQlInputException(__('The wishlist is not currently available.'));
+ throw new GraphQlInputException(__('The wishlist configuration is currently disabled.'));
}
if (false === $context->getExtensionAttributes()->getIsCustomer()) {
diff --git a/app/code/Magento/WishlistGraphQl/Model/Resolver/CustomerWishlists.php b/app/code/Magento/WishlistGraphQl/Model/Resolver/CustomerWishlists.php
new file mode 100644
index 0000000000000..ad0c73691720a
--- /dev/null
+++ b/app/code/Magento/WishlistGraphQl/Model/Resolver/CustomerWishlists.php
@@ -0,0 +1,102 @@
+wishlistDataMapper = $wishlistDataMapper;
+ $this->wishlistConfig = $wishlistConfig;
+ $this->wishlistCollectionFactory = $wishlistCollectionFactory;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function resolve(
+ Field $field,
+ $context,
+ ResolveInfo $info,
+ array $value = null,
+ array $args = null
+ ) {
+ if (!$this->wishlistConfig->isEnabled()) {
+ throw new GraphQlInputException(__('The wishlist configuration is currently disabled.'));
+ }
+
+ $customerId = $context->getUserId();
+
+ if (null === $customerId || 0 === $customerId) {
+ throw new GraphQlAuthorizationException(
+ __('The current user cannot perform operations on wishlist')
+ );
+ }
+
+ $currentPage = $args['currentPage'] ?? 1;
+ $pageSize = $args['pageSize'] ?? 20;
+
+ /** @var WishlistCollection $collection */
+ $collection = $this->wishlistCollectionFactory->create();
+ $collection->filterByCustomerId($customerId);
+
+ if ($currentPage > 0) {
+ $collection->setCurPage($currentPage);
+ }
+
+ if ($pageSize > 0) {
+ $collection->setPageSize($pageSize);
+ }
+
+ $wishlists = [];
+
+ /** @var Wishlist $wishList */
+ foreach ($collection->getItems() as $wishList) {
+ array_push($wishlists, $this->wishlistDataMapper->map($wishList));
+ }
+
+ return $wishlists;
+ }
+}
diff --git a/app/code/Magento/WishlistGraphQl/Model/Resolver/ProductResolver.php b/app/code/Magento/WishlistGraphQl/Model/Resolver/ProductResolver.php
index 65c8498fc89ad..d292d3eab9910 100644
--- a/app/code/Magento/WishlistGraphQl/Model/Resolver/ProductResolver.php
+++ b/app/code/Magento/WishlistGraphQl/Model/Resolver/ProductResolver.php
@@ -7,6 +7,7 @@
namespace Magento\WishlistGraphQl\Model\Resolver;
+use Magento\Catalog\Model\Product;
use Magento\CatalogGraphQl\Model\ProductDataProvider;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\GraphQl\Config\Element\Field;
@@ -45,9 +46,9 @@ public function resolve(
if (!isset($value['model'])) {
throw new LocalizedException(__('Missing key "model" in Wishlist Item value data'));
}
- /** @var Item $wishlistItem */
- $wishlistItem = $value['model'];
+ /** @var Product $product */
+ $product = $value['model'];
- return $this->productDataProvider->getProductDataById((int)$wishlistItem->getProductId());
+ return $this->productDataProvider->getProductDataById((int) $product->getId());
}
}
diff --git a/app/code/Magento/WishlistGraphQl/Model/Resolver/RemoveProductsFromWishlist.php b/app/code/Magento/WishlistGraphQl/Model/Resolver/RemoveProductsFromWishlist.php
index 1c741361ea7b7..11a962acbf787 100644
--- a/app/code/Magento/WishlistGraphQl/Model/Resolver/RemoveProductsFromWishlist.php
+++ b/app/code/Magento/WishlistGraphQl/Model/Resolver/RemoveProductsFromWishlist.php
@@ -83,7 +83,7 @@ public function resolve(
array $args = null
) {
if (!$this->wishlistConfig->isEnabled()) {
- throw new GraphQlInputException(__('The wishlist is not currently available.'));
+ throw new GraphQlInputException(__('The wishlist configuration is currently disabled.'));
}
$customerId = $context->getUserId();
diff --git a/app/code/Magento/WishlistGraphQl/Model/Resolver/Type/Bundle/BundleOptions.php b/app/code/Magento/WishlistGraphQl/Model/Resolver/Type/Bundle/BundleOptions.php
new file mode 100644
index 0000000000000..11af9bbbc60b9
--- /dev/null
+++ b/app/code/Magento/WishlistGraphQl/Model/Resolver/Type/Bundle/BundleOptions.php
@@ -0,0 +1,54 @@
+bundleOptionDataProvider = $bundleOptionDataProvider;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function resolve(
+ Field $field,
+ $context,
+ ResolveInfo $info,
+ array $value = null,
+ array $args = null
+ ) {
+ if (!$value['wishlistItemModel'] instanceof Item) {
+ throw new LocalizedException(__('"wishlistItemModel" should be a "%instance" instance', [
+ 'instance' => Item::class
+ ]));
+ }
+
+ return $this->bundleOptionDataProvider->getData($value['wishlistItemModel']);
+ }
+}
diff --git a/app/code/Magento/WishlistGraphQl/Model/Resolver/Type/Configurable/ChildSku.php b/app/code/Magento/WishlistGraphQl/Model/Resolver/Type/Configurable/ChildSku.php
new file mode 100644
index 0000000000000..7014312ce4765
--- /dev/null
+++ b/app/code/Magento/WishlistGraphQl/Model/Resolver/Type/Configurable/ChildSku.php
@@ -0,0 +1,43 @@
+ Item::class
+ ]));
+ }
+
+ /** @var Item $wishlistItem */
+ $wishlistItem = $value['wishlistItemModel'];
+ $optionProduct = $wishlistItem->getProduct()->getCustomOption('simple_product')->getProduct();
+
+ return $optionProduct->getSku();
+ }
+}
diff --git a/app/code/Magento/WishlistGraphQl/Model/Resolver/Type/Configurable/ConfigurableOptions.php b/app/code/Magento/WishlistGraphQl/Model/Resolver/Type/Configurable/ConfigurableOptions.php
new file mode 100644
index 0000000000000..f3e7be1395a24
--- /dev/null
+++ b/app/code/Magento/WishlistGraphQl/Model/Resolver/Type/Configurable/ConfigurableOptions.php
@@ -0,0 +1,67 @@
+configurationHelper = $configurationHelper;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function resolve(
+ Field $field,
+ $context,
+ ResolveInfo $info,
+ array $value = null,
+ array $args = null
+ ) {
+ if (!$value['wishlistItemModel'] instanceof Item) {
+ throw new LocalizedException(__('"wishlistItemModel" should be a "%instance" instance', [
+ 'instance' => Item::class
+ ]));
+ }
+
+ /** @var Item $wishlistItem */
+ $wishlistItem = $value['wishlistItemModel'];
+ $result = [];
+
+ foreach ($this->configurationHelper->getOptions($wishlistItem) as $option) {
+ $result[] = [
+ 'id' => $option['option_id'],
+ 'option_label' => $option['label'],
+ 'value_id' => $option['option_value'],
+ 'value_label' => $option['value'],
+ ];
+ }
+
+ return $result;
+ }
+}
diff --git a/app/code/Magento/WishlistGraphQl/Model/Resolver/Type/Downloadable/Links.php b/app/code/Magento/WishlistGraphQl/Model/Resolver/Type/Downloadable/Links.php
new file mode 100644
index 0000000000000..aa6f4c70318da
--- /dev/null
+++ b/app/code/Magento/WishlistGraphQl/Model/Resolver/Type/Downloadable/Links.php
@@ -0,0 +1,66 @@
+convertLinksToArray = $convertLinksToArray;
+ $this->downloadableConfiguration = $downloadableConfiguration;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function resolve(
+ Field $field,
+ $context,
+ ResolveInfo $info,
+ array $value = null,
+ array $args = null
+ ) {
+ if (!isset($value['wishlistItemModel'])) {
+ throw new LocalizedException(__('Missing key "wishlistItemModel" in Wishlist Item value data'));
+ }
+ /** @var Item $wishlistItem */
+ $wishlistItem = $value['wishlistItemModel'];
+
+ $links = $this->downloadableConfiguration->getLinks($wishlistItem);
+ $links = $this->convertLinksToArray->execute($links);
+
+ return $links;
+ }
+}
diff --git a/app/code/Magento/WishlistGraphQl/Model/Resolver/Type/WishlistItemType.php b/app/code/Magento/WishlistGraphQl/Model/Resolver/Type/WishlistItemType.php
new file mode 100644
index 0000000000000..ae4a6ed2b6a64
--- /dev/null
+++ b/app/code/Magento/WishlistGraphQl/Model/Resolver/Type/WishlistItemType.php
@@ -0,0 +1,59 @@
+supportedTypes = $supportedTypes;
+ }
+
+ /**
+ * Resolving wishlist item type
+ *
+ * @param array $data
+ *
+ * @return string
+ *
+ * @throws LocalizedException
+ */
+ public function resolveType(array $data): string
+ {
+ if (!$data['model'] instanceof ProductInterface) {
+ throw new LocalizedException(__('"model" should be a "%instance" instance', [
+ 'instance' => ProductInterface::class
+ ]));
+ }
+
+ $productTypeId = $data['model']->getTypeId();
+
+ if (!isset($this->supportedTypes[$productTypeId])) {
+ throw new LocalizedException(
+ __('Product "%product_type" type is not supported', ['product_type' => $productTypeId])
+ );
+ }
+
+ return $this->supportedTypes[$productTypeId];
+ }
+}
diff --git a/app/code/Magento/WishlistGraphQl/Model/Resolver/UpdateProductsInWishlist.php b/app/code/Magento/WishlistGraphQl/Model/Resolver/UpdateProductsInWishlist.php
index 50a56863596c0..e599323f04c42 100644
--- a/app/code/Magento/WishlistGraphQl/Model/Resolver/UpdateProductsInWishlist.php
+++ b/app/code/Magento/WishlistGraphQl/Model/Resolver/UpdateProductsInWishlist.php
@@ -83,7 +83,7 @@ public function resolve(
array $args = null
) {
if (!$this->wishlistConfig->isEnabled()) {
- throw new GraphQlInputException(__('The wishlist is not currently available.'));
+ throw new GraphQlInputException(__('The wishlist configuration is currently disabled.'));
}
$customerId = $context->getUserId();
diff --git a/app/code/Magento/WishlistGraphQl/Model/Resolver/WishlistById.php b/app/code/Magento/WishlistGraphQl/Model/Resolver/WishlistById.php
new file mode 100644
index 0000000000000..1ddf91637fe90
--- /dev/null
+++ b/app/code/Magento/WishlistGraphQl/Model/Resolver/WishlistById.php
@@ -0,0 +1,115 @@
+wishlistResource = $wishlistResource;
+ $this->wishlistFactory = $wishlistFactory;
+ $this->wishlistDataMapper = $wishlistDataMapper;
+ $this->wishlistConfig = $wishlistConfig;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function resolve(
+ Field $field,
+ $context,
+ ResolveInfo $info,
+ array $value = null,
+ array $args = null
+ ) {
+ if (!$this->wishlistConfig->isEnabled()) {
+ throw new GraphQlInputException(__('The wishlist configuration is currently disabled.'));
+ }
+
+ $customerId = $context->getUserId();
+
+ if (null === $customerId || 0 === $customerId) {
+ throw new GraphQlAuthorizationException(
+ __('The current user cannot perform operations on wishlist')
+ );
+ }
+
+ $wishlist = $this->getWishlist((int) $args['id'], $customerId);
+
+ if (null === $wishlist->getId() || (int) $wishlist->getCustomerId() !== $customerId) {
+ return [];
+ }
+
+ return $this->wishlistDataMapper->map($wishlist);
+ }
+
+ /**
+ * Get wishlist
+ *
+ * @param int $wishlistId
+ * @param int $customerId
+ *
+ * @return Wishlist
+ */
+ private function getWishlist(int $wishlistId, int $customerId): Wishlist
+ {
+ $wishlist = $this->wishlistFactory->create();
+
+ if ($wishlistId > 0) {
+ $this->wishlistResource->load($wishlist, $wishlistId);
+ } else {
+ $this->wishlistResource->load($wishlist, $customerId, 'customer_id');
+ }
+
+ return $wishlist;
+ }
+}
diff --git a/app/code/Magento/WishlistGraphQl/Model/Resolver/WishlistItems.php b/app/code/Magento/WishlistGraphQl/Model/Resolver/WishlistItems.php
new file mode 100644
index 0000000000000..1fa750af05e5d
--- /dev/null
+++ b/app/code/Magento/WishlistGraphQl/Model/Resolver/WishlistItems.php
@@ -0,0 +1,98 @@
+wishlistItemCollectionFactory = $wishlistItemCollectionFactory;
+ $this->storeManager = $storeManager;
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function resolve(
+ Field $field,
+ $context,
+ ResolveInfo $info,
+ array $value = null,
+ array $args = null
+ ) {
+ if (!isset($value['model'])) {
+ throw new LocalizedException(__('Missing key "model" in Wishlist value data'));
+ }
+ /** @var Wishlist $wishlist */
+ $wishlist = $value['model'];
+
+ $wishlistItems = $this->getWishListItems($wishlist);
+
+ $data = [];
+ foreach ($wishlistItems as $wishlistItem) {
+ $data[] = [
+ 'id' => $wishlistItem->getId(),
+ 'quantity' => $wishlistItem->getData('qty'),
+ 'description' => $wishlistItem->getDescription(),
+ 'added_at' => $wishlistItem->getAddedAt(),
+ 'model' => $wishlistItem->getProduct(),
+ 'wishlistItemModel' => $wishlistItem,
+ ];
+ }
+ return $data;
+ }
+
+ /**
+ * Get wishlist items
+ *
+ * @param Wishlist $wishlist
+ * @return Item[]
+ */
+ private function getWishListItems(Wishlist $wishlist): array
+ {
+ /** @var WishlistItemCollection $wishlistItemCollection */
+ $wishlistItemCollection = $this->wishlistItemCollectionFactory->create();
+ $wishlistItemCollection
+ ->addWishlistFilter($wishlist)
+ ->addStoreFilter(array_map(function (StoreInterface $store) {
+ return $store->getId();
+ }, $this->storeManager->getStores()))
+ ->setVisibilityFilter();
+ return $wishlistItemCollection->getItems();
+ }
+}
diff --git a/app/code/Magento/WishlistGraphQl/Model/Resolver/WishlistItemsResolver.php b/app/code/Magento/WishlistGraphQl/Model/Resolver/WishlistItemsResolver.php
index dfbbf6543f66f..36a03da2b79a9 100644
--- a/app/code/Magento/WishlistGraphQl/Model/Resolver/WishlistItemsResolver.php
+++ b/app/code/Magento/WishlistGraphQl/Model/Resolver/WishlistItemsResolver.php
@@ -70,7 +70,7 @@ public function resolve(
'qty' => $wishlistItem->getData('qty'),
'description' => $wishlistItem->getDescription(),
'added_at' => $wishlistItem->getAddedAt(),
- 'model' => $wishlistItem,
+ 'model' => $wishlistItem->getProduct(),
];
}
return $data;
diff --git a/app/code/Magento/WishlistGraphQl/Model/Resolver/WishlistResolver.php b/app/code/Magento/WishlistGraphQl/Model/Resolver/WishlistResolver.php
index 09c0a8a935a6c..f31b403a514fb 100644
--- a/app/code/Magento/WishlistGraphQl/Model/Resolver/WishlistResolver.php
+++ b/app/code/Magento/WishlistGraphQl/Model/Resolver/WishlistResolver.php
@@ -63,7 +63,7 @@ public function resolve(
array $args = null
) {
if (!$this->wishlistConfig->isEnabled()) {
- throw new GraphQlInputException(__('The wishlist is not currently available.'));
+ throw new GraphQlInputException(__('The wishlist configuration is currently disabled.'));
}
$customerId = $context->getUserId();
diff --git a/app/code/Magento/WishlistGraphQl/composer.json b/app/code/Magento/WishlistGraphQl/composer.json
index 7a3fca599a4b3..ba0ed697c3692 100644
--- a/app/code/Magento/WishlistGraphQl/composer.json
+++ b/app/code/Magento/WishlistGraphQl/composer.json
@@ -5,7 +5,10 @@
"require": {
"php": "~7.3.0||~7.4.0",
"magento/framework": "*",
+ "magento/module-catalog": "*",
"magento/module-catalog-graph-ql": "*",
+ "magento/module-downloadable": "*",
+ "magento/module-downloadable-graphql": "*",
"magento/module-wishlist": "*",
"magento/module-store": "*"
},
diff --git a/app/code/Magento/WishlistGraphQl/etc/di.xml b/app/code/Magento/WishlistGraphQl/etc/di.xml
new file mode 100644
index 0000000000000..de1a62225672a
--- /dev/null
+++ b/app/code/Magento/WishlistGraphQl/etc/di.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+ - SimpleWishlistItem
+ - VirtualWishlistItem
+ - ConfigurableWishlistItem
+ - DownloadableWishlistItem
+ - BundleWishlistItem
+
+
+
+
diff --git a/app/code/Magento/WishlistGraphQl/etc/schema.graphqls b/app/code/Magento/WishlistGraphQl/etc/schema.graphqls
index 794e90ed9f9a9..e6930ac331ad0 100644
--- a/app/code/Magento/WishlistGraphQl/etc/schema.graphqls
+++ b/app/code/Magento/WishlistGraphQl/etc/schema.graphqls
@@ -6,7 +6,12 @@ type Query {
}
type Customer {
- wishlist: Wishlist! @resolver(class:"\\Magento\\WishlistGraphQl\\Model\\Resolver\\CustomerWishlistResolver") @doc(description: "Contains the contents of a customer's wish lists") @cache(cacheable: false)
+ wishlists(
+ pageSize: Int = 20 @doc(description: "Specifies the maximum number of results to return at once. This attribute is optional."),
+ currentPage: Int = 1 @doc(description: "Specifies which page of results to return. The default value is 1.")
+ ): [Wishlist!]! @doc(description: "Customer wishlists are limited to a max of 1 wishlist in Magento Open Source") @resolver(class:"\\Magento\\WishlistGraphQl\\Model\\Resolver\\CustomerWishlists")
+ wishlist: Wishlist! @deprecated(reason: "Use `Customer.wishlists` or `Customer.wishlist_v2`") @resolver(class:"\\Magento\\WishlistGraphQl\\Model\\Resolver\\CustomerWishlistResolver") @doc(description: "Contains the contents of a customer's wish lists") @cache(cacheable: false)
+ wishlist_v2(id: ID!): Wishlist @doc(description: "Get the customer's wishlist by an ID") @resolver(class: "\\Magento\\WishlistGraphQl\\Model\\Resolver\\WishlistById")
}
type WishlistOutput @doc(description: "Deprecated: `Wishlist` type should be used instead") {
@@ -19,12 +24,42 @@ type WishlistOutput @doc(description: "Deprecated: `Wishlist` type should be use
type Wishlist {
id: ID @doc(description: "Wishlist unique identifier")
- items: [WishlistItem] @resolver(class: "\\Magento\\WishlistGraphQl\\Model\\Resolver\\WishlistItemsResolver") @doc(description: "An array of items in the customer's wish list"),
- items_count: Int @doc(description: "The number of items in the wish list"),
- sharing_code: String @doc(description: "An encrypted code that Magento uses to link to the wish list"),
+ items: [WishlistItem] @resolver(class: "\\Magento\\WishlistGraphQl\\Model\\Resolver\\WishlistItemsResolver") @doc(description: "Use field `items_v2` from type `Wishlist` instead")
+ items_v2: [WishlistItemInterface] @resolver(class: "\\Magento\\WishlistGraphQl\\Model\\Resolver\\WishlistItems") @doc(description: "An array of items in the customer's wishlist")
+ items_count: Int @doc(description: "The number of items in the wish list")
+ sharing_code: String @doc(description: "An encrypted code that Magento uses to link to the wish list")
updated_at: String @doc(description: "The time of the last modification to the wish list")
}
+interface WishlistItemInterface @typeResolver(class: "Magento\\WishlistGraphQl\\Model\\Resolver\\Type\\WishlistItemType") {
+ id: ID
+ quantity: Float
+ description: String
+ added_at: String
+ product: ProductInterface @resolver(class: "\\Magento\\WishlistGraphQl\\Model\\Resolver\\ProductResolver")
+ customizable_options: [SelectedCustomizableOption]
+}
+
+type SimpleWishlistItem implements WishlistItemInterface @doc(description: "Simple Wishlist Item") {
+}
+
+type VirtualWishlistItem implements WishlistItemInterface @doc(description: "Virtual Wishlist Item") {
+}
+
+type ConfigurableWishlistItem implements WishlistItemInterface {
+ child_sku: String! @doc(description: "SKU of the simple product corresponding to a set of selected configurable options.") @resolver(class: "\\Magento\\WishlistGraphQl\\Model\\Resolver\\Type\\Configurable\\ChildSku")
+ configurable_options: [SelectedConfigurableOption!] @resolver(class: "\\Magento\\WishlistGraphQl\\Model\\Resolver\\Type\\Configurable\\ConfigurableOptions")
+}
+
+type DownloadableWishlistItem implements WishlistItemInterface @doc(description: "Downloadable Wishlist Item") {
+ links_v2: [DownloadableProductLinks] @doc(description: "An array containing information about the selected links") @resolver(class: "\\Magento\\WishlistGraphQl\\Model\\Resolver\\Type\\Downloadable\\Links")
+ samples: [DownloadableProductSamples] @doc(description: "DownloadableProductSamples defines characteristics of a downloadable product") @resolver(class: "Magento\\DownloadableGraphQl\\Resolver\\Product\\Samples")
+}
+
+type BundleWishlistItem implements WishlistItemInterface {
+ bundle_options: [SelectedBundleOption!] @doc(description: "An array containing information about the selected bundled items") @resolver(class: "\\Magento\\WishlistGraphQl\\Model\\Resolver\\Type\\Bundle\\BundleOptions")
+}
+
type WishlistItem {
id: Int @doc(description: "The wish list item ID")
qty: Float @doc(description: "The quantity of this wish list item"),
@@ -43,34 +78,45 @@ input WishlistItemInput @doc(description: "Defines the items to add to a wish li
sku: String @doc(description: "The SKU of the product to add. For complex product types, specify the child product SKU")
quantity: Float @doc(description: "The amount or number of items to add")
parent_sku: String @doc(description: "For complex product types, the SKU of the parent product")
- selected_options: [String!] @doc(description: "An array of strings corresponding to options the customer selected")
+ selected_options: [ID!] @doc(description: "An array of strings corresponding to options the customer selected")
entered_options: [EnteredOptionInput!] @doc(description: "An array of options that the customer entered")
}
type AddProductsToWishlistOutput @doc(description: "Contains the customer's wish list and any errors encountered") {
wishlist: Wishlist! @doc(description: "Contains the wish list with all items that were successfully added")
- userInputErrors:[CheckoutUserInputError]! @doc(description: "An array of errors encountered while adding products to a wish list")
+ userInputErrors:[WishListUserInputError]! @doc(description: "An array of errors encountered while adding products to a wish list")
}
input EnteredOptionInput @doc(description: "Defines a customer-entered option") {
- id: String! @doc(description: "A base64 encoded ID")
+ id: String! @doc(description: "An encoded ID")
value: String! @doc(description: "Text the customer entered")
}
type RemoveProductsFromWishlistOutput @doc(description: "Contains the customer's wish list and any errors encountered") {
wishlist: Wishlist! @doc(description: "Contains the wish list with after items were successfully deleted")
- userInputErrors:[CheckoutUserInputError]! @doc(description:"An array of errors encountered while deleting products from a wish list")
+ userInputErrors:[WishListUserInputError]! @doc(description:"An array of errors encountered while deleting products from a wish list")
}
input WishlistItemUpdateInput @doc(description: "Defines updates to items in a wish list") {
wishlist_item_id: ID @doc(description: "The ID of the wishlist item to update")
quantity: Float @doc(description: "The new amount or number of this item")
description: String @doc(description: "Describes the update")
- selected_options: [String!] @doc(description: "An array of strings corresponding to options the customer selected")
+ selected_options: [ID!] @doc(description: "An array of strings corresponding to options the customer selected")
entered_options: [EnteredOptionInput!] @doc(description: "An array of options that the customer entered")
}
type UpdateProductsInWishlistOutput @doc(description: "Contains the customer's wish list and any errors encountered") {
wishlist: Wishlist! @doc(description: "Contains the wish list with all items that were successfully updated")
- userInputErrors:[CheckoutUserInputError]! @doc(description:"An array of errors encountered while updating products in a wish list")
+ userInputErrors:[WishListUserInputError]! @doc(description:"An array of errors encountered while updating products in a wish list")
+}
+
+type WishListUserInputError @doc(description:"An error encountered while performing operations with WishList.") {
+ message: String! @doc(description: "A localized error message")
+ path: [String]! @doc(description: "Path to the input field that caused an error. See the GraphQL specification about path errors for details: http://spec.graphql.org/draft/#sec-Errors")
+ code: WishListUserInputErrorType! @doc(description: "Wishlist-specific error code")
+}
+
+enum WishListUserInputErrorType {
+ PRODUCT_NOT_FOUND
+ UNDEFINED
}
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Wishlist/AddBundleProductToWishlistTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Wishlist/AddBundleProductToWishlistTest.php
index c0199e8908d0e..ecc88bfbe1455 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Wishlist/AddBundleProductToWishlistTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Wishlist/AddBundleProductToWishlistTest.php
@@ -16,6 +16,7 @@
use Magento\Integration\Api\CustomerTokenServiceInterface;
use Magento\TestFramework\Helper\Bootstrap;
use Magento\TestFramework\TestCase\GraphQlAbstract;
+use Magento\Ui\Component\Form\Element\Select;
use Magento\Wishlist\Model\Item;
use Magento\Wishlist\Model\WishlistFactory;
@@ -74,7 +75,7 @@ public function testAddBundleProductWithOptions(): void
$selection = $typeInstance->getSelectionsCollection([$option->getId()], $product)->getFirstItem();
$optionId = $option->getId();
$selectionId = $selection->getSelectionId();
- $bundleOptions = $this->generateBundleOptionIdV2((int) $optionId, (int) $selectionId, $optionQty);
+ $bundleOptions = $this->generateBundleOptionUid((int) $optionId, (int) $selectionId, $optionQty);
$query = $this->getQuery($sku, $qty, $bundleOptions);
$response = $this->graphQlMutation($query, [], '', $this->getHeaderMap());
@@ -88,9 +89,13 @@ public function testAddBundleProductWithOptions(): void
$this->assertEquals($wishlist->getItemsCount(), $response['items_count']);
$this->assertEquals($wishlist->getSharingCode(), $response['sharing_code']);
$this->assertEquals($wishlist->getUpdatedAt(), $response['updated_at']);
- $this->assertEquals($item->getData('qty'), $response['items'][0]['qty']);
- $this->assertEquals($item->getDescription(), $response['items'][0]['description']);
- $this->assertEquals($item->getAddedAt(), $response['items'][0]['added_at']);
+ $this->assertEquals($item->getData('qty'), $response['items_v2'][0]['quantity']);
+ $this->assertEquals($item->getDescription(), $response['items_v2'][0]['description']);
+ $this->assertEquals($item->getAddedAt(), $response['items_v2'][0]['added_at']);
+ $this->assertNotEmpty($response['items_v2'][0]['bundle_options']);
+ $bundleOptions = $response['items_v2'][0]['bundle_options'];
+ $this->assertEquals('Bundle Product Items', $bundleOptions[0]['label']);
+ $this->assertEquals(Select::NAME, $bundleOptions[0]['type']);
}
/**
@@ -149,11 +154,24 @@ private function getQuery(
sharing_code
items_count
updated_at
- items {
+ items_v2 {
id
description
- qty
+ quantity
added_at
+ ... on BundleWishlistItem {
+ bundle_options {
+ id
+ label
+ type
+ values {
+ id
+ label
+ quantity
+ price
+ }
+ }
+ }
}
}
}
@@ -169,7 +187,7 @@ private function getQuery(
*
* @return string
*/
- private function generateBundleOptionIdV2(int $optionId, int $selectionId, int $quantity): string
+ private function generateBundleOptionUid(int $optionId, int $selectionId, int $quantity): string
{
return base64_encode("bundle/$optionId/$selectionId/$quantity");
}
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Wishlist/AddConfigurableProductToWishlistTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Wishlist/AddConfigurableProductToWishlistTest.php
index 386df99f0d211..57e0852db00dc 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Wishlist/AddConfigurableProductToWishlistTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Wishlist/AddConfigurableProductToWishlistTest.php
@@ -57,7 +57,7 @@ public function testAddDownloadableProductWithOptions(): void
$valueIndex = $product['configurable_options'][0]['values'][0]['value_index'];
$childSku = $product['variants'][0]['product']['sku'];
$parentSku = $product['sku'];
- $selectedConfigurableOptionsQuery = $this->generateSuperAttributesIdV2Query($attributeId, $valueIndex);
+ $selectedConfigurableOptionsQuery = $this->generateSuperAttributesUidQuery($attributeId, $valueIndex);
$query = $this->getQuery($parentSku, $childSku, $qty, $selectedConfigurableOptionsQuery);
@@ -66,16 +66,19 @@ public function testAddDownloadableProductWithOptions(): void
/** @var Item $wishlistItem */
$wishlistItem = $wishlist->getItemCollection()->getFirstItem();
- self::assertArrayHasKey('addProductsToWishlist', $response);
- self::assertArrayHasKey('wishlist', $response['addProductsToWishlist']);
+ $this->assertArrayHasKey('addProductsToWishlist', $response);
+ $this->assertArrayHasKey('wishlist', $response['addProductsToWishlist']);
$wishlistResponse = $response['addProductsToWishlist']['wishlist'];
- self::assertEquals($wishlist->getItemsCount(), $wishlistResponse['items_count']);
- self::assertEquals($wishlist->getSharingCode(), $wishlistResponse['sharing_code']);
- self::assertEquals($wishlist->getUpdatedAt(), $wishlistResponse['updated_at']);
- self::assertEquals($wishlistItem->getId(), $wishlistResponse['items'][0]['id']);
- self::assertEquals($wishlistItem->getData('qty'), $wishlistResponse['items'][0]['qty']);
- self::assertEquals($wishlistItem->getDescription(), $wishlistResponse['items'][0]['description']);
- self::assertEquals($wishlistItem->getAddedAt(), $wishlistResponse['items'][0]['added_at']);
+ $this->assertEquals($wishlist->getItemsCount(), $wishlistResponse['items_count']);
+ $this->assertEquals($wishlist->getSharingCode(), $wishlistResponse['sharing_code']);
+ $this->assertEquals($wishlist->getUpdatedAt(), $wishlistResponse['updated_at']);
+ $this->assertEquals($wishlistItem->getId(), $wishlistResponse['items_v2'][0]['id']);
+ $this->assertEquals($wishlistItem->getData('qty'), $wishlistResponse['items_v2'][0]['quantity']);
+ $this->assertEquals($wishlistItem->getDescription(), $wishlistResponse['items_v2'][0]['description']);
+ $this->assertEquals($wishlistItem->getAddedAt(), $wishlistResponse['items_v2'][0]['added_at']);
+ $this->assertNotEmpty($wishlistResponse['items_v2'][0]['configurable_options']);
+ $configurableOptions = $wishlistResponse['items_v2'][0]['configurable_options'];
+ $this->assertEquals('Test Configurable', $configurableOptions[0]['option_label']);
}
/**
@@ -135,11 +138,20 @@ private function getQuery(
sharing_code
items_count
updated_at
- items {
+ items_v2 {
id
description
- qty
+ quantity
added_at
+ ... on ConfigurableWishlistItem {
+ child_sku
+ configurable_options {
+ id
+ option_label
+ value_id
+ value_label
+ }
+ }
}
}
}
@@ -155,7 +167,7 @@ private function getQuery(
*
* @return string
*/
- private function generateSuperAttributesIdV2Query(int $attributeId, int $valueIndex): string
+ private function generateSuperAttributesUidQuery(int $attributeId, int $valueIndex): string
{
return 'selected_options: ["' . base64_encode("configurable/$attributeId/$valueIndex") . '"]';
}
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Wishlist/AddDownloadableProductToWishlistTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Wishlist/AddDownloadableProductToWishlistTest.php
index 389f4eae4c574..f97da25a8d8c6 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Wishlist/AddDownloadableProductToWishlistTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Wishlist/AddDownloadableProductToWishlistTest.php
@@ -37,9 +37,9 @@ class AddDownloadableProductToWishlistTest extends GraphQlAbstract
private $wishlistFactory;
/**
- * @var GetCustomOptionsWithIDV2ForQueryBySku
+ * @var GetCustomOptionsWithUidForQueryBySku
*/
- private $getCustomOptionsWithIDV2ForQueryBySku;
+ private $getCustomOptionsWithUidForQueryBySku;
/**
* Set Up
@@ -49,69 +49,75 @@ protected function setUp(): void
$this->objectManager = Bootstrap::getObjectManager();
$this->customerTokenService = $this->objectManager->get(CustomerTokenServiceInterface::class);
$this->wishlistFactory = $this->objectManager->get(WishlistFactory::class);
- $this->getCustomOptionsWithIDV2ForQueryBySku =
- $this->objectManager->get(GetCustomOptionsWithIDV2ForQueryBySku::class);
+ $this->getCustomOptionsWithUidForQueryBySku =
+ $this->objectManager->get(GetCustomOptionsWithUidForQueryBySku::class);
}
/**
- * @magentoConfigFixture default_store wishlist/general/active 1
+ * @magentoConfigFixture default_store wishlist/general/active 0
* @magentoApiDataFixture Magento/Customer/_files/customer.php
* @magentoApiDataFixture Magento/Downloadable/_files/product_downloadable_with_custom_options.php
*/
- public function testAddDownloadableProductWithOptions(): void
+ public function testAddDownloadableProductOnDisabledWishlist(): void
{
- $customerId = 1;
- $sku = 'downloadable-product-with-purchased-separately-links';
$qty = 2;
+ $sku = 'downloadable-product-with-purchased-separately-links';
$links = $this->getProductsLinks($sku);
$linkId = key($links);
- $itemOptions = $this->getCustomOptionsWithIDV2ForQueryBySku->execute($sku);
+ $itemOptions = $this->getCustomOptionsWithUidForQueryBySku->execute($sku);
$itemOptions['selected_options'][] = $this->generateProductLinkSelectedOptions($linkId);
- $productOptionsQuery = preg_replace(
+ $productOptionsQuery = trim(preg_replace(
'/"([^"]+)"\s*:\s*/',
'$1:',
json_encode($itemOptions)
- );
- $query = $this->getQuery($qty, $sku, trim($productOptionsQuery, '{}'));
- $response = $this->graphQlMutation($query, [], '', $this->getHeaderMap());
- $wishlist = $this->wishlistFactory->create();
- $wishlist->loadByCustomerId($customerId, true);
- /** @var Item $wishlistItem */
- $wishlistItem = $wishlist->getItemCollection()->getFirstItem();
-
- self::assertArrayHasKey('addProductsToWishlist', $response);
- self::assertArrayHasKey('wishlist', $response['addProductsToWishlist']);
- $wishlistResponse = $response['addProductsToWishlist']['wishlist'];
- self::assertEquals($wishlist->getItemsCount(), $wishlistResponse['items_count']);
- self::assertEquals($wishlist->getSharingCode(), $wishlistResponse['sharing_code']);
- self::assertEquals($wishlist->getUpdatedAt(), $wishlistResponse['updated_at']);
- self::assertEquals($wishlistItem->getId(), $wishlistResponse['items'][0]['id']);
- self::assertEquals($wishlistItem->getData('qty'), $wishlistResponse['items'][0]['qty']);
- self::assertEquals($wishlistItem->getDescription(), $wishlistResponse['items'][0]['description']);
- self::assertEquals($wishlistItem->getAddedAt(), $wishlistResponse['items'][0]['added_at']);
+ ), '{}');
+ $query = $this->getQuery($qty, $sku, $productOptionsQuery);
+ $this->expectExceptionMessage('The wishlist configuration is currently disabled.');
+ $this->graphQlMutation($query, [], '', $this->getHeaderMap());
}
/**
- * @magentoConfigFixture default_store wishlist/general/active 0
+ * @magentoConfigFixture default_store wishlist/general/active 1
* @magentoApiDataFixture Magento/Customer/_files/customer.php
* @magentoApiDataFixture Magento/Downloadable/_files/product_downloadable_with_custom_options.php
*/
- public function testAddDownloadableProductOnDisabledWishlist(): void
+ public function testAddDownloadableProductWithOptions(): void
{
- $qty = 2;
+ $customerId = 1;
$sku = 'downloadable-product-with-purchased-separately-links';
+ $qty = 2;
$links = $this->getProductsLinks($sku);
$linkId = key($links);
- $itemOptions = $this->getCustomOptionsWithIDV2ForQueryBySku->execute($sku);
+ $itemOptions = $this->getCustomOptionsWithUidForQueryBySku->execute($sku);
$itemOptions['selected_options'][] = $this->generateProductLinkSelectedOptions($linkId);
- $productOptionsQuery = trim(preg_replace(
+ $productOptionsQuery = preg_replace(
'/"([^"]+)"\s*:\s*/',
'$1:',
json_encode($itemOptions)
- ), '{}');
- $query = $this->getQuery($qty, $sku, $productOptionsQuery);
- $this->expectExceptionMessage('The wishlist is not currently available.');
- $this->graphQlMutation($query, [], '', $this->getHeaderMap());
+ );
+ $query = $this->getQuery($qty, $sku, trim($productOptionsQuery, '{}'));
+ $response = $this->graphQlMutation($query, [], '', $this->getHeaderMap());
+ $wishlist = $this->wishlistFactory->create();
+ $wishlist->loadByCustomerId($customerId, true);
+ /** @var Item $wishlistItem */
+ $wishlistItem = $wishlist->getItemCollection()->getFirstItem();
+
+ $this->assertArrayHasKey('addProductsToWishlist', $response);
+ $this->assertArrayHasKey('wishlist', $response['addProductsToWishlist']);
+ $wishlistResponse = $response['addProductsToWishlist']['wishlist'];
+ $this->assertEquals($wishlist->getItemsCount(), $wishlistResponse['items_count']);
+ $this->assertEquals($wishlist->getSharingCode(), $wishlistResponse['sharing_code']);
+ $this->assertEquals($wishlist->getUpdatedAt(), $wishlistResponse['updated_at']);
+ $this->assertEquals($wishlistItem->getId(), $wishlistResponse['items_v2'][0]['id']);
+ $this->assertEquals($wishlistItem->getData('qty'), $wishlistResponse['items_v2'][0]['quantity']);
+ $this->assertEquals($wishlistItem->getDescription(), $wishlistResponse['items_v2'][0]['description']);
+ $this->assertEquals($wishlistItem->getAddedAt(), $wishlistResponse['items_v2'][0]['added_at']);
+ $this->assertNotEmpty($wishlistResponse['items_v2'][0]['links_v2']);
+ $wishlistItemLinks = $wishlistResponse['items_v2'][0]['links_v2'];
+ $this->assertEquals('Downloadable Product Link 1', $wishlistItemLinks[0]['title']);
+ $this->assertNotEmpty($wishlistResponse['items_v2'][0]['samples']);
+ $wishlistItemSamples = $wishlistResponse['items_v2'][0]['samples'];
+ $this->assertEquals('Downloadable Product Sample', $wishlistItemSamples[0]['title']);
}
/**
@@ -190,11 +196,23 @@ private function getQuery(
sharing_code
items_count
updated_at
- items {
+ items_v2 {
id
description
- qty
+ quantity
added_at
+ ... on DownloadableWishlistItem {
+ links_v2 {
+ id
+ title
+ sample_url
+ }
+ samples {
+ id
+ title
+ sample_url
+ }
+ }
}
}
}
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Wishlist/CustomerWishlistTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Wishlist/CustomerWishlistTest.php
index 0a8e1757a2ce2..04095c1679d2f 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Wishlist/CustomerWishlistTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Wishlist/CustomerWishlistTest.php
@@ -131,7 +131,7 @@ public function testGuestCannotGetWishlist()
public function testCustomerCannotGetWishlistWhenDisabled()
{
$this->expectException(\Exception::class);
- $this->expectExceptionMessage('The wishlist is not currently available.');
+ $this->expectExceptionMessage('The wishlist configuration is currently disabled.');
$query =
<<customerTokenService = Bootstrap::getObjectManager()->get(CustomerTokenServiceInterface::class);
+ $this->wishlistCollectionFactory = Bootstrap::getObjectManager()->get(CollectionFactory::class);
+ }
+
+ /**
+ * Test fetching customer wishlist
+ *
+ * @magentoConfigFixture default_store wishlist/general/active 1
+ * @magentoApiDataFixture Magento/Wishlist/_files/wishlist.php
+ */
+ public function testCustomerWishlist(): void
+ {
+ $customerId = 1;
+ /** @var Wishlist $wishlist */
+ $collection = $this->wishlistCollectionFactory->create()->filterByCustomerId($customerId);
+ /** @var Item $wishlistItem */
+ $wishlistItem = $collection->getFirstItem();
+ $response = $this->graphQlQuery(
+ $this->getQuery(),
+ [],
+ '',
+ $this->getCustomerAuthHeaders('customer@example.com', 'password')
+ );
+ $this->assertArrayHasKey('wishlists', $response['customer']);
+ $wishlist = $response['customer']['wishlists'][0];
+ $this->assertEquals($wishlistItem->getItemsCount(), $wishlist['items_count']);
+ $this->assertEquals($wishlistItem->getSharingCode(), $wishlist['sharing_code']);
+ $this->assertEquals($wishlistItem->getUpdatedAt(), $wishlist['updated_at']);
+ $wishlistItemResponse = $wishlist['items_v2'][0];
+ $this->assertEquals('simple', $wishlistItemResponse['product']['sku']);
+ }
+
+ /**
+ * Testing fetching the wishlist when wishlist is disabled
+ *
+ * @magentoConfigFixture default_store wishlist/general/active 0
+ * @magentoApiDataFixture Magento/Customer/_files/customer.php
+ */
+ public function testCustomerCannotGetWishlistWhenDisabled(): void
+ {
+ $this->expectException(Exception::class);
+ $this->expectExceptionMessage('The wishlist configuration is currently disabled.');
+ $this->graphQlQuery(
+ $this->getQuery(),
+ [],
+ '',
+ $this->getCustomerAuthHeaders('customer@example.com', 'password')
+ );
+ }
+
+ /**
+ * Test wishlist fetching for a guest customer
+ *
+ * @magentoConfigFixture default_store wishlist/general/active 1
+ */
+ public function testGuestCannotGetWishlist(): void
+ {
+ $this->expectException(Exception::class);
+ $this->expectExceptionMessage('The current customer isn\'t authorized.');
+ $this->graphQlQuery($this->getQuery());
+ }
+
+ /**
+ * Returns GraphQl query string
+ *
+ * @return string
+ */
+ private function getQuery(): string
+ {
+ return <<customerTokenService->createCustomerAccessToken($email, $password);
+
+ return ['Authorization' => 'Bearer ' . $customerToken];
+ }
+}
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Wishlist/DeleteProductsFromWishlistTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Wishlist/DeleteProductsFromWishlistTest.php
index 2e203e3ff4228..44e58b8b5ee27 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Wishlist/DeleteProductsFromWishlistTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Wishlist/DeleteProductsFromWishlistTest.php
@@ -42,17 +42,17 @@ public function testDeleteWishlistItemFromWishlist(): void
$wishlist = $this->getWishlist();
$wishlistId = $wishlist['customer']['wishlist']['id'];
$wishlist = $wishlist['customer']['wishlist'];
- $wishlistItems = $wishlist['items'];
- self::assertEquals(1, $wishlist['items_count']);
+ $wishlistItems = $wishlist['items_v2'];
+ $this->assertEquals(1, $wishlist['items_count']);
$query = $this->getQuery((int) $wishlistId, (int) $wishlistItems[0]['id']);
$response = $this->graphQlMutation($query, [], '', $this->getHeaderMap());
- self::assertArrayHasKey('removeProductsFromWishlist', $response);
- self::assertArrayHasKey('wishlist', $response['removeProductsFromWishlist']);
+ $this->assertArrayHasKey('removeProductsFromWishlist', $response);
+ $this->assertArrayHasKey('wishlist', $response['removeProductsFromWishlist']);
$wishlistResponse = $response['removeProductsFromWishlist']['wishlist'];
- self::assertEquals(0, $wishlistResponse['items_count']);
- self::assertEmpty($wishlistResponse['items']);
+ $this->assertEquals(0, $wishlistResponse['items_count']);
+ $this->assertEmpty($wishlistResponse['items_v2']);
}
/**
@@ -98,10 +98,10 @@ private function getQuery(
id
sharing_code
items_count
- items {
+ items_v2 {
id
description
- qty
+ quantity
}
}
}
@@ -134,9 +134,9 @@ private function getCustomerWishlistQuery(): string
wishlist {
id
items_count
- items {
+ items_v2 {
id
- qty
+ quantity
description
}
}
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Wishlist/GetCustomOptionsWithIDV2ForQueryBySku.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Wishlist/GetCustomOptionsWithUidForQueryBySku.php
similarity index 95%
rename from dev/tests/api-functional/testsuite/Magento/GraphQl/Wishlist/GetCustomOptionsWithIDV2ForQueryBySku.php
rename to dev/tests/api-functional/testsuite/Magento/GraphQl/Wishlist/GetCustomOptionsWithUidForQueryBySku.php
index 6d54d9f0b4444..d901b8ab7083f 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Wishlist/GetCustomOptionsWithIDV2ForQueryBySku.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Wishlist/GetCustomOptionsWithUidForQueryBySku.php
@@ -12,7 +12,7 @@
/**
* Generate an array with test values for customizable options with encoded id_v2 value
*/
-class GetCustomOptionsWithIDV2ForQueryBySku
+class GetCustomOptionsWithUidForQueryBySku
{
/**
* @var ProductCustomOptionRepositoryInterface
@@ -71,7 +71,7 @@ public function execute(string $sku): array
}
/**
- * Returns id_v2 of the selected custom option
+ * Returns uid of the selected custom option
*
* @param int $optionId
* @param int $optionValueId
@@ -84,7 +84,7 @@ private function encodeSelectedOption(int $optionId, int $optionValueId): string
}
/**
- * Returns id_v2 of the entered custom option
+ * Returns uid of the entered custom option
*
* @param int $optionId
*
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Wishlist/UpdateProductsFromWishlistTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Wishlist/UpdateProductsFromWishlistTest.php
index 9e96bdc5d7079..0c91311a524e0 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Wishlist/UpdateProductsFromWishlistTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Wishlist/UpdateProductsFromWishlistTest.php
@@ -43,18 +43,18 @@ public function testUpdateSimpleProductFromWishlist(): void
$qty = 5;
$description = 'New Description';
$wishlistId = $wishlist['customer']['wishlist']['id'];
- $wishlistItem = $wishlist['customer']['wishlist']['items'][0];
- self::assertNotEquals($description, $wishlistItem['description']);
- self::assertNotEquals($qty, $wishlistItem['qty']);
+ $wishlistItem = $wishlist['customer']['wishlist']['items_v2'][0];
+ $this->assertNotEquals($description, $wishlistItem['description']);
+ $this->assertNotEquals($qty, $wishlistItem['quantity']);
$query = $this->getQuery((int) $wishlistId, (int) $wishlistItem['id'], $qty, $description);
$response = $this->graphQlMutation($query, [], '', $this->getHeaderMap());
- self::assertArrayHasKey('updateProductsInWishlist', $response);
- self::assertArrayHasKey('wishlist', $response['updateProductsInWishlist']);
+ $this->assertArrayHasKey('updateProductsInWishlist', $response);
+ $this->assertArrayHasKey('wishlist', $response['updateProductsInWishlist']);
$wishlistResponse = $response['updateProductsInWishlist']['wishlist'];
- self::assertEquals($qty, $wishlistResponse['items'][0]['qty']);
- self::assertEquals($description, $wishlistResponse['items'][0]['description']);
+ $this->assertEquals($qty, $wishlistResponse['items_v2'][0]['quantity']);
+ $this->assertEquals($description, $wishlistResponse['items_v2'][0]['description']);
}
/**
@@ -110,10 +110,10 @@ private function getQuery(
id
sharing_code
items_count
- items {
+ items_v2 {
id
description
- qty
+ quantity
}
}
}
@@ -146,9 +146,9 @@ private function getCustomerWishlistQuery(): string
wishlist {
id
items_count
- items {
+ items_v2 {
id
- qty
+ quantity
description
}
}
From c5f6a1f4a70e979f2fc31a8c4d714c713bd9e650 Mon Sep 17 00:00:00 2001
From: "vadim.malesh"
Date: Wed, 12 Aug 2020 12:41:19 +0300
Subject: [PATCH 047/119] 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 c6bd685303913717a35e8f9200e06ffc90dee322 Mon Sep 17 00:00:00 2001
From: eduard13
Date: Wed, 12 Aug 2020 15:04:26 +0300
Subject: [PATCH 048/119] Refactoring the downloadable product logic
---
.../Model/Wishlist/ItemLinks.php} | 20 ++++++++++---------
.../Model/Resolver/ProductResolver.php | 1 -
.../Resolver/Type/Bundle/BundleOptions.php | 6 +++---
.../Resolver/Type/Configurable/ChildSku.php | 6 +++---
.../Type/Configurable/ConfigurableOptions.php | 6 +++---
.../Model/Resolver/WishlistItems.php | 2 +-
.../Magento/WishlistGraphQl/composer.json | 2 --
.../WishlistGraphQl/etc/schema.graphqls | 2 +-
.../AddConfigurableProductToWishlistTest.php | 2 +-
.../AddDownloadableProductToWishlistTest.php | 2 +-
.../GetCustomOptionsWithUidForQueryBySku.php | 2 +-
11 files changed, 25 insertions(+), 26 deletions(-)
rename app/code/Magento/{WishlistGraphQl/Model/Resolver/Type/Downloadable/Links.php => DownloadableGraphQl/Model/Wishlist/ItemLinks.php} (69%)
diff --git a/app/code/Magento/WishlistGraphQl/Model/Resolver/Type/Downloadable/Links.php b/app/code/Magento/DownloadableGraphQl/Model/Wishlist/ItemLinks.php
similarity index 69%
rename from app/code/Magento/WishlistGraphQl/Model/Resolver/Type/Downloadable/Links.php
rename to app/code/Magento/DownloadableGraphQl/Model/Wishlist/ItemLinks.php
index aa6f4c70318da..68223054aa806 100644
--- a/app/code/Magento/WishlistGraphQl/Model/Resolver/Type/Downloadable/Links.php
+++ b/app/code/Magento/DownloadableGraphQl/Model/Wishlist/ItemLinks.php
@@ -5,20 +5,20 @@
*/
declare(strict_types=1);
-namespace Magento\WishlistGraphQl\Model\Resolver\Type\Downloadable;
+namespace Magento\DownloadableGraphQl\Model\Wishlist;
+use Magento\Catalog\Model\Product\Configuration\Item\ItemInterface;
use Magento\Downloadable\Helper\Catalog\Product\Configuration;
use Magento\DownloadableGraphQl\Model\ConvertLinksToArray;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\GraphQl\Config\Element\Field;
use Magento\Framework\GraphQl\Query\ResolverInterface;
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
-use Magento\Wishlist\Model\Item;
/**
- * Fetches the selected downloadable links
+ * Fetches the selected item downloadable links
*/
-class Links implements ResolverInterface
+class ItemLinks implements ResolverInterface
{
/**
* @var ConvertLinksToArray
@@ -52,13 +52,15 @@ public function resolve(
array $value = null,
array $args = null
) {
- if (!isset($value['wishlistItemModel'])) {
- throw new LocalizedException(__('Missing key "wishlistItemModel" in Wishlist Item value data'));
+ if (!$value['itemModel'] instanceof ItemInterface) {
+ throw new LocalizedException(__('"itemModel" should be a "%instance" instance', [
+ 'instance' => ItemInterface::class
+ ]));
}
- /** @var Item $wishlistItem */
- $wishlistItem = $value['wishlistItemModel'];
+ /** @var ItemInterface $wishlistItem */
+ $itemItem = $value['itemModel'];
- $links = $this->downloadableConfiguration->getLinks($wishlistItem);
+ $links = $this->downloadableConfiguration->getLinks($itemItem);
$links = $this->convertLinksToArray->execute($links);
return $links;
diff --git a/app/code/Magento/WishlistGraphQl/Model/Resolver/ProductResolver.php b/app/code/Magento/WishlistGraphQl/Model/Resolver/ProductResolver.php
index d292d3eab9910..31dd33ff2cd79 100644
--- a/app/code/Magento/WishlistGraphQl/Model/Resolver/ProductResolver.php
+++ b/app/code/Magento/WishlistGraphQl/Model/Resolver/ProductResolver.php
@@ -13,7 +13,6 @@
use Magento\Framework\GraphQl\Config\Element\Field;
use Magento\Framework\GraphQl\Query\ResolverInterface;
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
-use Magento\Wishlist\Model\Item;
/**
* Fetches the Product data according to the GraphQL schema
diff --git a/app/code/Magento/WishlistGraphQl/Model/Resolver/Type/Bundle/BundleOptions.php b/app/code/Magento/WishlistGraphQl/Model/Resolver/Type/Bundle/BundleOptions.php
index 11af9bbbc60b9..d11200d96ce1a 100644
--- a/app/code/Magento/WishlistGraphQl/Model/Resolver/Type/Bundle/BundleOptions.php
+++ b/app/code/Magento/WishlistGraphQl/Model/Resolver/Type/Bundle/BundleOptions.php
@@ -43,12 +43,12 @@ public function resolve(
array $value = null,
array $args = null
) {
- if (!$value['wishlistItemModel'] instanceof Item) {
- throw new LocalizedException(__('"wishlistItemModel" should be a "%instance" instance', [
+ if (!$value['itemModel'] instanceof Item) {
+ throw new LocalizedException(__('"itemModel" should be a "%instance" instance', [
'instance' => Item::class
]));
}
- return $this->bundleOptionDataProvider->getData($value['wishlistItemModel']);
+ return $this->bundleOptionDataProvider->getData($value['itemModel']);
}
}
diff --git a/app/code/Magento/WishlistGraphQl/Model/Resolver/Type/Configurable/ChildSku.php b/app/code/Magento/WishlistGraphQl/Model/Resolver/Type/Configurable/ChildSku.php
index 7014312ce4765..a6c77cbe9da9c 100644
--- a/app/code/Magento/WishlistGraphQl/Model/Resolver/Type/Configurable/ChildSku.php
+++ b/app/code/Magento/WishlistGraphQl/Model/Resolver/Type/Configurable/ChildSku.php
@@ -28,14 +28,14 @@ public function resolve(
array $value = null,
array $args = null
) {
- if (!$value['wishlistItemModel'] instanceof Item) {
- throw new LocalizedException(__('"wishlistItemModel" should be a "%instance" instance', [
+ if (!$value['itemModel'] instanceof Item) {
+ throw new LocalizedException(__('"itemModel" should be a "%instance" instance', [
'instance' => Item::class
]));
}
/** @var Item $wishlistItem */
- $wishlistItem = $value['wishlistItemModel'];
+ $wishlistItem = $value['itemModel'];
$optionProduct = $wishlistItem->getProduct()->getCustomOption('simple_product')->getProduct();
return $optionProduct->getSku();
diff --git a/app/code/Magento/WishlistGraphQl/Model/Resolver/Type/Configurable/ConfigurableOptions.php b/app/code/Magento/WishlistGraphQl/Model/Resolver/Type/Configurable/ConfigurableOptions.php
index f3e7be1395a24..1090c8e5aaa1c 100644
--- a/app/code/Magento/WishlistGraphQl/Model/Resolver/Type/Configurable/ConfigurableOptions.php
+++ b/app/code/Magento/WishlistGraphQl/Model/Resolver/Type/Configurable/ConfigurableOptions.php
@@ -43,14 +43,14 @@ public function resolve(
array $value = null,
array $args = null
) {
- if (!$value['wishlistItemModel'] instanceof Item) {
- throw new LocalizedException(__('"wishlistItemModel" should be a "%instance" instance', [
+ if (!$value['itemModel'] instanceof Item) {
+ throw new LocalizedException(__('"itemModel" should be a "%instance" instance', [
'instance' => Item::class
]));
}
/** @var Item $wishlistItem */
- $wishlistItem = $value['wishlistItemModel'];
+ $wishlistItem = $value['itemModel'];
$result = [];
foreach ($this->configurationHelper->getOptions($wishlistItem) as $option) {
diff --git a/app/code/Magento/WishlistGraphQl/Model/Resolver/WishlistItems.php b/app/code/Magento/WishlistGraphQl/Model/Resolver/WishlistItems.php
index 1fa750af05e5d..77ff483a60bd2 100644
--- a/app/code/Magento/WishlistGraphQl/Model/Resolver/WishlistItems.php
+++ b/app/code/Magento/WishlistGraphQl/Model/Resolver/WishlistItems.php
@@ -71,7 +71,7 @@ public function resolve(
'description' => $wishlistItem->getDescription(),
'added_at' => $wishlistItem->getAddedAt(),
'model' => $wishlistItem->getProduct(),
- 'wishlistItemModel' => $wishlistItem,
+ 'itemModel' => $wishlistItem,
];
}
return $data;
diff --git a/app/code/Magento/WishlistGraphQl/composer.json b/app/code/Magento/WishlistGraphQl/composer.json
index ba0ed697c3692..58bc738bd24d6 100644
--- a/app/code/Magento/WishlistGraphQl/composer.json
+++ b/app/code/Magento/WishlistGraphQl/composer.json
@@ -7,8 +7,6 @@
"magento/framework": "*",
"magento/module-catalog": "*",
"magento/module-catalog-graph-ql": "*",
- "magento/module-downloadable": "*",
- "magento/module-downloadable-graphql": "*",
"magento/module-wishlist": "*",
"magento/module-store": "*"
},
diff --git a/app/code/Magento/WishlistGraphQl/etc/schema.graphqls b/app/code/Magento/WishlistGraphQl/etc/schema.graphqls
index 1068073d47386..a7c8003a7c3e7 100644
--- a/app/code/Magento/WishlistGraphQl/etc/schema.graphqls
+++ b/app/code/Magento/WishlistGraphQl/etc/schema.graphqls
@@ -52,7 +52,7 @@ type ConfigurableWishlistItem implements WishlistItemInterface {
}
type DownloadableWishlistItem implements WishlistItemInterface @doc(description: "Downloadable Wishlist Item") {
- links_v2: [DownloadableProductLinks] @doc(description: "An array containing information about the selected links") @resolver(class: "\\Magento\\WishlistGraphQl\\Model\\Resolver\\Type\\Downloadable\\Links")
+ links_v2: [DownloadableProductLinks] @doc(description: "An array containing information about the selected links") @resolver(class: "\\Magento\\DownloadableGraphQl\\Model\\Wishlist\\ItemLinks")
samples: [DownloadableProductSamples] @doc(description: "DownloadableProductSamples defines characteristics of a downloadable product") @resolver(class: "Magento\\DownloadableGraphQl\\Resolver\\Product\\Samples")
}
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Wishlist/AddConfigurableProductToWishlistTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Wishlist/AddConfigurableProductToWishlistTest.php
index 4d9362de2337c..7b2c12f88d3a4 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Wishlist/AddConfigurableProductToWishlistTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Wishlist/AddConfigurableProductToWishlistTest.php
@@ -160,7 +160,7 @@ private function getQuery(
}
/**
- * Generates Id_v2 for super configurable product super attributes
+ * Generates uid for super configurable product super attributes
*
* @param int $attributeId
* @param int $valueIndex
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Wishlist/AddDownloadableProductToWishlistTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Wishlist/AddDownloadableProductToWishlistTest.php
index 4ea1e2664f431..0de45fb21b20b 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Wishlist/AddDownloadableProductToWishlistTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Wishlist/AddDownloadableProductToWishlistTest.php
@@ -221,7 +221,7 @@ private function getQuery(
}
/**
- * Generates Id_v2 for downloadable links
+ * Generates uid for downloadable links
*
* @param int $linkId
*
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Wishlist/GetCustomOptionsWithUidForQueryBySku.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Wishlist/GetCustomOptionsWithUidForQueryBySku.php
index af839297dc8d4..4bd0c135f039a 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Wishlist/GetCustomOptionsWithUidForQueryBySku.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Wishlist/GetCustomOptionsWithUidForQueryBySku.php
@@ -10,7 +10,7 @@
use Magento\Catalog\Api\ProductCustomOptionRepositoryInterface;
/**
- * Generate an array with test values for customizable options with encoded id_v2 value
+ * Generate an array with test values for customizable options with encoded uid value
*/
class GetCustomOptionsWithUidForQueryBySku
{
From a7da7fd6ff08388b1a2364c23710f303e82b33bf Mon Sep 17 00:00:00 2001
From: "vadim.malesh"
Date: Wed, 12 Aug 2020 16:28:32 +0300
Subject: [PATCH 049/119] 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
Date: Thu, 13 Aug 2020 10:51:33 +0530
Subject: [PATCH 050/119] 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 603ef0565df194abab63b1c23b11d2ee0d11aa8d Mon Sep 17 00:00:00 2001
From: Russell Albin
Date: Thu, 13 Aug 2020 05:12:54 -0500
Subject: [PATCH 051/119] Update config.xml
Updating message to be a little more helpful
---
app/code/Magento/Multishipping/etc/config.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/code/Magento/Multishipping/etc/config.xml b/app/code/Magento/Multishipping/etc/config.xml
index e7f247b5afba5..0df8742016aed 100644
--- a/app/code/Magento/Multishipping/etc/config.xml
+++ b/app/code/Magento/Multishipping/etc/config.xml
@@ -15,7 +15,7 @@
- All shippable products have been removed from your order
+ The current cart does not match multi shipping criteria, please review or contact the store administrator
From 78f0780e7d4eec7863fc6a94ab8ce1e16e42f8c3 Mon Sep 17 00:00:00 2001
From: Russell Albin
Date: Thu, 13 Aug 2020 05:13:55 -0500
Subject: [PATCH 052/119] Update en_US.csv
Updated translation file with new more helpful message
---
app/code/Magento/Multishipping/i18n/en_US.csv | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/code/Magento/Multishipping/i18n/en_US.csv b/app/code/Magento/Multishipping/i18n/en_US.csv
index ad3e968d88cd5..412eb7b8bc730 100644
--- a/app/code/Magento/Multishipping/i18n/en_US.csv
+++ b/app/code/Magento/Multishipping/i18n/en_US.csv
@@ -92,4 +92,4 @@ Options,Options
"Error:","Error:"
"We are unable to process your request. Please, try again later.","We are unable to process your request. Please, try again later."
"Quote address for failed order ID "%1" not found.","Quote address for failed order ID "%1" not found."
-"All shippable products have been removed from your order","All shippable products have been removed from your order"
\ No newline at end of file
+"The current cart does not match multi shipping criteria, please review or contact the store administrator","The current cart does not match multi shipping criteria, please review or contact the store administrator"
From 60da76cf173a44c2c1545a643a96a858bdf19ed0 Mon Sep 17 00:00:00 2001
From: Sergii Ivashchenko
Date: Thu, 13 Aug 2020 17:20:59 +0100
Subject: [PATCH 053/119] magento/magento2#29411: Directory Tree refactoring
---
.../Model/Directory/Command/CreateByPaths.php | 2 +-
...{DirectoriesTree.php => DirectoryTree.php} | 8 +-
.../ui_component/media_gallery_listing.xml | 2 +-
.../standalone_media_gallery_listing.xml | 2 +-
.../deleteImageWithDetailConfirmation.js | 23 +-
.../adminhtml/web/js/directory/directories.js | 95 +++---
.../web/js/directory/directoryTree.js | 289 +++++++-----------
7 files changed, 177 insertions(+), 244 deletions(-)
rename app/code/Magento/MediaGalleryUi/Ui/Component/{DirectoriesTree.php => DirectoryTree.php} (81%)
diff --git a/app/code/Magento/MediaGallery/Model/Directory/Command/CreateByPaths.php b/app/code/Magento/MediaGallery/Model/Directory/Command/CreateByPaths.php
index f33c22a18b4b8..d0ba786c7084e 100644
--- a/app/code/Magento/MediaGallery/Model/Directory/Command/CreateByPaths.php
+++ b/app/code/Magento/MediaGallery/Model/Directory/Command/CreateByPaths.php
@@ -78,7 +78,7 @@ public function execute(array $paths): void
if (!empty($failedPaths)) {
throw new CouldNotSaveException(
__(
- 'Could not save directories: %paths',
+ 'Could not create directories: %paths',
[
'paths' => implode(' ,', $failedPaths)
]
diff --git a/app/code/Magento/MediaGalleryUi/Ui/Component/DirectoriesTree.php b/app/code/Magento/MediaGalleryUi/Ui/Component/DirectoryTree.php
similarity index 81%
rename from app/code/Magento/MediaGalleryUi/Ui/Component/DirectoriesTree.php
rename to app/code/Magento/MediaGalleryUi/Ui/Component/DirectoryTree.php
index 4047a4fcb98d8..269bc1f8bcba7 100644
--- a/app/code/Magento/MediaGalleryUi/Ui/Component/DirectoriesTree.php
+++ b/app/code/Magento/MediaGalleryUi/Ui/Component/DirectoryTree.php
@@ -14,7 +14,7 @@
/**
* Directories tree component
*/
-class DirectoriesTree extends Container
+class DirectoryTree extends Container
{
/**
* @var UrlInterface
@@ -50,9 +50,9 @@ public function prepare(): void
array_replace_recursive(
(array) $this->getData('config'),
[
- 'getDirectoryTreeUrl' => $this->url->getUrl("media_gallery/directories/gettree"),
- 'deleteDirectoryUrl' => $this->url->getUrl("media_gallery/directories/delete"),
- 'createDirectoryUrl' => $this->url->getUrl("media_gallery/directories/create")
+ 'getDirectoryTreeUrl' => $this->url->getUrl('media_gallery/directories/gettree'),
+ 'deleteDirectoryUrl' => $this->url->getUrl('media_gallery/directories/delete'),
+ 'createDirectoryUrl' => $this->url->getUrl('media_gallery/directories/create')
]
)
);
diff --git a/app/code/Magento/MediaGalleryUi/view/adminhtml/ui_component/media_gallery_listing.xml b/app/code/Magento/MediaGalleryUi/view/adminhtml/ui_component/media_gallery_listing.xml
index 5a16ed1792159..141f3efb2348a 100644
--- a/app/code/Magento/MediaGalleryUi/view/adminhtml/ui_component/media_gallery_listing.xml
+++ b/app/code/Magento/MediaGalleryUi/view/adminhtml/ui_component/media_gallery_listing.xml
@@ -211,7 +211,7 @@
diff --git a/app/code/Magento/MediaGalleryUi/view/adminhtml/ui_component/standalone_media_gallery_listing.xml b/app/code/Magento/MediaGalleryUi/view/adminhtml/ui_component/standalone_media_gallery_listing.xml
index c96ad0fd86661..686a8f8957120 100644
--- a/app/code/Magento/MediaGalleryUi/view/adminhtml/ui_component/standalone_media_gallery_listing.xml
+++ b/app/code/Magento/MediaGalleryUi/view/adminhtml/ui_component/standalone_media_gallery_listing.xml
@@ -198,7 +198,7 @@
diff --git a/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/action/deleteImageWithDetailConfirmation.js b/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/action/deleteImageWithDetailConfirmation.js
index 51d124ca319e6..58e86a3a152b8 100644
--- a/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/action/deleteImageWithDetailConfirmation.js
+++ b/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/action/deleteImageWithDetailConfirmation.js
@@ -21,25 +21,24 @@ define([
* @param {String} deleteImageUrl
*/
deleteImageAction: function (recordsIds, imageDetailsUrl, deleteImageUrl) {
- var confirmationContent = $t('%1 Are you sure you want to delete "%2" image(s)?')
+ var confirmationContent = $t('%1Are you sure you want to delete "%2" image(s)?')
.replace('%2', Object.keys(recordsIds).length),
deferred = $.Deferred();
- getDetails(imageDetailsUrl, recordsIds)
- .then(function (imageDetails) {
+ getDetails(imageDetailsUrl, recordsIds).then(function (images) {
confirmationContent = confirmationContent.replace(
'%1',
- this.getRecordRelatedContentMessage(imageDetails)
+ this.getRecordRelatedContentMessage(images) + ' '
);
}.bind(this)).fail(function () {
- confirmationContent = confirmationContent.replace('%1', '');
- }).always(function () {
- deleteImages(recordsIds, deleteImageUrl, confirmationContent).then(function (status) {
- deferred.resolve(status);
- }).fail(function (error) {
- deferred.reject(error);
- });
- });
+ confirmationContent = confirmationContent.replace('%1', '');
+ }).always(function () {
+ deleteImages(recordsIds, deleteImageUrl, confirmationContent).then(function (status) {
+ deferred.resolve(status);
+ }).fail(function (error) {
+ deferred.reject(error);
+ });
+ });
return deferred.promise();
},
diff --git a/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/directory/directories.js b/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/directory/directories.js
index d7f756d8bbd90..6d8d38a1ca1d6 100644
--- a/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/directory/directories.js
+++ b/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/directory/directories.js
@@ -23,6 +23,7 @@ define([
deleteButtonSelector: '#delete_folder',
createFolderButtonSelector: '#create_folder',
messageDelay: 5,
+ selectedFolder: null,
messagesName: 'media_gallery_listing.media_gallery_listing.messages',
modules: {
directoryTree: '${ $.parentName }.media_gallery_directories',
@@ -47,51 +48,57 @@ define([
*/
initEvents: function () {
$(this.deleteButtonSelector).on('delete_folder', function () {
- this.getConfirmationPopupDeleteFolder();
+ this.deleteFolder();
}.bind(this));
$(this.createFolderButtonSelector).on('create_folder', function () {
- this.getPrompt({
- title: $t('New Folder Name:'),
- content: '',
- actions: {
- /**
- * Confirm action
- */
- confirm: function (folderName) {
- createDirectory(
- this.directoryTree().createDirectoryUrl,
- [this.getNewFolderPath(folderName)]
- ).then(function () {
- this.directoryTree().reloadJsTree().then(function () {
- $(this.directoryTree().directoryTreeSelector).on('loaded.jstree', function () {
- this.directoryTree().locateNode(this.getNewFolderPath(folderName));
- }.bind(this));
- }.bind(this));
+ this.createFolder();
+ }.bind(this));
+ },
- }.bind(this)).fail(function (error) {
- uiAlert({
- content: error
- });
+ /**
+ * Show confirmation popup and create folder based on user input
+ */
+ createFolder: function () {
+ this.getPrompt({
+ title: $t('New Folder Name:'),
+ content: '',
+ actions: {
+ /**
+ * Confirm action
+ */
+ confirm: function (folderName) {
+ createDirectory(
+ this.directoryTree().createDirectoryUrl,
+ [this.getNewFolderPath(folderName)]
+ ).then(function () {
+ this.directoryTree().reloadJsTree().then(function () {
+ $(this.directoryTree().directoryTreeSelector).on('loaded.jstree', function () {
+ this.directoryTree().locateNode(this.getNewFolderPath(folderName));
+ }.bind(this));
+ }.bind(this));
+ }.bind(this)).fail(function (error) {
+ uiAlert({
+ content: error
});
- }.bind(this)
- },
- buttons: [{
- text: $t('Cancel'),
- class: 'action-secondary action-dismiss',
+ });
+ }.bind(this)
+ },
+ buttons: [{
+ text: $t('Cancel'),
+ class: 'action-secondary action-dismiss',
- /**
- * Close modal
- */
- click: function () {
- this.closeModal();
- }
- }, {
- text: $t('Confirm'),
- class: 'action-primary action-accept'
- }]
- });
- }.bind(this));
+ /**
+ * Close modal
+ */
+ click: function () {
+ this.closeModal();
+ }
+ }, {
+ text: $t('Confirm'),
+ class: 'action-primary action-accept'
+ }]
+ });
},
/**
@@ -101,11 +108,11 @@ define([
* @returns {String}
*/
getNewFolderPath: function (folderName) {
- var selectedFolder = _.isUndefined(this.selectedFolder()) ||
- _.isNull(this.selectedFolder()) ? '/' : this.selectedFolder(),
- folderToCreate = selectedFolder !== '/' ? selectedFolder + '/' + folderName : folderName;
+ if (_.isUndefined(this.selectedFolder()) || _.isNull(this.selectedFolder())) {
+ return folderName;
+ }
- return folderToCreate;
+ return this.selectedFolder() + '/' + folderName;
},
/**
@@ -136,7 +143,7 @@ define([
/**
* Confirmation popup for delete folder action.
*/
- getConfirmationPopupDeleteFolder: function () {
+ deleteFolder: function () {
confirm({
title: $t('Are you sure you want to delete this folder?'),
modalClass: 'delete-folder-confirmation-popup',
diff --git a/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/directory/directoryTree.js b/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/directory/directoryTree.js
index 7f0973a543761..9cf5144808f7d 100644
--- a/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/directory/directoryTree.js
+++ b/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/directory/directoryTree.js
@@ -20,13 +20,14 @@ define([
filterChipsProvider: 'componentType = filters, ns = ${ $.ns }',
directoryTreeSelector: '#media-gallery-directory-tree',
getDirectoryTreeUrl: 'media_gallery/directories/gettree',
- jsTreeReloaded: null,
+ createDirectoryUrl: 'media_gallery/directories/create',
+ activeNode: null,
modules: {
directories: '${ $.name }_directories',
filterChips: '${ $.filterChipsProvider }'
},
listens: {
- '${ $.provider }:params.filters.path': 'updateSelectedDirectory'
+ '${ $.provider }:params.filters.path': 'selectTreeFolder'
},
viewConfig: [{
component: 'Magento_MediaGalleryUi/js/directory/directories',
@@ -49,7 +50,8 @@ define([
this.renderDirectoryTree().then(function () {
this.initEvents();
}.bind(this));
- }.bind(this));
+ }.bind(this)
+ );
return this;
},
@@ -58,66 +60,57 @@ define([
* Render directory tree component.
*/
renderDirectoryTree: function () {
-
return this.getJsonTree().then(function (data) {
this.createFolderIfNotExists(data).then(function (isFolderCreated) {
- if (isFolderCreated) {
- this.getJsonTree().then(function (newData) {
- this.createTree(newData);
- }.bind(this));
- } else {
+ if (!isFolderCreated) {
this.createTree(data);
+ return;
}
+
+ this.getJsonTree().then(function (newData) {
+ this.createTree(newData);
+ }.bind(this));
}.bind(this));
}.bind(this));
},
- /**
- * Set jstree reloaded
- *
- * @param {Boolean} value
- */
- setJsTreeReloaded: function (value) {
- this.jsTreeReloaded = value;
- },
-
/**
* Create folder by provided current_tree_path param
*
* @param {Array} directories
*/
createFolderIfNotExists: function (directories) {
- var isMediaBrowser = !_.isUndefined(window.MediabrowserUtility),
- currentTreePath = isMediaBrowser ? window.MediabrowserUtility.pathId : null,
+ var requestedDirectoryPath = this.getRequestedDirectory(),
deferred = $.Deferred(),
- decodedPath,
pathArray;
- if (currentTreePath) {
- decodedPath = Base64.idDecode(currentTreePath);
-
- if (!this.isDirectoryExist(directories[0], decodedPath)) {
- pathArray = this.convertPathToPathsArray(decodedPath);
+ if (!requestedDirectoryPath) {
+ deferred.resolve(false);
- $.each(pathArray, function (i, val) {
- if (this.isDirectoryExist(directories[0], val)) {
- pathArray.splice(i, 1);
- }
- }.bind(this));
+ return deferred.promise();
+ }
- createDirectory(
- this.createDirectoryUrl,
- pathArray
- ).then(function () {
- deferred.resolve(true);
- });
- } else {
- deferred.resolve(false);
- }
- } else {
+ if (this.isDirectoryExist(directories[0], requestedDirectoryPath)) {
deferred.resolve(false);
+
+ return deferred.promise();
}
+ pathArray = this.convertPathToPathsArray(requestedDirectoryPath);
+
+ $.each(pathArray, function (index, directoryId) {
+ if (this.isDirectoryExist(directories[0], directoryId)) {
+ pathArray.splice(index, 1);
+ }
+ }.bind(this));
+
+ createDirectory(
+ this.createDirectoryUrl,
+ pathArray
+ ).then(function () {
+ deferred.resolve(true);
+ });
+
return deferred.promise();
},
@@ -125,33 +118,22 @@ define([
* Verify if directory exists in array
*
* @param {Array} directories
- * @param {String} directoryId
+ * @param {String} path
*/
- isDirectoryExist: function (directories, directoryId) {
- var found = false;
-
- /**
- * Recursive search in array
- *
- * @param {Array} data
- * @param {String} id
- */
- function recurse(data, id) {
- var i;
-
- for (i = 0; i < data.length; i++) {
- if (data[i].attr.id === id) {
- found = data[i];
- break;
- } else if (data[i].children && data[i].children.length) {
- recurse(data[i].children, id);
- }
+ isDirectoryExist: function (directories, path) {
+ var i;
+
+ for (i = 0; i < directories.length; i++) {
+ if (directories[i].attr.id === path
+ || directories[i].children
+ && directories[i].children.length
+ && this.isDirectoryExist(directories[i].children, path)
+ ) {
+ return true;
}
}
- recurse(directories, directoryId);
-
- return found;
+ return false;
},
/**
@@ -199,7 +181,7 @@ define([
/**
* Remove ability to multiple select on nodes
*/
- overrideMultiselectBehavior: function () {
+ disableMultiselectBehavior: function () {
$.jstree.defaults.ui['select_range_modifier'] = false;
$.jstree.defaults.ui['select_multiple_modifier'] = false;
},
@@ -208,21 +190,12 @@ define([
* Handle jstree events
*/
initEvents: function () {
- this.firejsTreeEvents();
- this.overrideMultiselectBehavior();
+ this.initJsTreeEvents();
+ this.disableMultiselectBehavior();
$(window).on('reload.MediaGallery', function () {
- this.getJsonTree().then(function (data) {
- this.createFolderIfNotExists(data).then(function (isCreated) {
- if (isCreated) {
- this.renderDirectoryTree().then(function () {
- this.setJsTreeReloaded(true);
- this.firejsTreeEvents();
- }.bind(this));
- } else {
- this.updateSelectedDirectory();
- }
- }.bind(this));
+ this.renderDirectoryTree().then(function () {
+ this.initJsTreeEvents();
}.bind(this));
}.bind(this));
},
@@ -230,64 +203,46 @@ define([
/**
* Fire event for jstree component
*/
- firejsTreeEvents: function () {
+ initJsTreeEvents: function () {
$(this.directoryTreeSelector).on('select_node.jstree', function (element, data) {
- var path = $(data.rslt.obj).data('path');
-
- this.setActiveNodeFilter(path);
- this.setJsTreeReloaded(false);
+ this.toggleSelectedDirectory($(data.rslt.obj).data('path'));
}.bind(this));
$(this.directoryTreeSelector).on('loaded.jstree', function () {
- this.updateSelectedDirectory();
- }.bind(this));
+ var path = this.getRequestedDirectory() || this.filterChips().filters.path;
+ if (this.activeNode() !== path) {
+ this.selectFolder(path);
+ }
+ }.bind(this));
},
/**
* Verify directory filter on init event, select folder per directory filter state
*/
- updateSelectedDirectory: function () {
- var currentFilterPath = this.filterChips().filters.path,
- isMediaBrowser = !_.isUndefined(window.MediabrowserUtility),
- currentTreePath;
-
- if (_.isUndefined(currentFilterPath)) {
- this.clearFiltersHandle();
-
- return;
- }
-
- currentTreePath = this.isFiltersApplied(currentFilterPath) || !isMediaBrowser ? currentFilterPath :
- Base64.idDecode(window.MediabrowserUtility.pathId);
-
- if (this.folderExistsInTree(currentTreePath)) {
- this.locateNode(currentTreePath);
- } else {
- this.selectStorageRoot();
- }
+ selectTreeFolder: function (path) {
+ this.isFolderRendered(path) ? this.locateNode(path) : this.selectStorageRoot();
},
/**
* Verify if directory exists in folder tree
*
* @param {String} path
+ * @return {Boolean}
*/
- folderExistsInTree: function (path) {
- if (!_.isUndefined(path)) {
- return $('#' + path.replace(/\//g, '\\/')).length === 1;
- }
-
- return false;
+ isFolderRendered: function (path) {
+ return _.isUndefined(path) ? false : $('#' + path.replace(/\//g, '\\/')).length === 1;
},
/**
- * Check if need to select directory by filters state
+ * Get directory requested from MediabrowserUtility
*
- * @param {String} currentFilterPath
+ * @return {String|Null}
*/
- isFiltersApplied: function (currentFilterPath) {
- return !_.isUndefined(currentFilterPath) && currentFilterPath !== '';
+ getRequestedDirectory: function () {
+ return !_.isUndefined(window.MediabrowserUtility) && window.MediabrowserUtility.pathId !== ''
+ ? Base64.idDecode(window.MediabrowserUtility.pathId)
+ : null;
},
/**
@@ -296,62 +251,40 @@ define([
* @param {String} path
*/
locateNode: function (path) {
- var selectedId = $(this.directoryTreeSelector).jstree('get_selected').attr('id');
-
- if (path === selectedId) {
+ if (path === $(this.directoryTreeSelector).jstree('get_selected').attr('id')) {
return;
}
path = path.replace(/\//g, '\\/');
$(this.directoryTreeSelector).jstree('open_node', '#' + path);
$(this.directoryTreeSelector).jstree('select_node', '#' + path, true);
-
- },
-
- /**
- * Clear filters
- */
- clearFiltersHandle: function () {
- $(this.directoryTreeSelector).jstree('deselect_all');
- this.activeNode(null);
- this.directories().setInActive();
},
/**
* Set active node filter, or deselect if the same node clicked
*
- * @param {String} nodePath
+ * @param {String} path
*/
- setActiveNodeFilter: function (nodePath) {
-
- if (this.activeNode() === nodePath && !this.jsTreeReloaded) {
- this.selectStorageRoot();
- } else {
- this.selectFolder(nodePath);
- }
+ toggleSelectedDirectory: function (path) {
+ this.activeNode() === path ? this.selectStorageRoot() : this.selectFolder(path);
},
/**
* Remove folders selection -> select storage root
*/
selectStorageRoot: function () {
- var filters = {},
- applied = this.filterChips().get('applied');
-
$(this.directoryTreeSelector).jstree('deselect_all');
-
- filters = $.extend(true, filters, applied);
- delete filters.path;
- this.filterChips().set('applied', filters);
this.activeNode(null);
+
this.waitForCondition(
- function () {
- return _.isUndefined(this.directories());
- }.bind(this),
function () {
- this.directories().setInActive();
- }.bind(this)
- );
+ return _.isUndefined(this.directories());
+ }.bind(this),
+ function () {
+ this.directories().setInActive();
+ }.bind(this)
+ );
+ this.dropFilter();
},
/**
@@ -360,7 +293,9 @@ define([
* @param {String} path
*/
selectFolder: function (path) {
- this.activeNode(path);
+ if (_.isUndefined(path) || _.isNull(path)) {
+ return;
+ }
this.waitForCondition(
function () {
@@ -372,11 +307,12 @@ define([
);
this.applyFilter(path);
+ this.activeNode(path);
},
/**
- * Remove active node from directory tree, and select next
- */
+ * Remove active node from directory tree, and select next
+ */
removeNode: function () {
$(this.directoryTreeSelector).jstree('remove');
},
@@ -387,13 +323,29 @@ define([
* @param {String} path
*/
applyFilter: function (path) {
+ this.filterChips().set(
+ 'applied',
+ $.extend(
+ true,
+ {},
+ this.filterChips().get('applied'),
+ {
+ path: path
+ }
+ )
+ );
+ },
+
+ /**
+ * Drop path filter
+ */
+ dropFilter: function () {
var filters = {},
applied = this.filterChips().get('applied');
filters = $.extend(true, filters, applied);
- filters.path = path;
+ delete filters.path;
this.filterChips().set('applied', filters);
-
},
/**
@@ -404,7 +356,6 @@ define([
this.getJsonTree().then(function (data) {
this.createTree(data);
- this.setJsTreeReloaded(true);
this.initEvents();
deferred.resolve();
}.bind(this));
@@ -416,35 +367,11 @@ define([
* Get json data for jstree
*/
getJsonTree: function () {
- var deferred = $.Deferred();
-
- $.ajax({
+ return $.ajax({
url: this.getDirectoryTreeUrl,
type: 'GET',
- dataType: 'json',
-
- /**
- * Success handler for request
- *
- * @param {Object} data
- */
- success: function (data) {
- deferred.resolve(data);
- },
-
- /**
- * Error handler for request
- *
- * @param {Object} jqXHR
- * @param {String} textStatus
- */
- error: function (jqXHR, textStatus) {
- deferred.reject();
- throw textStatus;
- }
+ dataType: 'json'
});
-
- return deferred.promise();
},
/**
@@ -454,7 +381,7 @@ define([
*/
createTree: function (data) {
$(this.directoryTreeSelector).jstree({
- plugins: ['json_data', 'themes', 'ui', 'crrm', 'types', 'hotkeys'],
+ plugins: ['json_data', 'themes', 'ui', 'crrm', 'types', 'hotkeys'],
vcheckbox: {
'two_state': true,
'real_checkboxes': true
From 6e53e0d90b3cbc86ee368c35605615d713fe9682 Mon Sep 17 00:00:00 2001
From: Shankar Konar
Date: Fri, 14 Aug 2020 11:04:05 +0530
Subject: [PATCH 054/119] 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 560c59fe7996b797a87426b18f7b8d206a079474 Mon Sep 17 00:00:00 2001
From: eduard13
Date: Fri, 14 Aug 2020 09:31:27 +0300
Subject: [PATCH 055/119] Refactoring the code in separate modules
---
.../Product/BundleOptionDataProvider.php | 3 +--
.../Model/Wishlist}/BundleOptions.php | 10 ++++-----
.../Magento/BundleGraphQl/etc/graphql/di.xml | 7 ++++++
.../Magento/BundleGraphQl/etc/schema.graphqls | 4 ++++
.../Magento/CatalogGraphQl/etc/graphql/di.xml | 8 +++++++
.../CatalogGraphQl/etc/schema.graphqls | 6 +++++
.../Model/Wishlist}/ChildSku.php | 14 ++++++------
.../Model/Wishlist}/ConfigurableOptions.php | 14 ++++++------
.../etc/graphql/di.xml | 7 ++++++
.../etc/schema.graphqls | 5 +++++
.../DownloadableGraphQl/etc/graphql/di.xml | 7 ++++++
.../DownloadableGraphQl/etc/schema.graphqls | 5 +++++
app/code/Magento/WishlistGraphQl/etc/di.xml | 21 ------------------
.../WishlistGraphQl/etc/schema.graphqls | 22 +------------------
14 files changed, 70 insertions(+), 63 deletions(-)
rename app/code/Magento/{Wishlist => Bundle}/Model/Product/BundleOptionDataProvider.php (98%)
rename app/code/Magento/{WishlistGraphQl/Model/Resolver/Type/Bundle => BundleGraphQl/Model/Wishlist}/BundleOptions.php (80%)
rename app/code/Magento/{WishlistGraphQl/Model/Resolver/Type/Configurable => ConfigurableProductGraphQl/Model/Wishlist}/ChildSku.php (68%)
rename app/code/Magento/{WishlistGraphQl/Model/Resolver/Type/Configurable => ConfigurableProductGraphQl/Model/Wishlist}/ConfigurableOptions.php (78%)
delete mode 100644 app/code/Magento/WishlistGraphQl/etc/di.xml
diff --git a/app/code/Magento/Wishlist/Model/Product/BundleOptionDataProvider.php b/app/code/Magento/Bundle/Model/Product/BundleOptionDataProvider.php
similarity index 98%
rename from app/code/Magento/Wishlist/Model/Product/BundleOptionDataProvider.php
rename to app/code/Magento/Bundle/Model/Product/BundleOptionDataProvider.php
index 406524c7a189d..d6b7419a9f934 100644
--- a/app/code/Magento/Wishlist/Model/Product/BundleOptionDataProvider.php
+++ b/app/code/Magento/Bundle/Model/Product/BundleOptionDataProvider.php
@@ -5,11 +5,10 @@
*/
declare(strict_types=1);
-namespace Magento\Wishlist\Model\Product;
+namespace Magento\Bundle\Model\Product;
use Magento\Bundle\Helper\Catalog\Product\Configuration;
use Magento\Bundle\Model\Option;
-use Magento\Bundle\Model\Product\Type;
use Magento\Catalog\Model\Product;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Pricing\Helper\Data;
diff --git a/app/code/Magento/WishlistGraphQl/Model/Resolver/Type/Bundle/BundleOptions.php b/app/code/Magento/BundleGraphQl/Model/Wishlist/BundleOptions.php
similarity index 80%
rename from app/code/Magento/WishlistGraphQl/Model/Resolver/Type/Bundle/BundleOptions.php
rename to app/code/Magento/BundleGraphQl/Model/Wishlist/BundleOptions.php
index d11200d96ce1a..217f822e771da 100644
--- a/app/code/Magento/WishlistGraphQl/Model/Resolver/Type/Bundle/BundleOptions.php
+++ b/app/code/Magento/BundleGraphQl/Model/Wishlist/BundleOptions.php
@@ -5,14 +5,14 @@
*/
declare(strict_types=1);
-namespace Magento\WishlistGraphQl\Model\Resolver\Type\Bundle;
+namespace Magento\BundleGraphQl\Model\Wishlist;
-use Magento\Wishlist\Model\Product\BundleOptionDataProvider;
+use Magento\Bundle\Model\Product\BundleOptionDataProvider;
+use Magento\Catalog\Model\Product\Configuration\Item\ItemInterface;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\GraphQl\Config\Element\Field;
use Magento\Framework\GraphQl\Query\ResolverInterface;
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
-use Magento\Wishlist\Model\Item;
/**
* Fetches the selected bundle options
@@ -43,9 +43,9 @@ public function resolve(
array $value = null,
array $args = null
) {
- if (!$value['itemModel'] instanceof Item) {
+ if (!$value['itemModel'] instanceof ItemInterface) {
throw new LocalizedException(__('"itemModel" should be a "%instance" instance', [
- 'instance' => Item::class
+ 'instance' => ItemInterface::class
]));
}
diff --git a/app/code/Magento/BundleGraphQl/etc/graphql/di.xml b/app/code/Magento/BundleGraphQl/etc/graphql/di.xml
index 863e152fbe177..7fe0b2a53677c 100644
--- a/app/code/Magento/BundleGraphQl/etc/graphql/di.xml
+++ b/app/code/Magento/BundleGraphQl/etc/graphql/di.xml
@@ -100,4 +100,11 @@
+
+
+
+ - BundleWishlistItem
+
+
+
diff --git a/app/code/Magento/BundleGraphQl/etc/schema.graphqls b/app/code/Magento/BundleGraphQl/etc/schema.graphqls
index a66fa397020a7..75731516daf4c 100644
--- a/app/code/Magento/BundleGraphQl/etc/schema.graphqls
+++ b/app/code/Magento/BundleGraphQl/etc/schema.graphqls
@@ -117,3 +117,7 @@ type ItemSelectedBundleOptionValue @doc(description: "A list of values for the s
quantity: Float! @doc(description: "Indicates how many of this bundle product were ordered")
price: Money! @doc(description: "The price of the child bundle product")
}
+
+type BundleWishlistItem implements WishlistItemInterface {
+ bundle_options: [SelectedBundleOption!] @doc(description: "An array containing information about the selected bundled items") @resolver(class: "\\Magento\\BundleGraphQl\\Model\\Wishlist\\BundleOptions")
+}
diff --git a/app/code/Magento/CatalogGraphQl/etc/graphql/di.xml b/app/code/Magento/CatalogGraphQl/etc/graphql/di.xml
index c4f9bc26ee9f3..9ed36098ab6eb 100644
--- a/app/code/Magento/CatalogGraphQl/etc/graphql/di.xml
+++ b/app/code/Magento/CatalogGraphQl/etc/graphql/di.xml
@@ -180,4 +180,12 @@
Magento\Widget\Model\Template\FilterEmulate
+
+
+
+ - SimpleWishlistItem
+ - VirtualWishlistItem
+
+
+
diff --git a/app/code/Magento/CatalogGraphQl/etc/schema.graphqls b/app/code/Magento/CatalogGraphQl/etc/schema.graphqls
index 35f2c767b3e1e..1a4fd6b8bd986 100644
--- a/app/code/Magento/CatalogGraphQl/etc/schema.graphqls
+++ b/app/code/Magento/CatalogGraphQl/etc/schema.graphqls
@@ -492,3 +492,9 @@ type StoreConfig @doc(description: "The type contains information about a store
catalog_default_sort_by : String @doc(description: "Default Sort By.")
root_category_id: Int @doc(description: "The ID of the root category") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\RootCategoryId")
}
+
+type SimpleWishlistItem implements WishlistItemInterface @doc(description: "Simple Wishlist Item") {
+}
+
+type VirtualWishlistItem implements WishlistItemInterface @doc(description: "Virtual Wishlist Item") {
+}
diff --git a/app/code/Magento/WishlistGraphQl/Model/Resolver/Type/Configurable/ChildSku.php b/app/code/Magento/ConfigurableProductGraphQl/Model/Wishlist/ChildSku.php
similarity index 68%
rename from app/code/Magento/WishlistGraphQl/Model/Resolver/Type/Configurable/ChildSku.php
rename to app/code/Magento/ConfigurableProductGraphQl/Model/Wishlist/ChildSku.php
index a6c77cbe9da9c..84decab81c96a 100644
--- a/app/code/Magento/WishlistGraphQl/Model/Resolver/Type/Configurable/ChildSku.php
+++ b/app/code/Magento/ConfigurableProductGraphQl/Model/Wishlist/ChildSku.php
@@ -5,13 +5,13 @@
*/
declare(strict_types=1);
-namespace Magento\WishlistGraphQl\Model\Resolver\Type\Configurable;
+namespace Magento\ConfigurableProductGraphQl\Model\Wishlist;
+use Magento\Catalog\Model\Product;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\GraphQl\Config\Element\Field;
use Magento\Framework\GraphQl\Query\ResolverInterface;
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
-use Magento\Wishlist\Model\Item;
/**
* Fetches the simple child sku of configurable product
@@ -28,15 +28,15 @@ public function resolve(
array $value = null,
array $args = null
) {
- if (!$value['itemModel'] instanceof Item) {
+ if (!$value['model'] instanceof Product) {
throw new LocalizedException(__('"itemModel" should be a "%instance" instance', [
- 'instance' => Item::class
+ 'instance' => Product::class
]));
}
- /** @var Item $wishlistItem */
- $wishlistItem = $value['itemModel'];
- $optionProduct = $wishlistItem->getProduct()->getCustomOption('simple_product')->getProduct();
+ /** @var Product $product */
+ $product = $value['model'];
+ $optionProduct = $product->getCustomOption('simple_product')->getProduct();
return $optionProduct->getSku();
}
diff --git a/app/code/Magento/WishlistGraphQl/Model/Resolver/Type/Configurable/ConfigurableOptions.php b/app/code/Magento/ConfigurableProductGraphQl/Model/Wishlist/ConfigurableOptions.php
similarity index 78%
rename from app/code/Magento/WishlistGraphQl/Model/Resolver/Type/Configurable/ConfigurableOptions.php
rename to app/code/Magento/ConfigurableProductGraphQl/Model/Wishlist/ConfigurableOptions.php
index 1090c8e5aaa1c..6fcb3e118e5f1 100644
--- a/app/code/Magento/WishlistGraphQl/Model/Resolver/Type/Configurable/ConfigurableOptions.php
+++ b/app/code/Magento/ConfigurableProductGraphQl/Model/Wishlist/ConfigurableOptions.php
@@ -5,14 +5,14 @@
*/
declare(strict_types=1);
-namespace Magento\WishlistGraphQl\Model\Resolver\Type\Configurable;
+namespace Magento\ConfigurableProductGraphQl\Model\Wishlist;
use Magento\Catalog\Helper\Product\Configuration;
+use Magento\Catalog\Model\Product\Configuration\Item\ItemInterface;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\GraphQl\Config\Element\Field;
use Magento\Framework\GraphQl\Query\ResolverInterface;
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
-use Magento\Wishlist\Model\Item;
/**
* Fetches the selected configurable options
@@ -43,17 +43,17 @@ public function resolve(
array $value = null,
array $args = null
) {
- if (!$value['itemModel'] instanceof Item) {
+ if (!$value['itemModel'] instanceof ItemInterface) {
throw new LocalizedException(__('"itemModel" should be a "%instance" instance', [
- 'instance' => Item::class
+ 'instance' => ItemInterface::class
]));
}
- /** @var Item $wishlistItem */
- $wishlistItem = $value['itemModel'];
+ /** @var ItemInterface $item */
+ $item = $value['itemModel'];
$result = [];
- foreach ($this->configurationHelper->getOptions($wishlistItem) as $option) {
+ foreach ($this->configurationHelper->getOptions($item) as $option) {
$result[] = [
'id' => $option['option_id'],
'option_label' => $option['label'],
diff --git a/app/code/Magento/ConfigurableProductGraphQl/etc/graphql/di.xml b/app/code/Magento/ConfigurableProductGraphQl/etc/graphql/di.xml
index f82bb0dbd4d91..808ca62f7e149 100644
--- a/app/code/Magento/ConfigurableProductGraphQl/etc/graphql/di.xml
+++ b/app/code/Magento/ConfigurableProductGraphQl/etc/graphql/di.xml
@@ -36,4 +36,11 @@
+
+
+
+ - ConfigurableWishlistItem
+
+
+
diff --git a/app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls b/app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls
index 6e85653380acc..6690835237ccf 100644
--- a/app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls
+++ b/app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls
@@ -68,3 +68,8 @@ type SelectedConfigurableOption {
value_id: Int!
value_label: String!
}
+
+type ConfigurableWishlistItem implements WishlistItemInterface {
+ child_sku: String! @doc(description: "SKU of the simple product corresponding to a set of selected configurable options.") @resolver(class: "\\Magento\\ConfigurableProductGraphQl\\Model\\Wishlist\\ChildSku")
+ configurable_options: [SelectedConfigurableOption!] @resolver(class: "\\Magento\\ConfigurableProductGraphQl\\Model\\Wishlist\\ConfigurableOptions")
+}
diff --git a/app/code/Magento/DownloadableGraphQl/etc/graphql/di.xml b/app/code/Magento/DownloadableGraphQl/etc/graphql/di.xml
index c95667de15ac3..51a630d59ca0f 100644
--- a/app/code/Magento/DownloadableGraphQl/etc/graphql/di.xml
+++ b/app/code/Magento/DownloadableGraphQl/etc/graphql/di.xml
@@ -39,4 +39,11 @@
+
+
+
+ - DownloadableWishlistItem
+
+
+
diff --git a/app/code/Magento/DownloadableGraphQl/etc/schema.graphqls b/app/code/Magento/DownloadableGraphQl/etc/schema.graphqls
index 5863e62e81b1b..8795b70475f1f 100644
--- a/app/code/Magento/DownloadableGraphQl/etc/schema.graphqls
+++ b/app/code/Magento/DownloadableGraphQl/etc/schema.graphqls
@@ -64,3 +64,8 @@ type DownloadableProductSamples @doc(description: "DownloadableProductSamples de
sample_type: DownloadableFileTypeEnum @deprecated(reason: "`sample_url` serves to get the downloadable sample")
sample_file: String @deprecated(reason: "`sample_url` serves to get the downloadable sample")
}
+
+type DownloadableWishlistItem implements WishlistItemInterface @doc(description: "Downloadable Wishlist Item") {
+ links_v2: [DownloadableProductLinks] @doc(description: "An array containing information about the selected links") @resolver(class: "\\Magento\\DownloadableGraphQl\\Model\\Wishlist\\ItemLinks")
+ samples: [DownloadableProductSamples] @doc(description: "DownloadableProductSamples defines characteristics of a downloadable product") @resolver(class: "Magento\\DownloadableGraphQl\\Resolver\\Product\\Samples")
+}
diff --git a/app/code/Magento/WishlistGraphQl/etc/di.xml b/app/code/Magento/WishlistGraphQl/etc/di.xml
deleted file mode 100644
index de1a62225672a..0000000000000
--- a/app/code/Magento/WishlistGraphQl/etc/di.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
-
- - SimpleWishlistItem
- - VirtualWishlistItem
- - ConfigurableWishlistItem
- - DownloadableWishlistItem
- - BundleWishlistItem
-
-
-
-
diff --git a/app/code/Magento/WishlistGraphQl/etc/schema.graphqls b/app/code/Magento/WishlistGraphQl/etc/schema.graphqls
index a7c8003a7c3e7..f6ff44e34e6c5 100644
--- a/app/code/Magento/WishlistGraphQl/etc/schema.graphqls
+++ b/app/code/Magento/WishlistGraphQl/etc/schema.graphqls
@@ -24,7 +24,7 @@ type WishlistOutput @doc(description: "Deprecated: `Wishlist` type should be use
type Wishlist {
id: ID @doc(description: "Wishlist unique identifier")
- items: [WishlistItem] @resolver(class: "\\Magento\\WishlistGraphQl\\Model\\Resolver\\WishlistItemsResolver") @doc(description: "Use field `items_v2` from type `Wishlist` instead")
+ items: [WishlistItem] @resolver(class: "\\Magento\\WishlistGraphQl\\Model\\Resolver\\WishlistItemsResolver") @deprecated(description: "Use field `items_v2` from type `Wishlist` instead")
items_v2: [WishlistItemInterface] @resolver(class: "\\Magento\\WishlistGraphQl\\Model\\Resolver\\WishlistItems") @doc(description: "An array of items in the customer's wishlist")
items_count: Int @doc(description: "The number of items in the wish list")
sharing_code: String @doc(description: "An encrypted code that Magento uses to link to the wish list")
@@ -40,26 +40,6 @@ interface WishlistItemInterface @typeResolver(class: "Magento\\WishlistGraphQl\\
customizable_options: [SelectedCustomizableOption]
}
-type SimpleWishlistItem implements WishlistItemInterface @doc(description: "Simple Wishlist Item") {
-}
-
-type VirtualWishlistItem implements WishlistItemInterface @doc(description: "Virtual Wishlist Item") {
-}
-
-type ConfigurableWishlistItem implements WishlistItemInterface {
- child_sku: String! @doc(description: "SKU of the simple product corresponding to a set of selected configurable options.") @resolver(class: "\\Magento\\WishlistGraphQl\\Model\\Resolver\\Type\\Configurable\\ChildSku")
- configurable_options: [SelectedConfigurableOption!] @resolver(class: "\\Magento\\WishlistGraphQl\\Model\\Resolver\\Type\\Configurable\\ConfigurableOptions")
-}
-
-type DownloadableWishlistItem implements WishlistItemInterface @doc(description: "Downloadable Wishlist Item") {
- links_v2: [DownloadableProductLinks] @doc(description: "An array containing information about the selected links") @resolver(class: "\\Magento\\DownloadableGraphQl\\Model\\Wishlist\\ItemLinks")
- samples: [DownloadableProductSamples] @doc(description: "DownloadableProductSamples defines characteristics of a downloadable product") @resolver(class: "Magento\\DownloadableGraphQl\\Resolver\\Product\\Samples")
-}
-
-type BundleWishlistItem implements WishlistItemInterface {
- bundle_options: [SelectedBundleOption!] @doc(description: "An array containing information about the selected bundled items") @resolver(class: "\\Magento\\WishlistGraphQl\\Model\\Resolver\\Type\\Bundle\\BundleOptions")
-}
-
type WishlistItem {
id: Int @doc(description: "The wish list item ID")
qty: Float @doc(description: "The quantity of this wish list item"),
From f1ccb7c1a85ed6f6485885b9aab1ac1e19a2534e Mon Sep 17 00:00:00 2001
From: eduard13
Date: Fri, 14 Aug 2020 10:27:07 +0300
Subject: [PATCH 056/119] Removing the Wishlist dependency
---
.../Product/BundleOptionDataProvider.php | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/app/code/Magento/Bundle/Model/Product/BundleOptionDataProvider.php b/app/code/Magento/Bundle/Model/Product/BundleOptionDataProvider.php
index d6b7419a9f934..f56c4228e49e5 100644
--- a/app/code/Magento/Bundle/Model/Product/BundleOptionDataProvider.php
+++ b/app/code/Magento/Bundle/Model/Product/BundleOptionDataProvider.php
@@ -10,10 +10,9 @@
use Magento\Bundle\Helper\Catalog\Product\Configuration;
use Magento\Bundle\Model\Option;
use Magento\Catalog\Model\Product;
-use Magento\Framework\Exception\LocalizedException;
+use Magento\Catalog\Model\Product\Configuration\Item\ItemInterface;
use Magento\Framework\Pricing\Helper\Data;
use Magento\Framework\Serialize\SerializerInterface;
-use Magento\Wishlist\Model\Item;
/**
* Data provider for bundled product options
@@ -51,13 +50,13 @@ public function __construct(
}
/**
- * Extract data for a bundled wishlist item
+ * Extract data for a bundled item
*
- * @param Item $item
+ * @param ItemInterface $item
*
* @return array
*/
- public function getData(Item $item): array
+ public function getData(ItemInterface $item): array
{
$options = [];
$product = $item->getProduct();
@@ -89,11 +88,11 @@ public function getData(Item $item): array
* Build bundle product options based on current selection
*
* @param Option[] $bundleOptions
- * @param Item $item
+ * @param ItemInterface $item
*
* @return array
*/
- private function buildBundleOptions(array $bundleOptions, Item $item): array
+ private function buildBundleOptions(array $bundleOptions, ItemInterface $item): array
{
$options = [];
foreach ($bundleOptions as $bundleOption) {
@@ -116,13 +115,11 @@ private function buildBundleOptions(array $bundleOptions, Item $item): array
* Build bundle product option values based on current selection
*
* @param Product[] $selections
- * @param Item $item
+ * @param ItemInterface $item
*
* @return array
- *
- * @throws LocalizedException
*/
- private function buildBundleOptionValues(array $selections, Item $item): array
+ private function buildBundleOptionValues(array $selections, ItemInterface $item): array
{
$product = $item->getProduct();
$values = [];
From 3d7298e3d10a77b5321a152bfec9eeea634b079d Mon Sep 17 00:00:00 2001
From: Sathish
Date: Fri, 31 Jul 2020 23:27:29 +0530
Subject: [PATCH 057/119] Fix #29194 Update tier price block show & hide
---
.../StorefrontProductInfoMainSection.xml | 1 +
...ableProductWithTierPriceForOneItemTest.xml | 5 ++++-
.../view/frontend/web/js/configurable.js | 22 +++++++++----------
3 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Section/StorefrontProductInfoMainSection.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Section/StorefrontProductInfoMainSection.xml
index cf0e99f7c45c0..37c129dc3bbde 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Section/StorefrontProductInfoMainSection.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Section/StorefrontProductInfoMainSection.xml
@@ -13,6 +13,7 @@
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithTierPriceForOneItemTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithTierPriceForOneItemTest.xml
index 1491081a82ee4..4de01b0c9d14e 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithTierPriceForOneItemTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCreateConfigurableProductWithTierPriceForOneItemTest.xml
@@ -48,7 +48,7 @@
-
+
@@ -109,5 +109,8 @@
Buy {{tierProductPrice.quantity}} for ${{tierProductPrice.price}} each and save 27%
tierPriceText
+
+
+
diff --git a/app/code/Magento/ConfigurableProduct/view/frontend/web/js/configurable.js b/app/code/Magento/ConfigurableProduct/view/frontend/web/js/configurable.js
index f705b6a95987c..00030be74324f 100644
--- a/app/code/Magento/ConfigurableProduct/view/frontend/web/js/configurable.js
+++ b/app/code/Magento/ConfigurableProduct/view/frontend/web/js/configurable.js
@@ -740,21 +740,19 @@ define([
* @private
*/
_displayTierPriceBlock: function (optionId) {
- var options, tierPriceHtml;
+ var tierPrices = typeof optionId != 'undefined' && this.options.spConfig.optionPrices[optionId].tierPrices;
- if (typeof optionId != 'undefined' &&
- this.options.spConfig.optionPrices[optionId].tierPrices != [] // eslint-disable-line eqeqeq
- ) {
- options = this.options.spConfig.optionPrices[optionId];
+ if (_.isArray(tierPrices) && tierPrices.length > 0) {
if (this.options.tierPriceTemplate) {
- tierPriceHtml = mageTemplate(this.options.tierPriceTemplate, {
- 'tierPrices': options.tierPrices,
- '$t': $t,
- 'currencyFormat': this.options.spConfig.currencyFormat,
- 'priceUtils': priceUtils
- });
- $(this.options.tierPriceBlockSelector).html(tierPriceHtml).show();
+ $(this.options.tierPriceBlockSelector).html(
+ mageTemplate(this.options.tierPriceTemplate, {
+ 'tierPrices': tierPrices,
+ '$t': $t,
+ 'currencyFormat': this.options.spConfig.currencyFormat,
+ 'priceUtils': priceUtils
+ })
+ ).show();
}
} else {
$(this.options.tierPriceBlockSelector).hide();
From b566b8000621ccfdf96c894d2f73968daed8926e Mon Sep 17 00:00:00 2001
From: "vadim.malesh"
Date: Mon, 17 Aug 2020 14:48:00 +0300
Subject: [PATCH 058/119] add mftf
---
...tAssertCheckoutErrorMessageActionGroup.xml | 18 +++++
.../Section/CheckoutCartMessageSection.xml | 1 +
...rontRemoveProductOnCheckoutActionGroup.xml | 18 +++++
.../MultishippingSection.xml | 1 +
...rontCheckoutWithWithVirtualProductTest.xml | 70 +++++++++++++++++++
5 files changed, 108 insertions(+)
create mode 100644 app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontAssertCheckoutErrorMessageActionGroup.xml
create mode 100644 app/code/Magento/Multishipping/Test/Mftf/ActionGroup/StorefrontRemoveProductOnCheckoutActionGroup.xml
create mode 100644 app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontCheckoutWithWithVirtualProductTest.xml
diff --git a/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontAssertCheckoutErrorMessageActionGroup.xml b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontAssertCheckoutErrorMessageActionGroup.xml
new file mode 100644
index 0000000000000..6db9d9a1f0673
--- /dev/null
+++ b/app/code/Magento/Checkout/Test/Mftf/ActionGroup/StorefrontAssertCheckoutErrorMessageActionGroup.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutCartMessageSection.xml b/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutCartMessageSection.xml
index cf15cdf15cf15..0c7f200e2b5eb 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutCartMessageSection.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Section/CheckoutCartMessageSection.xml
@@ -12,5 +12,6 @@
+
diff --git a/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/StorefrontRemoveProductOnCheckoutActionGroup.xml b/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/StorefrontRemoveProductOnCheckoutActionGroup.xml
new file mode 100644
index 0000000000000..af0f3e2d597b8
--- /dev/null
+++ b/app/code/Magento/Multishipping/Test/Mftf/ActionGroup/StorefrontRemoveProductOnCheckoutActionGroup.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Multishipping/Test/Mftf/Section/MultishippingSection/MultishippingSection.xml b/app/code/Magento/Multishipping/Test/Mftf/Section/MultishippingSection/MultishippingSection.xml
index db037d50f7dc6..9c89ffa3cd405 100644
--- a/app/code/Magento/Multishipping/Test/Mftf/Section/MultishippingSection/MultishippingSection.xml
+++ b/app/code/Magento/Multishipping/Test/Mftf/Section/MultishippingSection/MultishippingSection.xml
@@ -14,5 +14,6 @@
+
diff --git a/app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontCheckoutWithWithVirtualProductTest.xml b/app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontCheckoutWithWithVirtualProductTest.xml
new file mode 100644
index 0000000000000..b1e676b8b5188
--- /dev/null
+++ b/app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontCheckoutWithWithVirtualProductTest.xml
@@ -0,0 +1,70 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
From 9a980484c23a78f888708223df55f56090b970c9 Mon Sep 17 00:00:00 2001
From: "taras.gamanov"
Date: Tue, 18 Aug 2020 12:00:32 +0300
Subject: [PATCH 059/119] 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 @@
+
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 @@
+
+
+
+
+
+ Goes to the Catalog->Product filters and check store view options at the Store View dropdown
+
+
+
+
+
+
+
+
+
+
+
+
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 @@
store
add
+
+
+ sameNameStoreView
+ storeViewCode
+ 1
+ null
+ add
+ store
+ customStoreGroup
+
+
+ sameNameStoreView
+ storeViewCode
+ 1
+ null
+ add
+ store
+ customStoreGroup
+
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 @@
+
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 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
From afe499d5fbd09abd86e3c8d48797395fada01fa6 Mon Sep 17 00:00:00 2001
From: janmonteros
Date: Tue, 18 Aug 2020 20:01:07 +0800
Subject: [PATCH 060/119] magento/adobe-stock-integration#1760: Media Gallery
page and Category grid page opened successfully if "Enhanced Media Gallery"
disabled - redirect to 404 if enhanced media gallery config is disabled.
---
.../Controller/Adminhtml/Category/Index.php | 29 +++++++++++++++++++
.../MediaGalleryCatalogUi/composer.json | 3 +-
.../Controller/Adminhtml/Media/Index.php | 29 +++++++++++++++++++
3 files changed, 60 insertions(+), 1 deletion(-)
diff --git a/app/code/Magento/MediaGalleryCatalogUi/Controller/Adminhtml/Category/Index.php b/app/code/Magento/MediaGalleryCatalogUi/Controller/Adminhtml/Category/Index.php
index a541e9999b784..497a65b207353 100644
--- a/app/code/Magento/MediaGalleryCatalogUi/Controller/Adminhtml/Category/Index.php
+++ b/app/code/Magento/MediaGalleryCatalogUi/Controller/Adminhtml/Category/Index.php
@@ -8,10 +8,13 @@
namespace Magento\MediaGalleryCatalogUi\Controller\Adminhtml\Category;
use Magento\Backend\App\Action;
+use Magento\Backend\App\Action\Context;
use Magento\Backend\Model\View\Result\Page;
+use Magento\Backend\Model\View\Result\Forward;
use Magento\Framework\App\Action\HttpGetActionInterface;
use Magento\Framework\Controller\ResultFactory;
use Magento\Framework\Controller\ResultInterface;
+use Magento\MediaContentApi\Model\Config;
/**
* Controller serving the media gallery content
@@ -20,6 +23,24 @@ class Index extends Action implements HttpGetActionInterface
{
public const ADMIN_RESOURCE = 'Magento_Cms::media_gallery';
+ /**
+ * @var Config
+ */
+ private $config;
+
+ /**
+ * Index constructor.
+ * @param Context $context
+ * @param Config $config
+ */
+ public function __construct(
+ Context $context,
+ Config $config
+ ) {
+ parent::__construct($context);
+ $this->config = $config;
+ }
+
/**
* Get the media gallery layout
*
@@ -27,6 +48,14 @@ class Index extends Action implements HttpGetActionInterface
*/
public function execute(): ResultInterface
{
+ if (!$this->config->isEnabled()) {
+ /** @var Forward $resultForward */
+ $resultForward = $this->resultFactory->create(ResultFactory::TYPE_FORWARD);
+ $resultForward->forward('noroute');
+
+ return $resultForward;
+ }
+
/** @var Page $resultPage */
$resultPage = $this->resultFactory->create(ResultFactory::TYPE_PAGE);
$resultPage->getConfig()->getTitle()->prepend(__('Categories'));
diff --git a/app/code/Magento/MediaGalleryCatalogUi/composer.json b/app/code/Magento/MediaGalleryCatalogUi/composer.json
index 985d581beff25..da759e67ddf54 100644
--- a/app/code/Magento/MediaGalleryCatalogUi/composer.json
+++ b/app/code/Magento/MediaGalleryCatalogUi/composer.json
@@ -8,7 +8,8 @@
"magento/module-backend": "*",
"magento/module-catalog": "*",
"magento/module-store": "*",
- "magento/module-ui": "*"
+ "magento/module-ui": "*",
+ "magento/module-media-content-api": "*"
},
"type": "magento2-module",
"license": [
diff --git a/app/code/Magento/MediaGalleryUi/Controller/Adminhtml/Media/Index.php b/app/code/Magento/MediaGalleryUi/Controller/Adminhtml/Media/Index.php
index 3660374243d16..8c5b3d4d3a9ac 100644
--- a/app/code/Magento/MediaGalleryUi/Controller/Adminhtml/Media/Index.php
+++ b/app/code/Magento/MediaGalleryUi/Controller/Adminhtml/Media/Index.php
@@ -12,6 +12,9 @@
use Magento\Framework\App\Action\HttpGetActionInterface;
use Magento\Framework\Controller\ResultFactory;
use Magento\Framework\Controller\ResultInterface;
+use Magento\MediaContentApi\Model\Config;
+use Magento\Backend\App\Action\Context;
+use Magento\Backend\Model\View\Result\Forward;
/**
* Controller serving the media gallery content
@@ -20,6 +23,24 @@ class Index extends Action implements HttpGetActionInterface
{
public const ADMIN_RESOURCE = 'Magento_Cms::media_gallery';
+ /**
+ * @var Config
+ */
+ private $config;
+
+ /**
+ * Index constructor.
+ * @param Context $context
+ * @param Config $config
+ */
+ public function __construct(
+ Context $context,
+ Config $config
+ ) {
+ parent::__construct($context);
+ $this->config = $config;
+ }
+
/**
* Get the media gallery layout
*
@@ -27,6 +48,14 @@ class Index extends Action implements HttpGetActionInterface
*/
public function execute(): ResultInterface
{
+ if (!$this->config->isEnabled()) {
+ /** @var Forward $resultForward */
+ $resultForward = $this->resultFactory->create(ResultFactory::TYPE_FORWARD);
+ $resultForward->forward('noroute');
+
+ return $resultForward;
+ }
+
/** @var Page $resultPage */
$resultPage = $this->resultFactory->create(ResultFactory::TYPE_PAGE);
$resultPage->setActiveMenu('Magento_MediaGalleryUi::media_gallery')
From 9fd19aa5e6210e23d84d36b15f9807a2442a0854 Mon Sep 17 00:00:00 2001
From: Nazar Klovanych
Date: Tue, 18 Aug 2020 15:13:59 +0300
Subject: [PATCH 061/119] cut long folders name to avoid styles issue
---
.../Magento/MediaGalleryUi/Model/Directories/GetFolderTree.php | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/app/code/Magento/MediaGalleryUi/Model/Directories/GetFolderTree.php b/app/code/Magento/MediaGalleryUi/Model/Directories/GetFolderTree.php
index f0998a3e120f2..c152330a39bbd 100644
--- a/app/code/Magento/MediaGalleryUi/Model/Directories/GetFolderTree.php
+++ b/app/code/Magento/MediaGalleryUi/Model/Directories/GetFolderTree.php
@@ -84,8 +84,9 @@ private function getDirectories(): array
}
$pathArray = explode('/', $path);
+ $displayName = strlen(end($pathArray)) > 50 ? substr(end($pathArray),0,50)."..." : end($pathArray);
$directories[] = [
- 'data' => count($pathArray) > 0 ? end($pathArray) : $path,
+ 'data' => count($pathArray) > 0 ? $displayName : $path,
'attr' => ['id' => $path],
'metadata' => [
'path' => $path
From a516ee5ff9c1cc64878c4101d2a010cc2173560d Mon Sep 17 00:00:00 2001
From: Sergii Ivashchenko
Date: Tue, 18 Aug 2020 13:23:24 +0100
Subject: [PATCH 062/119] magento/magento2#29411: Naming update
---
.../Adminhtml/Directories/GetTree.php | 16 ++---
.../{FolderTree.php => GetDirectoryTree.php} | 59 ++++++-------------
app/code/Magento/MediaGalleryUi/etc/di.xml | 5 --
3 files changed, 28 insertions(+), 52 deletions(-)
rename app/code/Magento/MediaGalleryUi/Model/Directories/{FolderTree.php => GetDirectoryTree.php} (77%)
diff --git a/app/code/Magento/MediaGalleryUi/Controller/Adminhtml/Directories/GetTree.php b/app/code/Magento/MediaGalleryUi/Controller/Adminhtml/Directories/GetTree.php
index 229a717ef13dd..d9a38895e1fa0 100644
--- a/app/code/Magento/MediaGalleryUi/Controller/Adminhtml/Directories/GetTree.php
+++ b/app/code/Magento/MediaGalleryUi/Controller/Adminhtml/Directories/GetTree.php
@@ -11,7 +11,7 @@
use Magento\Framework\App\Action\HttpGetActionInterface;
use Magento\Framework\Controller\Result\Json;
use Magento\Framework\Controller\ResultFactory;
-use Magento\MediaGalleryUi\Model\Directories\FolderTree;
+use Magento\MediaGalleryUi\Model\Directories\GetDirectoryTree;
use Psr\Log\LoggerInterface;
/**
@@ -33,25 +33,25 @@ class GetTree extends Action implements HttpGetActionInterface
private $logger;
/**
- * @var FolderTree
+ * @var GetDirectoryTree
*/
- private $folderTree;
+ private $getDirectoryTree;
/**
* Constructor
*
* @param Action\Context $context
* @param LoggerInterface $logger
- * @param FolderTree $folderTree
+ * @param GetDirectoryTree $getDirectoryTree
*/
public function __construct(
Action\Context $context,
LoggerInterface $logger,
- FolderTree $folderTree
+ GetDirectoryTree $getDirectoryTree
) {
parent::__construct($context);
$this->logger = $logger;
- $this->folderTree = $folderTree;
+ $this->getDirectoryTree = $getDirectoryTree;
}
/**
* @inheritdoc
@@ -59,7 +59,9 @@ public function __construct(
public function execute()
{
try {
- $responseContent[] = $this->folderTree->buildTree();
+ $responseContent = [
+ $this->getDirectoryTree->execute()
+ ];
$responseCode = self::HTTP_OK;
} catch (\Exception $exception) {
$this->logger->critical($exception);
diff --git a/app/code/Magento/MediaGalleryUi/Model/Directories/FolderTree.php b/app/code/Magento/MediaGalleryUi/Model/Directories/GetDirectoryTree.php
similarity index 77%
rename from app/code/Magento/MediaGalleryUi/Model/Directories/FolderTree.php
rename to app/code/Magento/MediaGalleryUi/Model/Directories/GetDirectoryTree.php
index 574b8aab8bcd3..35e34a7e5532c 100644
--- a/app/code/Magento/MediaGalleryUi/Model/Directories/FolderTree.php
+++ b/app/code/Magento/MediaGalleryUi/Model/Directories/GetDirectoryTree.php
@@ -7,58 +7,61 @@
namespace Magento\MediaGalleryUi\Model\Directories;
+use Magento\Framework\App\Filesystem\DirectoryList;
use Magento\Framework\Exception\ValidatorException;
use Magento\Framework\Filesystem;
use Magento\Framework\Filesystem\Directory\Read;
use Magento\MediaGalleryApi\Api\IsPathExcludedInterface;
/**
- * Build folder tree structure by path
+ * Build media gallery folder tree structure by path
*/
-class FolderTree
+class GetDirectoryTree
{
/**
* @var Filesystem
*/
private $filesystem;
- /**
- * @var string
- */
- private $path;
-
/**
* @var IsPathExcludedInterface
*/
private $isPathExcluded;
/**
- * Constructor
- *
* @param Filesystem $filesystem
- * @param string $path
* @param IsPathExcludedInterface $isPathExcluded
*/
public function __construct(
Filesystem $filesystem,
- string $path,
IsPathExcludedInterface $isPathExcluded
) {
$this->filesystem = $filesystem;
- $this->path = $path;
$this->isPathExcluded = $isPathExcluded;
}
/**
* Return directory folder structure in array
*
- * @param bool $skipRoot
* @return array
* @throws ValidatorException
*/
- public function buildTree(bool $skipRoot = true): array
+ public function execute(): array
{
- return $this->buildFolderTree($this->getDirectories(), $skipRoot);
+ $tree = [
+ 'name' => 'root',
+ 'path' => '/',
+ 'children' => []
+ ];
+ $directories = $this->getDirectories();
+ foreach ($directories as $idx => &$node) {
+ $node['children'] = [];
+ $result = $this->findParent($node, $tree);
+ $parent = &$result['treeNode'];
+
+ $parent['children'][] = &$directories[$idx];
+ }
+ return $tree['children'];
}
/**
@@ -72,7 +75,7 @@ private function getDirectories(): array
$directories = [];
/** @var Read $directory */
- $directory = $this->filesystem->getDirectoryRead($this->path);
+ $directory = $this->filesystem->getDirectoryRead(DirectoryList::MEDIA);
if (!$directory->isDirectory()) {
return $directories;
@@ -96,30 +99,6 @@ private function getDirectories(): array
return $directories;
}
- /**
- * Build folder tree structure by provided directories path
- *
- * @param array $directories
- * @param bool $skipRoot
- * @return array
- */
- private function buildFolderTree(array $directories, bool $skipRoot): array
- {
- $tree = [
- 'name' => 'root',
- 'path' => '/',
- 'children' => []
- ];
- foreach ($directories as $idx => &$node) {
- $node['children'] = [];
- $result = $this->findParent($node, $tree);
- $parent = & $result['treeNode'];
-
- $parent['children'][] =& $directories[$idx];
- }
- return $skipRoot ? $tree['children'] : $tree;
- }
-
/**
* Find parent directory
*
diff --git a/app/code/Magento/MediaGalleryUi/etc/di.xml b/app/code/Magento/MediaGalleryUi/etc/di.xml
index 040e003817efa..63a5a1a5ad378 100644
--- a/app/code/Magento/MediaGalleryUi/etc/di.xml
+++ b/app/code/Magento/MediaGalleryUi/etc/di.xml
@@ -28,11 +28,6 @@
-
-
- media
-
-
From 084f689c14cc47fae2b53c8f11f87de548e76227 Mon Sep 17 00:00:00 2001
From: Nazar Klovanych
Date: Tue, 18 Aug 2020 15:51:17 +0300
Subject: [PATCH 063/119] Correctly apply filters from url-applier do avoid
dropping other filters
---
.../Ui/view/base/web/js/grid/url-filter-applier.js | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/app/code/Magento/Ui/view/base/web/js/grid/url-filter-applier.js b/app/code/Magento/Ui/view/base/web/js/grid/url-filter-applier.js
index 1f870e9e819a1..ab985c51449e8 100644
--- a/app/code/Magento/Ui/view/base/web/js/grid/url-filter-applier.js
+++ b/app/code/Magento/Ui/view/base/web/js/grid/url-filter-applier.js
@@ -5,8 +5,9 @@
define([
'uiComponent',
- 'underscore'
-], function (Component, _) {
+ 'underscore',
+ 'jquery'
+], function (Component, _, $) {
'use strict';
return Component.extend({
@@ -36,7 +37,9 @@ define([
* Apply filter
*/
apply: function () {
- var urlFilter = this.getFilterParam(this.searchString);
+ var urlFilter = this.getFilterParam(this.searchString),
+ applied,
+ filters = {};
if (_.isUndefined(this.filterComponent())) {
setTimeout(function () {
@@ -47,8 +50,9 @@ define([
}
if (Object.keys(urlFilter).length) {
- this.filterComponent().setData(urlFilter, false);
- this.filterComponent().apply();
+ applied = this.filterComponent().get('applied');
+ filters = $.extend(true, urlFilter, applied);
+ this.filterComponent().set('applied', filters);
}
},
From eb1f0bb35652eaf0a88aa9218214bde38119f4e7 Mon Sep 17 00:00:00 2001
From: Sergii Ivashchenko
Date: Tue, 18 Aug 2020 14:21:19 +0100
Subject: [PATCH 064/119] magento/magento2#29411: Updated requested directory
selection behaviour
---
.../web/js/directory/directoryTree.js | 244 ++++++++++++------
1 file changed, 163 insertions(+), 81 deletions(-)
diff --git a/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/directory/directoryTree.js b/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/directory/directoryTree.js
index 9cf5144808f7d..a5c5de1ccdf73 100644
--- a/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/directory/directoryTree.js
+++ b/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/directory/directoryTree.js
@@ -21,13 +21,13 @@ define([
directoryTreeSelector: '#media-gallery-directory-tree',
getDirectoryTreeUrl: 'media_gallery/directories/gettree',
createDirectoryUrl: 'media_gallery/directories/create',
- activeNode: null,
+ jsTreeReloaded: null,
modules: {
directories: '${ $.name }_directories',
filterChips: '${ $.filterChipsProvider }'
},
listens: {
- '${ $.provider }:params.filters.path': 'selectTreeFolder'
+ '${ $.provider }:params.filters.path': 'updateSelectedDirectory'
},
viewConfig: [{
component: 'Magento_MediaGalleryUi/js/directory/directories',
@@ -62,45 +62,57 @@ define([
renderDirectoryTree: function () {
return this.getJsonTree().then(function (data) {
this.createFolderIfNotExists(data).then(function (isFolderCreated) {
- if (!isFolderCreated) {
+ if (isFolderCreated) {
+ this.getJsonTree().then(function (newData) {
+ this.createTree(newData);
+ }.bind(this));
+ } else {
this.createTree(data);
- return;
}
-
- this.getJsonTree().then(function (newData) {
- this.createTree(newData);
- }.bind(this));
}.bind(this));
}.bind(this));
},
+ /**
+ * Set jstree reloaded
+ *
+ * @param {Boolean} value
+ */
+ setJsTreeReloaded: function (value) {
+ this.jsTreeReloaded = value;
+ },
+
/**
* Create folder by provided current_tree_path param
*
* @param {Array} directories
*/
createFolderIfNotExists: function (directories) {
- var requestedDirectoryPath = this.getRequestedDirectory(),
+ var isMediaBrowser = !_.isUndefined(window.MediabrowserUtility),
+ currentTreePath = isMediaBrowser ? window.MediabrowserUtility.pathId : null,
deferred = $.Deferred(),
+ decodedPath,
pathArray;
- if (!requestedDirectoryPath) {
+ if (!currentTreePath) {
deferred.resolve(false);
return deferred.promise();
}
- if (this.isDirectoryExist(directories[0], requestedDirectoryPath)) {
+ decodedPath = Base64.idDecode(currentTreePath);
+
+ if (this.isDirectoryExist(directories[0], decodedPath)) {
deferred.resolve(false);
return deferred.promise();
}
- pathArray = this.convertPathToPathsArray(requestedDirectoryPath);
+ pathArray = this.convertPathToPathsArray(decodedPath);
- $.each(pathArray, function (index, directoryId) {
- if (this.isDirectoryExist(directories[0], directoryId)) {
- pathArray.splice(index, 1);
+ $.each(pathArray, function (i, val) {
+ if (this.isDirectoryExist(directories[0], val)) {
+ pathArray.splice(i, 1);
}
}.bind(this));
@@ -118,22 +130,33 @@ define([
* Verify if directory exists in array
*
* @param {Array} directories
- * @param {String} path
+ * @param {String} directoryId
*/
- isDirectoryExist: function (directories, path) {
- var i;
-
- for (i = 0; i < directories.length; i++) {
- if (directories[i].attr.id === path
- || directories[i].children
- && directories[i].children.length
- && this.isDirectoryExist(directories[i].children, path)
- ) {
- return true;
+ isDirectoryExist: function (directories, directoryId) {
+ var found = false;
+
+ /**
+ * Recursive search in array
+ *
+ * @param {Array} data
+ * @param {String} id
+ */
+ function recurse(data, id) {
+ var i;
+
+ for (i = 0; i < data.length; i++) {
+ if (data[i].attr.id === id) {
+ found = data[i];
+ break;
+ } else if (data[i].children && data[i].children.length) {
+ recurse(data[i].children, id);
+ }
}
}
- return false;
+ recurse(directories, directoryId);
+
+ return found;
},
/**
@@ -181,7 +204,7 @@ define([
/**
* Remove ability to multiple select on nodes
*/
- disableMultiselectBehavior: function () {
+ overrideMultiselectBehavior: function () {
$.jstree.defaults.ui['select_range_modifier'] = false;
$.jstree.defaults.ui['select_multiple_modifier'] = false;
},
@@ -190,12 +213,21 @@ define([
* Handle jstree events
*/
initEvents: function () {
- this.initJsTreeEvents();
- this.disableMultiselectBehavior();
+ this.firejsTreeEvents();
+ this.overrideMultiselectBehavior();
$(window).on('reload.MediaGallery', function () {
- this.renderDirectoryTree().then(function () {
- this.initJsTreeEvents();
+ this.getJsonTree().then(function (data) {
+ this.createFolderIfNotExists(data).then(function (isCreated) {
+ if (isCreated) {
+ this.renderDirectoryTree().then(function () {
+ this.setJsTreeReloaded(true);
+ this.firejsTreeEvents();
+ }.bind(this));
+ } else {
+ this.updateSelectedDirectory();
+ }
+ }.bind(this));
}.bind(this));
}.bind(this));
},
@@ -203,78 +235,124 @@ define([
/**
* Fire event for jstree component
*/
- initJsTreeEvents: function () {
+ firejsTreeEvents: function () {
$(this.directoryTreeSelector).on('select_node.jstree', function (element, data) {
- this.toggleSelectedDirectory($(data.rslt.obj).data('path'));
+ this.setActiveNodeFilter($(data.rslt.obj).data('path'));
+ this.setJsTreeReloaded(false);
}.bind(this));
$(this.directoryTreeSelector).on('loaded.jstree', function () {
- var path = this.getRequestedDirectory() || this.filterChips().filters.path;
-
- if (this.activeNode() !== path) {
- this.selectFolder(path);
- }
+ this.updateSelectedDirectory();
}.bind(this));
+
},
/**
* Verify directory filter on init event, select folder per directory filter state
*/
- selectTreeFolder: function (path) {
- this.isFolderRendered(path) ? this.locateNode(path) : this.selectStorageRoot();
+ updateSelectedDirectory: function () {
+ var currentFilterPath = this.filterChips().filters.path,
+ requestedDirectory = this.getRequestedDirectory(),
+ currentTreePath;
+
+ if (_.isUndefined(currentFilterPath)) {
+ this.clearFiltersHandle();
+
+ return;
+ }
+
+ currentTreePath = this.isFilterApplied(currentFilterPath) || _.isNull(requestedDirectory)
+ ? currentFilterPath
+ : requestedDirectory;
+
+ if (this.folderExistsInTree(currentTreePath)) {
+ this.locateNode(currentTreePath);
+ } else {
+ this.selectStorageRoot();
+ }
},
/**
* Verify if directory exists in folder tree
*
* @param {String} path
- * @return {Boolean}
*/
- isFolderRendered: function (path) {
- return _.isUndefined(path) ? false : $('#' + path.replace(/\//g, '\\/')).length === 1;
+ folderExistsInTree: function (path) {
+ if (!_.isUndefined(path)) {
+ return $('#' + path.replace(/\//g, '\\/')).length === 1;
+ }
+
+ return false;
},
- /**
- * Get directory requested from MediabrowserUtility
- *
- * @return {String|Null}
- */
getRequestedDirectory: function () {
- return !_.isUndefined(window.MediabrowserUtility) && window.MediabrowserUtility.pathId !== ''
+ return (!_.isUndefined(window.MediabrowserUtility) && window.MediabrowserUtility.pathId !== '')
? Base64.idDecode(window.MediabrowserUtility.pathId)
: null;
},
+ /**
+ * Check if need to select directory by filters state
+ *
+ * @param {String} currentFilterPath
+ */
+ isFilterApplied: function (currentFilterPath) {
+ return !_.isUndefined(currentFilterPath) && currentFilterPath !== '';
+ },
+
/**
* Locate and higlight node in jstree by path id.
*
* @param {String} path
*/
locateNode: function (path) {
- if (path === $(this.directoryTreeSelector).jstree('get_selected').attr('id')) {
+ var selectedId = $(this.directoryTreeSelector).jstree('get_selected').attr('id');
+
+ if (path === selectedId) {
return;
}
path = path.replace(/\//g, '\\/');
$(this.directoryTreeSelector).jstree('open_node', '#' + path);
$(this.directoryTreeSelector).jstree('select_node', '#' + path, true);
+
+ },
+
+ /**
+ * Clear filters
+ */
+ clearFiltersHandle: function () {
+ $(this.directoryTreeSelector).jstree('deselect_all');
+ this.activeNode(null);
+ this.directories().setInActive();
},
/**
* Set active node filter, or deselect if the same node clicked
*
- * @param {String} path
+ * @param {String} nodePath
*/
- toggleSelectedDirectory: function (path) {
- this.activeNode() === path ? this.selectStorageRoot() : this.selectFolder(path);
+ setActiveNodeFilter: function (nodePath) {
+
+ if (this.activeNode() === nodePath && !this.jsTreeReloaded) {
+ this.selectStorageRoot();
+ } else {
+ this.selectFolder(nodePath);
+ }
},
/**
* Remove folders selection -> select storage root
*/
selectStorageRoot: function () {
+ var filters = {},
+ applied = this.filterChips().get('applied');
+
$(this.directoryTreeSelector).jstree('deselect_all');
- this.activeNode(null);
+ filters = $.extend(true, filters, applied);
+ delete filters.path;
+ this.filterChips().set('applied', filters);
+ this.activeNode(null);
this.waitForCondition(
function () {
return _.isUndefined(this.directories());
@@ -284,7 +362,6 @@ define([
}.bind(this)
);
- this.dropFilter();
},
/**
@@ -293,9 +370,7 @@ define([
* @param {String} path
*/
selectFolder: function (path) {
- if (_.isUndefined(path) || _.isNull(path)) {
- return;
- }
+ this.activeNode(path);
this.waitForCondition(
function () {
@@ -307,7 +382,6 @@ define([
);
this.applyFilter(path);
- this.activeNode(path);
},
/**
@@ -323,28 +397,11 @@ define([
* @param {String} path
*/
applyFilter: function (path) {
- this.filterChips().set(
- 'applied',
- $.extend(
- true,
- {},
- this.filterChips().get('applied'),
- {
- path: path
- }
- )
- );
- },
-
- /**
- * Drop path filter
- */
- dropFilter: function () {
var filters = {},
applied = this.filterChips().get('applied');
filters = $.extend(true, filters, applied);
- delete filters.path;
+ filters.path = path;
this.filterChips().set('applied', filters);
},
@@ -356,6 +413,7 @@ define([
this.getJsonTree().then(function (data) {
this.createTree(data);
+ this.setJsTreeReloaded(true);
this.initEvents();
deferred.resolve();
}.bind(this));
@@ -367,11 +425,35 @@ define([
* Get json data for jstree
*/
getJsonTree: function () {
- return $.ajax({
+ var deferred = $.Deferred();
+
+ $.ajax({
url: this.getDirectoryTreeUrl,
type: 'GET',
- dataType: 'json'
+ dataType: 'json',
+
+ /**
+ * Success handler for request
+ *
+ * @param {Object} data
+ */
+ success: function (data) {
+ deferred.resolve(data);
+ },
+
+ /**
+ * Error handler for request
+ *
+ * @param {Object} jqXHR
+ * @param {String} textStatus
+ */
+ error: function (jqXHR, textStatus) {
+ deferred.reject();
+ throw textStatus;
+ }
});
+
+ return deferred.promise();
},
/**
@@ -381,7 +463,7 @@ define([
*/
createTree: function (data) {
$(this.directoryTreeSelector).jstree({
- plugins: ['json_data', 'themes', 'ui', 'crrm', 'types', 'hotkeys'],
+ plugins: ['json_data', 'themes', 'ui', 'crrm', 'types', 'hotkeys'],
vcheckbox: {
'two_state': true,
'real_checkboxes': true
From 36074a918e077096f7978f05a7a1df8662474706 Mon Sep 17 00:00:00 2001
From: Sergii Ivashchenko
Date: Tue, 18 Aug 2020 14:33:35 +0100
Subject: [PATCH 065/119] magento/magento2#29411: Formatting fixes
---
.../web/js/directory/directoryTree.js | 35 +++++++++----------
1 file changed, 16 insertions(+), 19 deletions(-)
diff --git a/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/directory/directoryTree.js b/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/directory/directoryTree.js
index a5c5de1ccdf73..4749593f08d4f 100644
--- a/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/directory/directoryTree.js
+++ b/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/directory/directoryTree.js
@@ -21,6 +21,7 @@ define([
directoryTreeSelector: '#media-gallery-directory-tree',
getDirectoryTreeUrl: 'media_gallery/directories/gettree',
createDirectoryUrl: 'media_gallery/directories/create',
+ deleteDirectoryUrl: 'media_gallery/directories/delete',
jsTreeReloaded: null,
modules: {
directories: '${ $.name }_directories',
@@ -88,27 +89,23 @@ define([
* @param {Array} directories
*/
createFolderIfNotExists: function (directories) {
- var isMediaBrowser = !_.isUndefined(window.MediabrowserUtility),
- currentTreePath = isMediaBrowser ? window.MediabrowserUtility.pathId : null,
+ var requestedDirectory = this.getRequestedDirectory(),
deferred = $.Deferred(),
- decodedPath,
pathArray;
- if (!currentTreePath) {
+ if (_.isNull(requestedDirectory)) {
deferred.resolve(false);
return deferred.promise();
}
- decodedPath = Base64.idDecode(currentTreePath);
-
- if (this.isDirectoryExist(directories[0], decodedPath)) {
+ if (this.isDirectoryExist(directories[0], requestedDirectory)) {
deferred.resolve(false);
return deferred.promise();
}
- pathArray = this.convertPathToPathsArray(decodedPath);
+ pathArray = this.convertPathToPathsArray(requestedDirectory);
$.each(pathArray, function (i, val) {
if (this.isDirectoryExist(directories[0], val)) {
@@ -204,7 +201,7 @@ define([
/**
* Remove ability to multiple select on nodes
*/
- overrideMultiselectBehavior: function () {
+ disableMultiselectBehavior : function () {
$.jstree.defaults.ui['select_range_modifier'] = false;
$.jstree.defaults.ui['select_multiple_modifier'] = false;
},
@@ -213,8 +210,8 @@ define([
* Handle jstree events
*/
initEvents: function () {
- this.firejsTreeEvents();
- this.overrideMultiselectBehavior();
+ this.initJsTreeEvents();
+ this.disableMultiselectBehavior();
$(window).on('reload.MediaGallery', function () {
this.getJsonTree().then(function (data) {
@@ -222,7 +219,7 @@ define([
if (isCreated) {
this.renderDirectoryTree().then(function () {
this.setJsTreeReloaded(true);
- this.firejsTreeEvents();
+ this.initJsTreeEvents();
}.bind(this));
} else {
this.updateSelectedDirectory();
@@ -235,7 +232,7 @@ define([
/**
* Fire event for jstree component
*/
- firejsTreeEvents: function () {
+ initJsTreeEvents: function () {
$(this.directoryTreeSelector).on('select_node.jstree', function (element, data) {
this.setActiveNodeFilter($(data.rslt.obj).data('path'));
this.setJsTreeReloaded(false);
@@ -244,7 +241,6 @@ define([
$(this.directoryTreeSelector).on('loaded.jstree', function () {
this.updateSelectedDirectory();
}.bind(this));
-
},
/**
@@ -285,6 +281,11 @@ define([
return false;
},
+ /**
+ * Get requested directory from MediabrowserUtility
+ *
+ * @returns {String|null}
+ */
getRequestedDirectory: function () {
return (!_.isUndefined(window.MediabrowserUtility) && window.MediabrowserUtility.pathId !== '')
? Base64.idDecode(window.MediabrowserUtility.pathId)
@@ -306,9 +307,7 @@ define([
* @param {String} path
*/
locateNode: function (path) {
- var selectedId = $(this.directoryTreeSelector).jstree('get_selected').attr('id');
-
- if (path === selectedId) {
+ if (path === $(this.directoryTreeSelector).jstree('get_selected').attr('id')) {
return;
}
path = path.replace(/\//g, '\\/');
@@ -332,7 +331,6 @@ define([
* @param {String} nodePath
*/
setActiveNodeFilter: function (nodePath) {
-
if (this.activeNode() === nodePath && !this.jsTreeReloaded) {
this.selectStorageRoot();
} else {
@@ -361,7 +359,6 @@ define([
this.directories().setInActive();
}.bind(this)
);
-
},
/**
From 5018515c4bf351bcb8d6a2a059210405b60c42f0 Mon Sep 17 00:00:00 2001
From: Deepty Thampy
Date: Tue, 18 Aug 2020 09:47:54 -0500
Subject: [PATCH 066/119] test name correction
---
.../GraphQl/Wishlist/AddConfigurableProductToWishlistTest.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Wishlist/AddConfigurableProductToWishlistTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Wishlist/AddConfigurableProductToWishlistTest.php
index 7b2c12f88d3a4..cffc5eb6f93c1 100644
--- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Wishlist/AddConfigurableProductToWishlistTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Wishlist/AddConfigurableProductToWishlistTest.php
@@ -48,7 +48,7 @@ protected function setUp(): void
*
* @throws Exception
*/
- public function testAddDownloadableProductWithOptions(): void
+ public function testAddConfigurableProductWithOptions(): void
{
$product = $this->getConfigurableProductInfo();
$customerId = 1;
From 154ebc00572533bc1a4573f305ff26bc3a7455d0 Mon Sep 17 00:00:00 2001
From: joweecaquicla
Date: Tue, 18 Aug 2020 23:25:22 +0800
Subject: [PATCH 067/119] magento/adobe-stock-integration#1387: Uncaught
TypeError: Cannot read property 'complete' of undefined appears in dev
console if save Previewed image as a new View and open this View on another
page - created separate function for loading of image data in preview
---
.../base/web/js/grid/columns/image-preview.js | 30 ++++++++++++-------
1 file changed, 20 insertions(+), 10 deletions(-)
diff --git a/app/code/Magento/Ui/view/base/web/js/grid/columns/image-preview.js b/app/code/Magento/Ui/view/base/web/js/grid/columns/image-preview.js
index d675bd7a60ab5..8a9df56562a15 100644
--- a/app/code/Magento/Ui/view/base/web/js/grid/columns/image-preview.js
+++ b/app/code/Magento/Ui/view/base/web/js/grid/columns/image-preview.js
@@ -128,8 +128,6 @@ define([
* @param {Object} record
*/
show: function (record) {
- var img;
-
if (record._rowIndex === this.visibleRecord()) {
this.hide();
@@ -141,19 +139,31 @@ define([
this._selectRow(record.rowNumber || null);
this.visibleRecord(record._rowIndex);
- img = $(this.previewImageSelector + ' img');
+ this.lastOpenedImage(record._rowIndex);
+ this.updateImageData();
+ },
- if (img.get(0).complete) {
- this.updateHeight();
- this.scrollToPreview();
+ /**
+ * Update image data
+ */
+ updateImageData: function () {
+ var img = $(this.previewImageSelector + ' img');
+
+ if (!img.get(0)) {
+ setTimeout(function () {
+ this.updateImageData();
+ }.bind(this), 100);
} else {
- img.load(function () {
+ if (img.get(0).complete) {
this.updateHeight();
this.scrollToPreview();
- }.bind(this));
+ } else {
+ img.load(function () {
+ this.updateHeight();
+ this.scrollToPreview();
+ }.bind(this));
+ }
}
-
- this.lastOpenedImage(record._rowIndex);
},
/**
From 1df4ca7381a8963dc206723d75666af832709128 Mon Sep 17 00:00:00 2001
From: eduard13
Date: Tue, 18 Aug 2020 19:30:19 +0300
Subject: [PATCH 068/119] Fixing reason for deprecated annotation
---
app/code/Magento/WishlistGraphQl/etc/schema.graphqls | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/code/Magento/WishlistGraphQl/etc/schema.graphqls b/app/code/Magento/WishlistGraphQl/etc/schema.graphqls
index f6ff44e34e6c5..bd46c6a90b1d2 100644
--- a/app/code/Magento/WishlistGraphQl/etc/schema.graphqls
+++ b/app/code/Magento/WishlistGraphQl/etc/schema.graphqls
@@ -24,7 +24,7 @@ type WishlistOutput @doc(description: "Deprecated: `Wishlist` type should be use
type Wishlist {
id: ID @doc(description: "Wishlist unique identifier")
- items: [WishlistItem] @resolver(class: "\\Magento\\WishlistGraphQl\\Model\\Resolver\\WishlistItemsResolver") @deprecated(description: "Use field `items_v2` from type `Wishlist` instead")
+ items: [WishlistItem] @resolver(class: "\\Magento\\WishlistGraphQl\\Model\\Resolver\\WishlistItemsResolver") @deprecated(reason: "Use field `items_v2` from type `Wishlist` instead")
items_v2: [WishlistItemInterface] @resolver(class: "\\Magento\\WishlistGraphQl\\Model\\Resolver\\WishlistItems") @doc(description: "An array of items in the customer's wishlist")
items_count: Int @doc(description: "The number of items in the wish list")
sharing_code: String @doc(description: "An encrypted code that Magento uses to link to the wish list")
From 9a69a6af4a1a7f6e04659cca2546d109cbf8fe4e Mon Sep 17 00:00:00 2001
From: Sergii Ivashchenko
Date: Tue, 18 Aug 2020 18:24:51 +0100
Subject: [PATCH 069/119] magento/magento2#29411: Fixed static tests
---
.../view/adminhtml/web/js/directory/directoryTree.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/directory/directoryTree.js b/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/directory/directoryTree.js
index 4749593f08d4f..0309b11296181 100644
--- a/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/directory/directoryTree.js
+++ b/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/directory/directoryTree.js
@@ -201,7 +201,7 @@ define([
/**
* Remove ability to multiple select on nodes
*/
- disableMultiselectBehavior : function () {
+ disableMultiselectBehavior: function () {
$.jstree.defaults.ui['select_range_modifier'] = false;
$.jstree.defaults.ui['select_multiple_modifier'] = false;
},
@@ -287,7 +287,7 @@ define([
* @returns {String|null}
*/
getRequestedDirectory: function () {
- return (!_.isUndefined(window.MediabrowserUtility) && window.MediabrowserUtility.pathId !== '')
+ return !_.isUndefined(window.MediabrowserUtility) && window.MediabrowserUtility.pathId !== ''
? Base64.idDecode(window.MediabrowserUtility.pathId)
: null;
},
From ea584f9815ec3b119e9ac73ccc773435c7727960 Mon Sep 17 00:00:00 2001
From: Shankar Konar
Date: Wed, 19 Aug 2020 11:01:04 +0530
Subject: [PATCH 070/119] 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 1978ed84540aec1e945fa25502d2ae49943e1191 Mon Sep 17 00:00:00 2001
From: Eduard Chitoraga
Date: Wed, 19 Aug 2020 09:11:29 +0300
Subject: [PATCH 071/119] Applying schema suggestions
Co-authored-by: Kevin Harper
---
.../Magento/BundleGraphQl/etc/schema.graphqls | 2 +-
.../CatalogGraphQl/etc/schema.graphqls | 4 ++--
.../etc/schema.graphqls | 6 +++---
.../DownloadableGraphQl/etc/schema.graphqls | 4 ++--
.../WishlistGraphQl/etc/schema.graphqls | 20 +++++++++----------
5 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/app/code/Magento/BundleGraphQl/etc/schema.graphqls b/app/code/Magento/BundleGraphQl/etc/schema.graphqls
index 75731516daf4c..a2cba24c7c4d4 100644
--- a/app/code/Magento/BundleGraphQl/etc/schema.graphqls
+++ b/app/code/Magento/BundleGraphQl/etc/schema.graphqls
@@ -119,5 +119,5 @@ type ItemSelectedBundleOptionValue @doc(description: "A list of values for the s
}
type BundleWishlistItem implements WishlistItemInterface {
- bundle_options: [SelectedBundleOption!] @doc(description: "An array containing information about the selected bundled items") @resolver(class: "\\Magento\\BundleGraphQl\\Model\\Wishlist\\BundleOptions")
+ bundle_options: [SelectedBundleOption!] @doc(description: "An array containing information about the selected bundle items") @resolver(class: "\\Magento\\BundleGraphQl\\Model\\Wishlist\\BundleOptions")
}
diff --git a/app/code/Magento/CatalogGraphQl/etc/schema.graphqls b/app/code/Magento/CatalogGraphQl/etc/schema.graphqls
index 1a4fd6b8bd986..de4f088aac1d0 100644
--- a/app/code/Magento/CatalogGraphQl/etc/schema.graphqls
+++ b/app/code/Magento/CatalogGraphQl/etc/schema.graphqls
@@ -493,8 +493,8 @@ type StoreConfig @doc(description: "The type contains information about a store
root_category_id: Int @doc(description: "The ID of the root category") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\RootCategoryId")
}
-type SimpleWishlistItem implements WishlistItemInterface @doc(description: "Simple Wishlist Item") {
+type SimpleWishlistItem implements WishlistItemInterface @doc(description: "A simple product wishlist Item") {
}
-type VirtualWishlistItem implements WishlistItemInterface @doc(description: "Virtual Wishlist Item") {
+type VirtualWishlistItem implements WishlistItemInterface @doc(description: "A virtual product wishlist item") {
}
diff --git a/app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls b/app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls
index 6690835237ccf..f66f8f7ee2eac 100644
--- a/app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls
+++ b/app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls
@@ -69,7 +69,7 @@ type SelectedConfigurableOption {
value_label: String!
}
-type ConfigurableWishlistItem implements WishlistItemInterface {
- child_sku: String! @doc(description: "SKU of the simple product corresponding to a set of selected configurable options.") @resolver(class: "\\Magento\\ConfigurableProductGraphQl\\Model\\Wishlist\\ChildSku")
- configurable_options: [SelectedConfigurableOption!] @resolver(class: "\\Magento\\ConfigurableProductGraphQl\\Model\\Wishlist\\ConfigurableOptions")
+type ConfigurableWishlistItem implements WishlistItemInterface @doc(description: "A configurable product wishlist item"){
+ child_sku: String! @doc(description: "The SKU of the simple product corresponding to a set of selected configurable options") @resolver(class: "\\Magento\\ConfigurableProductGraphQl\\Model\\Wishlist\\ChildSku")
+ configurable_options: [SelectedConfigurableOption!] @resolver(class: "\\Magento\\ConfigurableProductGraphQl\\Model\\Wishlist\\ConfigurableOptions") @doc (description: "An array of selected configurable options")
}
diff --git a/app/code/Magento/DownloadableGraphQl/etc/schema.graphqls b/app/code/Magento/DownloadableGraphQl/etc/schema.graphqls
index 8795b70475f1f..64ef43aa03d1b 100644
--- a/app/code/Magento/DownloadableGraphQl/etc/schema.graphqls
+++ b/app/code/Magento/DownloadableGraphQl/etc/schema.graphqls
@@ -65,7 +65,7 @@ type DownloadableProductSamples @doc(description: "DownloadableProductSamples de
sample_file: String @deprecated(reason: "`sample_url` serves to get the downloadable sample")
}
-type DownloadableWishlistItem implements WishlistItemInterface @doc(description: "Downloadable Wishlist Item") {
+type DownloadableWishlistItem implements WishlistItemInterface @doc(description: "A downloadable product wishlist item") {
links_v2: [DownloadableProductLinks] @doc(description: "An array containing information about the selected links") @resolver(class: "\\Magento\\DownloadableGraphQl\\Model\\Wishlist\\ItemLinks")
- samples: [DownloadableProductSamples] @doc(description: "DownloadableProductSamples defines characteristics of a downloadable product") @resolver(class: "Magento\\DownloadableGraphQl\\Resolver\\Product\\Samples")
+ samples: [DownloadableProductSamples] @doc(description: "An array containing information about the selected samples") @resolver(class: "Magento\\DownloadableGraphQl\\Resolver\\Product\\Samples")
}
diff --git a/app/code/Magento/WishlistGraphQl/etc/schema.graphqls b/app/code/Magento/WishlistGraphQl/etc/schema.graphqls
index bd46c6a90b1d2..9c82ca03323ec 100644
--- a/app/code/Magento/WishlistGraphQl/etc/schema.graphqls
+++ b/app/code/Magento/WishlistGraphQl/etc/schema.graphqls
@@ -9,9 +9,9 @@ type Customer {
wishlists(
pageSize: Int = 20 @doc(description: "Specifies the maximum number of results to return at once. This attribute is optional."),
currentPage: Int = 1 @doc(description: "Specifies which page of results to return. The default value is 1.")
- ): [Wishlist!]! @doc(description: "Customer wishlists are limited to a max of 1 wishlist in Magento Open Source") @resolver(class:"\\Magento\\WishlistGraphQl\\Model\\Resolver\\CustomerWishlists")
- wishlist: Wishlist! @deprecated(reason: "Use `Customer.wishlists` or `Customer.wishlist_v2`") @resolver(class:"\\Magento\\WishlistGraphQl\\Model\\Resolver\\CustomerWishlistResolver") @doc(description: "Contains the contents of a customer's wish lists") @cache(cacheable: false)
- wishlist_v2(id: ID!): Wishlist @doc(description: "Get the customer's wishlist by an ID") @resolver(class: "\\Magento\\WishlistGraphQl\\Model\\Resolver\\WishlistById")
+ ): [Wishlist!]! @doc(description: "An array of wishlists. In Magento Open Source, customers are limited to one wishlist. The number of wishlists is not restricted for Magento Commerce") @resolver(class:"\\Magento\\WishlistGraphQl\\Model\\Resolver\\CustomerWishlists")
+ wishlist: Wishlist! @deprecated(reason: "Use `Customer.wishlists` or `Customer.wishlist_v2`") @resolver(class:"\\Magento\\WishlistGraphQl\\Model\\Resolver\\CustomerWishlistResolver") @doc(description: "Contains a customer's wish lists") @cache(cacheable: false)
+ wishlist_v2(id: ID!): Wishlist @doc(description: "Retrieve the specified wishlist") @resolver(class: "\\Magento\\WishlistGraphQl\\Model\\Resolver\\WishlistById")
}
type WishlistOutput @doc(description: "Deprecated: `Wishlist` type should be used instead") {
@@ -25,19 +25,19 @@ type WishlistOutput @doc(description: "Deprecated: `Wishlist` type should be use
type Wishlist {
id: ID @doc(description: "Wishlist unique identifier")
items: [WishlistItem] @resolver(class: "\\Magento\\WishlistGraphQl\\Model\\Resolver\\WishlistItemsResolver") @deprecated(reason: "Use field `items_v2` from type `Wishlist` instead")
- items_v2: [WishlistItemInterface] @resolver(class: "\\Magento\\WishlistGraphQl\\Model\\Resolver\\WishlistItems") @doc(description: "An array of items in the customer's wishlist")
+ items_v2: [WishlistItemInterface] @resolver(class: "\\Magento\\WishlistGraphQl\\Model\\Resolver\\WishlistItems") @doc(description: "An array of items in the customer's wish list")
items_count: Int @doc(description: "The number of items in the wish list")
sharing_code: String @doc(description: "An encrypted code that Magento uses to link to the wish list")
updated_at: String @doc(description: "The time of the last modification to the wish list")
}
interface WishlistItemInterface @typeResolver(class: "Magento\\WishlistGraphQl\\Model\\Resolver\\Type\\WishlistItemType") {
- id: ID
- quantity: Float
- description: String
- added_at: String
- product: ProductInterface @resolver(class: "\\Magento\\WishlistGraphQl\\Model\\Resolver\\ProductResolver")
- customizable_options: [SelectedCustomizableOption]
+ id: ID @doc(description: "The ID of the wish list item")
+ quantity: Float @doc(description: "The quantity of this wish list item")
+ description: String @doc(description: "The description of the item")
+ added_at: String @doc(description: "The date and time the item was added to the wish list")
+ product: ProductInterface @doc(description: "Product details of the wish list item") @resolver(class: "\\Magento\\WishlistGraphQl\\Model\\Resolver\\ProductResolver")
+ customizable_options: [SelectedCustomizableOption] @doc(description: "Custom options selected for the wish list item")
}
type WishlistItem {
From ab3db167e1594e935350d4be6494ce1f56c48b4f Mon Sep 17 00:00:00 2001
From: Shankar Konar
Date: Wed, 19 Aug 2020 12:30:25 +0530
Subject: [PATCH 072/119] 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 e40b1ca58f17e2cd0f54995ad6b722165af3c78c Mon Sep 17 00:00:00 2001
From: "vadim.malesh"
Date: Wed, 19 Aug 2020 12:03:30 +0300
Subject: [PATCH 073/119] add translation
---
.../Multishipping/Model/Checkout/Type/Multishipping.php | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php b/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php
index 49212202b5f62..0c1f5d95a0005 100644
--- a/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php
+++ b/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php
@@ -975,7 +975,8 @@ public function getMinimumAmountError()
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
);
}
- return $error;
+
+ return __($error);
}
/**
From 0994c44a964406f1eae1c4779903c78533111989 Mon Sep 17 00:00:00 2001
From: janmonteros
Date: Wed, 19 Aug 2020 17:04:46 +0800
Subject: [PATCH 074/119] magento/adobe-stock-integration#1760: Media Gallery
page and Category grid page opened successfully if "Enhanced Media Gallery"
disabled - revert category grid no route redirect when media gallery is
disabled, MFTF test coverage
---
.../Controller/Adminhtml/Category/Index.php | 29 -------------------
.../MediaGalleryCatalogUi/composer.json | 3 +-
...daloneMediaGalleryPageIs404ActionGroup.xml | 18 ++++++++++++
...dminStandaloneMediaGalleryDisabledTest.xml | 28 ++++++++++++++++++
4 files changed, 47 insertions(+), 31 deletions(-)
create mode 100644 app/code/Magento/MediaGalleryUi/Test/Mftf/ActionGroup/AssertAdminStandaloneMediaGalleryPageIs404ActionGroup.xml
create mode 100644 app/code/Magento/MediaGalleryUi/Test/Mftf/Test/AdminStandaloneMediaGalleryDisabledTest.xml
diff --git a/app/code/Magento/MediaGalleryCatalogUi/Controller/Adminhtml/Category/Index.php b/app/code/Magento/MediaGalleryCatalogUi/Controller/Adminhtml/Category/Index.php
index 497a65b207353..a541e9999b784 100644
--- a/app/code/Magento/MediaGalleryCatalogUi/Controller/Adminhtml/Category/Index.php
+++ b/app/code/Magento/MediaGalleryCatalogUi/Controller/Adminhtml/Category/Index.php
@@ -8,13 +8,10 @@
namespace Magento\MediaGalleryCatalogUi\Controller\Adminhtml\Category;
use Magento\Backend\App\Action;
-use Magento\Backend\App\Action\Context;
use Magento\Backend\Model\View\Result\Page;
-use Magento\Backend\Model\View\Result\Forward;
use Magento\Framework\App\Action\HttpGetActionInterface;
use Magento\Framework\Controller\ResultFactory;
use Magento\Framework\Controller\ResultInterface;
-use Magento\MediaContentApi\Model\Config;
/**
* Controller serving the media gallery content
@@ -23,24 +20,6 @@ class Index extends Action implements HttpGetActionInterface
{
public const ADMIN_RESOURCE = 'Magento_Cms::media_gallery';
- /**
- * @var Config
- */
- private $config;
-
- /**
- * Index constructor.
- * @param Context $context
- * @param Config $config
- */
- public function __construct(
- Context $context,
- Config $config
- ) {
- parent::__construct($context);
- $this->config = $config;
- }
-
/**
* Get the media gallery layout
*
@@ -48,14 +27,6 @@ public function __construct(
*/
public function execute(): ResultInterface
{
- if (!$this->config->isEnabled()) {
- /** @var Forward $resultForward */
- $resultForward = $this->resultFactory->create(ResultFactory::TYPE_FORWARD);
- $resultForward->forward('noroute');
-
- return $resultForward;
- }
-
/** @var Page $resultPage */
$resultPage = $this->resultFactory->create(ResultFactory::TYPE_PAGE);
$resultPage->getConfig()->getTitle()->prepend(__('Categories'));
diff --git a/app/code/Magento/MediaGalleryCatalogUi/composer.json b/app/code/Magento/MediaGalleryCatalogUi/composer.json
index da759e67ddf54..985d581beff25 100644
--- a/app/code/Magento/MediaGalleryCatalogUi/composer.json
+++ b/app/code/Magento/MediaGalleryCatalogUi/composer.json
@@ -8,8 +8,7 @@
"magento/module-backend": "*",
"magento/module-catalog": "*",
"magento/module-store": "*",
- "magento/module-ui": "*",
- "magento/module-media-content-api": "*"
+ "magento/module-ui": "*"
},
"type": "magento2-module",
"license": [
diff --git a/app/code/Magento/MediaGalleryUi/Test/Mftf/ActionGroup/AssertAdminStandaloneMediaGalleryPageIs404ActionGroup.xml b/app/code/Magento/MediaGalleryUi/Test/Mftf/ActionGroup/AssertAdminStandaloneMediaGalleryPageIs404ActionGroup.xml
new file mode 100644
index 0000000000000..868477910f52b
--- /dev/null
+++ b/app/code/Magento/MediaGalleryUi/Test/Mftf/ActionGroup/AssertAdminStandaloneMediaGalleryPageIs404ActionGroup.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+ Validates that the '404 Error' message is present and correct in the Admin Standalone Media Gallery Page Header.
+
+
+
+
+
diff --git a/app/code/Magento/MediaGalleryUi/Test/Mftf/Test/AdminStandaloneMediaGalleryDisabledTest.xml b/app/code/Magento/MediaGalleryUi/Test/Mftf/Test/AdminStandaloneMediaGalleryDisabledTest.xml
new file mode 100644
index 0000000000000..0d2c8207f90c5
--- /dev/null
+++ b/app/code/Magento/MediaGalleryUi/Test/Mftf/Test/AdminStandaloneMediaGalleryDisabledTest.xml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
From 61f5cbe2a86a2be90e88cee25c77233c44344c0d Mon Sep 17 00:00:00 2001
From: joweecaquicla
Date: Wed, 19 Aug 2020 18:47:36 +0800
Subject: [PATCH 075/119] magento/adobe-stock-integration#1387: Uncaught
TypeError: Cannot read property 'complete' of undefined appears in dev
console if save Previewed image as a new View and open this View on another
page - suggested modifications
---
.../base/web/js/grid/columns/image-preview.js | 30 ++++++++++++++++++-
1 file changed, 29 insertions(+), 1 deletion(-)
diff --git a/app/code/Magento/Ui/view/base/web/js/grid/columns/image-preview.js b/app/code/Magento/Ui/view/base/web/js/grid/columns/image-preview.js
index 8a9df56562a15..047e2cbae666b 100644
--- a/app/code/Magento/Ui/view/base/web/js/grid/columns/image-preview.js
+++ b/app/code/Magento/Ui/view/base/web/js/grid/columns/image-preview.js
@@ -32,7 +32,8 @@ define([
listens: {
'${ $.provider }:params.filters': 'hide',
'${ $.provider }:params.search': 'hide',
- '${ $.provider }:params.paging': 'hide'
+ '${ $.provider }:params.paging': 'hide',
+ '${ $.provider }:data.items': 'updateDisplayedRecord'
},
exports: {
height: '${ $.parentName }.thumbnail_url:previewHeight'
@@ -48,6 +49,22 @@ define([
this._super();
$(document).on('keydown', this.handleKeyDown.bind(this));
+ this.lastOpenedImage.subscribe(function (newValue) {
+ if (newValue === false && _.isNull(this.visibleRecord())) {
+ return;
+ }
+ if (newValue === this.visibleRecord()) {
+ return;
+ }
+
+ if (newValue === false) {
+ this.hide();
+ return;
+ }
+
+ this.show(this.masonry().rows()[newValue]);
+ }.bind(this));
+
return this;
},
@@ -166,6 +183,17 @@ define([
}
},
+ /**
+ * Update displayed record
+ *
+ * @param items
+ */
+ updateDisplayedRecord: function (items) {
+ if (!_.isNull(this.visibleRecord())) {
+ this.displayedRecord(items[this.visibleRecord()]);
+ }
+ },
+
/**
* Update image preview section height
*/
From 090f06a0a832adb64c298f297e0bc2741cd92b9d Mon Sep 17 00:00:00 2001
From: "vadim.malesh"
Date: Wed, 19 Aug 2020 14:01:37 +0300
Subject: [PATCH 076/119] fix static
---
.../Magento/Multishipping/Model/Checkout/Type/Multishipping.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php b/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php
index 0c1f5d95a0005..8845395be406e 100644
--- a/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php
+++ b/app/code/Magento/Multishipping/Model/Checkout/Type/Multishipping.php
@@ -695,7 +695,7 @@ protected function _prepareOrder(\Magento\Quote\Model\Quote\Address $address)
);
$shippingMethodCode = $address->getShippingMethod();
- if (isset($shippingMethodCode) && !empty($shippingMethodCode)) {
+ if ($shippingMethodCode) {
$rate = $address->getShippingRateByCode($shippingMethodCode);
$shippingPrice = $rate->getPrice();
} else {
From e2e6b3e095e5b727384a67f54f81f713fd88097a Mon Sep 17 00:00:00 2001
From: joweecaquicla
Date: Wed, 19 Aug 2020 19:26:49 +0800
Subject: [PATCH 077/119] magento/adobe-stock-integration#1387: Uncaught
TypeError: Cannot read property 'complete' of undefined appears in dev
console if save Previewed image as a new View and open this View on another
page - requested modifications
---
.../Ui/view/base/web/js/grid/columns/image-preview.js | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/app/code/Magento/Ui/view/base/web/js/grid/columns/image-preview.js b/app/code/Magento/Ui/view/base/web/js/grid/columns/image-preview.js
index 047e2cbae666b..ee2d9decdb0bb 100644
--- a/app/code/Magento/Ui/view/base/web/js/grid/columns/image-preview.js
+++ b/app/code/Magento/Ui/view/base/web/js/grid/columns/image-preview.js
@@ -161,7 +161,7 @@ define([
},
/**
- * Update image data
+ * Update image data when image preview is opened
*/
updateImageData: function () {
var img = $(this.previewImageSelector + ' img');
@@ -184,9 +184,9 @@ define([
},
/**
- * Update displayed record
+ * Update opened image preview contents when the data provider is updated
*
- * @param items
+ * @param {Array} items
*/
updateDisplayedRecord: function (items) {
if (!_.isNull(this.visibleRecord())) {
From 363a100196ae516e616d74050945b07f9343552d Mon Sep 17 00:00:00 2001
From: Nazar Klovanych
Date: Wed, 19 Aug 2020 14:35:23 +0300
Subject: [PATCH 078/119] Cover long folder names in media gallery with mftf
test
---
.../Model/Directories/GetFolderTree.php | 6 ++-
.../Mftf/Data/AdminMediaGalleryFolderData.xml | 2 +
...iaGalleryCreateFolderWithLongNamesTest.xml | 43 +++++++++++++++++++
3 files changed, 50 insertions(+), 1 deletion(-)
create mode 100644 app/code/Magento/MediaGalleryUi/Test/Mftf/Test/AdminMediaGalleryCreateFolderWithLongNamesTest.xml
diff --git a/app/code/Magento/MediaGalleryUi/Model/Directories/GetFolderTree.php b/app/code/Magento/MediaGalleryUi/Model/Directories/GetFolderTree.php
index c152330a39bbd..f297d027c13e1 100644
--- a/app/code/Magento/MediaGalleryUi/Model/Directories/GetFolderTree.php
+++ b/app/code/Magento/MediaGalleryUi/Model/Directories/GetFolderTree.php
@@ -17,6 +17,8 @@
*/
class GetFolderTree
{
+ private const NAME_LENGTH = 50;
+
/**
* @var Filesystem
*/
@@ -84,7 +86,9 @@ private function getDirectories(): array
}
$pathArray = explode('/', $path);
- $displayName = strlen(end($pathArray)) > 50 ? substr(end($pathArray),0,50)."..." : end($pathArray);
+ $displayName = strlen(end($pathArray)) > self::NAME_LENGTH ?
+ substr(end($pathArray),0, self::NAME_LENGTH) . "..." :
+ end($pathArray);
$directories[] = [
'data' => count($pathArray) > 0 ? $displayName : $path,
'attr' => ['id' => $path],
diff --git a/app/code/Magento/MediaGalleryUi/Test/Mftf/Data/AdminMediaGalleryFolderData.xml b/app/code/Magento/MediaGalleryUi/Test/Mftf/Data/AdminMediaGalleryFolderData.xml
index e4149acdf58d1..d67c019397ec1 100644
--- a/app/code/Magento/MediaGalleryUi/Test/Mftf/Data/AdminMediaGalleryFolderData.xml
+++ b/app/code/Magento/MediaGalleryUi/Test/Mftf/Data/AdminMediaGalleryFolderData.xml
@@ -13,5 +13,7 @@
,.?/:;'[{]}|~`!@#$%^*()_=+
+ mediagallerylongfoldernamemediagallerylongfoldername54
+ mediagallerylongfoldernamemediagallerylongfolderna...
diff --git a/app/code/Magento/MediaGalleryUi/Test/Mftf/Test/AdminMediaGalleryCreateFolderWithLongNamesTest.xml b/app/code/Magento/MediaGalleryUi/Test/Mftf/Test/AdminMediaGalleryCreateFolderWithLongNamesTest.xml
new file mode 100644
index 0000000000000..c76790e164298
--- /dev/null
+++ b/app/code/Magento/MediaGalleryUi/Test/Mftf/Test/AdminMediaGalleryCreateFolderWithLongNamesTest.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
From 152c29b6b28a21df854d2924c9cb7b92bde190bc Mon Sep 17 00:00:00 2001
From: Oleh Usik
Date: Wed, 19 Aug 2020 15:08:18 +0300
Subject: [PATCH 079/119] 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 @@
-
+
Click edit link for first row on the grid.
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 @@
-
+
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 @@
-
+
@@ -66,7 +66,7 @@
-
+
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 @@
-
+
@@ -66,7 +66,7 @@
-
+
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 @@
-
+
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 @@
-
+
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 @@
-
+
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 @@
-
+
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 @@
-
+
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 @@
-
+
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 @@
-
+
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 @@
-
+
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 @@
-
+
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 @@
-
+
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 @@
-
+
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 @@
-
+
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 @@
-
+
From 5a70b81a23733856bfd7d4e74e23106f97d245d9 Mon Sep 17 00:00:00 2001
From: janmonteros
Date: Wed, 19 Aug 2020 20:12:00 +0800
Subject: [PATCH 080/119] magento/adobe-stock-integration#1760: Media Gallery
page and Category grid page opened successfully if "Enhanced Media Gallery"
disabled - MFTF Apply PR suggestions
---
...p.xml => AssertAdminPageIs404ActionGroup.xml} | 4 ++--
.../Mftf/Suite/MediaGalleryUiDisabledSuite.xml | 16 ++++++++++++++++
.../AdminStandaloneMediaGalleryDisabledTest.xml | 6 +++---
3 files changed, 21 insertions(+), 5 deletions(-)
rename app/code/Magento/MediaGalleryUi/Test/Mftf/ActionGroup/{AssertAdminStandaloneMediaGalleryPageIs404ActionGroup.xml => AssertAdminPageIs404ActionGroup.xml} (77%)
create mode 100644 app/code/Magento/MediaGalleryUi/Test/Mftf/Suite/MediaGalleryUiDisabledSuite.xml
diff --git a/app/code/Magento/MediaGalleryUi/Test/Mftf/ActionGroup/AssertAdminStandaloneMediaGalleryPageIs404ActionGroup.xml b/app/code/Magento/MediaGalleryUi/Test/Mftf/ActionGroup/AssertAdminPageIs404ActionGroup.xml
similarity index 77%
rename from app/code/Magento/MediaGalleryUi/Test/Mftf/ActionGroup/AssertAdminStandaloneMediaGalleryPageIs404ActionGroup.xml
rename to app/code/Magento/MediaGalleryUi/Test/Mftf/ActionGroup/AssertAdminPageIs404ActionGroup.xml
index 868477910f52b..09b0bdcc146ae 100644
--- a/app/code/Magento/MediaGalleryUi/Test/Mftf/ActionGroup/AssertAdminStandaloneMediaGalleryPageIs404ActionGroup.xml
+++ b/app/code/Magento/MediaGalleryUi/Test/Mftf/ActionGroup/AssertAdminPageIs404ActionGroup.xml
@@ -8,9 +8,9 @@
-
+
- Validates that the '404 Error' message is present and correct in the Admin Standalone Media Gallery Page Header.
+ Validates that the '404 Error' message is present in the current Admin Page Header.
diff --git a/app/code/Magento/MediaGalleryUi/Test/Mftf/Suite/MediaGalleryUiDisabledSuite.xml b/app/code/Magento/MediaGalleryUi/Test/Mftf/Suite/MediaGalleryUiDisabledSuite.xml
new file mode 100644
index 0000000000000..727fbde3f17b6
--- /dev/null
+++ b/app/code/Magento/MediaGalleryUi/Test/Mftf/Suite/MediaGalleryUiDisabledSuite.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/MediaGalleryUi/Test/Mftf/Test/AdminStandaloneMediaGalleryDisabledTest.xml b/app/code/Magento/MediaGalleryUi/Test/Mftf/Test/AdminStandaloneMediaGalleryDisabledTest.xml
index 0d2c8207f90c5..767a0004872c4 100644
--- a/app/code/Magento/MediaGalleryUi/Test/Mftf/Test/AdminStandaloneMediaGalleryDisabledTest.xml
+++ b/app/code/Magento/MediaGalleryUi/Test/Mftf/Test/AdminStandaloneMediaGalleryDisabledTest.xml
@@ -7,7 +7,7 @@
-->
-
+
@@ -16,13 +16,13 @@
-
+
-
+
From 702d201af93f3560dcfa5d46a209aa2a1d8a1dd8 Mon Sep 17 00:00:00 2001
From: Nazar Klovanych
Date: Wed, 19 Aug 2020 15:32:11 +0300
Subject: [PATCH 081/119] Cover filters functionality
---
...AdminMediaGalleryCatalogUiUsedInProductFilterTest.xml | 2 +-
...aGalleryCatalogUiVerifyUsedInLinkCategoryGridTest.xml | 9 +++++++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/Test/AdminMediaGalleryCatalogUiUsedInProductFilterTest.xml b/app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/Test/AdminMediaGalleryCatalogUiUsedInProductFilterTest.xml
index d68fd4cb7cca8..87dcc5513f1b2 100644
--- a/app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/Test/AdminMediaGalleryCatalogUiUsedInProductFilterTest.xml
+++ b/app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/Test/AdminMediaGalleryCatalogUiUsedInProductFilterTest.xml
@@ -68,6 +68,6 @@
-
+
diff --git a/app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/Test/AdminMediaGalleryCatalogUiVerifyUsedInLinkCategoryGridTest.xml b/app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/Test/AdminMediaGalleryCatalogUiVerifyUsedInLinkCategoryGridTest.xml
index e761ef5cd08ba..866b1e1a30e33 100644
--- a/app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/Test/AdminMediaGalleryCatalogUiVerifyUsedInLinkCategoryGridTest.xml
+++ b/app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/Test/AdminMediaGalleryCatalogUiVerifyUsedInLinkCategoryGridTest.xml
@@ -57,5 +57,14 @@
+
+
+
+
+
+
+
+
+
From 716ca4d85d3354fb37e8ed70055a22c3433dcfff Mon Sep 17 00:00:00 2001
From: Arnob Saha
Date: Wed, 12 Aug 2020 18:58:34 -0500
Subject: [PATCH 082/119] MC-34091: Recently compared products widget sometimes
not appear on page
- Removing unstable broken MFTF test
---
...rontRecentlyComparedAtWebsiteLevelTest.xml | 108 ------------------
1 file changed, 108 deletions(-)
delete mode 100644 app/code/Magento/Catalog/Test/Mftf/Test/StoreFrontRecentlyComparedAtWebsiteLevelTest.xml
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/StoreFrontRecentlyComparedAtWebsiteLevelTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/StoreFrontRecentlyComparedAtWebsiteLevelTest.xml
deleted file mode 100644
index 7ec5fea49f64b..0000000000000
--- a/app/code/Magento/Catalog/Test/Mftf/Test/StoreFrontRecentlyComparedAtWebsiteLevelTest.xml
+++ /dev/null
@@ -1,108 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
From 37570780174507183909ff1e8b822b0737f944fc Mon Sep 17 00:00:00 2001
From: Nazar Klovanych
Date: Wed, 19 Aug 2020 15:56:27 +0300
Subject: [PATCH 083/119] Cover url-filter-applier issue with mftf test
---
...leryCatalogUiVerifyUsedInLinkCategoryGridTest.xml | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/Test/AdminMediaGalleryCatalogUiVerifyUsedInLinkCategoryGridTest.xml b/app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/Test/AdminMediaGalleryCatalogUiVerifyUsedInLinkCategoryGridTest.xml
index fd669926c2f09..58c270687ab34 100644
--- a/app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/Test/AdminMediaGalleryCatalogUiVerifyUsedInLinkCategoryGridTest.xml
+++ b/app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/Test/AdminMediaGalleryCatalogUiVerifyUsedInLinkCategoryGridTest.xml
@@ -60,14 +60,16 @@
-
-
+
+
-
+
-
+
-
+
+
+
From a246993700ecca5abbe32128fc2735a5110abdd5 Mon Sep 17 00:00:00 2001
From: Nazar Klovanych
Date: Wed, 19 Aug 2020 16:31:09 +0300
Subject: [PATCH 084/119] Correct jasmine tests && fix static tests
---
.../Model/Directories/GetFolderTree.php | 2 +-
.../base/js/grid/url-filter-applier.test.js | 21 ++++++++++++-------
2 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/app/code/Magento/MediaGalleryUi/Model/Directories/GetFolderTree.php b/app/code/Magento/MediaGalleryUi/Model/Directories/GetFolderTree.php
index f297d027c13e1..9dba5ec8433af 100644
--- a/app/code/Magento/MediaGalleryUi/Model/Directories/GetFolderTree.php
+++ b/app/code/Magento/MediaGalleryUi/Model/Directories/GetFolderTree.php
@@ -87,7 +87,7 @@ private function getDirectories(): array
$pathArray = explode('/', $path);
$displayName = strlen(end($pathArray)) > self::NAME_LENGTH ?
- substr(end($pathArray),0, self::NAME_LENGTH) . "..." :
+ substr(end($pathArray), 0 , self::NAME_LENGTH) . "..." :
end($pathArray);
$directories[] = [
'data' => count($pathArray) > 0 ? $displayName : $path,
diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/url-filter-applier.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/url-filter-applier.test.js
index a3d49e382de51..71ca60ef9077f 100644
--- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/url-filter-applier.test.js
+++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/url-filter-applier.test.js
@@ -5,14 +5,16 @@
/*eslint max-nested-callbacks: 0*/
define([
- 'Magento_Ui/js/grid/url-filter-applier'
-], function (UrlFilterApplier) {
+ 'Magento_Ui/js/grid/url-filter-applier',
+ 'jquery'
+], function (UrlFilterApplier, $) {
'use strict';
describe('Magento_Ui/js/grid/url-filter-applier', function () {
var urlFilterApplierObj,
filterComponentMock = {
- setData: jasmine.createSpy(),
+ set: jasmine.createSpy(),
+ get: jasmine.createSpy(),
apply: jasmine.createSpy()
};
@@ -64,11 +66,14 @@ define([
it('applies url filter on filter component', function () {
urlFilterApplierObj.searchString = '?filters[name]=test&filters[qty]=1';
urlFilterApplierObj.apply();
- expect(urlFilterApplierObj.filterComponent().setData).toHaveBeenCalledWith({
- 'name': 'test',
- 'qty': '1'
- }, false);
- expect(urlFilterApplierObj.filterComponent().apply).toHaveBeenCalled();
+ expect(urlFilterApplierObj.filterComponent().get).toHaveBeenCalled();
+ expect(urlFilterApplierObj.filterComponent().set).toHaveBeenCalledWith(
+ 'applied',
+ {
+ 'name': 'test',
+ 'qty': '1'
+ }
+ );
});
});
});
From 4e112321d92b65852db358feb1e9098e023eb346 Mon Sep 17 00:00:00 2001
From: Nazar Klovanych
Date: Wed, 19 Aug 2020 18:02:41 +0300
Subject: [PATCH 085/119] Correctly revert default view after mass image
deletion
---
.../view/adminhtml/web/js/grid/massaction/massactions.js | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/grid/massaction/massactions.js b/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/grid/massaction/massactions.js
index 4f09854005f23..7799bc00f958c 100644
--- a/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/grid/massaction/massactions.js
+++ b/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/grid/massaction/massactions.js
@@ -141,9 +141,7 @@ define([
if (response.status === 'canceled') {
return;
}
- this.imageModel().selected({});
- this.massActionMode(false);
- this.switchMode();
+ $(window).trigger('terminateMassAction.MediaGallery');
}.bind(this));
}
}.bind(this));
From 773c20c8506c90127eb6c39d642547acfa4e2b48 Mon Sep 17 00:00:00 2001
From: Nazar Klovanych
Date: Wed, 19 Aug 2020 18:11:45 +0300
Subject: [PATCH 086/119] static tests fix
---
.../MediaGalleryUi/Model/Directories/GetFolderTree.php | 2 +-
.../code/Magento/Ui/base/js/grid/url-filter-applier.test.js | 5 ++---
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/app/code/Magento/MediaGalleryUi/Model/Directories/GetFolderTree.php b/app/code/Magento/MediaGalleryUi/Model/Directories/GetFolderTree.php
index 9dba5ec8433af..54c3cac5ecd13 100644
--- a/app/code/Magento/MediaGalleryUi/Model/Directories/GetFolderTree.php
+++ b/app/code/Magento/MediaGalleryUi/Model/Directories/GetFolderTree.php
@@ -87,7 +87,7 @@ private function getDirectories(): array
$pathArray = explode('/', $path);
$displayName = strlen(end($pathArray)) > self::NAME_LENGTH ?
- substr(end($pathArray), 0 , self::NAME_LENGTH) . "..." :
+ substr(end($pathArray), 0, self::NAME_LENGTH) . "..." :
end($pathArray);
$directories[] = [
'data' => count($pathArray) > 0 ? $displayName : $path,
diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/url-filter-applier.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/url-filter-applier.test.js
index 71ca60ef9077f..1e63f9f61f6d1 100644
--- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/url-filter-applier.test.js
+++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/url-filter-applier.test.js
@@ -5,9 +5,8 @@
/*eslint max-nested-callbacks: 0*/
define([
- 'Magento_Ui/js/grid/url-filter-applier',
- 'jquery'
-], function (UrlFilterApplier, $) {
+ 'Magento_Ui/js/grid/url-filter-applier'
+], function (UrlFilterApplier) {
'use strict';
describe('Magento_Ui/js/grid/url-filter-applier', function () {
From f648b8b3c293f837bbbbad6688990ecf228f323d Mon Sep 17 00:00:00 2001
From: Nazar Klovanych
Date: Wed, 19 Aug 2020 19:10:54 +0300
Subject: [PATCH 087/119] Fix bindings
---
.../view/adminhtml/web/js/grid/massaction/massactions.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/grid/massaction/massactions.js b/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/grid/massaction/massactions.js
index 7799bc00f958c..03e82e65b5db5 100644
--- a/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/grid/massaction/massactions.js
+++ b/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/grid/massaction/massactions.js
@@ -142,7 +142,7 @@ define([
return;
}
$(window).trigger('terminateMassAction.MediaGallery');
- }.bind(this));
+ });
}
}.bind(this));
}
From fe781002e372ff7fe7b5952f34a268266956698a Mon Sep 17 00:00:00 2001
From: Nazar Klovanych
Date: Thu, 20 Aug 2020 10:01:00 +0300
Subject: [PATCH 088/119] Cover changes with mftf test
---
...lleryAssertMassActionModeNotActiveActionGroup.xml | 2 +-
...minEnhancedMediaGalleryDeleteImagesInBulkTest.xml | 12 ++++++++++--
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/app/code/Magento/MediaGalleryUi/Test/Mftf/ActionGroup/AdminEnhancedMediaGalleryAssertMassActionModeNotActiveActionGroup.xml b/app/code/Magento/MediaGalleryUi/Test/Mftf/ActionGroup/AdminEnhancedMediaGalleryAssertMassActionModeNotActiveActionGroup.xml
index a691f65387e8e..1ec2004b22f24 100644
--- a/app/code/Magento/MediaGalleryUi/Test/Mftf/ActionGroup/AdminEnhancedMediaGalleryAssertMassActionModeNotActiveActionGroup.xml
+++ b/app/code/Magento/MediaGalleryUi/Test/Mftf/ActionGroup/AdminEnhancedMediaGalleryAssertMassActionModeNotActiveActionGroup.xml
@@ -12,8 +12,8 @@
Asserts that massaction mode is terminated
-
+
diff --git a/app/code/Magento/MediaGalleryUi/Test/Mftf/Test/AdminEnhancedMediaGalleryDeleteImagesInBulkTest.xml b/app/code/Magento/MediaGalleryUi/Test/Mftf/Test/AdminEnhancedMediaGalleryDeleteImagesInBulkTest.xml
index 94831b039b53a..63c0fbfeefbbf 100644
--- a/app/code/Magento/MediaGalleryUi/Test/Mftf/Test/AdminEnhancedMediaGalleryDeleteImagesInBulkTest.xml
+++ b/app/code/Magento/MediaGalleryUi/Test/Mftf/Test/AdminEnhancedMediaGalleryDeleteImagesInBulkTest.xml
@@ -19,9 +19,17 @@
+
-
+
+
+
+
+
+
+
+
@@ -34,7 +42,7 @@
-
+
From 523a8c9865227cfc9d9bdf9a150bb48586704f39 Mon Sep 17 00:00:00 2001
From: Nazar Klovanych
Date: Thu, 20 Aug 2020 14:08:10 +0300
Subject: [PATCH 089/119] Add ablility to scroll folders in case when we have a
lot of included one by one folders revert cutting folders from backend
---
.../Model/Directories/GetFolderTree.php | 7 +------
.../view/adminhtml/web/css/source/_module.less | 12 +++++++++++-
2 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/app/code/Magento/MediaGalleryUi/Model/Directories/GetFolderTree.php b/app/code/Magento/MediaGalleryUi/Model/Directories/GetFolderTree.php
index 54c3cac5ecd13..f0998a3e120f2 100644
--- a/app/code/Magento/MediaGalleryUi/Model/Directories/GetFolderTree.php
+++ b/app/code/Magento/MediaGalleryUi/Model/Directories/GetFolderTree.php
@@ -17,8 +17,6 @@
*/
class GetFolderTree
{
- private const NAME_LENGTH = 50;
-
/**
* @var Filesystem
*/
@@ -86,11 +84,8 @@ private function getDirectories(): array
}
$pathArray = explode('/', $path);
- $displayName = strlen(end($pathArray)) > self::NAME_LENGTH ?
- substr(end($pathArray), 0, self::NAME_LENGTH) . "..." :
- end($pathArray);
$directories[] = [
- 'data' => count($pathArray) > 0 ? $displayName : $path,
+ 'data' => count($pathArray) > 0 ? end($pathArray) : $path,
'attr' => ['id' => $path],
'metadata' => [
'path' => $path
diff --git a/app/code/Magento/MediaGalleryUi/view/adminhtml/web/css/source/_module.less b/app/code/Magento/MediaGalleryUi/view/adminhtml/web/css/source/_module.less
index fc8bd49126d8e..b1e7966a3cfb4 100644
--- a/app/code/Magento/MediaGalleryUi/view/adminhtml/web/css/source/_module.less
+++ b/app/code/Magento/MediaGalleryUi/view/adminhtml/web/css/source/_module.less
@@ -170,8 +170,9 @@
height: 30px;
margin: 1px;
padding-left: 6px;
+ padding-right: 10px;
padding-top: 6px;
- width: 100%;
+ width: max-content;
}
.jstree-default .jstree-clicked {
@@ -272,8 +273,17 @@
}
.media-directory-container {
+ &::-webkit-scrollbar {
+ background: transparent;
+ width: 0px;
+ }
+ -ms-overflow-style: none;
float: left;
+ max-width: 50%;
+ overflow-x: scroll;
+ overflow-y: hidden;
padding-right: 40px;
+ scrollbar-width: none;
}
.media-gallery-image-block {
From c7d50bb2f126e8e1fd72541d597eeda0e908aa1d Mon Sep 17 00:00:00 2001
From: Nazar Klovanych
Date: Thu, 20 Aug 2020 14:10:19 +0300
Subject: [PATCH 090/119] Rever foders tests as it can't be veryfied by mftf
tests
---
.../Mftf/Data/AdminMediaGalleryFolderData.xml | 2 -
...iaGalleryCreateFolderWithLongNamesTest.xml | 43 -------------------
2 files changed, 45 deletions(-)
delete mode 100644 app/code/Magento/MediaGalleryUi/Test/Mftf/Test/AdminMediaGalleryCreateFolderWithLongNamesTest.xml
diff --git a/app/code/Magento/MediaGalleryUi/Test/Mftf/Data/AdminMediaGalleryFolderData.xml b/app/code/Magento/MediaGalleryUi/Test/Mftf/Data/AdminMediaGalleryFolderData.xml
index d67c019397ec1..e4149acdf58d1 100644
--- a/app/code/Magento/MediaGalleryUi/Test/Mftf/Data/AdminMediaGalleryFolderData.xml
+++ b/app/code/Magento/MediaGalleryUi/Test/Mftf/Data/AdminMediaGalleryFolderData.xml
@@ -13,7 +13,5 @@
,.?/:;'[{]}|~`!@#$%^*()_=+
- mediagallerylongfoldernamemediagallerylongfoldername54
- mediagallerylongfoldernamemediagallerylongfolderna...
diff --git a/app/code/Magento/MediaGalleryUi/Test/Mftf/Test/AdminMediaGalleryCreateFolderWithLongNamesTest.xml b/app/code/Magento/MediaGalleryUi/Test/Mftf/Test/AdminMediaGalleryCreateFolderWithLongNamesTest.xml
deleted file mode 100644
index c76790e164298..0000000000000
--- a/app/code/Magento/MediaGalleryUi/Test/Mftf/Test/AdminMediaGalleryCreateFolderWithLongNamesTest.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
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 091/119] 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 @@
+
From d24d07da57c074e282fed0666f58ce8f42d6951a Mon Sep 17 00:00:00 2001
From: joweecaquicla
Date: Thu, 20 Aug 2020 21:21:04 +0800
Subject: [PATCH 092/119] magento/adobe-stock-integration#1387: Uncaught
TypeError: Cannot read property 'complete' of undefined appears in dev
console if save Previewed image as a new View and open this View on another
page - fix static test and unit test
---
.../base/web/js/grid/columns/image-preview.js | 15 ++++++++-------
.../Ui/base/js/grid/columns/image-preview.test.js | 1 +
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/app/code/Magento/Ui/view/base/web/js/grid/columns/image-preview.js b/app/code/Magento/Ui/view/base/web/js/grid/columns/image-preview.js
index ee2d9decdb0bb..1e4ae9df7dc77 100644
--- a/app/code/Magento/Ui/view/base/web/js/grid/columns/image-preview.js
+++ b/app/code/Magento/Ui/view/base/web/js/grid/columns/image-preview.js
@@ -50,15 +50,18 @@ define([
$(document).on('keydown', this.handleKeyDown.bind(this));
this.lastOpenedImage.subscribe(function (newValue) {
+
if (newValue === false && _.isNull(this.visibleRecord())) {
return;
}
+
if (newValue === this.visibleRecord()) {
return;
}
if (newValue === false) {
this.hide();
+
return;
}
@@ -170,16 +173,14 @@ define([
setTimeout(function () {
this.updateImageData();
}.bind(this), 100);
+ } else if (img.get(0).complete) {
+ this.updateHeight();
+ this.scrollToPreview();
} else {
- if (img.get(0).complete) {
+ img.load(function () {
this.updateHeight();
this.scrollToPreview();
- } else {
- img.load(function () {
- this.updateHeight();
- this.scrollToPreview();
- }.bind(this));
- }
+ }.bind(this));
}
},
diff --git a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/columns/image-preview.test.js b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/columns/image-preview.test.js
index 6a466f0c37872..a5b434d956097 100644
--- a/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/columns/image-preview.test.js
+++ b/dev/tests/js/jasmine/tests/app/code/Magento/Ui/base/js/grid/columns/image-preview.test.js
@@ -74,6 +74,7 @@ define([
originMock = $.fn.get;
spyOn($.fn, 'get').and.returnValue(imageMock);
+ imagePreview.lastOpenedImage = jasmine.createSpy().and.returnValue(2);
imagePreview.visibleRecord = jasmine.createSpy().and.returnValue(2);
imagePreview.displayedRecord = ko.observable();
imagePreview.displayedRecord(recordMock);
From a2f56ab91aa4baba4751768015290c54c5b2b3dd Mon Sep 17 00:00:00 2001
From: joweecaquicla
Date: Thu, 20 Aug 2020 21:27:56 +0800
Subject: [PATCH 093/119] magento/adobe-stock-integration#1387: Uncaught
TypeError: Cannot read property 'complete' of undefined appears in dev
console if save Previewed image as a new View and open this View on another
page - modified function description
---
.../Magento/Ui/view/base/web/js/grid/columns/image-preview.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/code/Magento/Ui/view/base/web/js/grid/columns/image-preview.js b/app/code/Magento/Ui/view/base/web/js/grid/columns/image-preview.js
index 1e4ae9df7dc77..b561ce2e784b8 100644
--- a/app/code/Magento/Ui/view/base/web/js/grid/columns/image-preview.js
+++ b/app/code/Magento/Ui/view/base/web/js/grid/columns/image-preview.js
@@ -185,7 +185,7 @@ define([
},
/**
- * Update opened image preview contents when the data provider is updated
+ * Update preview displayed record data from the new items data if the preview is expanded
*
* @param {Array} items
*/
From 18e7988989037dabb97559d95892cb5f8d555f57 Mon Sep 17 00:00:00 2001
From: Nazar Klovanych
Date: Thu, 20 Aug 2020 17:09:45 +0300
Subject: [PATCH 094/119] fix static tests
---
.../MediaGalleryUi/view/adminhtml/web/css/source/_module.less | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/code/Magento/MediaGalleryUi/view/adminhtml/web/css/source/_module.less b/app/code/Magento/MediaGalleryUi/view/adminhtml/web/css/source/_module.less
index b1e7966a3cfb4..2b26fc19945d6 100644
--- a/app/code/Magento/MediaGalleryUi/view/adminhtml/web/css/source/_module.less
+++ b/app/code/Magento/MediaGalleryUi/view/adminhtml/web/css/source/_module.less
@@ -275,7 +275,7 @@
.media-directory-container {
&::-webkit-scrollbar {
background: transparent;
- width: 0px;
+ width: 0;
}
-ms-overflow-style: none;
float: left;
From 22670212eee321623260da8e9b406c8186309ed3 Mon Sep 17 00:00:00 2001
From: janmonteros
Date: Fri, 21 Aug 2020 00:56:30 +0800
Subject: [PATCH 095/119] magento/adobe-stock-integration#1760: Media Gallery
page and Category grid page opened successfully if "Enhanced Media Gallery"
disabled - MFTF Apply PR suggestions
---
.../Test/Mftf/ActionGroup/AssertAdminPageIs404ActionGroup.xml | 0
.../Test/Mftf/Test/AdminStandaloneMediaGalleryDisabledTest.xml | 3 +--
2 files changed, 1 insertion(+), 2 deletions(-)
rename app/code/Magento/{MediaGalleryUi => Backend}/Test/Mftf/ActionGroup/AssertAdminPageIs404ActionGroup.xml (100%)
diff --git a/app/code/Magento/MediaGalleryUi/Test/Mftf/ActionGroup/AssertAdminPageIs404ActionGroup.xml b/app/code/Magento/Backend/Test/Mftf/ActionGroup/AssertAdminPageIs404ActionGroup.xml
similarity index 100%
rename from app/code/Magento/MediaGalleryUi/Test/Mftf/ActionGroup/AssertAdminPageIs404ActionGroup.xml
rename to app/code/Magento/Backend/Test/Mftf/ActionGroup/AssertAdminPageIs404ActionGroup.xml
diff --git a/app/code/Magento/MediaGalleryUi/Test/Mftf/Test/AdminStandaloneMediaGalleryDisabledTest.xml b/app/code/Magento/MediaGalleryUi/Test/Mftf/Test/AdminStandaloneMediaGalleryDisabledTest.xml
index 767a0004872c4..8b0c984c1df77 100644
--- a/app/code/Magento/MediaGalleryUi/Test/Mftf/Test/AdminStandaloneMediaGalleryDisabledTest.xml
+++ b/app/code/Magento/MediaGalleryUi/Test/Mftf/Test/AdminStandaloneMediaGalleryDisabledTest.xml
@@ -20,9 +20,8 @@
-
-
+
From 01e90b12be723c1b64e10c8aa7028bfbe7263015 Mon Sep 17 00:00:00 2001
From: Andrii Beziazychnyi
Date: Thu, 20 Aug 2020 20:04:56 +0300
Subject: [PATCH 096/119] 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 = [];
From 8c4de4d793590a4ca5282e4afb986205c7b773b4 Mon Sep 17 00:00:00 2001
From: Prabhu Ram
Date: Thu, 20 Aug 2020 18:34:47 -0500
Subject: [PATCH 097/119] minor schema updates
---
app/code/Magento/CatalogGraphQl/etc/schema.graphqls | 4 ++--
.../ConfigurableProductGraphQl/etc/schema.graphqls | 2 +-
.../Magento/DownloadableGraphQl/etc/schema.graphqls | 2 +-
app/code/Magento/WishlistGraphQl/etc/schema.graphqls | 10 +++++-----
4 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/app/code/Magento/CatalogGraphQl/etc/schema.graphqls b/app/code/Magento/CatalogGraphQl/etc/schema.graphqls
index de4f088aac1d0..35067a6cb99af 100644
--- a/app/code/Magento/CatalogGraphQl/etc/schema.graphqls
+++ b/app/code/Magento/CatalogGraphQl/etc/schema.graphqls
@@ -493,8 +493,8 @@ type StoreConfig @doc(description: "The type contains information about a store
root_category_id: Int @doc(description: "The ID of the root category") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\RootCategoryId")
}
-type SimpleWishlistItem implements WishlistItemInterface @doc(description: "A simple product wishlist Item") {
+type SimpleWishlistItem implements WishlistItemInterface @doc(description: "A simple product wish list Item") {
}
-type VirtualWishlistItem implements WishlistItemInterface @doc(description: "A virtual product wishlist item") {
+type VirtualWishlistItem implements WishlistItemInterface @doc(description: "A virtual product wish list item") {
}
diff --git a/app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls b/app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls
index f66f8f7ee2eac..257bca11fb5b7 100644
--- a/app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls
+++ b/app/code/Magento/ConfigurableProductGraphQl/etc/schema.graphqls
@@ -69,7 +69,7 @@ type SelectedConfigurableOption {
value_label: String!
}
-type ConfigurableWishlistItem implements WishlistItemInterface @doc(description: "A configurable product wishlist item"){
+type ConfigurableWishlistItem implements WishlistItemInterface @doc(description: "A configurable product wish list item"){
child_sku: String! @doc(description: "The SKU of the simple product corresponding to a set of selected configurable options") @resolver(class: "\\Magento\\ConfigurableProductGraphQl\\Model\\Wishlist\\ChildSku")
configurable_options: [SelectedConfigurableOption!] @resolver(class: "\\Magento\\ConfigurableProductGraphQl\\Model\\Wishlist\\ConfigurableOptions") @doc (description: "An array of selected configurable options")
}
diff --git a/app/code/Magento/DownloadableGraphQl/etc/schema.graphqls b/app/code/Magento/DownloadableGraphQl/etc/schema.graphqls
index 64ef43aa03d1b..ba178bb1a427e 100644
--- a/app/code/Magento/DownloadableGraphQl/etc/schema.graphqls
+++ b/app/code/Magento/DownloadableGraphQl/etc/schema.graphqls
@@ -65,7 +65,7 @@ type DownloadableProductSamples @doc(description: "DownloadableProductSamples de
sample_file: String @deprecated(reason: "`sample_url` serves to get the downloadable sample")
}
-type DownloadableWishlistItem implements WishlistItemInterface @doc(description: "A downloadable product wishlist item") {
+type DownloadableWishlistItem implements WishlistItemInterface @doc(description: "A downloadable product wish list item") {
links_v2: [DownloadableProductLinks] @doc(description: "An array containing information about the selected links") @resolver(class: "\\Magento\\DownloadableGraphQl\\Model\\Wishlist\\ItemLinks")
samples: [DownloadableProductSamples] @doc(description: "An array containing information about the selected samples") @resolver(class: "Magento\\DownloadableGraphQl\\Resolver\\Product\\Samples")
}
diff --git a/app/code/Magento/WishlistGraphQl/etc/schema.graphqls b/app/code/Magento/WishlistGraphQl/etc/schema.graphqls
index 9c82ca03323ec..69bc45462d4c8 100644
--- a/app/code/Magento/WishlistGraphQl/etc/schema.graphqls
+++ b/app/code/Magento/WishlistGraphQl/etc/schema.graphqls
@@ -9,9 +9,9 @@ type Customer {
wishlists(
pageSize: Int = 20 @doc(description: "Specifies the maximum number of results to return at once. This attribute is optional."),
currentPage: Int = 1 @doc(description: "Specifies which page of results to return. The default value is 1.")
- ): [Wishlist!]! @doc(description: "An array of wishlists. In Magento Open Source, customers are limited to one wishlist. The number of wishlists is not restricted for Magento Commerce") @resolver(class:"\\Magento\\WishlistGraphQl\\Model\\Resolver\\CustomerWishlists")
+ ): [Wishlist!]! @doc(description: "An array of wishlists. In Magento Open Source, customers are limited to one wish list. The number of wish lists is configurable for Magento Commerce") @resolver(class:"\\Magento\\WishlistGraphQl\\Model\\Resolver\\CustomerWishlists")
wishlist: Wishlist! @deprecated(reason: "Use `Customer.wishlists` or `Customer.wishlist_v2`") @resolver(class:"\\Magento\\WishlistGraphQl\\Model\\Resolver\\CustomerWishlistResolver") @doc(description: "Contains a customer's wish lists") @cache(cacheable: false)
- wishlist_v2(id: ID!): Wishlist @doc(description: "Retrieve the specified wishlist") @resolver(class: "\\Magento\\WishlistGraphQl\\Model\\Resolver\\WishlistById")
+ wishlist_v2(id: ID!): Wishlist @doc(description: "Retrieve the specified wish list") @resolver(class: "\\Magento\\WishlistGraphQl\\Model\\Resolver\\WishlistById")
}
type WishlistOutput @doc(description: "Deprecated: `Wishlist` type should be used instead") {
@@ -32,10 +32,10 @@ type Wishlist {
}
interface WishlistItemInterface @typeResolver(class: "Magento\\WishlistGraphQl\\Model\\Resolver\\Type\\WishlistItemType") {
- id: ID @doc(description: "The ID of the wish list item")
- quantity: Float @doc(description: "The quantity of this wish list item")
+ id: ID! @doc(description: "The ID of the wish list item")
+ quantity: Float! @doc(description: "The quantity of this wish list item")
description: String @doc(description: "The description of the item")
- added_at: String @doc(description: "The date and time the item was added to the wish list")
+ added_at: String! @doc(description: "The date and time the item was added to the wish list")
product: ProductInterface @doc(description: "Product details of the wish list item") @resolver(class: "\\Magento\\WishlistGraphQl\\Model\\Resolver\\ProductResolver")
customizable_options: [SelectedCustomizableOption] @doc(description: "Custom options selected for the wish list item")
}
From 8c0e9919f8acaf741a44a0fe7a74cb42276c8d0d Mon Sep 17 00:00:00 2001
From: Nazar Klovanych
Date: Fri, 21 Aug 2020 13:21:02 +0300
Subject: [PATCH 098/119] update style to match mockups
---
.../view/adminhtml/web/css/source/_module.less | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/app/code/Magento/MediaGalleryUi/view/adminhtml/web/css/source/_module.less b/app/code/Magento/MediaGalleryUi/view/adminhtml/web/css/source/_module.less
index 2b26fc19945d6..16a2453b8b542 100644
--- a/app/code/Magento/MediaGalleryUi/view/adminhtml/web/css/source/_module.less
+++ b/app/code/Magento/MediaGalleryUi/view/adminhtml/web/css/source/_module.less
@@ -274,16 +274,17 @@
.media-directory-container {
&::-webkit-scrollbar {
- background: transparent;
- width: 0;
+ background-color: @color-media-gallery-checkbox-background;
+ }
+ &::-webkit-scrollbar-thumb {
+ background-color: @color-masonry-grey;
}
- -ms-overflow-style: none;
float: left;
max-width: 50%;
overflow-x: scroll;
overflow-y: hidden;
padding-right: 40px;
- scrollbar-width: none;
+ scrollbar-color: @color-masonry-grey @color-media-gallery-checkbox-background;
}
.media-gallery-image-block {
From 9a2880dd11eb8cd6bc4b1afab08d7f4e31bedb96 Mon Sep 17 00:00:00 2001
From: Nazar Klovanych
Date: Fri, 21 Aug 2020 13:40:52 +0300
Subject: [PATCH 099/119] cFix colors
---
.../view/adminhtml/web/css/source/_module.less | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/app/code/Magento/MediaGalleryUi/view/adminhtml/web/css/source/_module.less b/app/code/Magento/MediaGalleryUi/view/adminhtml/web/css/source/_module.less
index 16a2453b8b542..05cdf1d440833 100644
--- a/app/code/Magento/MediaGalleryUi/view/adminhtml/web/css/source/_module.less
+++ b/app/code/Magento/MediaGalleryUi/view/adminhtml/web/css/source/_module.less
@@ -18,7 +18,7 @@
@color-media-gallery-buttons-border: #adadad;
@color-media-gallery-buttons-text: #514943;
@color-media-gallery-checkbox-background: #eee;
-
+@color-media-gallery-scrollbar-background: white;
& when (@media-common = true) {
.media-gallery-delete-image-action,
@@ -274,7 +274,7 @@
.media-directory-container {
&::-webkit-scrollbar {
- background-color: @color-media-gallery-checkbox-background;
+ background-color: @color-media-gallery-scrollbar-background;
}
&::-webkit-scrollbar-thumb {
background-color: @color-masonry-grey;
@@ -284,7 +284,7 @@
overflow-x: scroll;
overflow-y: hidden;
padding-right: 40px;
- scrollbar-color: @color-masonry-grey @color-media-gallery-checkbox-background;
+ scrollbar-color: @color-masonry-grey @color-media-gallery-scrollbar-background;
}
.media-gallery-image-block {
From 141434f64214fb4bda3262a03fe4e8ed91fcac71 Mon Sep 17 00:00:00 2001
From: Nazar Klovanych
Date: Fri, 21 Aug 2020 14:20:18 +0300
Subject: [PATCH 100/119] Fix static CSS tests
---
.../MediaGalleryUi/view/adminhtml/web/css/source/_module.less | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/code/Magento/MediaGalleryUi/view/adminhtml/web/css/source/_module.less b/app/code/Magento/MediaGalleryUi/view/adminhtml/web/css/source/_module.less
index 05cdf1d440833..df005319a50d4 100644
--- a/app/code/Magento/MediaGalleryUi/view/adminhtml/web/css/source/_module.less
+++ b/app/code/Magento/MediaGalleryUi/view/adminhtml/web/css/source/_module.less
@@ -18,7 +18,7 @@
@color-media-gallery-buttons-border: #adadad;
@color-media-gallery-buttons-text: #514943;
@color-media-gallery-checkbox-background: #eee;
-@color-media-gallery-scrollbar-background: white;
+@color-media-gallery-scrollbar-background: #FFFFFF;
& when (@media-common = true) {
.media-gallery-delete-image-action,
From 22e613ce6486a3e4c291b756cd9c02e04a57aed9 Mon Sep 17 00:00:00 2001
From: Nazar Klovanych
Date: Fri, 21 Aug 2020 15:11:07 +0300
Subject: [PATCH 101/119] again css static tests
---
.../MediaGalleryUi/view/adminhtml/web/css/source/_module.less | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/code/Magento/MediaGalleryUi/view/adminhtml/web/css/source/_module.less b/app/code/Magento/MediaGalleryUi/view/adminhtml/web/css/source/_module.less
index df005319a50d4..b4529ac9296b1 100644
--- a/app/code/Magento/MediaGalleryUi/view/adminhtml/web/css/source/_module.less
+++ b/app/code/Magento/MediaGalleryUi/view/adminhtml/web/css/source/_module.less
@@ -18,7 +18,7 @@
@color-media-gallery-buttons-border: #adadad;
@color-media-gallery-buttons-text: #514943;
@color-media-gallery-checkbox-background: #eee;
-@color-media-gallery-scrollbar-background: #FFFFFF;
+@color-media-gallery-scrollbar-background: #ffffff;
& when (@media-common = true) {
.media-gallery-delete-image-action,
From a7a20f8f1ec67aa74f350dfb03d12a7a0061bfc8 Mon Sep 17 00:00:00 2001
From: Nazar Klovanych
Date: Fri, 21 Aug 2020 15:24:29 +0300
Subject: [PATCH 102/119] Cover Used In information is not displayed after the
entity was deleted with mftf tests
---
...talogUiVerifyUsedInLinkCategoryGridTest.xml | 7 +++++--
...eryUsedInSectionNotDisplayedActionGroup.xml | 18 ++++++++++++++++++
...nEnhancedMediaGalleryViewDetailsSection.xml | 1 +
3 files changed, 24 insertions(+), 2 deletions(-)
create mode 100644 app/code/Magento/MediaGalleryUi/Test/Mftf/ActionGroup/AssertAdminEnhancedMediaGalleryUsedInSectionNotDisplayedActionGroup.xml
diff --git a/app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/Test/AdminMediaGalleryCatalogUiVerifyUsedInLinkCategoryGridTest.xml b/app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/Test/AdminMediaGalleryCatalogUiVerifyUsedInLinkCategoryGridTest.xml
index 7e0fa6c477c45..502b26b4a2aec 100644
--- a/app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/Test/AdminMediaGalleryCatalogUiVerifyUsedInLinkCategoryGridTest.xml
+++ b/app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/Test/AdminMediaGalleryCatalogUiVerifyUsedInLinkCategoryGridTest.xml
@@ -23,14 +23,12 @@
-
-
@@ -60,5 +58,10 @@
+
+
+
+
+
diff --git a/app/code/Magento/MediaGalleryUi/Test/Mftf/ActionGroup/AssertAdminEnhancedMediaGalleryUsedInSectionNotDisplayedActionGroup.xml b/app/code/Magento/MediaGalleryUi/Test/Mftf/ActionGroup/AssertAdminEnhancedMediaGalleryUsedInSectionNotDisplayedActionGroup.xml
new file mode 100644
index 0000000000000..afee0ed681ab1
--- /dev/null
+++ b/app/code/Magento/MediaGalleryUi/Test/Mftf/ActionGroup/AssertAdminEnhancedMediaGalleryUsedInSectionNotDisplayedActionGroup.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+ Assert thats used in section not displayed in vew details.
+
+
+
+
+
diff --git a/app/code/Magento/MediaGalleryUi/Test/Mftf/Section/AdminEnhancedMediaGalleryViewDetailsSection.xml b/app/code/Magento/MediaGalleryUi/Test/Mftf/Section/AdminEnhancedMediaGalleryViewDetailsSection.xml
index e63429677fbae..d6abe464048c7 100644
--- a/app/code/Magento/MediaGalleryUi/Test/Mftf/Section/AdminEnhancedMediaGalleryViewDetailsSection.xml
+++ b/app/code/Magento/MediaGalleryUi/Test/Mftf/Section/AdminEnhancedMediaGalleryViewDetailsSection.xml
@@ -19,6 +19,7 @@
+
From 80efa90b4bc82b0d26e71614b4a7729f924d4caf Mon Sep 17 00:00:00 2001
From: Vadim Malesh <51680850+engcom-Charlie@users.noreply.github.com>
Date: Fri, 21 Aug 2020 15:35:52 +0300
Subject: [PATCH 103/119] add test case Id
---
.../Test/Mftf/Test/AdminCheckAnalyticsTrackingTest.xml | 1 +
1 file changed, 1 insertion(+)
diff --git a/app/code/Magento/AdminAnalytics/Test/Mftf/Test/AdminCheckAnalyticsTrackingTest.xml b/app/code/Magento/AdminAnalytics/Test/Mftf/Test/AdminCheckAnalyticsTrackingTest.xml
index cd79851d16b96..4f0e9bb000a27 100644
--- a/app/code/Magento/AdminAnalytics/Test/Mftf/Test/AdminCheckAnalyticsTrackingTest.xml
+++ b/app/code/Magento/AdminAnalytics/Test/Mftf/Test/AdminCheckAnalyticsTrackingTest.xml
@@ -14,6 +14,7 @@
+
From 54c8ebc95dd9391db5a983ff7d63dbb3f8489b35 Mon Sep 17 00:00:00 2001
From: Vadim Malesh <51680850+engcom-Charlie@users.noreply.github.com>
Date: Fri, 21 Aug 2020 16:01:09 +0300
Subject: [PATCH 104/119] add test case id
---
.../Mftf/Test/StorefrontCheckoutWithWithVirtualProductTest.xml | 1 +
1 file changed, 1 insertion(+)
diff --git a/app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontCheckoutWithWithVirtualProductTest.xml b/app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontCheckoutWithWithVirtualProductTest.xml
index b1e676b8b5188..632950120474d 100644
--- a/app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontCheckoutWithWithVirtualProductTest.xml
+++ b/app/code/Magento/Multishipping/Test/Mftf/Test/StorefrontCheckoutWithWithVirtualProductTest.xml
@@ -15,6 +15,7 @@
+
From 338f5105f4158b30e1678e8227b88c61bd0e89e6 Mon Sep 17 00:00:00 2001
From: Nazar Klovanych
Date: Fri, 21 Aug 2020 16:33:48 +0300
Subject: [PATCH 105/119] css static test fix !!
---
.../MediaGalleryUi/view/adminhtml/web/css/source/_module.less | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/code/Magento/MediaGalleryUi/view/adminhtml/web/css/source/_module.less b/app/code/Magento/MediaGalleryUi/view/adminhtml/web/css/source/_module.less
index b4529ac9296b1..6b3cd610f0348 100644
--- a/app/code/Magento/MediaGalleryUi/view/adminhtml/web/css/source/_module.less
+++ b/app/code/Magento/MediaGalleryUi/view/adminhtml/web/css/source/_module.less
@@ -18,7 +18,7 @@
@color-media-gallery-buttons-border: #adadad;
@color-media-gallery-buttons-text: #514943;
@color-media-gallery-checkbox-background: #eee;
-@color-media-gallery-scrollbar-background: #ffffff;
+@color-media-gallery-scrollbar-background: #fff;
& when (@media-common = true) {
.media-gallery-delete-image-action,
From d6de4c43fe3280df8202c2e0c6254328c36d1d49 Mon Sep 17 00:00:00 2001
From: Nazar Klovanych
Date: Fri, 21 Aug 2020 17:54:00 +0300
Subject: [PATCH 106/119] Update
app/code/Magento/MediaGalleryUi/Test/Mftf/ActionGroup/AssertAdminEnhancedMediaGalleryUsedInSectionNotDisplayedActionGroup.xml
Co-authored-by: Barny Shergold
---
...EnhancedMediaGalleryUsedInSectionNotDisplayedActionGroup.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/code/Magento/MediaGalleryUi/Test/Mftf/ActionGroup/AssertAdminEnhancedMediaGalleryUsedInSectionNotDisplayedActionGroup.xml b/app/code/Magento/MediaGalleryUi/Test/Mftf/ActionGroup/AssertAdminEnhancedMediaGalleryUsedInSectionNotDisplayedActionGroup.xml
index afee0ed681ab1..62adffc931c16 100644
--- a/app/code/Magento/MediaGalleryUi/Test/Mftf/ActionGroup/AssertAdminEnhancedMediaGalleryUsedInSectionNotDisplayedActionGroup.xml
+++ b/app/code/Magento/MediaGalleryUi/Test/Mftf/ActionGroup/AssertAdminEnhancedMediaGalleryUsedInSectionNotDisplayedActionGroup.xml
@@ -10,7 +10,7 @@
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
- Assert thats used in section not displayed in vew details.
+ Assert that's used in section not displayed in view details.
From a572253280b0cfe296be7622288cc06453bb171f Mon Sep 17 00:00:00 2001
From: Nazar Klovanych
Date: Fri, 21 Aug 2020 18:27:42 +0300
Subject: [PATCH 107/119] Remove product name assertion as other tests can
leave some active filters on product grid
---
.../Test/Mftf/Test/AdminProductGridUrlFilterApplierTest.xml | 1 -
1 file changed, 1 deletion(-)
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductGridUrlFilterApplierTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductGridUrlFilterApplierTest.xml
index fea4436446da2..d4047cbe51722 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductGridUrlFilterApplierTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductGridUrlFilterApplierTest.xml
@@ -33,7 +33,6 @@
-
From 51188d9a565bada56ed38dd5740f19b387db3029 Mon Sep 17 00:00:00 2001
From: Nazar Klovanych
Date: Fri, 21 Aug 2020 19:03:57 +0300
Subject: [PATCH 108/119] Add ablility to ovveride same filter woth url
applier, fix unstable mftf test
---
.../Test/Mftf/Test/AdminProductGridUrlFilterApplierTest.xml | 5 +++--
.../Magento/Ui/view/base/web/js/grid/url-filter-applier.js | 4 ++--
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductGridUrlFilterApplierTest.xml b/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductGridUrlFilterApplierTest.xml
index d4047cbe51722..2eda7b8d02481 100644
--- a/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductGridUrlFilterApplierTest.xml
+++ b/app/code/Magento/Catalog/Test/Mftf/Test/AdminProductGridUrlFilterApplierTest.xml
@@ -31,10 +31,11 @@
-
+
+
-
+
diff --git a/app/code/Magento/Ui/view/base/web/js/grid/url-filter-applier.js b/app/code/Magento/Ui/view/base/web/js/grid/url-filter-applier.js
index ab985c51449e8..be9044143c5a4 100644
--- a/app/code/Magento/Ui/view/base/web/js/grid/url-filter-applier.js
+++ b/app/code/Magento/Ui/view/base/web/js/grid/url-filter-applier.js
@@ -39,7 +39,7 @@ define([
apply: function () {
var urlFilter = this.getFilterParam(this.searchString),
applied,
- filters = {};
+ filters;
if (_.isUndefined(this.filterComponent())) {
setTimeout(function () {
@@ -51,7 +51,7 @@ define([
if (Object.keys(urlFilter).length) {
applied = this.filterComponent().get('applied');
- filters = $.extend(true, urlFilter, applied);
+ filters = $.extend({}, applied, urlFilter);
this.filterComponent().set('applied', filters);
}
},
From 40025cc706ca1f4041e8bdcda1c721044e1bdde9 Mon Sep 17 00:00:00 2001
From: Gabriel Galvao da Gama
Date: Mon, 17 Aug 2020 12:32:22 +0100
Subject: [PATCH 109/119] Added no store cache header to webapis requests
---
.../Plugin/AppendNoStoreCacheHeader.php | 30 +++++++++++++++++++
.../Magento/PageCache/etc/webapi_rest/di.xml | 12 ++++++++
.../Magento/PageCache/etc/webapi_soap/di.xml | 12 ++++++++
3 files changed, 54 insertions(+)
create mode 100644 app/code/Magento/PageCache/Plugin/AppendNoStoreCacheHeader.php
create mode 100644 app/code/Magento/PageCache/etc/webapi_rest/di.xml
create mode 100644 app/code/Magento/PageCache/etc/webapi_soap/di.xml
diff --git a/app/code/Magento/PageCache/Plugin/AppendNoStoreCacheHeader.php b/app/code/Magento/PageCache/Plugin/AppendNoStoreCacheHeader.php
new file mode 100644
index 0000000000000..fc18855a51710
--- /dev/null
+++ b/app/code/Magento/PageCache/Plugin/AppendNoStoreCacheHeader.php
@@ -0,0 +1,30 @@
+setHeader('Cache-Control', 'no-store');
+ return $response;
+ }
+}
diff --git a/app/code/Magento/PageCache/etc/webapi_rest/di.xml b/app/code/Magento/PageCache/etc/webapi_rest/di.xml
new file mode 100644
index 0000000000000..04906a615a9df
--- /dev/null
+++ b/app/code/Magento/PageCache/etc/webapi_rest/di.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
diff --git a/app/code/Magento/PageCache/etc/webapi_soap/di.xml b/app/code/Magento/PageCache/etc/webapi_soap/di.xml
new file mode 100644
index 0000000000000..04906a615a9df
--- /dev/null
+++ b/app/code/Magento/PageCache/etc/webapi_soap/di.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
From 5ff347c8a730581f59f761bd0c302eeca1caedbe Mon Sep 17 00:00:00 2001
From: joweecaquicla
Date: Tue, 25 Aug 2020 00:26:18 +0800
Subject: [PATCH 110/119] magento/adobe-stock-integration#1387: Uncaught
TypeError: Cannot read property 'complete' of undefined appears in dev
console if save Previewed image as a new View and open this View on another
page - fix static test fail
---
.../Magento/Ui/view/base/web/js/grid/columns/image-preview.js | 1 +
1 file changed, 1 insertion(+)
diff --git a/app/code/Magento/Ui/view/base/web/js/grid/columns/image-preview.js b/app/code/Magento/Ui/view/base/web/js/grid/columns/image-preview.js
index b561ce2e784b8..7dcf0994ef56b 100644
--- a/app/code/Magento/Ui/view/base/web/js/grid/columns/image-preview.js
+++ b/app/code/Magento/Ui/view/base/web/js/grid/columns/image-preview.js
@@ -2,6 +2,7 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
+/* eslint-disable no-undef */
define([
'jquery',
'Magento_Ui/js/grid/columns/column',
From 79c8386e1896008dfc8ef08df5b41f92b3f8100e Mon Sep 17 00:00:00 2001
From: Sergii Ivashchenko
Date: Mon, 24 Aug 2020 17:56:31 +0100
Subject: [PATCH 111/119] magento/magento2#29411: Fixed MFTF test
---
.../Test/Mftf/Test/AdminMediaGalleryUploadCategoryImageTest.xml | 1 +
1 file changed, 1 insertion(+)
diff --git a/app/code/Magento/MediaGalleryUi/Test/Mftf/Test/AdminMediaGalleryUploadCategoryImageTest.xml b/app/code/Magento/MediaGalleryUi/Test/Mftf/Test/AdminMediaGalleryUploadCategoryImageTest.xml
index ca7a71258fead..3dd294fa50605 100644
--- a/app/code/Magento/MediaGalleryUi/Test/Mftf/Test/AdminMediaGalleryUploadCategoryImageTest.xml
+++ b/app/code/Magento/MediaGalleryUi/Test/Mftf/Test/AdminMediaGalleryUploadCategoryImageTest.xml
@@ -36,6 +36,7 @@
+
From ae615991f7bb182c70485511f6675673471dc26f Mon Sep 17 00:00:00 2001
From: Sergii Ivashchenko
Date: Mon, 24 Aug 2020 20:11:29 +0100
Subject: [PATCH 112/119] Fixed static tests
---
.../view/adminhtml/web/js/directory/directoryTree.js | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/directory/directoryTree.js b/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/directory/directoryTree.js
index 0309b11296181..00a23e4a5fe08 100644
--- a/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/directory/directoryTree.js
+++ b/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/directory/directoryTree.js
@@ -257,16 +257,15 @@ define([
return;
}
- currentTreePath = this.isFilterApplied(currentFilterPath) || _.isNull(requestedDirectory)
- ? currentFilterPath
- : requestedDirectory;
+ currentTreePath = this.isFilterApplied(currentFilterPath) || _.isNull(requestedDirectory) ?
+ currentFilterPath : requestedDirectory;
if (this.folderExistsInTree(currentTreePath)) {
this.locateNode(currentTreePath);
} else {
this.selectStorageRoot();
}
- },
+ },g
/**
* Verify if directory exists in folder tree
From 8793d83717b8a12d565ecd5c6ccd16e59784522d Mon Sep 17 00:00:00 2001
From: Nazar Klovanych
Date: Tue, 25 Aug 2020 12:21:31 +0300
Subject: [PATCH 113/119] Cover product grid used in functionality
---
...ilterPlaceHolderProductGridActionGroup.xml | 20 +++++
...alleryCatalogUiUsedInProductFilterTest.xml | 35 ++++----
...talogUiVerifyUsedInLinkProductGridTest.xml | 84 +++++++++++++++++++
3 files changed, 120 insertions(+), 19 deletions(-)
create mode 100644 app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/ActionGroup/AdminAssertMediaGalleryFilterPlaceHolderProductGridActionGroup.xml
create mode 100644 app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/Test/AdminMediaGalleryCatalogUiVerifyUsedInLinkProductGridTest.xml
diff --git a/app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/ActionGroup/AdminAssertMediaGalleryFilterPlaceHolderProductGridActionGroup.xml b/app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/ActionGroup/AdminAssertMediaGalleryFilterPlaceHolderProductGridActionGroup.xml
new file mode 100644
index 0000000000000..02324fd76001f
--- /dev/null
+++ b/app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/ActionGroup/AdminAssertMediaGalleryFilterPlaceHolderProductGridActionGroup.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+ Assert asset filter placeholder value
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/Test/AdminMediaGalleryCatalogUiUsedInProductFilterTest.xml b/app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/Test/AdminMediaGalleryCatalogUiUsedInProductFilterTest.xml
index 74633fbb73542..934388188f23a 100644
--- a/app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/Test/AdminMediaGalleryCatalogUiUsedInProductFilterTest.xml
+++ b/app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/Test/AdminMediaGalleryCatalogUiUsedInProductFilterTest.xml
@@ -10,27 +10,22 @@
-
-
+
+
-
+
-
-
-
-
+
-
-
@@ -39,10 +34,7 @@
-
-
-
-
+
@@ -59,17 +51,22 @@
-
-
+
+
+
+
-
-
-
-
+
+
+
+
+
+
+
diff --git a/app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/Test/AdminMediaGalleryCatalogUiVerifyUsedInLinkProductGridTest.xml b/app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/Test/AdminMediaGalleryCatalogUiVerifyUsedInLinkProductGridTest.xml
new file mode 100644
index 0000000000000..77e837af080f0
--- /dev/null
+++ b/app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/Test/AdminMediaGalleryCatalogUiVerifyUsedInLinkProductGridTest.xml
@@ -0,0 +1,84 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
From a68bbbd6243ab5325ab8d5e0278a86d153175022 Mon Sep 17 00:00:00 2001
From: Sergii Ivashchenko
Date: Tue, 25 Aug 2020 12:00:17 +0100
Subject: [PATCH 114/119] Fixed static tests
---
.../view/adminhtml/web/js/directory/directoryTree.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/directory/directoryTree.js b/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/directory/directoryTree.js
index 00a23e4a5fe08..cf894a7395b31 100644
--- a/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/directory/directoryTree.js
+++ b/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/directory/directoryTree.js
@@ -265,7 +265,7 @@ define([
} else {
this.selectStorageRoot();
}
- },g
+ },
/**
* Verify if directory exists in folder tree
From f5ef67e45f924a7e562ad59c38915494fa6ae3c0 Mon Sep 17 00:00:00 2001
From: Nazar Klovanych
Date: Tue, 25 Aug 2020 14:59:59 +0300
Subject: [PATCH 115/119] Cover all entities ans filter placeholders
---
...lleryFilterPlaceHolderGridActionGroup.xml} | 4 +-
...talogUiVerifyUsedInLinkProductGridTest.xml | 8 +--
...aGalleryAssertUsedInLinkBlocksGridTest.xml | 66 +++++++++++++++++
...iaGalleryAssertUsedInLinkPagesGridTest.xml | 71 +++++++++++++++++++
...ediaGalleryCmsUiUsedInBlocksFilterTest.xml | 2 +-
...MediaGalleryCmsUiUsedInPagesFilterTest.xml | 8 +--
6 files changed, 145 insertions(+), 14 deletions(-)
rename app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/ActionGroup/{AdminAssertMediaGalleryFilterPlaceHolderProductGridActionGroup.xml => AdminAssertMediaGalleryFilterPlaceHolderGridActionGroup.xml} (79%)
create mode 100644 app/code/Magento/MediaGalleryCmsUi/Test/Mftf/Test/AdminMediaGalleryAssertUsedInLinkBlocksGridTest.xml
create mode 100644 app/code/Magento/MediaGalleryCmsUi/Test/Mftf/Test/AdminMediaGalleryAssertUsedInLinkPagesGridTest.xml
diff --git a/app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/ActionGroup/AdminAssertMediaGalleryFilterPlaceHolderProductGridActionGroup.xml b/app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/ActionGroup/AdminAssertMediaGalleryFilterPlaceHolderGridActionGroup.xml
similarity index 79%
rename from app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/ActionGroup/AdminAssertMediaGalleryFilterPlaceHolderProductGridActionGroup.xml
rename to app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/ActionGroup/AdminAssertMediaGalleryFilterPlaceHolderGridActionGroup.xml
index 02324fd76001f..e21fa89965391 100644
--- a/app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/ActionGroup/AdminAssertMediaGalleryFilterPlaceHolderProductGridActionGroup.xml
+++ b/app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/ActionGroup/AdminAssertMediaGalleryFilterPlaceHolderGridActionGroup.xml
@@ -7,7 +7,7 @@
-->
-
+
Assert asset filter placeholder value
@@ -15,6 +15,6 @@
-
+
diff --git a/app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/Test/AdminMediaGalleryCatalogUiVerifyUsedInLinkProductGridTest.xml b/app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/Test/AdminMediaGalleryCatalogUiVerifyUsedInLinkProductGridTest.xml
index 77e837af080f0..db7942d4c53bf 100644
--- a/app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/Test/AdminMediaGalleryCatalogUiVerifyUsedInLinkProductGridTest.xml
+++ b/app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/Test/AdminMediaGalleryCatalogUiVerifyUsedInLinkProductGridTest.xml
@@ -53,17 +53,11 @@
-
-
-
-
-
-
-
+
diff --git a/app/code/Magento/MediaGalleryCmsUi/Test/Mftf/Test/AdminMediaGalleryAssertUsedInLinkBlocksGridTest.xml b/app/code/Magento/MediaGalleryCmsUi/Test/Mftf/Test/AdminMediaGalleryAssertUsedInLinkBlocksGridTest.xml
new file mode 100644
index 0000000000000..a0cd04fad54c5
--- /dev/null
+++ b/app/code/Magento/MediaGalleryCmsUi/Test/Mftf/Test/AdminMediaGalleryAssertUsedInLinkBlocksGridTest.xml
@@ -0,0 +1,66 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/MediaGalleryCmsUi/Test/Mftf/Test/AdminMediaGalleryAssertUsedInLinkPagesGridTest.xml b/app/code/Magento/MediaGalleryCmsUi/Test/Mftf/Test/AdminMediaGalleryAssertUsedInLinkPagesGridTest.xml
new file mode 100644
index 0000000000000..de8517eedae0e
--- /dev/null
+++ b/app/code/Magento/MediaGalleryCmsUi/Test/Mftf/Test/AdminMediaGalleryAssertUsedInLinkPagesGridTest.xml
@@ -0,0 +1,71 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/MediaGalleryCmsUi/Test/Mftf/Test/AdminMediaGalleryCmsUiUsedInBlocksFilterTest.xml b/app/code/Magento/MediaGalleryCmsUi/Test/Mftf/Test/AdminMediaGalleryCmsUiUsedInBlocksFilterTest.xml
index 810d9eea4e261..fa6dc6c1a07fa 100644
--- a/app/code/Magento/MediaGalleryCmsUi/Test/Mftf/Test/AdminMediaGalleryCmsUiUsedInBlocksFilterTest.xml
+++ b/app/code/Magento/MediaGalleryCmsUi/Test/Mftf/Test/AdminMediaGalleryCmsUiUsedInBlocksFilterTest.xml
@@ -55,6 +55,6 @@
-
+
diff --git a/app/code/Magento/MediaGalleryCmsUi/Test/Mftf/Test/AdminMediaGalleryCmsUiUsedInPagesFilterTest.xml b/app/code/Magento/MediaGalleryCmsUi/Test/Mftf/Test/AdminMediaGalleryCmsUiUsedInPagesFilterTest.xml
index a6bfdb781a734..e88da08554fa4 100644
--- a/app/code/Magento/MediaGalleryCmsUi/Test/Mftf/Test/AdminMediaGalleryCmsUiUsedInPagesFilterTest.xml
+++ b/app/code/Magento/MediaGalleryCmsUi/Test/Mftf/Test/AdminMediaGalleryCmsUiUsedInPagesFilterTest.xml
@@ -21,14 +21,14 @@
-
+
-
+
@@ -39,7 +39,7 @@
-
+
@@ -56,7 +56,7 @@
-
+
From 7ca91d145e0a0d5f12223062a60398cb60ffd867 Mon Sep 17 00:00:00 2001
From: Nazar Klovanych
Date: Tue, 25 Aug 2020 15:20:44 +0300
Subject: [PATCH 116/119] fxi typo
---
.../Test/AdminMediaGalleryCatalogUiUsedInProductFilterTest.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/Test/AdminMediaGalleryCatalogUiUsedInProductFilterTest.xml b/app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/Test/AdminMediaGalleryCatalogUiUsedInProductFilterTest.xml
index 934388188f23a..01b96de8bba38 100644
--- a/app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/Test/AdminMediaGalleryCatalogUiUsedInProductFilterTest.xml
+++ b/app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/Test/AdminMediaGalleryCatalogUiUsedInProductFilterTest.xml
@@ -57,7 +57,7 @@
-
+
From e533396304e8d978568c4b2165d09c87fa33479b Mon Sep 17 00:00:00 2001
From: Sergii Ivashchenko
Date: Tue, 25 Aug 2020 13:27:02 +0100
Subject: [PATCH 117/119] Fixed static tests
---
.../view/adminhtml/web/js/directory/directoryTree.js | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/directory/directoryTree.js b/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/directory/directoryTree.js
index cf894a7395b31..2e1e9a980cd59 100644
--- a/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/directory/directoryTree.js
+++ b/app/code/Magento/MediaGalleryUi/view/adminhtml/web/js/directory/directoryTree.js
@@ -286,9 +286,8 @@ define([
* @returns {String|null}
*/
getRequestedDirectory: function () {
- return !_.isUndefined(window.MediabrowserUtility) && window.MediabrowserUtility.pathId !== ''
- ? Base64.idDecode(window.MediabrowserUtility.pathId)
- : null;
+ return !_.isUndefined(window.MediabrowserUtility) && window.MediabrowserUtility.pathId !== '' ?
+ Base64.idDecode(window.MediabrowserUtility.pathId) : null;
},
/**
From 7138093d2a91a4c711cc4c19f07a677b02d82774 Mon Sep 17 00:00:00 2001
From: Nazar Klovanych
Date: Tue, 25 Aug 2020 17:23:41 +0300
Subject: [PATCH 118/119] Mftf test stabilization
---
.../Test/AdminMediaGalleryCatalogUiUsedInProductFilterTest.xml | 1 -
.../Mftf/Test/AdminMediaGalleryCmsUiUsedInPagesFilterTest.xml | 1 +
2 files changed, 1 insertion(+), 1 deletion(-)
diff --git a/app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/Test/AdminMediaGalleryCatalogUiUsedInProductFilterTest.xml b/app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/Test/AdminMediaGalleryCatalogUiUsedInProductFilterTest.xml
index 01b96de8bba38..c3f3d6ecd9e8d 100644
--- a/app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/Test/AdminMediaGalleryCatalogUiUsedInProductFilterTest.xml
+++ b/app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/Test/AdminMediaGalleryCatalogUiUsedInProductFilterTest.xml
@@ -33,7 +33,6 @@
-
diff --git a/app/code/Magento/MediaGalleryCmsUi/Test/Mftf/Test/AdminMediaGalleryCmsUiUsedInPagesFilterTest.xml b/app/code/Magento/MediaGalleryCmsUi/Test/Mftf/Test/AdminMediaGalleryCmsUiUsedInPagesFilterTest.xml
index e88da08554fa4..038f1ae077b4a 100644
--- a/app/code/Magento/MediaGalleryCmsUi/Test/Mftf/Test/AdminMediaGalleryCmsUiUsedInPagesFilterTest.xml
+++ b/app/code/Magento/MediaGalleryCmsUi/Test/Mftf/Test/AdminMediaGalleryCmsUiUsedInPagesFilterTest.xml
@@ -58,6 +58,7 @@
+
From 62a4eacde00243365c9985cecc3ebaf1f4543a8d Mon Sep 17 00:00:00 2001
From: Nazar Klovanych
Date: Tue, 25 Aug 2020 21:31:47 +0300
Subject: [PATCH 119/119] Fix failed mftf test
---
...ryCatalogUiVerifyUsedInLinkCategoryGridTest.xml | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/Test/AdminMediaGalleryCatalogUiVerifyUsedInLinkCategoryGridTest.xml b/app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/Test/AdminMediaGalleryCatalogUiVerifyUsedInLinkCategoryGridTest.xml
index 697d52b153814..5cb778dfb9c8c 100644
--- a/app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/Test/AdminMediaGalleryCatalogUiVerifyUsedInLinkCategoryGridTest.xml
+++ b/app/code/Magento/MediaGalleryCatalogUi/Test/Mftf/Test/AdminMediaGalleryCatalogUiVerifyUsedInLinkCategoryGridTest.xml
@@ -58,13 +58,7 @@
-
-
-
-
-
-
-
+
@@ -75,5 +69,11 @@
+
+
+
+
+
+