コード例 #1
0
 /**
  * Reports configurable product size to the database reporting_counts table
  *
  * @return void
  */
 protected function reportConfigurableProductsSize()
 {
     $configurableCount = $this->configurableManagement->getCount();
     /** @var \Magento\NewRelicReporting\Model\Counts $model */
     $model = $this->countsFactory->create()->load(Config::CONFIGURABLE_COUNT, 'type');
     $this->updateCount($configurableCount, $model, Config::CONFIGURABLE_COUNT);
 }
コード例 #2
0
 /**
  * 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());
 }
コード例 #3
0
ファイル: Counter.php プロジェクト: pradeep-wagento/magento2
 /**
  * Get count of configurable products
  *
  * @return int
  */
 public function getConfigurableCount()
 {
     $count = $this->configurableManagement->getCount();
     return (int) $count;
 }
コード例 #4
0
 /**
  * Tests all configurable products count will return int
  *
  * @return void
  */
 public function testGetConfigurableCount()
 {
     $this->configurableManagement->expects($this->once())->method('getCount')->willReturn(1);
     $this->assertInternalType('int', $this->model->getConfigurableCount());
 }