Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit 6b325e1

Browse files
committed
Use $quote->getStoreId() in Quote::getReservedOrderId()
1 parent 5afcc52 commit 6b325e1

File tree

2 files changed

+10
-19
lines changed

2 files changed

+10
-19
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ public function getReservedOrderId($quote)
167167
{
168168
return $this->sequenceManager->getSequence(
169169
\Magento\Sales\Model\Order::ENTITY,
170-
$quote->getStore()->getStoreId()
170+
$quote->getStoreId()
171171
)
172172
->getNextValue();
173173
}

app/code/Magento/Quote/Test/Unit/Model/ResourceModel/QuoteTest.php

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,6 @@ class QuoteTest extends \PHPUnit\Framework\TestCase
2323
*/
2424
private $sequenceMock;
2525

26-
/**
27-
* @var \Magento\Sales\Model\Order|\PHPUnit_Framework_MockObject_MockObject
28-
*/
29-
private $storeMock;
30-
3126
/**
3227
* @var \Magento\Quote\Model\ResourceModel\Quote
3328
*/
@@ -56,9 +51,6 @@ protected function setUp()
5651
$this->sequenceMock = $this->getMockBuilder(\Magento\Framework\DB\Sequence\SequenceInterface::class)
5752
->disableOriginalConstructor()
5853
->getMock();
59-
$this->storeMock = $this->getMockBuilder(\Magento\Sales\Model\Order::class)
60-
->disableOriginalConstructor()
61-
->getMock();
6254
$this->quote = new \Magento\Quote\Model\ResourceModel\Quote(
6355
$context,
6456
$snapshot,
@@ -71,24 +63,23 @@ protected function setUp()
7163
/**
7264
* @param $entityType
7365
* @param $storeId
66+
* @param $reservedOrderId
7467
* @dataProvider getReservedOrderIdDataProvider
7568
*/
76-
public function testGetReservedOrderId($entityType, $storeId)
69+
public function testGetReservedOrderId($entityType, $storeId, $reservedOrderId)
7770
{
7871
$this->sequenceManagerMock->expects($this->once())
7972
->method('getSequence')
80-
->with(\Magento\Sales\Model\Order::ENTITY, $storeId)
73+
->with($entityType, $storeId)
8174
->willReturn($this->sequenceMock);
8275
$this->quoteMock->expects($this->once())
83-
->method('getStore')
84-
->willReturn($this->storeMock);
85-
$this->storeMock->expects($this->once())
8676
->method('getStoreId')
8777
->willReturn($storeId);
8878
$this->sequenceMock->expects($this->once())
89-
->method('getNextValue');
79+
->method('getNextValue')
80+
->willReturn($reservedOrderId);
9081

91-
$this->quote->getReservedOrderId($this->quoteMock);
82+
$this->assertEquals($reservedOrderId, $this->quote->getReservedOrderId($this->quoteMock));
9283
}
9384

9485
/**
@@ -97,9 +88,9 @@ public function testGetReservedOrderId($entityType, $storeId)
9788
public function getReservedOrderIdDataProvider(): array
9889
{
9990
return [
100-
[\Magento\Sales\Model\Order::ENTITY, 1],
101-
[\Magento\Sales\Model\Order::ENTITY, 2],
102-
[\Magento\Sales\Model\Order::ENTITY, 3]
91+
[\Magento\Sales\Model\Order::ENTITY, 1, '1000000001'],
92+
[\Magento\Sales\Model\Order::ENTITY, 2, '2000000001'],
93+
[\Magento\Sales\Model\Order::ENTITY, 3, '3000000001']
10394
];
10495
}
10596
}

0 commit comments

Comments
 (0)