Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ConfigChangeDetectorTest.php
Go to the documentation of this file.
1 <?php
8 
13 
14 class ConfigChangeDetectorTest extends \PHPUnit\Framework\TestCase
15 {
19  private $configChangeDetectorPlugin;
20 
24  private $changeDetectorMock;
25 
29  private $frontControllerMock;
30 
34  private $requestMock;
35 
39  protected function setUp()
40  {
41  $this->changeDetectorMock = $this->getMockBuilder(ChangeDetector::class)
42  ->disableOriginalConstructor()
43  ->getMock();
44  $this->frontControllerMock = $this->getMockBuilder(FrontControllerInterface::class)
45  ->getMockForAbstractClass();
46  $this->requestMock = $this->getMockBuilder(RequestInterface::class)
47  ->getMockForAbstractClass();
48 
49  $this->configChangeDetectorPlugin = new ConfigChangeDetector($this->changeDetectorMock);
50  }
51 
56  {
57  $this->changeDetectorMock->expects($this->once())
58  ->method('hasChanges')
59  ->willReturn(false);
60  $this->configChangeDetectorPlugin->beforeDispatch($this->frontControllerMock, $this->requestMock);
61  }
62 
71  {
72  $this->changeDetectorMock->expects($this->once())
73  ->method('hasChanges')
74  ->willReturn(true);
75  $this->configChangeDetectorPlugin->beforeDispatch($this->frontControllerMock, $this->requestMock);
76  }
77 }