Ejemplo n.º 1
0
 /**
  * @param mixed $from
  * @param mixed $to
  * @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $truncateCount
  * @param \PHPUnit_Framework_MockObject_Matcher_InvokedCount $deleteCount
  * @dataProvider intervalsDataProvider
  * @return void
  */
 public function testAggregate($from, $to, $truncateCount, $deleteCount)
 {
     $this->connectionMock->expects($truncateCount)->method('truncateTable');
     $this->connectionMock->expects($deleteCount)->method('delete');
     $this->helperMock->expects($this->at(0))->method('updateReportRatingPos')->with($this->connectionMock, 'day', 'views_num', 'report_viewed_product_aggregated_daily', 'report_viewed_product_aggregated_daily')->willReturnSelf();
     $this->helperMock->expects($this->at(1))->method('updateReportRatingPos')->with($this->connectionMock, 'month', 'views_num', 'report_viewed_product_aggregated_daily', 'report_viewed_product_aggregated_monthly')->willReturnSelf();
     $this->helperMock->expects($this->at(2))->method('updateReportRatingPos')->with($this->connectionMock, 'year', 'views_num', 'report_viewed_product_aggregated_daily', 'report_viewed_product_aggregated_yearly')->willReturnSelf();
     $this->flagMock->expects($this->once())->method('unsetData')->willReturnSelf();
     $this->flagMock->expects($this->once())->method('loadSelf')->willReturnSelf();
     $this->flagMock->expects($this->never())->method('setFlagData')->willReturnSelf();
     $this->flagMock->expects($this->once())->method('setLastUpdate')->willReturnSelf();
     $this->flagMock->expects($this->once())->method('save')->willReturnSelf();
     $this->flagMock->expects($this->once())->method('setReportFlagCode')->with(\Magento\Reports\Model\Flag::REPORT_PRODUCT_VIEWED_FLAG_CODE)->willReturnSelf();
     $this->viewed->aggregate($from, $to);
 }