Skip to content

Commit 670cb56

Browse files
author
Oleksii Korshenko
committed
Merge remote-tracking branch 'origin/MAGETWO-64266-PR-8419' into develop-prs
2 parents 1fbf992 + 6f1b5c6 commit 670cb56

File tree

5 files changed

+31
-24
lines changed

5 files changed

+31
-24
lines changed

app/code/Magento/Backup/Controller/Adminhtml/Index/Grid.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,17 @@
66
*/
77
namespace Magento\Backup\Controller\Adminhtml\Index;
88

9+
use Magento\Framework\Controller\ResultFactory;
10+
911
class Grid extends \Magento\Backup\Controller\Adminhtml\Index
1012
{
1113
/**
1214
* Backup list action
1315
*
14-
* @return void
16+
* @return \Magento\Framework\Controller\ResultInterface
1517
*/
1618
public function execute()
1719
{
18-
$this->_view->loadLayout();
19-
$this->_view->renderLayout();
20+
return $this->resultFactory->create(ResultFactory::TYPE_PAGE);
2021
}
2122
}

app/code/Magento/CatalogSearch/Controller/Advanced/Index.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@
66
*/
77
namespace Magento\CatalogSearch\Controller\Advanced;
88

9+
use Magento\Framework\Controller\ResultFactory;
10+
911
class Index extends \Magento\Framework\App\Action\Action
1012
{
1113
/**
12-
* @return void
14+
* @return \Magento\Framework\Controller\ResultInterface
1315
*/
1416
public function execute()
1517
{
16-
$this->_view->loadLayout();
17-
$this->_view->renderLayout();
18+
return $this->resultFactory->create(ResultFactory::TYPE_PAGE);
1819
}
1920
}

app/code/Magento/Contact/Controller/Index/Index.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,17 @@
66
*/
77
namespace Magento\Contact\Controller\Index;
88

9+
use Magento\Framework\Controller\ResultFactory;
10+
911
class Index extends \Magento\Contact\Controller\Index
1012
{
1113
/**
1214
* Show Contact Us page
1315
*
14-
* @return void
16+
* @return \Magento\Framework\Controller\ResultInterface
1517
*/
1618
public function execute()
1719
{
18-
$this->_view->loadLayout();
19-
$this->_view->renderLayout();
20+
return $this->resultFactory->create(ResultFactory::TYPE_PAGE);
2021
}
2122
}

app/code/Magento/Contact/Test/Unit/Controller/Index/IndexTest.php

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
namespace Magento\Contact\Test\Unit\Controller\Index;
88

9+
use Magento\Framework\Controller\ResultFactory;
10+
use Magento\Framework\Controller\ResultInterface;
11+
912
class IndexTest extends \PHPUnit_Framework_TestCase
1013
{
1114
/**
@@ -25,7 +28,7 @@ class IndexTest extends \PHPUnit_Framework_TestCase
2528
* View mock
2629
* @var \Magento\Framework\App\ViewInterface|\PHPUnit_Framework_MockObject_MockObject
2730
*/
28-
protected $_view;
31+
protected $resultFactory;
2932

3033
/**
3134
* Url mock
@@ -43,7 +46,7 @@ protected function setUp()
4346
);
4447
$context = $this->getMock(
4548
\Magento\Framework\App\Action\Context::class,
46-
['getRequest', 'getResponse', 'getView', 'getUrl'],
49+
['getRequest', 'getResponse', 'getResultFactory', 'getUrl'],
4750
[],
4851
'',
4952
false
@@ -67,17 +70,17 @@ protected function setUp()
6770
$this->getMockForAbstractClass(\Magento\Framework\App\ResponseInterface::class, [], '', false)
6871
));
6972

70-
$this->_view = $this->getMock(
71-
\Magento\Framework\App\ViewInterface::class,
73+
$this->resultFactory = $this->getMock(
74+
ResultFactory::class,
7275
[],
7376
[],
7477
'',
7578
false
7679
);
7780

7881
$context->expects($this->once())
79-
->method('getView')
80-
->will($this->returnValue($this->_view));
82+
->method('getResultFactory')
83+
->will($this->returnValue($this->resultFactory));
8184

8285
$this->_controller = new \Magento\Contact\Controller\Index\Index(
8386
$context,
@@ -90,12 +93,12 @@ protected function setUp()
9093

9194
public function testExecute()
9295
{
93-
$this->_view->expects($this->once())
94-
->method('loadLayout');
95-
96-
$this->_view->expects($this->once())
97-
->method('renderLayout');
96+
$resultStub = $this->getMockForAbstractClass(ResultInterface::class);
97+
$this->resultFactory->expects($this->once())
98+
->method('create')
99+
->with(ResultFactory::TYPE_PAGE)
100+
->willReturn($resultStub);
98101

99-
$this->_controller->execute();
102+
$this->assertSame($resultStub, $this->_controller->execute());
100103
}
101104
}

app/code/Magento/User/Controller/Adminhtml/User/Role/Editrolegrid.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,17 @@
66
*/
77
namespace Magento\User\Controller\Adminhtml\User\Role;
88

9+
use Magento\Framework\Controller\ResultFactory;
10+
911
class Editrolegrid extends \Magento\User\Controller\Adminhtml\User\Role
1012
{
1113
/**
1214
* Action for ajax request from assigned users grid
1315
*
14-
* @return void
16+
* @return \Magento\Framework\Controller\ResultInterface
1517
*/
1618
public function execute()
1719
{
18-
$this->_view->loadLayout();
19-
$this->_view->renderLayout();
20+
return $this->resultFactory->create(ResultFactory::TYPE_PAGE);
2021
}
2122
}

0 commit comments

Comments
 (0)