Example #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());
 }
 /**
  * Test case when module is enabled
  *
  * @return void
  */
 public function testReportReportModulesInfo()
 {
     $this->config->expects($this->once())->method('isNewRelicEnabled')->willReturn(true);
     $this->collectMock->expects($this->once())->method('getModuleData')->willReturn(['installed' => '1', 'uninstalled' => '1', 'enabled' => '1', 'disabled' => '1', 'changes' => [['name' => 'name', 'setup_version' => '2.0.0', 'type' => 'enabled'], ['name' => 'name', 'setup_version' => '2.0.0', 'type' => 'disabled'], ['name' => 'name', 'setup_version' => '2.0.0', 'type' => 'installed'], ['name' => 'name', 'setup_version' => '2.0.0', 'type' => 'uninstalled']]]);
     $this->systemModelMock->expects($this->any())->method('setData')->willReturnSelf();
     $this->systemModelMock->expects($this->any())->method('save')->willReturnSelf();
     $this->assertSame($this->model, $this->model->report());
 }
Example #3
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;
 }