/**
  * Reports counts info to New Relic
  *
  * @return void
  */
 protected function reportCounts()
 {
     $this->addCustomParameters([Config::PRODUCT_COUNT => $this->counter->getAllProductsCount(), Config::CONFIGURABLE_COUNT => $this->counter->getConfigurableCount(), Config::ACTIVE_COUNT => $this->counter->getActiveCatalogSize(), Config::CATEGORY_COUNT => $this->counter->getCategoryCount(), Config::WEBSITE_COUNT => $this->counter->getWebsiteCount(), Config::STORE_VIEW_COUNT => $this->counter->getStoreViewsCount(), Config::CUSTOMER_COUNT => $this->counter->getCustomerCount()]);
     if (!empty($this->customParameters)) {
         try {
             $this->cronEventFactory->create()->addData($this->customParameters)->sendRequest();
         } catch (\Exception $e) {
             $this->logger->critical(sprintf("New Relic Cron Event exception: %s\n%s", $e->getMessage(), $e->getTraceAsString()));
         }
     }
 }
 /**
  * Test case when module is enabled and request is failed
  *
  * @return void
  */
 public function testReportNewRelicCronRequestFailed()
 {
     $testModuleData = ['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']], 'enabled' => 1, 'disabled' => 1, 'installed' => 1];
     $this->config->expects($this->once())->method('isNewRelicEnabled')->willReturn(true);
     $this->collect->expects($this->once())->method('getModuleData')->willReturn($testModuleData);
     $this->counter->expects($this->once())->method('getAllProductsCount');
     $this->counter->expects($this->once())->method('getConfigurableCount');
     $this->counter->expects($this->once())->method('getActiveCatalogSize');
     $this->counter->expects($this->once())->method('getCategoryCount');
     $this->counter->expects($this->once())->method('getWebsiteCount');
     $this->counter->expects($this->once())->method('getStoreViewsCount');
     $this->counter->expects($this->once())->method('getCustomerCount');
     $this->cronEventModel->expects($this->once())->method('addData')->willReturnSelf();
     $this->cronEventModel->expects($this->once())->method('sendRequest');
     $this->cronEventModel->expects($this->once())->method('sendRequest')->willThrowException(new \Exception());
     $this->logger->expects($this->once())->method('critical');
     $this->deploymentsModel->expects($this->any())->method('setDeployment');
     $this->assertSame($this->model, $this->model->report());
 }
 /**
  * Tests stores count will return int
  *
  * @return void
  */
 public function testGetStoreViewsCount()
 {
     $this->storeManagement->expects($this->once())->method('getCount')->willReturn(1);
     $this->assertInternalType('int', $this->model->getStoreViewsCount());
 }