Skip to content

Commit e5e804f

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

File tree

5 files changed

+2
-197
lines changed

5 files changed

+2
-197
lines changed

dev/tests/integration/testsuite/Magento/Catalog/Block/Product/ListProduct/SortingTest.php

Lines changed: 0 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,11 @@
99

1010
use Magento\Catalog\Api\CategoryRepositoryInterface;
1111
use Magento\Catalog\Api\Data\CategoryInterface;
12-
use Magento\Catalog\Api\ProductRepositoryInterface;
1312
use Magento\Catalog\Block\Product\ListProduct;
1413
use Magento\Catalog\Block\Product\ProductList\Toolbar;
1514
use Magento\Catalog\Model\Config;
1615
use Magento\Catalog\Model\ResourceModel\Category\Collection;
1716
use Magento\Catalog\Model\ResourceModel\Category\CollectionFactory;
18-
use Magento\CatalogInventory\Model\Configuration;
1917
use Magento\Framework\App\Config\MutableScopeConfigInterface;
2018
use Magento\Framework\ObjectManagerInterface;
2119
use Magento\Framework\View\LayoutInterface;
@@ -69,11 +67,6 @@ class SortingTest extends TestCase
6967
*/
7068
private $scopeConfig;
7169

72-
/**
73-
* @var ProductRepositoryInterface
74-
*/
75-
private $productRepository;
76-
7770
/**
7871
* @inheritdoc
7972
*/
@@ -87,7 +80,6 @@ protected function setUp(): void
8780
$this->categoryCollectionFactory = $this->objectManager->get(CollectionFactory::class);
8881
$this->categoryRepository = $this->objectManager->get(CategoryRepositoryInterface::class);
8982
$this->scopeConfig = $this->objectManager->get(MutableScopeConfigInterface::class);
90-
$this->productRepository = $this->objectManager->create(ProductRepositoryInterface::class);
9183
parent::setUp();
9284
}
9385

@@ -475,91 +467,4 @@ private function assertProductListSortOrderWithConfig(string $sortBy, string $di
475467
$this->renderBlock($category, $direction);
476468
$this->assertBlockSorting($sortBy, $expected);
477469
}
478-
479-
/**
480-
* Test product list ordered by product name with out-of-stock configurable product options.
481-
*
482-
* @magentoDataFixture Magento/ConfigurableProduct/_files/configurable_product_show_out_of_stock.php
483-
* @dataProvider productListWithShowOutOfStockSortOrderDataProvider
484-
* @param string $sortBy
485-
* @param string $direction
486-
* @param array $expected
487-
* @return void
488-
*/
489-
public function testProductListOutOfStockSortOrderBySaleability(
490-
string $sortBy,
491-
string $direction,
492-
array $expected
493-
): void {
494-
$this->scopeConfig->setValue(
495-
Config::XML_PATH_LIST_DEFAULT_SORT_BY,
496-
$sortBy,
497-
ScopeInterface::SCOPE_STORE,
498-
Store::DEFAULT_STORE_ID
499-
);
500-
$this->scopeConfig->setValue(
501-
Configuration::XML_PATH_SHOW_OUT_OF_STOCK,
502-
1,
503-
ScopeInterface::SCOPE_STORE,
504-
\Magento\Framework\App\ScopeInterface::SCOPE_DEFAULT
505-
);
506-
507-
/** @var CategoryInterface $category */
508-
$category = $this->categoryRepository->get(333);
509-
if ($category->getId()) {
510-
$category->setAvailableSortBy(['position', 'name', 'price']);
511-
$category->addData(['available_sort_by' => 'position,name,price']);
512-
$category->setDefaultSortBy($sortBy);
513-
$this->categoryRepository->save($category);
514-
}
515-
516-
foreach (['simple_41', 'simple_42', 'configurable_12345'] as $sku) {
517-
$product = $this->productRepository->get($sku);
518-
$product->setStockData(['is_in_stock' => 0]);
519-
$this->productRepository->save($product);
520-
}
521-
$this->renderBlock($category, $direction);
522-
$this->assertBlockSorting($sortBy, $expected);
523-
}
524-
525-
/**
526-
* Product list with out-of-stock sort order data provider
527-
*
528-
* @return array
529-
*/
530-
public function productListWithShowOutOfStockSortOrderDataProvider(): array
531-
{
532-
return [
533-
'default_order_position_asc' => [
534-
'sort' => 'position',
535-
'direction' => 'ASC',
536-
'expectation' => ['simple2', 'simple1', 'configurable', 'configurable_12345'],
537-
],
538-
'default_order_position_desc' => [
539-
'sort' => 'position',
540-
'direction' => 'DESC',
541-
'expectation' => ['simple2', 'simple1', 'configurable', 'configurable_12345'],
542-
],
543-
'default_order_price_asc' => [
544-
'sort' => 'price',
545-
'direction' => 'ASC',
546-
'expectation' => ['simple1', 'simple2', 'configurable', 'configurable_12345'],
547-
],
548-
'default_order_price_desc' => [
549-
'sort' => 'price',
550-
'direction' => 'DESC',
551-
'expectation' => ['configurable', 'simple2', 'simple1', 'configurable_12345'],
552-
],
553-
'default_order_name_asc' => [
554-
'sort' => 'name',
555-
'direction' => 'ASC',
556-
'expectation' => ['configurable', 'simple1', 'simple2', 'configurable_12345'],
557-
],
558-
'default_order_name_desc' => [
559-
'sort' => 'name',
560-
'direction' => 'DESC',
561-
'expectation' => ['simple2', 'simple1', 'configurable', 'configurable_12345'],
562-
],
563-
];
564-
}
565470
}

dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_show_out_of_stock.php

Lines changed: 0 additions & 63 deletions
This file was deleted.

dev/tests/integration/testsuite/Magento/ConfigurableProduct/_files/configurable_product_show_out_of_stock_rollback.php

Lines changed: 0 additions & 37 deletions
This file was deleted.

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,15 @@ public function testMapSelectAttributeWithDifferentStoreLabels(): void
8585
'store_id' => $defaultStore->getId(),
8686
'select_attribute' => (int)$attributeValue,
8787
'select_attribute_value' => 'Table_default',
88+
'is_out_of_stock' => 1
8889
],
8990
];
9091
$secondStoreMap = [
9192
$productId => [
9293
'store_id' => $secondStore->getId(),
9394
'select_attribute' => (int)$attributeValue,
9495
'select_attribute_value' => 'Table_fixture_second_store',
96+
'is_out_of_stock' => 1
9597
],
9698
];
9799
$data = [

dev/tests/integration/testsuite/Magento/LayeredNavigation/Block/Navigation/Category/OutOfStockProductsFilterTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ protected function setUp(): void
5050
*/
5151
public function testGetFiltersWithOutOfStockProduct(int $showOutOfStock, array $expectation): void
5252
{
53-
$this->markTestSkipped('Unskip after fixing ACP2E-748.');
54-
5553
$this->updateConfigShowOutOfStockFlag($showOutOfStock);
5654
$this->getCategoryFiltersAndAssert(
5755
['out-of-stock-product' => 'Option 1', 'in-stock-product' => 'Option 2'],

0 commit comments

Comments
 (0)