File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change @@ -244,4 +244,47 @@ public function testExecuteWithException(): void
244244
245245 $ this ->assertEquals ('json represented ' , $ this ->updateItemQty ->execute ());
246246 }
247+
248+ /**
249+ * @return void
250+ */
251+ public function testExecuteWithWrongRequestParams (): void
252+ {
253+ $ this ->requestMock
254+ ->method ('getParam ' )
255+ ->withConsecutive (['item_id ' ], ['item_qty ' ])
256+ ->willReturnOnConsecutiveCalls (0 , 'error ' );
257+
258+ $ this ->sidebarMock ->expects ($ this ->once ())
259+ ->method ('checkQuoteItem ' )
260+ ->with (0 )
261+ ->willThrowException (new LocalizedException (__ ('Error! ' )));
262+
263+ $ this ->sidebarMock ->expects ($ this ->once ())
264+ ->method ('getResponseData ' )
265+ ->with ('Error! ' )
266+ ->willReturn (
267+ [
268+ 'success ' => false ,
269+ 'error_message ' => 'Error! '
270+ ]
271+ );
272+
273+ $ this ->jsonHelperMock ->expects ($ this ->once ())
274+ ->method ('jsonEncode ' )
275+ ->with (
276+ [
277+ 'success ' => false ,
278+ 'error_message ' => 'Error! '
279+ ]
280+ )
281+ ->willReturn ('json encoded ' );
282+
283+ $ this ->responseMock ->expects ($ this ->once ())
284+ ->method ('representJson ' )
285+ ->with ('json encoded ' )
286+ ->willReturn ('json represented ' );
287+
288+ $ this ->assertEquals ('json represented ' , $ this ->updateItemQty ->execute ());
289+ }
247290}
You can’t perform that action at this time.
0 commit comments