26 $this->productFrontendActionMock = $this->getMockBuilder(
29 ->disableOriginalConstructor()
31 $this->frontendStorageConfigurationPoolMock = $this->getMockBuilder(
32 \
Magento\Catalog\Model\FrontendStorageConfigurationPool::class
34 ->disableOriginalConstructor()
37 $this->objectManagerHelper =
new ObjectManagerHelper($this);
38 $this->model = $this->objectManagerHelper->getObject(
39 \
Magento\Catalog\Cron\FrontendActionsFlush::class,
41 'productFrontendActionResource' => $this->productFrontendActionMock,
42 'frontendStorageConfigurationPool' => $this->frontendStorageConfigurationPoolMock
49 $connectionMock = $this->createMock(\
Magento\Framework\DB\Adapter\AdapterInterface::class);
50 $selectMock = $this->createMock(\
Magento\Framework\DB\Select::class);
51 $frontendConfiguration = $this->createMock(\
Magento\Catalog\Model\FrontendStorageConfigurationInterface::class);
54 ->expects($this->once())
56 ->with(
'catalog_product_frontend_action', [
'action_id',
'type_id'])
57 ->will($this->returnSelf());
59 ->expects($this->once())
64 $frontendConfiguration->expects($this->once())
70 $this->frontendStorageConfigurationPoolMock->expects($this->once())
72 ->with(
'recently_viewed_product')
73 ->willReturn($frontendConfiguration);
74 $this->productFrontendActionMock->expects($this->exactly(2))
75 ->method(
'getMainTable')
76 ->willReturn(
'catalog_product_frontend_action');
77 $this->productFrontendActionMock->expects($this->exactly(2))
78 ->method(
'getConnection')
79 ->willReturn($connectionMock);
80 $connectionMock->expects($this->once())
82 ->willReturn($selectMock);
83 $connectionMock->expects($this->once())
84 ->method(
'fetchPairs')
87 'recently_viewed_product' 90 $connectionMock->expects($this->once())
92 ->with(
'added_at < ?',
time() - 1500)
93 ->willReturn([
'added_at < ?',
time() - 1500]);
94 $connectionMock->expects($this->once())
96 ->with(
'catalog_product_frontend_action', [[
'added_at < ?',
time() - 1500]]);
98 $this->model->execute();
$frontendStorageConfigurationPoolMock
$productFrontendActionMock