Skip to content

Commit 0ce49b1

Browse files
committed
issue 31043: fix unit test
1 parent b9d331a commit 0ce49b1

File tree

2 files changed

+30
-3
lines changed

2 files changed

+30
-3
lines changed

app/code/Magento/Elasticsearch/Test/Unit/Model/Adapter/BatchDataMapper/ProductDataMapperTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@ public function testGetMapAdditionalFieldsOnly()
101101
$storeId = 1;
102102
$productId = 42;
103103
$additionalFields = ['some data'];
104-
$this->builderMock->expects($this->once())
104+
$this->builderMock->expects($this->exactly(2))
105105
->method('addField')
106-
->with('store_id', $storeId);
106+
->withConsecutive(['store_id', $storeId], ['entity_id', $productId]);
107107

108108
$this->builderMock->expects($this->any())
109109
->method('addFields')
@@ -167,7 +167,7 @@ public function testGetMap(int $productId, array $attributeData, $attributeValue
167167
$productId => [$attributeId => $attributeValue],
168168
];
169169
$documents = $this->model->map($documentData, $storeId, $context);
170-
$returnAttributeData = ['store_id' => $storeId] + $returnAttributeData;
170+
$returnAttributeData = ['store_id' => $storeId] + ['entity_id' => $productId] + $returnAttributeData;
171171
$this->assertSame($returnAttributeData, $documents[$productId]);
172172
}
173173

@@ -183,6 +183,7 @@ public function testGetMapWithOptions()
183183
$returnAttributeData = [
184184
'store_id' => $storeId,
185185
'options' => $attributeValue,
186+
'entity_id' => 10,
186187
];
187188

188189
$this->dataProvider->expects($this->never())

app/code/Magento/Elasticsearch/Test/Unit/Model/Adapter/FieldMapper/Product/FieldProvider/StaticFieldTest.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,8 @@ function ($type) use ($complexType) {
228228
return 'float';
229229
} elseif ($type === 'keyword') {
230230
return 'string';
231+
} elseif ($type === 'integer') {
232+
return 'integer';
231233
} else {
232234
return $complexType;
233235
}
@@ -276,6 +278,10 @@ public function attributeProvider(): array
276278
'type' => 'string',
277279
'index' => 'no',
278280
],
281+
'entity_id' => [
282+
'type' => 'integer',
283+
'index' => 'no',
284+
],
279285
],
280286
],
281287
[
@@ -304,6 +310,10 @@ public function attributeProvider(): array
304310
'type' => 'string',
305311
'index' => 'no',
306312
],
313+
'entity_id' => [
314+
'type' => 'integer',
315+
'index' => 'no',
316+
],
307317
],
308318
],
309319
[
@@ -332,6 +342,10 @@ public function attributeProvider(): array
332342
'type' => 'string',
333343
'index' => 'no',
334344
],
345+
'entity_id' => [
346+
'type' => 'integer',
347+
'index' => 'no',
348+
],
335349
],
336350
],
337351
[
@@ -354,6 +368,10 @@ public function attributeProvider(): array
354368
'type' => 'string',
355369
'index' => 'no',
356370
],
371+
'entity_id' => [
372+
'type' => 'integer',
373+
'index' => 'no',
374+
],
357375
],
358376
],
359377
[
@@ -382,6 +400,10 @@ public function attributeProvider(): array
382400
'type' => 'string',
383401
'index' => 'no',
384402
],
403+
'entity_id' => [
404+
'type' => 'integer',
405+
'index' => 'no',
406+
],
385407
],
386408
],
387409
[
@@ -400,6 +422,10 @@ public function attributeProvider(): array
400422
'type' => 'string',
401423
'index' => 'no',
402424
],
425+
'entity_id' => [
426+
'type' => 'integer',
427+
'index' => 'no',
428+
],
403429
],
404430
],
405431
];

0 commit comments

Comments
 (0)