Skip to content

Commit 1bb6cf5

Browse files
author
Evgeniy Miskov
committed
MAGETWO-33059: Refactor CMS module
1 parent c265165 commit 1bb6cf5

File tree

6 files changed

+17
-38
lines changed

6 files changed

+17
-38
lines changed

app/code/Magento/Cms/Controller/Adminhtml/Block.php

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function __construct(\Magento\Backend\App\Action\Context $context, \Magen
3535
* @param \Magento\Backend\Model\View\Result\Page $resultPage
3636
* @return \Magento\Backend\Model\View\Result\Page
3737
*/
38-
protected function _initPage($resultPage)
38+
protected function initPage($resultPage)
3939
{
4040
$resultPage->setActiveMenu(
4141
'Magento_Cms::cms_block'
@@ -49,27 +49,6 @@ protected function _initPage($resultPage)
4949
return $resultPage;
5050
}
5151

52-
/**
53-
* Init actions
54-
*
55-
* @return $this
56-
*/
57-
protected function _initAction()
58-
{
59-
// load layout, set active menu and breadcrumbs
60-
$this->_view->loadLayout();
61-
$this->_setActiveMenu(
62-
'Magento_Cms::cms_block'
63-
)->_addBreadcrumb(
64-
__('CMS'),
65-
__('CMS')
66-
)->_addBreadcrumb(
67-
__('Static Blocks'),
68-
__('Static Blocks')
69-
);
70-
return $this;
71-
}
72-
7352
/**
7453
* Check the permission to run it
7554
*

app/code/Magento/Cms/Controller/Adminhtml/Block/Edit.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function execute()
7070
$resultPage = $this->resultPageFactory->create();
7171

7272
// 5. Build edit form
73-
$this->_initPage($resultPage)->addBreadcrumb(
73+
$this->initPage($resultPage)->addBreadcrumb(
7474
$id ? __('Edit Block') : __('New Block'),
7575
$id ? __('Edit Block') : __('New Block')
7676
);

app/code/Magento/Cms/Controller/Adminhtml/Block/Index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function execute()
3636
{
3737
/** @var \Magento\Backend\Model\View\Result\Page $resultPage */
3838
$resultPage = $this->resultPageFactory->create();
39-
$this->_initPage($resultPage)->getConfig()->getTitle()->prepend(__('Blocks'));
39+
$this->initPage($resultPage)->getConfig()->getTitle()->prepend(__('Blocks'));
4040
return $resultPage;
4141
}
4242
}

app/code/Magento/Cms/Controller/Index/DefaultNoCookies.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,31 @@
99
class DefaultNoCookies extends \Magento\Framework\App\Action\Action
1010
{
1111
/**
12-
* @var \Magento\Framework\View\Result\LayoutFactory
12+
* @var \Magento\Framework\View\Result\PageFactory
1313
*/
14-
protected $resultLayoutFactory;
14+
protected $resultPageFactory;
1515

1616
/**
17-
* @param \Magento\Backend\App\Action\Context $context
18-
* @param \Magento\Framework\View\Result\LayoutFactory $resultLayoutFactory
17+
* @param \Magento\Framework\App\Action\Context $context
18+
* @param \Magento\Framework\View\Result\PageFactory $resultPageFactory
1919
*/
2020
public function __construct(
21-
\Magento\Backend\App\Action\Context $context,
22-
\Magento\Framework\View\Result\LayoutFactory $resultLayoutFactory
21+
\Magento\Framework\App\Action\Context $context,
22+
\Magento\Framework\View\Result\PageFactory $resultPageFactory
2323
) {
24-
$this->resultLayoutFactory = $resultLayoutFactory;
24+
$this->resultPageFactory = $resultPageFactory;
2525
parent::__construct($context);
2626
}
2727

2828
/**
2929
* Default no cookies page action
3030
* Used if no cookies page don't configure or available
3131
*
32-
* @return \Magento\Framework\View\Result\LayoutFactory
32+
* @return \Magento\Framework\View\Result\PageFactory
3333
*/
3434
public function execute()
3535
{
36-
$resultLayout = $this->resultLayoutFactory->create();
37-
return $resultLayout;
36+
$resultPage = $this->resultPageFactory->create();
37+
return $resultPage;
3838
}
3939
}

dev/tests/unit/testsuite/Magento/Cms/Controller/Adminhtml/Wysiwyg/DirectiveTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ public function testExecute()
186186
->method('create')
187187
->willReturn($this->rawMock);
188188

189-
$this->wysiwygDirective->execute();
189+
$this->assertSame($this->rawMock, $this->wysiwygDirective->execute());
190190
}
191191

192192
/**
@@ -231,7 +231,7 @@ public function testExecuteException()
231231
->method('create')
232232
->willReturn($this->rawMock);
233233

234-
$this->wysiwygDirective->execute();
234+
$this->assertSame($this->rawMock, $this->wysiwygDirective->execute());
235235
}
236236

237237
protected function prepareExecuteTest()

dev/tests/unit/testsuite/Magento/Cms/Controller/Noroute/IndexTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ protected function setUp()
6262
$valueMap = [
6363
[
6464
'Magento\Framework\App\Config\ScopeConfigInterface',
65-
\Magento\Store\Model\ScopeInterface::SCOPE_STORE,
65+
\Magento\Framework\Store\ScopeInterface::SCOPE_STORE,
6666
$scopeConfigMock,
6767
],
6868
['Magento\Cms\Helper\Page', $this->_cmsHelperMock],
@@ -114,7 +114,7 @@ public function testExecuteResultPage()
114114
)->will(
115115
$this->returnValue($this->resultPageMock)
116116
);
117-
$this->assertInstanceOf('Magento\Framework\View\Result\Page', $this->_controller->execute());
117+
$this->assertSame($this->resultPageMock, $this->_controller->execute());
118118
}
119119

120120
public function testExecuteResultForward()

0 commit comments

Comments
 (0)