Skip to content

Commit

Permalink
ENGCOM-4218: Updated Deprecated functions call #21098
Browse files Browse the repository at this point in the history
  • Loading branch information
sidolov authored Feb 13, 2019
2 parents b35ded1 + 82335e0 commit 3ccc44c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
13 changes: 8 additions & 5 deletions app/code/Magento/Wishlist/Controller/Index/Cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,19 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\Wishlist\Controller\Index;

use Magento\Framework\App\Action;
use Magento\Catalog\Model\Product\Exception as ProductException;
use Magento\Framework\App\Action;
use Magento\Framework\Controller\ResultFactory;

/**
* Add wishlist item to shopping cart and remove from wishlist controller.
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class Cart extends \Magento\Wishlist\Controller\AbstractIndex
class Cart extends \Magento\Wishlist\Controller\AbstractIndex implements Action\HttpPostActionInterface
{
/**
* @var \Magento\Wishlist\Controller\WishlistProviderInterface
Expand Down Expand Up @@ -195,12 +198,12 @@ public function execute()
}
}
} catch (ProductException $e) {
$this->messageManager->addError(__('This product(s) is out of stock.'));
$this->messageManager->addErrorMessage(__('This product(s) is out of stock.'));
} catch (\Magento\Framework\Exception\LocalizedException $e) {
$this->messageManager->addNotice($e->getMessage());
$this->messageManager->addNoticeMessage($e->getMessage());
$redirectUrl = $configureUrl;
} catch (\Exception $e) {
$this->messageManager->addException($e, __('We can\'t add the item to the cart right now.'));
$this->messageManager->addExceptionMessage($e, __('We can\'t add the item to the cart right now.'));
}

$this->helper->calculate();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@ public function testExecuteWithoutQuantityArrayAndOutOfStock()
->willThrowException(new ProductException(__('Test Phrase')));

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

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

$this->messageManagerMock->expects($this->once())
->method('addNotice')
->method('addNoticeMessage')
->with('message', null)
->willReturnSelf();

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

$this->messageManagerMock->expects($this->once())
->method('addNotice')
->method('addNoticeMessage')
->with('message', null)
->willReturnSelf();

Expand Down

0 comments on commit 3ccc44c

Please sign in to comment.