changeDetectorMock = $this->getMockBuilder(ChangeDetector::class) ->disableOriginalConstructor() ->getMock(); $this->frontControllerMock = $this->getMockBuilder(FrontControllerInterface::class) ->getMockForAbstractClass(); $this->requestMock = $this->getMockBuilder(RequestInterface::class) ->getMockForAbstractClass(); $this->configChangeDetectorPlugin = new ConfigChangeDetector($this->changeDetectorMock); } /** * @return void */ public function testBeforeDispatchWithoutException() { $this->changeDetectorMock->expects($this->once()) ->method('hasChanges') ->willReturn(false); $this->configChangeDetectorPlugin->beforeDispatch($this->frontControllerMock, $this->requestMock); } /** * @return void * @expectedException \Magento\Framework\Exception\LocalizedException * @codingStandardsIgnoreStart * @expectedExceptionMessage The configuration file has changed. Run the "app:config:import" or the "setup:upgrade" command to synchronize the configuration. * @codingStandardsIgnoreEnd */ public function testBeforeDispatchWithException() { $this->changeDetectorMock->expects($this->once()) ->method('hasChanges') ->willReturn(true); $this->configChangeDetectorPlugin->beforeDispatch($this->frontControllerMock, $this->requestMock); } }