-
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.
Merge pull request #1836 from magento-engcom/2.2-develop-prs
[EngCom] Public Pull Requests - 2.2-develop Public Pull Requests - magento-engcom#980 10123: Wrong invoice entity_model in table eav_entity_type. by @nmalevanec - magento-engcom#964 8507: There is invalid type in PHPDoc block of \Magento\Framework\Data\Tree::getNodeById() by @RomaKis - #11702 Fix getReservedOrderId() to use current store instead of default store by @tdgroot Fixed Public Issues - #10123 Invoice entity_model in table eav_entity_type - #8507 There is invalid type in PHPDoc block of \Magento\Framework\Data\Tree::getNodeById() - #9055 Default Store is always used when retrieving sequence value's for sales entity's.
- Loading branch information
Showing
7 changed files
with
139 additions
and
17 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
103 changes: 103 additions & 0 deletions
103
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,103 @@ | ||
<?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(): array | ||
{ | ||
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
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
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