17 private $resourceConnectionMock;
26 $this->resourceConnectionMock = $this->getMockBuilder(\
Magento\Framework\
App\ResourceConnection::class)
27 ->disableOriginalConstructor()
30 $this->model = new \Magento\Catalog\Model\Indexer\Category\Product\RowSizeEstimator(
31 $this->resourceConnectionMock
37 $connectionMock = $this->getMockBuilder(\
Magento\Framework\DB\Adapter\AdapterInterface::class)
39 $storeGroupCounterMock = $this->getMockBuilder(\
Magento\Framework\DB\Select::class)
40 ->disableOriginalConstructor()
42 $this->resourceConnectionMock->expects($this->exactly(2))
43 ->method(
'getTableName')
44 ->willReturnMap([[
'store_group',
'storegrouptable'], [
'catalog_category_product',
'ccp']]);
46 $this->resourceConnectionMock->expects($this->once())
47 ->method(
'getConnection')
48 ->willReturn($connectionMock);
49 $connectionMock->expects($this->exactly(3))
51 ->willReturn($storeGroupCounterMock);
52 $storeGroupCounterMock->expects($this->exactly(3))
55 $storeGroupCounterMock->expects($this->once())
57 ->with(
'group_id > 0')
59 $connectionMock->expects($this->exactly(2))
63 $storeGroupCounterMock->expects($this->once())
67 $this->assertEquals(2500, $this->model->estimateRowSize());