30 private $objectManagerHelper;
50 private $frontControllerMock;
55 private $responseMock;
64 $this->configMock = $this->getMockBuilder(Config::class)
65 ->disableOriginalConstructor()
67 $this->versionMock = $this->getMockBuilder(Version::class)
68 ->disableOriginalConstructor()
70 $this->stateMock = $this->getMockBuilder(AppState::class)
71 ->disableOriginalConstructor()
73 $this->frontControllerMock = $this->getMockBuilder(FrontControllerInterface::class)
74 ->getMockForAbstractClass();
75 $this->responseMock = $this->getMockBuilder(ResponseHttp::class)
76 ->disableOriginalConstructor()
78 $this->resultMock = $this->getMockBuilder(ResultInterface::class)
79 ->getMockForAbstractClass();
81 $this->objectManagerHelper =
new ObjectManagerHelper($this);
82 $this->plugin = $this->objectManagerHelper->getObject(
85 'config' => $this->configMock,
86 'version' => $this->versionMock,
87 'state' => $this->stateMock
100 $this->configMock->expects(static::once())
101 ->method(
'isEnabled')
103 $this->configMock->expects(static::once())
106 $this->versionMock->expects(static::once())
108 $this->stateMock->expects(static::once())
110 ->willReturn($state);
111 $this->responseMock->expects(static::exactly($countHeader))
112 ->method(
'setHeader')
113 ->with(
'X-Magento-Debug');
117 $this->plugin->afterDispatch($this->frontControllerMock, $this->responseMock)
123 $this->configMock->expects(static::once())
124 ->method(
'isEnabled')
126 $this->configMock->expects(static::once())
129 $this->versionMock->expects(static::never())
131 $this->stateMock->expects(static::never())
133 $this->resultMock->expects(static::never())
134 ->method(
'setHeader');
138 $this->plugin->afterDispatch($this->frontControllerMock, $this->resultMock)
144 $this->configMock->expects(static::any())
147 $this->versionMock->expects(static::never())
149 $this->stateMock->expects(static::any())
151 ->willReturn(AppState::MODE_DEVELOPER);
152 $this->responseMock->expects(static::never())
153 ->method(
'setHeader');
157 $this->plugin->afterDispatch($this->frontControllerMock, $this->responseMock)
167 'developer_mode' => [AppState::MODE_DEVELOPER, 1],
168 'production' => [AppState::MODE_PRODUCTION, 0]
afterDispatchDataProvider()
testAfterDispatchReturnsCache($state, $countHeader)
testAfterDispatchDisabled()
testAfterDispatchNotResponse()