67 $this->contextMock = $this->createPartialMock(\
Magento\Backend\
App\Action\Context::class, [
75 'getFormKeyValidator',
84 $this->response = $this->createPartialMock(
85 \
Magento\Framework\
App\ResponseInterface::class,
86 [
'setRedirect',
'sendResponse']
89 $this->request = $this->getMockForAbstractClass(
90 \
Magento\Framework\
App\RequestInterface::class,
91 [
'getParam',
'getRequest'],
96 $this->view = $this->createPartialMock(\
Magento\Framework\
App\ViewInterface::class, [
103 'getDefaultLayoutHandle',
105 'addPageLayoutHandles',
106 'generateLayoutBlocks',
108 'addActionLayoutHandles',
113 $this->block = $this->createPartialMock(
114 \
Magento\Framework\View\Element\AbstractBlock::class,
115 [
'setActive',
'getMenuModel']
118 $this->layout = $this->getMockForAbstractClass(
119 \
Magento\Framework\View\LayoutInterface::class,
125 $this->menu = $this->createPartialMock(\
Magento\Backend\Model\Menu::class, [
'getParentItems']);
127 $this->items = $this->createPartialMock(\
Magento\Backend\Model\Menu\Item::class, [
'getParentItems']);
129 $this->contextMock->expects($this->any())->method(
"getRequest")->willReturn($this->request);
130 $this->contextMock->expects($this->any())->method(
"getResponse")->willReturn($this->response);
131 $this->contextMock->expects($this->any())->method(
'getView')->will($this->returnValue($this->view));
133 $this->page = $this->createPartialMock(\
Magento\Framework\View\Result\Page::class, [
'getConfig']);
134 $this->config = $this->createPartialMock(\
Magento\Framework\View\Result\Page::class, [
'getTitle']);
135 $this->title = $this->getMockBuilder(
'Title')
136 ->setMethods([
'prepend'])
139 $this->block->expects($this->any())->method(
'setActive')->will($this->returnValue(1));
140 $this->view->expects($this->any())->method(
'getLayout')->will($this->returnValue($this->layout));
141 $this->layout->expects($this->any())->method(
'getBlock')->with(
'menu')->will($this->returnValue($this->block));
142 $this->block->expects($this->any())->method(
'getMenuModel')->will($this->returnValue($this->menu));
143 $this->menu->expects($this->any())->method(
'getParentItems')->will($this->returnValue($this->items));
145 $this->
object = new \Magento\Indexer\Controller\Adminhtml\Indexer\ListAction($this->contextMock);
150 $this->view->expects($this->any())
151 ->method(
'loadLayout')
152 ->will($this->returnValue(1));
154 $this->view->expects($this->any())
156 ->will($this->returnValue($this->page));
158 $this->page->expects($this->any())
159 ->method(
'getConfig')
160 ->will($this->returnValue($this->config));
162 $this->config->expects($this->any())
164 ->will($this->returnValue($this->title));
166 $this->title->expects($this->any())
167 ->method(
'prepend')->with(
__(
'Index Management'))
168 ->will($this->returnValue(1));
170 $this->view->expects($this->any())
171 ->method(
'renderLayout')
172 ->will($this->returnValue(1));
174 $result = $this->
object->execute();