@@ -79,21 +79,7 @@ protected function setUp()
79
79
{
80
80
$ this ->objectManager = new \Magento \Framework \TestFramework \Unit \Helper \ObjectManager ($ this );
81
81
82
- $ this ->contextMock = $ this ->getMock (
83
- 'Magento\Backend\App\Action\Context ' ,
84
- [
85
- 'getTitle ' ,
86
- 'getRequest ' ,
87
- 'getObjectManager ' ,
88
- 'getEventManager ' ,
89
- 'getResponse ' ,
90
- 'getMessageManager ' ,
91
- 'getResultRedirectFactory '
92
- ],
93
- [],
94
- '' ,
95
- false
96
- );
82
+ $ this ->contextMock = $ this ->getMock ('Magento\Backend\App\Action\Context ' , [], [], '' , false );
97
83
98
84
$ this ->resultRedirectFactory = $ this ->getMockBuilder ('Magento\Backend\Model\View\Result\RedirectFactory ' )
99
85
->disableOriginalConstructor ()
@@ -132,12 +118,7 @@ protected function setUp()
132
118
['getParam ' , 'getPostValue ' ]
133
119
);
134
120
135
- $ this ->blockMock = $ this ->getMockBuilder ('Magento\Cms\Model\Block ' )
136
- ->disableOriginalConstructor ()
137
- ->setMethods (
138
- ['load ' , 'getId ' , 'setData ' , 'save ' ]
139
- )
140
- ->getMock ();
121
+ $ this ->blockMock = $ this ->getMockBuilder ('Magento\Cms\Model\Block ' )->disableOriginalConstructor ()->getMock ();
141
122
142
123
$ this ->messageManagerMock = $ this ->getMock ('Magento\Framework\Message\ManagerInterface ' , [], [], '' , false );
143
124
@@ -191,7 +172,10 @@ public function testSaveAction()
191
172
'content ' => '"><script>alert("cookie: "+document.cookie)</script> '
192
173
];
193
174
194
- $ this ->dataProcessorMock ->expects ($ this ->any ())->method ('filter ' )->willReturn ($ filteredPostData );
175
+ $ this ->dataProcessorMock ->expects ($ this ->any ())
176
+ ->method ('filter ' )
177
+ ->with ($ postData )
178
+ ->willReturn ($ filteredPostData );
195
179
196
180
$ this ->requestMock ->expects ($ this ->any ())->method ('getPostValue ' )->willReturn ($ postData );
197
181
$ this ->requestMock ->expects ($ this ->atLeastOnce ())
@@ -232,16 +216,14 @@ public function testSaveAction()
232
216
233
217
$ this ->resultRedirect ->expects ($ this ->atLeastOnce ())->method ('setPath ' )->with ('*/*/ ' ) ->willReturnSelf ();
234
218
235
- $ this ->assertEquals ($ this ->resultRedirect , $ this ->saveController ->execute ());
219
+ $ this ->assertSame ($ this ->resultRedirect , $ this ->saveController ->execute ());
236
220
}
237
221
238
222
public function testSaveActionWithoutData ()
239
223
{
240
224
$ this ->requestMock ->expects ($ this ->any ())->method ('getPostValue ' )->willReturn (false );
241
-
242
225
$ this ->resultRedirect ->expects ($ this ->atLeastOnce ())->method ('setPath ' )->with ('*/*/ ' ) ->willReturnSelf ();
243
-
244
- $ this ->assertEquals ($ this ->resultRedirect , $ this ->saveController ->execute ());
226
+ $ this ->assertSame ($ this ->resultRedirect , $ this ->saveController ->execute ());
245
227
}
246
228
247
229
public function testSaveActionNoId ()
@@ -274,7 +256,7 @@ public function testSaveActionNoId()
274
256
275
257
$ this ->resultRedirect ->expects ($ this ->atLeastOnce ())->method ('setPath ' )->with ('*/*/ ' ) ->willReturnSelf ();
276
258
277
- $ this ->assertEquals ($ this ->resultRedirect , $ this ->saveController ->execute ());
259
+ $ this ->assertSame ($ this ->resultRedirect , $ this ->saveController ->execute ());
278
260
}
279
261
280
262
public function testSaveAndContinue ()
@@ -321,7 +303,7 @@ public function testSaveAndContinue()
321
303
->with ('*/*/edit ' , ['block_id ' => $ this ->blockId ])
322
304
->willReturnSelf ();
323
305
324
- $ this ->assertEquals ($ this ->resultRedirect , $ this ->saveController ->execute ());
306
+ $ this ->assertSame ($ this ->resultRedirect , $ this ->saveController ->execute ());
325
307
}
326
308
327
309
public function testSaveActionThrowsException ()
@@ -370,6 +352,6 @@ public function testSaveActionThrowsException()
370
352
->with ('*/*/edit ' , ['block_id ' => $ this ->blockId ])
371
353
->willReturnSelf ();
372
354
373
- $ this ->assertEquals ($ this ->resultRedirect , $ this ->saveController ->execute ());
355
+ $ this ->assertSame ($ this ->resultRedirect , $ this ->saveController ->execute ());
374
356
}
375
357
}
0 commit comments