Skip to content

Commit

Permalink
issue/14056 - Coupon API not working for guest user - adjusted unit t…
Browse files Browse the repository at this point in the history
…ests
  • Loading branch information
mdykas authored and gelanivishal committed Jul 5, 2018
1 parent 1acd06f commit 2651be3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions app/code/Magento/Quote/Test/Unit/Model/CouponManagementTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ protected function setUp()
'save',
'getShippingAddress',
'getCouponCode',
'getStoreId',
'__wakeup'
]);
$this->quoteAddressMock = $this->createPartialMock(\Magento\Quote\Model\Quote\Address::class, [
Expand Down Expand Up @@ -98,6 +99,9 @@ public function testSetWhenCouldNotApplyCoupon()
$cartId = 33;
$couponCode = '153a-ABC';

$this->storeMock->expects($this->any())->method('getId')->will($this->returnValue(1));
$this->quoteMock->expects($this->once())->method('getStoreId')->willReturn($this->returnValue(1));

$this->quoteRepositoryMock->expects($this->once())
->method('getActive')->with($cartId)->will($this->returnValue($this->quoteMock));
$this->quoteMock->expects($this->once())->method('getItemsCount')->will($this->returnValue(12));
Expand Down Expand Up @@ -125,6 +129,9 @@ public function testSetWhenCouponCodeIsInvalid()
$cartId = 33;
$couponCode = '153a-ABC';

$this->storeMock->expects($this->any())->method('getId')->will($this->returnValue(1));
$this->quoteMock->expects($this->once())->method('getStoreId')->willReturn($this->returnValue(1));

$this->quoteRepositoryMock->expects($this->once())
->method('getActive')->with($cartId)->will($this->returnValue($this->quoteMock));
$this->quoteMock->expects($this->once())->method('getItemsCount')->will($this->returnValue(12));
Expand All @@ -144,6 +151,9 @@ public function testSet()
$cartId = 33;
$couponCode = '153a-ABC';

$this->storeMock->expects($this->any())->method('getId')->will($this->returnValue(1));
$this->quoteMock->expects($this->once())->method('getStoreId')->willReturn($this->returnValue(1));

$this->quoteRepositoryMock->expects($this->once())
->method('getActive')->with($cartId)->will($this->returnValue($this->quoteMock));
$this->quoteMock->expects($this->once())->method('getItemsCount')->will($this->returnValue(12));
Expand Down

0 comments on commit 2651be3

Please sign in to comment.