Skip to content

Commit 3ccc44c

Browse files
authored
ENGCOM-4218: Updated Deprecated functions call #21098
2 parents b35ded1 + 82335e0 commit 3ccc44c

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

app/code/Magento/Wishlist/Controller/Index/Cart.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,19 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
67
namespace Magento\Wishlist\Controller\Index;
78

8-
use Magento\Framework\App\Action;
99
use Magento\Catalog\Model\Product\Exception as ProductException;
10+
use Magento\Framework\App\Action;
1011
use Magento\Framework\Controller\ResultFactory;
1112

1213
/**
14+
* Add wishlist item to shopping cart and remove from wishlist controller.
15+
*
1316
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1417
*/
15-
class Cart extends \Magento\Wishlist\Controller\AbstractIndex
18+
class Cart extends \Magento\Wishlist\Controller\AbstractIndex implements Action\HttpPostActionInterface
1619
{
1720
/**
1821
* @var \Magento\Wishlist\Controller\WishlistProviderInterface
@@ -195,12 +198,12 @@ public function execute()
195198
}
196199
}
197200
} catch (ProductException $e) {
198-
$this->messageManager->addError(__('This product(s) is out of stock.'));
201+
$this->messageManager->addErrorMessage(__('This product(s) is out of stock.'));
199202
} catch (\Magento\Framework\Exception\LocalizedException $e) {
200-
$this->messageManager->addNotice($e->getMessage());
203+
$this->messageManager->addNoticeMessage($e->getMessage());
201204
$redirectUrl = $configureUrl;
202205
} catch (\Exception $e) {
203-
$this->messageManager->addException($e, __('We can\'t add the item to the cart right now.'));
206+
$this->messageManager->addExceptionMessage($e, __('We can\'t add the item to the cart right now.'));
204207
}
205208

206209
$this->helper->calculate();

app/code/Magento/Wishlist/Test/Unit/Controller/Index/CartTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,7 @@ public function testExecuteWithoutQuantityArrayAndOutOfStock()
735735
->willThrowException(new ProductException(__('Test Phrase')));
736736

737737
$this->messageManagerMock->expects($this->once())
738-
->method('addError')
738+
->method('addErrorMessage')
739739
->with('This product(s) is out of stock.', null)
740740
->willReturnSelf();
741741

@@ -901,7 +901,7 @@ public function testExecuteWithoutQuantityArrayAndConfigurable()
901901
->willThrowException(new \Magento\Framework\Exception\LocalizedException(__('message')));
902902

903903
$this->messageManagerMock->expects($this->once())
904-
->method('addNotice')
904+
->method('addNoticeMessage')
905905
->with('message', null)
906906
->willReturnSelf();
907907

@@ -1073,7 +1073,7 @@ public function testExecuteWithEditQuantity()
10731073
->willThrowException(new \Magento\Framework\Exception\LocalizedException(__('message')));
10741074

10751075
$this->messageManagerMock->expects($this->once())
1076-
->method('addNotice')
1076+
->method('addNoticeMessage')
10771077
->with('message', null)
10781078
->willReturnSelf();
10791079

0 commit comments

Comments
 (0)