Skip to content

Commit ca6b7ce

Browse files
author
Sergey Semenov
committed
MAGETWO-37742: It's impossible to add Product to Shopping Cart from shared Wishlist
1 parent db49147 commit ca6b7ce

File tree

4 files changed

+25
-1
lines changed

4 files changed

+25
-1
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,10 @@ class Send extends Action\Action implements IndexInterface
7979
* @param \Magento\Framework\Mail\Template\TransportBuilder $transportBuilder
8080
* @param \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation
8181
* @param \Magento\Customer\Helper\View $customerHelperView
82+
* @param WishlistSession $wishlistSession
83+
* @param ScopeConfigInterface $scopeConfig
84+
* @param StoreManagerInterface $storeManager
85+
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
8286
*/
8387
public function __construct(
8488
Action\Context $context,

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
use Magento\Wishlist\Model\ItemFactory;
1717
use Magento\Wishlist\Model\Resource\Item\Option\Collection as OptionCollection;
1818

19+
/**
20+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
21+
*/
1922
class Cart extends \Magento\Framework\App\Action\Action
2023
{
2124
/**

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

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@
3232
use Magento\Wishlist\Model\Config as WishlistConfig;
3333
use Magento\Wishlist\Model\Wishlist;
3434

35+
/**
36+
* @SuppressWarnings(PHPMD.TooManyFields)
37+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
38+
*/
3539
class SendTest extends \PHPUnit_Framework_TestCase
3640
{
3741
/** @var Send |\PHPUnit_Framework_MockObject_MockObject */
@@ -106,6 +110,9 @@ class SendTest extends \PHPUnit_Framework_TestCase
106110
/** @var EventManagerInterface |\PHPUnit_Framework_MockObject_MockObject */
107111
protected $eventManager;
108112

113+
/**
114+
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
115+
*/
109116
protected function setUp()
110117
{
111118
$this->resultRedirect = $this->getMockBuilder('Magento\Framework\Controller\Result\Redirect')
@@ -370,13 +377,16 @@ public function dataProviderExecuteWithError()
370377
['test text', 100, null, 1, 0, '', 'Email address can\'t be empty.'],
371378
['test text', 100, '', 1, 0, '', 'Email address can\'t be empty.'],
372379
['test text', 100, 'user1@example.com', 1, 1, '', 'This wishlist can be shared 0 more times.'],
373-
['test text', 100, 'user1@example.com, user2@example.com', 3, 2, '', 'This wishlist can be shared 1 more times.'],
380+
['test text', 100, 'u1@example.com, u2@example.com', 3, 2, '', 'This wishlist can be shared 1 more times.'],
374381
['test text', 100, 'wrongEmailAddress', 1, 0, '', 'Please input a valid email address.'],
375382
['test text', 100, 'user1@example.com, wrongEmailAddress', 2, 0, '', 'Please input a valid email address.'],
376383
['test text', 100, 'wrongEmailAddress, user2@example.com', 2, 0, '', 'Please input a valid email address.'],
377384
];
378385
}
379386

387+
/**
388+
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
389+
*/
380390
public function testExecuteWithException()
381391
{
382392
$text = 'test text';
@@ -499,6 +509,9 @@ public function testExecuteWithException()
499509
$this->assertEquals($this->resultRedirect, $this->model->execute());
500510
}
501511

512+
/**
513+
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
514+
*/
502515
public function testExecute()
503516
{
504517
$text = 'text';

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@
2424
use Magento\Wishlist\Model\ItemFactory;
2525
use Magento\Wishlist\Model\Resource\Item\Option\Collection as OptionCollection;
2626

27+
/**
28+
* @SuppressWarnings(PHPMD.TooManyFields)
29+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
30+
*/
2731
class CartTest extends \PHPUnit_Framework_TestCase
2832
{
2933
/** @var SharedCart |\PHPUnit_Framework_MockObject_MockObject */

0 commit comments

Comments
 (0)