Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
module-catalog
Test
Unit
Model
ResourceModel
Product
Indexer
Eav
BatchSizeCalculatorTest.php
Go to the documentation of this file.
1
<?php
7
namespace
Magento\Catalog\Test\Unit\Model\ResourceModel\Product\Indexer\Eav
;
8
9
use
Magento\Framework\DB\Adapter\AdapterInterface
;
10
use
Magento\Framework\Indexer\BatchSizeManagement
;
11
use
Magento\Catalog\Model\ResourceModel\Product\Indexer\Eav\BatchSizeCalculator
;
12
13
class
BatchSizeCalculatorTest
extends
\PHPUnit\Framework\TestCase
14
{
15
public
function
testEstimateBatchSize
()
16
{
17
$indexerId =
'default'
;
18
$batchManagerMock = $this->createMock(BatchSizeManagement::class);
19
$batchSizes = [
20
$indexerId => 2000,
21
];
22
$batchManagers = [
23
$indexerId => $batchManagerMock,
24
];
25
$model
=
new
BatchSizeCalculator
(
26
$batchSizes,
27
$batchManagers
28
);
29
$connectionMock = $this->createMock(AdapterInterface::class);
30
31
$batchManagerMock->expects($this->once())
32
->method(
'ensureBatchSize'
)
33
->with($connectionMock, $batchSizes[$indexerId]);
34
$this->assertEquals($batchSizes[$indexerId],
$model
->estimateBatchSize($connectionMock, $indexerId));
35
}
36
40
public
function
testEstimateBatchSizeThrowsExceptionIfIndexerIdIsNotRecognized
()
41
{
42
$model
=
new
BatchSizeCalculator
(
43
[],
44
[]
45
);
46
$connectionMock = $this->createMock(AdapterInterface::class);
47
48
$model
->estimateBatchSize($connectionMock,
'wrong_indexer_id'
);
49
}
50
}
Magento\Framework\Indexer\BatchSizeManagement
Definition:
BatchSizeManagement.php:12
$model
$model
Definition:
enable_catalog_product_reindex_schedule.php:9
Magento\Catalog\Test\Unit\Model\ResourceModel\Product\Indexer\Eav\BatchSizeCalculatorTest\testEstimateBatchSizeThrowsExceptionIfIndexerIdIsNotRecognized
testEstimateBatchSizeThrowsExceptionIfIndexerIdIsNotRecognized()
Definition:
BatchSizeCalculatorTest.php:40
Magento\Catalog\Test\Unit\Model\ResourceModel\Product\Indexer\Eav\BatchSizeCalculatorTest
Definition:
BatchSizeCalculatorTest.php:13
Magento\Catalog\Model\ResourceModel\Product\Indexer\Eav\BatchSizeCalculator
Definition:
BatchSizeCalculator.php:17
Magento\Catalog\Test\Unit\Model\ResourceModel\Product\Indexer\Eav\BatchSizeCalculatorTest\testEstimateBatchSize
testEstimateBatchSize()
Definition:
BatchSizeCalculatorTest.php:15
Magento\Framework\DB\Adapter\AdapterInterface
Definition:
AdapterInterface.php:16
Magento\Catalog\Test\Unit\Model\ResourceModel\Product\Indexer\Eav
Definition:
BatchSizeCalculatorTest.php:7