Ejemplo n.º 1
0
 /**
  * Test case when cron is enabled in config
  *
  * @return \Magento\NewRelicReporting\Model\Cron
  */
 public function testRunCronCronEnabledFromConfig()
 {
     $this->configMock->expects($this->once())->method('isCronEnabled')->willReturn(true);
     $this->reportModulesInfoMock->expects($this->once())->method('report')->willReturnSelf();
     $this->reportCountsMock->expects($this->once())->method('report')->willReturnSelf();
     $this->reportNewRelicCronMock->expects($this->once())->method('report')->willReturnSelf();
     $this->assertSame($this->model, $this->model->runCron());
 }
Ejemplo n.º 2
0
 /**
  * The method run by the cron that fires all required events.
  * 
  * @return \Magento\NewRelicReporting\Model\Cron
  */
 public function runCron()
 {
     if ($this->config->isCronEnabled()) {
         $this->reportNewRelicCron->report();
         $this->reportModulesInfo->report();
         $this->reportCounts->report();
     }
     return $this;
 }
 /**
  * Test case when module is enabled
  *
  * @return void
  */
 public function testReportCountsTest()
 {
     $this->configMock->expects($this->once())->method('isNewRelicEnabled')->willReturn(true);
     $this->productManagementMock->expects($this->exactly(2))->method('getCount')->willReturn(2);
     $this->configurableManagementMock->expects($this->once())->method('getCount')->willReturn(2);
     $this->categoryManagementMock->expects($this->once())->method('getCount')->willReturn(2);
     $this->countsModelMock->expects($this->any())->method('getCount')->willReturn(1);
     $this->countsModelMock->expects($this->any())->method('setEntityId')->willReturnSelf();
     $this->countsModelMock->expects($this->any())->method('setType')->willReturnSelf();
     $this->countsModelMock->expects($this->any())->method('setCount')->willReturnSelf();
     $this->countsModelMock->expects($this->any())->method('setUpdatedAt')->willReturnSelf();
     $this->countsModelMock->expects($this->any())->method('save')->willReturnSelf();
     $this->assertSame($this->model, $this->model->report());
 }