/**
  * Setup
  *
  * @return void
  */
 public function setUp()
 {
     $this->config = $this->getMockBuilder('Magento\\NewRelicReporting\\Model\\Config')->disableOriginalConstructor()->setMethods(['isNewRelicEnabled'])->getMock();
     $this->collect = $this->getMockBuilder('Magento\\NewRelicReporting\\Model\\Module\\Collect')->disableOriginalConstructor()->setMethods(['getModuleData'])->getMock();
     $this->counter = $this->getMockBuilder('Magento\\NewRelicReporting\\Model\\Counter')->disableOriginalConstructor()->setMethods(['getAllProductsCount', 'getConfigurableCount', 'getActiveCatalogSize', 'getCategoryCount', 'getWebsiteCount', 'getStoreViewsCount', 'getCustomerCount'])->getMock();
     $this->cronEventFactory = $this->getMockBuilder('Magento\\NewRelicReporting\\Model\\CronEventFactory')->disableOriginalConstructor()->setMethods(['create'])->getMock();
     $this->cronEventModel = $this->getMockBuilder('Magento\\NewRelicReporting\\Model\\CronEvent')->disableOriginalConstructor()->setMethods(['addData', 'sendRequest'])->getMock();
     $this->deploymentsFactory = $this->getMockBuilder('Magento\\NewRelicReporting\\Model\\Apm\\DeploymentsFactory')->disableOriginalConstructor()->setMethods(['create'])->getMock();
     $this->deploymentsModel = $this->getMockBuilder('Magento\\NewRelicReporting\\Model\\Apm\\Deployments')->disableOriginalConstructor()->setMethods(['setDeployment'])->getMock();
     $this->logger = $this->getMockBuilder('Psr\\Log\\LoggerInterface')->getMock();
     $this->cronEventFactory->expects($this->any())->method('create')->willReturn($this->cronEventModel);
     $this->deploymentsFactory->expects($this->any())->method('create')->willReturn($this->deploymentsModel);
     $this->model = new ReportNewRelicCron($this->config, $this->collect, $this->counter, $this->cronEventFactory, $this->deploymentsFactory, $this->logger);
 }
 /**
  * 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()));
         }
     }
 }