Skip to content

Commit 1bbf53d

Browse files
committed
Merge branch 'MC-40083' into 2.4-develop-sidecar-pr13
2 parents 95584a3 + 0d5a593 commit 1bbf53d

File tree

1 file changed

+28
-0
lines changed
  • dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action

1 file changed

+28
-0
lines changed

dev/tests/integration/testsuite/Magento/Catalog/Model/Indexer/Product/Flat/Action/FullTest.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@
1010
use Magento\Catalog\Api\Data\ProductInterface;
1111
use Magento\Catalog\Api\ProductRepositoryInterface;
1212
use Magento\Catalog\Block\Product\ListProduct;
13+
use Magento\Catalog\Helper\Product\Flat\Indexer as IndexerHelper;
1314
use Magento\Catalog\Model\CategoryFactory;
1415
use Magento\Catalog\Model\Indexer\Product\Flat\Processor;
1516
use Magento\Catalog\Model\Indexer\Product\Flat\State;
1617
use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory as ProductCollectionFactory;
1718
use Magento\Catalog\Model\ResourceModel\Product\Flat as FlatResource;
1819
use Magento\CatalogSearch\Model\Indexer\Fulltext;
1920
use Magento\Eav\Api\AttributeOptionManagementInterface;
21+
use Magento\Framework\Exception\LocalizedException;
2022
use Magento\Framework\Indexer\IndexerRegistry;
2123
use Magento\Framework\ObjectManagerInterface;
2224
use Magento\Store\Model\StoreManagerInterface;
@@ -49,6 +51,9 @@ class FullTest extends TestCase
4951
/** @var Full */
5052
private $action;
5153

54+
/** @var IndexerHelper */
55+
private $productIndexerHelper;
56+
5257
/**
5358
* @inheritdoc
5459
*/
@@ -79,6 +84,7 @@ protected function setUp(): void
7984
$this->optionManagement = $this->objectManager->get(AttributeOptionManagementInterface::class);
8085
$this->productRepository = $this->objectManager->get(ProductRepositoryInterface::class);
8186
$this->action = $this->objectManager->get(Full::class);
87+
$this->productIndexerHelper = $this->objectManager->get(IndexerHelper::class);
8288
}
8389

8490
/**
@@ -180,6 +186,28 @@ public function testCheckDropdownAttributeInFlat(): void
180186
$this->assertFlatColumnValue($attributeCode, $attributeValue);
181187
}
182188

189+
/**
190+
* @magentoDbIsolation disabled
191+
*
192+
* @magentoConfigFixture default/catalog/product/flat/max_index_count 1
193+
*
194+
* @return void
195+
*/
196+
public function testWithTooManyIndexes(): void
197+
{
198+
$indexesNeed = count($this->productIndexerHelper->getFlatIndexes());
199+
$message = (string)__(
200+
'The Flat Catalog module has a limit of %2$d filterable and/or sortable attributes.'
201+
. 'Currently there are %1$d of them.'
202+
. 'Please reduce the number of filterable/sortable attributes in order to use this module',
203+
$indexesNeed,
204+
1
205+
);
206+
$this->expectExceptionMessage($message);
207+
$this->expectException(LocalizedException::class);
208+
$this->action->execute();
209+
}
210+
183211
/**
184212
* Assert if column exist and column value in flat table
185213
*

0 commit comments

Comments
 (0)