210 $this->_viewMock = $this->getMockBuilder(\
Magento\Framework\
App\ViewInterface::class)
212 $this->_layoutMock = $this->getMockBuilder(\
Magento\Framework\View\LayoutInterface::class)
213 ->setMethods([
'getNode'])
214 ->getMockForAbstractClass();
215 $this->_layoutMergeMock = $this->getMockBuilder(
216 \
Magento\Framework\View\Model\Layout\Merge::class
217 )->disableOriginalConstructor()->getMock();
218 $this->_layoutMock->expects(
223 $this->returnValue($this->_layoutMergeMock)
225 $testElement = new \Magento\Framework\Simplexml\Element(
'<test>test</test>');
226 $this->_layoutMock->expects($this->any())->method(
'getNode')->will($this->returnValue($testElement));
228 $this->_viewMock->expects($this->any())->method(
'getLayout')->will($this->returnValue($this->_layoutMock));
229 $blockMock = $this->getMockBuilder(\
Magento\Backend\Block\Menu::class)->disableOriginalConstructor()->getMock();
230 $menuMock = $this->getMockBuilder(\
Magento\Backend\Model\Menu::class)
231 ->setConstructorArgs([$this->createMock(\Psr\Log\LoggerInterface::class)])
233 $loggerMock = $this->getMockBuilder(\Psr\Log\LoggerInterface::class)->getMock();
234 $loggerMock->expects($this->any())->method(
'critical')->will($this->returnSelf());
235 $menuMock->expects($this->any())->method(
'getParentItems')->will($this->returnValue([]));
236 $blockMock->expects($this->any())->method(
'getMenuModel')->will($this->returnValue($menuMock));
237 $this->_layoutMock->expects($this->any())->method(
'getMessagesBlock')->will($this->returnValue($blockMock));
238 $this->_layoutMock->expects($this->any())->method(
'getBlock')->will($this->returnValue($blockMock));
239 $this->_viewMock->expects($this->any())
241 ->willReturn($this->resultPageMock);
242 $this->resultPageMock->expects($this->any())
243 ->method(
'getConfig')
244 ->willReturn($this->viewConfigMock);
245 $this->viewConfigMock->expects($this->any())
247 ->willReturn($this->pageTitleMock);
249 $this->resultRedirectFactory = $this->getMockBuilder(\
Magento\Backend\Model\View\Result\RedirectFactory::class)
250 ->disableOriginalConstructor()
251 ->setMethods([
'create'])
254 $this->resultFactory = $this->getMockBuilder(\
Magento\Framework\Controller\ResultFactory::class)
255 ->disableOriginalConstructor()
256 ->setMethods([
'create'])
259 $this->_authMock->expects(
264 $this->returnValue($this->_userMock)
267 $this->_userMock->expects($this->any())
269 ->willReturn($this->_userMock);
271 $this->_backendSessionMock->expects($this->any())
272 ->method(
'getIntegrationData')
273 ->willReturn([
'all_resources' => 1]);
275 $contextParameters = [
289 $this->_backendActionCtxMock = $this->_objectManagerHelper->getObject(
294 $integrationCollection =
296 ->disableOriginalConstructor()
297 ->setMethods([
'addUnsecureUrlsFilter',
'getSize'])
299 $integrationCollection->expects($this->any())
300 ->method(
'addUnsecureUrlsFilter')
301 ->will($this->returnValue($integrationCollection));
302 $integrationCollection->expects($this->any())
304 ->will($this->returnValue(0));
306 $subControllerParams = [
311 'logger' => $loggerMock,
314 'integrationCollection' => $integrationCollection,
317 $controller = $this->_objectManagerHelper->getObject(
318 '\\Magento\\Integration\\Controller\\Adminhtml\\Integration\\' . $actionName,
321 if ($actionName ==
'Save') {
322 $reflection = new \ReflectionClass(get_class(
$controller));
323 $reflectionProperty = $reflection->getProperty(
'securityCookie');
324 $reflectionProperty->setAccessible(
true);
325 $reflectionProperty->setValue(
$controller, $this->securityCookieMock);