Skip to content

Commit 52971ba

Browse files
committed
MAGETWO-90563: [Forwardport] Implement segmentation for Category Product Indexer
1 parent dbf74dc commit 52971ba

File tree

2 files changed

+31
-6
lines changed
  • app/code/Magento/Catalog/Model/Indexer/Category/Product
  • dev/tests/integration/testsuite/Magento/BundleImportExport/Model/Import/Product/Type

2 files changed

+31
-6
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,8 +411,11 @@ protected function isRangingNeeded()
411411
* @param int $range
412412
* @return Select[]
413413
*/
414-
protected function prepareSelectsByRange(Select $select, $field, $range = self::RANGE_CATEGORY_STEP)
415-
{
414+
protected function prepareSelectsByRange(
415+
Select $select,
416+
string $field,
417+
int $range = self::RANGE_CATEGORY_STEP
418+
) {
416419
if ($this->isRangingNeeded()) {
417420
$iterator = $this->queryGenerator->generate(
418421
$field,

dev/tests/integration/testsuite/Magento/BundleImportExport/Model/Import/Product/Type/BundleTest.php

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
*/
66
namespace Magento\BundleImportExport\Model\Import\Product\Type;
77

8-
use Magento\Framework\App\Bootstrap;
8+
use Magento\TestFramework\Helper\Bootstrap;
99
use Magento\Framework\App\Filesystem\DirectoryList;
10-
use Magento\ImportExport\Model\Import;
1110

1211
/**
1312
* @magentoAppArea adminhtml
13+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1414
*/
15-
class BundleTest extends \PHPUnit\Framework\TestCase
15+
class BundleTest extends \Magento\TestFramework\Indexer\TestCase
1616
{
1717
/**
1818
* Bundle product test Name
@@ -41,9 +41,22 @@ class BundleTest extends \PHPUnit\Framework\TestCase
4141
*/
4242
protected $optionSkuList = ['Simple 1', 'Simple 2', 'Simple 3'];
4343

44+
public static function setUpBeforeClass()
45+
{
46+
$db = Bootstrap::getInstance()->getBootstrap()
47+
->getApplication()
48+
->getDbInstance();
49+
if (!$db->isDbDumpExists()) {
50+
throw new \LogicException('DB dump does not exist.');
51+
}
52+
$db->restoreFromDbDump();
53+
54+
parent::setUpBeforeClass();
55+
}
56+
4457
protected function setUp()
4558
{
46-
$this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
59+
$this->objectManager = Bootstrap::getObjectManager();
4760
$this->model = $this->objectManager->create(\Magento\CatalogImportExport\Model\Import\Product::class);
4861
}
4962

@@ -122,6 +135,7 @@ public function testBundleImport()
122135

123136
/**
124137
* @magentoDataFixture Magento/Store/_files/second_store.php
138+
* @magentoDbIsolation disabled
125139
* @magentoAppArea adminhtml
126140
* @return void
127141
*/
@@ -179,4 +193,12 @@ public function testBundleImportWithMultipleStoreViews(): void
179193
}
180194
}
181195
}
196+
197+
/**
198+
* teardown
199+
*/
200+
public function tearDown()
201+
{
202+
parent::tearDown();
203+
}
182204
}

0 commit comments

Comments
 (0)