Skip to content

Commit 3a99c94

Browse files
committed
MAGETWO-64547: Bundle Products - The options you selected are not available.
Unit tests
1 parent a2e6b6b commit 3a99c94

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

lib/internal/Magento/Framework/EntityManager/Test/Unit/Db/UpdateRowTest.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ protected function setUp()
7171
*/
7272
public function testExecute(array $data, array $columns, array $preparedColumns)
7373
{
74+
$primaryKeyName = 'entity_id';
7475
$this->metadataPoolMock->expects($this->once())
7576
->method('getMetadata')
7677
->with('test')
@@ -81,15 +82,16 @@ public function testExecute(array $data, array $columns, array $preparedColumns)
8182
$this->metadataMock->expects($this->once())
8283
->method('getEntityConnectionName')
8384
->willReturn('test_connection_name');
84-
$this->metadataMock->expects($this->exactly(2))
85+
$this->metadataMock->expects($this->atLeastOnce())
8586
->method('getEntityTable')
8687
->willReturn('test_entity_table');
8788
$this->connectionMock->expects($this->once())
8889
->method('update')
8990
->with('test_entity_table', $preparedColumns, ['test_link_field' . ' = ?' => $data['test_link_field']]);
90-
$this->metadataMock->expects($this->exactly(2))
91-
->method('getLinkField')
92-
->willReturn('test_link_field');
91+
$this->connectionMock->expects($this->once())->method('getIndexList')
92+
->willReturn([$primaryKeyName => ['COLUMNS_LIST' => ['test_link_field']]]);
93+
$this->connectionMock->expects($this->once())->method('getPrimaryKeyName')
94+
->willReturn($primaryKeyName);
9395
$this->connectionMock->expects($this->once())
9496
->method('describeTable')
9597
->willReturn($columns);

lib/internal/Magento/Framework/EntityManager/Test/Unit/Operation/CreateTest.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Magento\Framework\EntityManager\MetadataPool;
1414
use Magento\Framework\EntityManager\Operation\Create;
1515
use Magento\Framework\EntityManager\Operation\Create\CreateMain;
16+
use Magento\Framework\EntityManager\Sequence\SequenceApplier;
1617
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
1718

1819
class CreateTest extends \PHPUnit_Framework_TestCase
@@ -32,6 +33,11 @@ class CreateTest extends \PHPUnit_Framework_TestCase
3233
*/
3334
private $createMain;
3435

36+
/**
37+
* @var SequenceApplier|\PHPUnit_Framework_MockObject_MockObject
38+
*/
39+
private $sequenceApplier;
40+
3541
/**
3642
* @var Create
3743
*/
@@ -48,11 +54,15 @@ public function setUp()
4854
$this->createMain = $this->getMockBuilder(CreateMain::class)
4955
->disableOriginalConstructor()
5056
->getMock();
51-
52-
$this->create = (new ObjectManager($this))->getObject(Create::class, [
57+
$this->sequenceApplier = $this->getMockBuilder(SequenceApplier::class)
58+
->disableOriginalConstructor()
59+
->getMock();
60+
$objectManagerHelper = new ObjectManager($this);
61+
$this->create = $objectManagerHelper->getObject(Create::class, [
5362
'metadataPool' => $this->metadataPool,
5463
'resourceConnection' => $this->resourceConnection,
5564
'createMain' => $this->createMain,
65+
'sequenceApplier' => $this->sequenceApplier,
5666
]);
5767
}
5868

0 commit comments

Comments
 (0)