Skip to content

Commit

Permalink
Merge pull request #43 from magento-epam/MAGETWO-66666
Browse files Browse the repository at this point in the history
MAGETWO-66666: Adding a product to cart from category page with an ex…
  • Loading branch information
vital-pantsialeyeu authored Aug 10, 2018
2 parents 687807d + eb61445 commit 0044785
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ class AddTest extends \PHPUnit\Framework\TestCase
*/
private $messageManager;

/**
* @var \Magento\Checkout\Controller\Cart\Add | \PHPUnit_Framework_MockObject_MockObject
*/
private $cartAdd;

/**
* Init mocks for tests.
*
Expand All @@ -52,7 +57,7 @@ public function setUp()
->disableOriginalConstructor()->getMock();

$this->objectManagerHelper = new ObjectManagerHelper($this);
$this->add = $this->objectManagerHelper->getObject(
$this->cartAdd = $this->objectManagerHelper->getObject(
\Magento\Checkout\Controller\Cart\Add::class,
[
'_formKeyValidator' => $this->formKeyValidator,
Expand All @@ -79,6 +84,6 @@ public function testExecute()
$this->messageManager->expects($this->once())->method('addErrorMessage');
$this->resultRedirectFactory->expects($this->once())->method('create')->willReturn($redirect);
$redirect->expects($this->once())->method('setPath')->with($path)->willReturnSelf();
$this->assertEquals($redirect, $this->add->execute());
$this->assertEquals($redirect, $this->cartAdd->execute());
}
}

0 comments on commit 0044785

Please sign in to comment.