Skip to content

Commit 7663193

Browse files
author
Yuri Kovsher
committed
MAGETWO-36101: Refactor controllers in the Wishlist module
1 parent 4ee4ccf commit 7663193

File tree

4 files changed

+14
-0
lines changed

4 files changed

+14
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public function execute()
4242
}
4343
/** @var \Magento\Framework\View\Result\Page resultPage */
4444
$resultPage = $this->resultFactory->create(ResultFactory::TYPE_PAGE);
45+
$resultPage->getLayout()->initMessages();
4546
return $resultPage;
4647
}
4748
}

app/code/Magento/Wishlist/Controller/Index/Share.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public function execute()
2020
{
2121
/** @var \Magento\Framework\View\Result\Page $resultPage */
2222
$resultPage = $this->resultFactory->create(ResultFactory::TYPE_PAGE);
23+
$resultPage->getLayout()->initMessages();
2324
return $resultPage;
2425
}
2526
}

app/code/Magento/Wishlist/Controller/Shared/Index.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ public function execute()
6868
$this->registry->register('shared_wishlist', $wishlist);
6969
/** @var \Magento\Framework\View\Result\Page $resultPage */
7070
$resultPage = $this->resultFactory->create(ResultFactory::TYPE_PAGE);
71+
$resultPage->getLayout()->initMessages();
7172
return $resultPage;
7273
}
7374
}

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ class IndexTest extends \PHPUnit_Framework_TestCase
4444
*/
4545
protected $resultPageMock;
4646

47+
/**
48+
* @var \Magento\Framework\View\Layout
49+
*/
50+
protected $layoutMock;
51+
4752
protected function setUp()
4853
{
4954
$this->context = $this->getMock('Magento\Framework\App\Action\Context', [], [], '', false);
@@ -57,11 +62,17 @@ protected function setUp()
5762
$this->resultPageMock = $this->getMockBuilder('Magento\Framework\View\Result\Page')
5863
->disableOriginalConstructor()
5964
->getMock();
65+
$this->layoutMock = $this->getMockBuilder('Magento\Framework\View\Layout')
66+
->disableOriginalConstructor()
67+
->getMock();
6068

6169
$this->resultFactoryMock->expects($this->any())
6270
->method('create')
6371
->with(ResultFactory::TYPE_PAGE, [])
6472
->willReturn($this->resultPageMock);
73+
$this->resultPageMock->expects($this->any())
74+
->method('getLayout')
75+
->willReturn($this->layoutMock);
6576
}
6677

6778
protected function prepareContext()

0 commit comments

Comments
 (0)