Skip to content

Commit 8252f45

Browse files
author
Oleksii Korshenko
committed
MAGETWO-81994: Products added to cart with REST API give total prices equal to zero #11458
- fixed unit tests
1 parent 16712cd commit 8252f45

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

app/code/Magento/Quote/Test/Unit/Model/QuoteManagementTest.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,11 @@ class QuoteManagementTest extends \PHPUnit\Framework\TestCase
131131
*/
132132
private $addressRepositoryMock;
133133

134+
/**
135+
* @var \PHPUnit_Framework_MockObject_MockObject
136+
*/
137+
private $quoteFactoryMock;
138+
134139
/**
135140
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
136141
*/
@@ -241,10 +246,15 @@ public function testCreateEmptyCartAnonymous()
241246

242247
$quoteMock = $this->createMock(\Magento\Quote\Model\Quote::class);
243248

244-
$quoteAddress = $this->createMock(\Magento\Quote\Model\Quote\Address::class);
249+
$quoteAddress = $this->getMockBuilder(\Magento\Quote\Model\Quote\Address::class)
250+
->disableOriginalConstructor()
251+
->setMethods(['setCollectShippingRates'])
252+
->getMock();
245253

246254
$quoteMock->expects($this->any())->method('setBillingAddress')->with($quoteAddress)->willReturnSelf();
247255
$quoteMock->expects($this->any())->method('setShippingAddress')->with($quoteAddress)->willReturnSelf();
256+
$quoteMock->expects($this->any())->method('getShippingAddress')->willReturn($quoteAddress);
257+
$quoteAddress->expects($this->once())->method('setCollectShippingRates')->with(true);
248258

249259
$this->quoteAddressFactory->expects($this->any())->method('create')->willReturn($quoteAddress);
250260

0 commit comments

Comments
 (0)