diff --git a/app/code/Magento/Backup/Controller/Adminhtml/Index/Grid.php b/app/code/Magento/Backup/Controller/Adminhtml/Index/Grid.php index e6a30b0300874..02c6d280f6f5f 100644 --- a/app/code/Magento/Backup/Controller/Adminhtml/Index/Grid.php +++ b/app/code/Magento/Backup/Controller/Adminhtml/Index/Grid.php @@ -6,16 +6,17 @@ */ namespace Magento\Backup\Controller\Adminhtml\Index; +use Magento\Framework\Controller\ResultFactory; + class Grid extends \Magento\Backup\Controller\Adminhtml\Index { /** * Backup list action * - * @return void + * @return \Magento\Framework\Controller\ResultInterface */ public function execute() { - $this->_view->loadLayout(); - $this->_view->renderLayout(); + return $this->resultFactory->create(ResultFactory::TYPE_PAGE); } } diff --git a/app/code/Magento/CatalogSearch/Controller/Advanced/Index.php b/app/code/Magento/CatalogSearch/Controller/Advanced/Index.php index 92ebc7625a0df..e9a81d964803a 100644 --- a/app/code/Magento/CatalogSearch/Controller/Advanced/Index.php +++ b/app/code/Magento/CatalogSearch/Controller/Advanced/Index.php @@ -6,14 +6,15 @@ */ namespace Magento\CatalogSearch\Controller\Advanced; +use Magento\Framework\Controller\ResultFactory; + class Index extends \Magento\Framework\App\Action\Action { /** - * @return void + * @return \Magento\Framework\Controller\ResultInterface */ public function execute() { - $this->_view->loadLayout(); - $this->_view->renderLayout(); + return $this->resultFactory->create(ResultFactory::TYPE_PAGE); } } diff --git a/app/code/Magento/Contact/Controller/Index/Index.php b/app/code/Magento/Contact/Controller/Index/Index.php index bed5611bbe7a4..78e996b28bd0f 100644 --- a/app/code/Magento/Contact/Controller/Index/Index.php +++ b/app/code/Magento/Contact/Controller/Index/Index.php @@ -6,16 +6,17 @@ */ namespace Magento\Contact\Controller\Index; +use Magento\Framework\Controller\ResultFactory; + class Index extends \Magento\Contact\Controller\Index { /** * Show Contact Us page * - * @return void + * @return \Magento\Framework\Controller\ResultInterface */ public function execute() { - $this->_view->loadLayout(); - $this->_view->renderLayout(); + return $this->resultFactory->create(ResultFactory::TYPE_PAGE); } } diff --git a/app/code/Magento/Contact/Test/Unit/Controller/Index/IndexTest.php b/app/code/Magento/Contact/Test/Unit/Controller/Index/IndexTest.php index 5b4071eb4106e..1b50c424773bb 100644 --- a/app/code/Magento/Contact/Test/Unit/Controller/Index/IndexTest.php +++ b/app/code/Magento/Contact/Test/Unit/Controller/Index/IndexTest.php @@ -6,6 +6,9 @@ namespace Magento\Contact\Test\Unit\Controller\Index; +use Magento\Framework\Controller\ResultFactory; +use Magento\Framework\Controller\ResultInterface; + class IndexTest extends \PHPUnit_Framework_TestCase { /** @@ -25,7 +28,7 @@ class IndexTest extends \PHPUnit_Framework_TestCase * View mock * @var \Magento\Framework\App\ViewInterface|\PHPUnit_Framework_MockObject_MockObject */ - protected $_view; + protected $resultFactory; /** * Url mock @@ -43,7 +46,7 @@ protected function setUp() ); $context = $this->getMock( \Magento\Framework\App\Action\Context::class, - ['getRequest', 'getResponse', 'getView', 'getUrl'], + ['getRequest', 'getResponse', 'getResultFactory', 'getUrl'], [], '', false @@ -67,8 +70,8 @@ protected function setUp() $this->getMockForAbstractClass(\Magento\Framework\App\ResponseInterface::class, [], '', false) )); - $this->_view = $this->getMock( - \Magento\Framework\App\ViewInterface::class, + $this->resultFactory = $this->getMock( + ResultFactory::class, [], [], '', @@ -76,8 +79,8 @@ protected function setUp() ); $context->expects($this->once()) - ->method('getView') - ->will($this->returnValue($this->_view)); + ->method('getResultFactory') + ->will($this->returnValue($this->resultFactory)); $this->_controller = new \Magento\Contact\Controller\Index\Index( $context, @@ -90,12 +93,12 @@ protected function setUp() public function testExecute() { - $this->_view->expects($this->once()) - ->method('loadLayout'); - - $this->_view->expects($this->once()) - ->method('renderLayout'); + $resultStub = $this->getMockForAbstractClass(ResultInterface::class); + $this->resultFactory->expects($this->once()) + ->method('create') + ->with(ResultFactory::TYPE_PAGE) + ->willReturn($resultStub); - $this->_controller->execute(); + $this->assertSame($resultStub, $this->_controller->execute()); } } diff --git a/app/code/Magento/User/Controller/Adminhtml/User/Role/Editrolegrid.php b/app/code/Magento/User/Controller/Adminhtml/User/Role/Editrolegrid.php index 0f56e7c69507e..9a1708afcf566 100644 --- a/app/code/Magento/User/Controller/Adminhtml/User/Role/Editrolegrid.php +++ b/app/code/Magento/User/Controller/Adminhtml/User/Role/Editrolegrid.php @@ -6,16 +6,17 @@ */ namespace Magento\User\Controller\Adminhtml\User\Role; +use Magento\Framework\Controller\ResultFactory; + class Editrolegrid extends \Magento\User\Controller\Adminhtml\User\Role { /** * Action for ajax request from assigned users grid * - * @return void + * @return \Magento\Framework\Controller\ResultInterface */ public function execute() { - $this->_view->loadLayout(); - $this->_view->renderLayout(); + return $this->resultFactory->create(ResultFactory::TYPE_PAGE); } }