Skip to content

Commit cfddf04

Browse files
committed
ACP2E-748: Layered navigation filters don't work when "show out of stock" is enabled
1 parent e5e804f commit cfddf04

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

dev/tests/integration/testsuite/Magento/Elasticsearch/Model/Adapter/BatchDataMapper/ProductDataMapperTest.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use Magento\Catalog\Model\Product;
1313
use Magento\Eav\Model\Config;
1414
use Magento\Eav\Model\Entity\Attribute\AbstractAttribute;
15+
use Magento\Framework\Module\Manager;
1516
use Magento\Framework\ObjectManagerInterface;
1617
use Magento\Store\Model\StoreManagerInterface;
1718
use Magento\TestFramework\Helper\Bootstrap;
@@ -84,18 +85,24 @@ public function testMapSelectAttributeWithDifferentStoreLabels(): void
8485
$productId => [
8586
'store_id' => $defaultStore->getId(),
8687
'select_attribute' => (int)$attributeValue,
87-
'select_attribute_value' => 'Table_default',
88-
'is_out_of_stock' => 1
88+
'select_attribute_value' => 'Table_default'
8989
],
9090
];
9191
$secondStoreMap = [
9292
$productId => [
9393
'store_id' => $secondStore->getId(),
9494
'select_attribute' => (int)$attributeValue,
95-
'select_attribute_value' => 'Table_fixture_second_store',
96-
'is_out_of_stock' => 1
95+
'select_attribute_value' => 'Table_fixture_second_store'
9796
],
9897
];
98+
99+
/** @var Manager $moduleManager */
100+
$moduleManager = $this->objectManager->get(Manager::class);
101+
if ($moduleManager->isEnabled('Magento_InventoryElasticsearch')) {
102+
$defaultStoreMap[$productId] += ['is_out_of_stock' => 1];
103+
$secondStoreMap[$productId] += ['is_out_of_stock' => 1];
104+
}
105+
99106
$data = [
100107
$productId => [
101108
$attributeId => $attributeValue,

0 commit comments

Comments
 (0)