-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ENGCOM-2031: [Backport] #14063 - Wrong invoice prefix in multistore s…
…etup due to default store id (fix order increment id)
- Loading branch information
1 parent
b82653b
commit 957cb34
Showing
4 changed files
with
105 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
99 changes: 99 additions & 0 deletions
99
app/code/Magento/Quote/Test/Unit/Model/ResourceModel/QuoteTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Magento\Quote\Test\Unit\Model\ResourceModel; | ||
|
||
use Magento\Framework\DB\Sequence\SequenceInterface; | ||
use Magento\Framework\Model\ResourceModel\Db\Context; | ||
use Magento\Framework\Model\ResourceModel\Db\VersionControl\RelationComposite; | ||
use Magento\Framework\Model\ResourceModel\Db\VersionControl\Snapshot; | ||
use Magento\Quote\Model\Quote; | ||
use Magento\SalesSequence\Model\Manager; | ||
|
||
class QuoteTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* @var Quote|\PHPUnit_Framework_MockObject_MockObject | ||
*/ | ||
private $quoteMock; | ||
/** | ||
* @var Manager|\PHPUnit_Framework_MockObject_MockObject | ||
*/ | ||
private $sequenceManagerMock; | ||
/** | ||
* @var SequenceInterface|\PHPUnit_Framework_MockObject_MockObject | ||
*/ | ||
private $sequenceMock; | ||
/** | ||
* @var \Magento\Quote\Model\ResourceModel\Quote | ||
*/ | ||
private $quote; | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
protected function setUp() | ||
{ | ||
$context = $this->getMockBuilder(Context::class) | ||
->disableOriginalConstructor() | ||
->getMock(); | ||
$snapshot = $this->getMockBuilder(Snapshot::class) | ||
->disableOriginalConstructor() | ||
->getMock(); | ||
$relationComposite = $this->getMockBuilder(RelationComposite::class) | ||
->disableOriginalConstructor() | ||
->getMock(); | ||
$this->quoteMock = $this->getMockBuilder(Quote::class) | ||
->disableOriginalConstructor() | ||
->getMock(); | ||
$this->sequenceManagerMock = $this->getMockBuilder(Manager::class) | ||
->disableOriginalConstructor() | ||
->getMock(); | ||
$this->sequenceMock = $this->getMockBuilder(SequenceInterface::class) | ||
->disableOriginalConstructor() | ||
->getMock(); | ||
$this->quote = new \Magento\Quote\Model\ResourceModel\Quote( | ||
$context, | ||
$snapshot, | ||
$relationComposite, | ||
$this->sequenceManagerMock, | ||
null | ||
); | ||
} | ||
|
||
/** | ||
* @param $entityType | ||
* @param $storeId | ||
* @param $reservedOrderId | ||
* @dataProvider getReservedOrderIdDataProvider | ||
*/ | ||
public function testGetReservedOrderId($entityType, $storeId, $reservedOrderId) | ||
{ | ||
$this->sequenceManagerMock->expects($this->once()) | ||
->method('getSequence') | ||
->with($entityType, $storeId) | ||
->willReturn($this->sequenceMock); | ||
$this->quoteMock->expects($this->once()) | ||
->method('getStoreId') | ||
->willReturn($storeId); | ||
$this->sequenceMock->expects($this->once()) | ||
->method('getNextValue') | ||
->willReturn($reservedOrderId); | ||
$this->assertEquals($reservedOrderId, $this->quote->getReservedOrderId($this->quoteMock)); | ||
} | ||
|
||
/** | ||
* @return array | ||
*/ | ||
public function getReservedOrderIdDataProvider() | ||
{ | ||
return [ | ||
[\Magento\Sales\Model\Order::ENTITY, 1, '1000000001'], | ||
[\Magento\Sales\Model\Order::ENTITY, 2, '2000000001'], | ||
[\Magento\Sales\Model\Order::ENTITY, 3, '3000000001'] | ||
]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters