Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
BatchSizeCalculatorTest.php
Go to the documentation of this file.
1 <?php
8 
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  ];
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 
41  {
43  [],
44  []
45  );
46  $connectionMock = $this->createMock(AdapterInterface::class);
47 
48  $model->estimateBatchSize($connectionMock, 'wrong_indexer_id');
49  }
50 }