Skip to content

Commit c06bb3d

Browse files
committed
MC-37484: Cart query error when trying to switch store view
1 parent 10dc15f commit c06bb3d

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

app/code/Magento/Quote/Model/PaymentMethodManagement.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public function set($cartId, \Magento\Quote\Api\Data\PaymentInterface $method)
8383
throw new InvalidTransitionException(__('The requested Payment Method is not available.'));
8484
}
8585

86-
$this->quoteRepository->save($quote);
86+
$quote->save();
8787
return $quote->getPayment()->getId();
8888
}
8989

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public function testSetVirtualProduct()
136136

137137
$quoteMock = $this->getMockBuilder(Quote::class)
138138
->addMethods(['setTotalsCollectedFlag'])
139-
->onlyMethods(['getPayment', 'isVirtual', 'getBillingAddress', 'collectTotals'])
139+
->onlyMethods(['getPayment', 'isVirtual', 'getBillingAddress', 'collectTotals', 'save'])
140140
->disableOriginalConstructor()
141141
->getMock();
142142
$this->quoteRepositoryMock->expects($this->once())->method('get')->with($cartId)->willReturn($quoteMock);
@@ -189,7 +189,7 @@ public function testSetVirtualProduct()
189189
->willReturn(true);
190190

191191
$quoteMock->expects($this->once())->method('setTotalsCollectedFlag')->with(false)->willReturnSelf();
192-
$this->quoteRepositoryMock->expects($this->once())->method('save')->with($quoteMock);
192+
$quoteMock->expects($this->once())->method('save')->willReturnSelf();
193193

194194
$paymentMock->expects($this->once())->method('getId')->willReturn($paymentId);
195195
$this->assertEquals($paymentId, $this->model->set($cartId, $methodMock));
@@ -267,7 +267,7 @@ public function testSetSimpleProduct()
267267

268268
$quoteMock = $this->getMockBuilder(Quote::class)
269269
->addMethods(['setTotalsCollectedFlag'])
270-
->onlyMethods(['getPayment', 'isVirtual', 'getShippingAddress', 'collectTotals'])
270+
->onlyMethods(['getPayment', 'isVirtual', 'getShippingAddress', 'collectTotals', 'save'])
271271
->disableOriginalConstructor()
272272
->getMock();
273273
$this->quoteRepositoryMock->expects($this->once())->method('get')->with($cartId)->willReturn($quoteMock);
@@ -324,7 +324,7 @@ public function testSetSimpleProduct()
324324
->willReturn(true);
325325

326326
$quoteMock->expects($this->once())->method('setTotalsCollectedFlag')->with(false)->willReturnSelf();
327-
$this->quoteRepositoryMock->expects($this->once())->method('save')->with($quoteMock);
327+
$quoteMock->expects($this->once())->method('save')->willReturnSelf();
328328

329329
$paymentMock->expects($this->once())->method('getId')->willReturn($paymentId);
330330
$this->assertEquals($paymentId, $this->model->set($cartId, $methodMock));

0 commit comments

Comments
 (0)