Skip to content

Commit 748c6b9

Browse files
committed
Merge branch 'ACP2E-2811' of https://github.com/adobe-commerce-tier-4/magento2ce into 2.4-develop
2 parents ea79f7d + fa009e4 commit 748c6b9

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

app/code/Magento/CatalogRule/Model/Indexer/ReindexRuleProduct.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ public function execute(Rule $rule, $batchCount, $useAdditionalTable = false)
146146
'sort_order' => $sortOrder,
147147
];
148148

149-
if (count($rows) === $batchCount) {
149+
if (count($rows) === (int) $batchCount) {
150150
$connection->insertMultiple($indexTable, $rows);
151151
$rows = [];
152152
}

app/code/Magento/CatalogRule/Test/Unit/Model/Indexer/ReindexRuleProductTest.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,28 @@ function ($table, $rows) use ($batchRows, $rowsNotInBatch) {
191191
self::assertTrue($this->model->execute($this->ruleMock, 2, true));
192192
}
193193

194+
public function testExecuteWithCustomBatchSize()
195+
{
196+
$websiteId = 3;
197+
$productIds = [
198+
4 => [$websiteId => 1],
199+
5 => [$websiteId => 1],
200+
6 => [$websiteId => 1]
201+
];
202+
203+
$this->prepareResourceMock();
204+
$this->prepareRuleMock([3], $productIds, [10]);
205+
206+
$this->localeDateMock->method('getConfigTimezone')
207+
->willReturnMap([
208+
[ScopeInterface::SCOPE_WEBSITE, self::ADMIN_WEBSITE_ID, $this->adminTimeZone],
209+
[ScopeInterface::SCOPE_WEBSITE, $websiteId, $this->websiteTz]
210+
]);
211+
212+
$this->connectionMock->expects($this->exactly(2))->method('insertMultiple');
213+
self::assertTrue($this->model->execute($this->ruleMock, '2', true));
214+
}
215+
194216
/**
195217
* @param array $websitesIds
196218
* @param array $productIds

0 commit comments

Comments
 (0)