Skip to content

Commit aaf1c2b

Browse files
committed
MAGETWO-75786: Incorrect count for category filter at layered navigation for configurable with no available options
1 parent 8c86e80 commit aaf1c2b

File tree

3 files changed

+15
-16
lines changed

3 files changed

+15
-16
lines changed

app/code/Magento/Catalog/Model/Indexer/Category/Product/AbstractAction.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -814,16 +814,4 @@ protected function reindexRootCategory(Store $store)
814814
}
815815
}
816816
}
817-
818-
/**
819-
* @return \Magento\Framework\EntityManager\MetadataPool
820-
*/
821-
private function getMetadataPool()
822-
{
823-
if (null === $this->metadataPool) {
824-
$this->metadataPool = \Magento\Framework\App\ObjectManager::getInstance()
825-
->get(\Magento\Framework\EntityManager\MetadataPool::class);
826-
}
827-
return $this->metadataPool;
828-
}
829817
}

dev/tests/functional/tests/app/Magento/LayeredNavigation/Test/Constraint/AssertProductsCount.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
3+
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
66
namespace Magento\LayeredNavigation\Test\Constraint;

dev/tests/integration/testsuite/Magento/CatalogSearch/Model/Indexer/FulltextTest.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
namespace Magento\CatalogSearch\Model\Indexer;
77

88
use Magento\Catalog\Model\Product;
9+
use Magento\Catalog\Model\Product\Visibility;
910
use Magento\CatalogSearch\Model\ResourceModel\Fulltext\Collection;
1011
use Magento\TestFramework\Helper\Bootstrap;
1112

@@ -199,23 +200,29 @@ public function testReindexParentProductWhenChildBeingDisabled()
199200
{
200201
$this->indexer->reindexAll();
201202

202-
$products = $this->search('Configurable');
203+
$visibilityFilter = [
204+
Visibility::VISIBILITY_IN_SEARCH,
205+
Visibility::VISIBILITY_IN_CATALOG,
206+
Visibility::VISIBILITY_BOTH
207+
];
208+
$products = $this->search('Configurable', $visibilityFilter);
203209
$this->assertCount(1, $products);
204210

205211
$childProduct = $this->getProductBySku('configurable_option_single_child');
206212
$childProduct->setStatus(Product\Attribute\Source\Status::STATUS_DISABLED)->save();
207213

208-
$products = $this->search('Configurable');
214+
$products = $this->search('Configurable', $visibilityFilter);
209215
$this->assertCount(0, $products);
210216
}
211217

212218
/**
213219
* Search the text and return result collection
214220
*
215221
* @param string $text
222+
* @param null|array $visibilityFilter
216223
* @return Product[]
217224
*/
218-
protected function search($text)
225+
protected function search($text, $visibilityFilter = null)
219226
{
220227
$this->resourceFulltext->resetSearchResults();
221228
$query = $this->queryFactory->get();
@@ -230,6 +237,10 @@ protected function search($text)
230237
]
231238
);
232239
$collection->addSearchFilter($text);
240+
if (null !== $visibilityFilter) {
241+
$collection->setVisibility($visibilityFilter);
242+
}
243+
233244
foreach ($collection as $product) {
234245
$products[] = $product;
235246
}

0 commit comments

Comments
 (0)