@@ -30,21 +30,11 @@ class AddCommentTest extends \PHPUnit_Framework_TestCase
3030 */
3131 protected $ responseMock ;
3232
33- /**
34- * @var \Magento\Framework\View\Page\Title|\PHPUnit_Framework_MockObject_MockObject
35- */
36- protected $ titleMock ;
37-
3833 /**
3934 * @var \PHPUnit_Framework_MockObject_MockObject
4035 */
4136 protected $ resultPageMock ;
4237
43- /**
44- * @var \PHPUnit_Framework_MockObject_MockObject
45- */
46- protected $ pageConfigMock ;
47-
4838 /**
4939 * @var \Magento\Sales\Model\Order\Shipment|\PHPUnit_Framework_MockObject_MockObject
5040 */
@@ -60,11 +50,6 @@ class AddCommentTest extends \PHPUnit_Framework_TestCase
6050 */
6151 protected $ resultLayoutFactoryMock ;
6252
63- /**
64- * @var \Magento\Framework\View\Result\Layout|\PHPUnit_Framework_MockObject_MockObject
65- */
66- protected $ resultLayoutMock ;
67-
6853 /**
6954 * @var \Magento\Framework\ObjectManagerInterface|\PHPUnit_Framework_MockObject_MockObject
7055 */
@@ -105,13 +90,6 @@ protected function setUp()
10590 '' ,
10691 false
10792 );
108- $ this ->titleMock = $ this ->getMock (
109- 'Magento\Framework\View\Page\Title ' ,
110- ['prepend ' , '__wakeup ' ],
111- [],
112- '' ,
113- false
114- );
11593 $ this ->resultLayoutFactoryMock = $ this ->getMock (
11694 'Magento\Framework\View\Result\LayoutFactory ' ,
11795 ['create ' ],
@@ -123,9 +101,6 @@ protected function setUp()
123101 $ this ->resultPageMock = $ this ->getMockBuilder ('Magento\Framework\View\Result\Page ' )
124102 ->disableOriginalConstructor ()
125103 ->getMock ();
126- $ this ->pageConfigMock = $ this ->getMockBuilder ('Magento\Framework\View\Page\Config ' )
127- ->disableOriginalConstructor ()
128- ->getMock ();
129104
130105 $ this ->shipmentMock = $ this ->getMock (
131106 'Magento\Sales\Model\Order\Shipment ' ,
@@ -153,15 +128,9 @@ protected function setUp()
153128 $ this ->viewInterfaceMock ->expects ($ this ->any ())->method ('getPage ' )->will (
154129 $ this ->returnValue ($ this ->resultPageMock )
155130 );
156- $ this ->resultPageMock ->expects ($ this ->any ())->method ('getConfig ' )->will (
157- $ this ->returnValue ($ this ->pageConfigMock )
158- );
159-
160- $ this ->pageConfigMock ->expects ($ this ->any ())->method ('getTitle ' )->will ($ this ->returnValue ($ this ->titleMock ));
161131
162132 $ contextMock ->expects ($ this ->any ())->method ('getRequest ' )->will ($ this ->returnValue ($ this ->requestMock ));
163133 $ contextMock ->expects ($ this ->any ())->method ('getResponse ' )->will ($ this ->returnValue ($ this ->responseMock ));
164- $ contextMock ->expects ($ this ->any ())->method ('getTitle ' )->will ($ this ->returnValue ($ this ->titleMock ));
165134 $ contextMock ->expects ($ this ->any ())->method ('getView ' )->will ($ this ->returnValue ($ this ->viewInterfaceMock ));
166135 $ contextMock ->expects ($ this ->any ())
167136 ->method ('getObjectManager ' )
@@ -207,7 +176,7 @@ public function testExecute()
207176 $ shipment = [];
208177 $ tracking = [];
209178
210- $ this -> resultLayoutMock = $ this ->getMock (
179+ $ resultLayoutMock = $ this ->getMock (
211180 'Magento\Framework\View\Result\Layout ' ,
212181 ['getBlock ' , 'getDefaultLayoutHandle ' , 'addDefaultHandle ' , 'getLayout ' ],
213182 [],
@@ -247,9 +216,9 @@ public function testExecute()
247216 $ blockMock = $ this ->getMock ('Magento\Shipping\Block\Adminhtml\View\Comments ' , ['toHtml ' ], [], '' , false );
248217 $ blockMock ->expects ($ this ->once ())->method ('toHtml ' )->willReturn ($ result );
249218 $ layoutMock ->expects ($ this ->once ())->method ('getBlock ' )->with ('shipment_comments ' )->willReturn ($ blockMock );
250- $ this -> resultLayoutMock ->expects ($ this ->once ())->method ('getLayout ' )->willReturn ($ layoutMock );
251- $ this -> resultLayoutMock ->expects ($ this ->once ())->method ('addDefaultHandle ' );
252- $ this ->resultLayoutFactoryMock ->expects ($ this ->once ())->method ('create ' )->will ($ this ->returnValue ($ this -> resultLayoutMock ));
219+ $ resultLayoutMock ->expects ($ this ->once ())->method ('getLayout ' )->willReturn ($ layoutMock );
220+ $ resultLayoutMock ->expects ($ this ->once ())->method ('addDefaultHandle ' );
221+ $ this ->resultLayoutFactoryMock ->expects ($ this ->once ())->method ('create ' )->will ($ this ->returnValue ($ resultLayoutMock ));
253222 $ this ->responseMock ->expects ($ this ->once ())->method ('setBody ' )->with ($ result );
254223
255224 $ this ->assertNull ($ this ->controller ->execute ());
0 commit comments