Skip to content

Commit 2651be3

Browse files
mdykasgelanivishal
mdykas
authored andcommitted
issue/14056 - Coupon API not working for guest user - adjusted unit tests
1 parent 1acd06f commit 2651be3

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Diff for: app/code/Magento/Quote/Test/Unit/Model/CouponManagementTest.php

+10
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ protected function setUp()
4747
'save',
4848
'getShippingAddress',
4949
'getCouponCode',
50+
'getStoreId',
5051
'__wakeup'
5152
]);
5253
$this->quoteAddressMock = $this->createPartialMock(\Magento\Quote\Model\Quote\Address::class, [
@@ -98,6 +99,9 @@ public function testSetWhenCouldNotApplyCoupon()
9899
$cartId = 33;
99100
$couponCode = '153a-ABC';
100101

102+
$this->storeMock->expects($this->any())->method('getId')->will($this->returnValue(1));
103+
$this->quoteMock->expects($this->once())->method('getStoreId')->willReturn($this->returnValue(1));
104+
101105
$this->quoteRepositoryMock->expects($this->once())
102106
->method('getActive')->with($cartId)->will($this->returnValue($this->quoteMock));
103107
$this->quoteMock->expects($this->once())->method('getItemsCount')->will($this->returnValue(12));
@@ -125,6 +129,9 @@ public function testSetWhenCouponCodeIsInvalid()
125129
$cartId = 33;
126130
$couponCode = '153a-ABC';
127131

132+
$this->storeMock->expects($this->any())->method('getId')->will($this->returnValue(1));
133+
$this->quoteMock->expects($this->once())->method('getStoreId')->willReturn($this->returnValue(1));
134+
128135
$this->quoteRepositoryMock->expects($this->once())
129136
->method('getActive')->with($cartId)->will($this->returnValue($this->quoteMock));
130137
$this->quoteMock->expects($this->once())->method('getItemsCount')->will($this->returnValue(12));
@@ -144,6 +151,9 @@ public function testSet()
144151
$cartId = 33;
145152
$couponCode = '153a-ABC';
146153

154+
$this->storeMock->expects($this->any())->method('getId')->will($this->returnValue(1));
155+
$this->quoteMock->expects($this->once())->method('getStoreId')->willReturn($this->returnValue(1));
156+
147157
$this->quoteRepositoryMock->expects($this->once())
148158
->method('getActive')->with($cartId)->will($this->returnValue($this->quoteMock));
149159
$this->quoteMock->expects($this->once())->method('getItemsCount')->will($this->returnValue(12));

0 commit comments

Comments
 (0)