Skip to content

Commit 70c10b1

Browse files
author
Robert He
committed
MAGETWO-71445: Out of stock options for configurable products still show up in search and layered navigation
- fixed processing relations of products using the wrong productIds
1 parent 1c02661 commit 70c10b1

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

app/code/Magento/Catalog/Test/Unit/Model/Indexer/Product/Eav/AbstractActionTest.php

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,9 @@ public function testReindexWithoutArgumentsExecutesReindexAll()
115115

116116
public function testReindexWithNotNullArgumentExecutesReindexEntities()
117117
{
118-
$ids = [1, 2, 3];
118+
$childIds = [1, 2, 3];
119+
$parentIds = [4];
120+
$reindexIds = array_merge($childIds, $parentIds);
119121
$connectionMock = $this->getMockBuilder(\Magento\Framework\DB\Adapter\AdapterInterface::class)
120122
->getMockForAbstractClass();
121123

@@ -127,21 +129,21 @@ public function testReindexWithNotNullArgumentExecutesReindexEntities()
127129
->disableOriginalConstructor()
128130
->getMock();
129131

130-
$eavSource->expects($this->once())->method('getRelationsByChild')->with($ids)->willReturn([]);
131-
$eavSource->expects($this->once())->method('getRelationsByParent')->with($ids)->willReturn([]);
132+
$eavSource->expects($this->once())->method('getRelationsByChild')->with($childIds)->willReturn($childIds);
133+
$eavSource->expects($this->once())->method('getRelationsByParent')->with($childIds)->willReturn($parentIds);
132134

133-
$eavDecimal->expects($this->once())->method('getRelationsByChild')->with($ids)->willReturn([]);
134-
$eavDecimal->expects($this->once())->method('getRelationsByParent')->with($ids)->willReturn([]);
135+
$eavDecimal->expects($this->once())->method('getRelationsByChild')->with($reindexIds)->willReturn($reindexIds);
136+
$eavDecimal->expects($this->once())->method('getRelationsByParent')->with($reindexIds)->willReturn([]);
135137

136138
$eavSource->expects($this->once())->method('getConnection')->willReturn($connectionMock);
137139
$eavDecimal->expects($this->once())->method('getConnection')->willReturn($connectionMock);
138140
$eavDecimal->expects($this->once())
139141
->method('reindexEntities')
140-
->with($ids);
142+
->with($reindexIds);
141143

142144
$eavSource->expects($this->once())
143145
->method('reindexEntities')
144-
->with($ids);
146+
->with($reindexIds);
145147

146148
$this->_eavSourceFactoryMock->expects($this->once())
147149
->method('create')
@@ -151,6 +153,6 @@ public function testReindexWithNotNullArgumentExecutesReindexEntities()
151153
->method('create')
152154
->will($this->returnValue($eavDecimal));
153155

154-
$this->_model->reindex($ids);
156+
$this->_model->reindex($childIds);
155157
}
156158
}

0 commit comments

Comments
 (0)