47 $this->config = $this->getMockBuilder(\
Magento\NewRelicReporting\Model\Config::class)
48 ->disableOriginalConstructor()
49 ->setMethods([
'isNewRelicEnabled'])
51 $this->systemFactory = $this->getMockBuilder(\
Magento\NewRelicReporting\Model\SystemFactory::class)
52 ->disableOriginalConstructor()
53 ->setMethods([
'create'])
55 $this->systemModel = $this->getMockBuilder(\
Magento\NewRelicReporting\Model\System::class)
56 ->disableOriginalConstructor()
58 $this->jsonEncoder = $this->getMockBuilder(\
Magento\Framework\Json\EncoderInterface::class)
60 $this->systemFactory->expects($this->any())
62 ->willReturn($this->systemModel);
76 public function testReportSystemCacheFlushModuleDisabledFromConfig()
79 $eventObserver = $this->getMockBuilder(\
Magento\Framework\Event\Observer::class)
80 ->disableOriginalConstructor()
83 $this->config->expects($this->once())
84 ->method(
'isNewRelicEnabled')
87 $this->model->execute($eventObserver);
95 public function testReportSystemCacheFlush()
97 $testType =
'systemCacheFlush';
98 $testAction =
'JSON string';
101 $eventObserver = $this->getMockBuilder(\
Magento\Framework\Event\Observer::class)
102 ->disableOriginalConstructor()
105 $this->config->expects($this->once())
106 ->method(
'isNewRelicEnabled')
108 $this->jsonEncoder->expects($this->once())
110 ->willReturn($testAction);
111 $this->systemModel->expects($this->once())
113 ->with([
'type' => $testType,
'action' => $testAction])
115 $this->systemModel->expects($this->once())
118 $this->model->execute($eventObserver);