@@ -45,8 +45,7 @@ protected function setUp(): void
4545 'getIsVirtual ' ,
4646 'getIsNotVirtual ' ,
4747 'getStatus ' ,
48- 'getAllItems ' ,
49- 'isPartiallyRefundedOrderShipped '
48+ 'getAllItems '
5049 ]
5150 )
5251 ->disableOriginalConstructor ()
@@ -69,6 +68,7 @@ protected function setUp(): void
6968 * @param bool $isCanceled
7069 * @param bool $canUnhold
7170 * @param bool $isNotVirtual
71+ * @param bool $isPartiallyRefundedOrderShipped
7272 * @dataProvider stateCheckDataProvider
7373 * @SuppressWarnings(PHPMD.ExcessiveParameterList)
7474 */
@@ -107,18 +107,14 @@ public function testCheck(
107107 ->willReturn ($ isInProcess );
108108 $ this ->orderMock ->method ('getIsNotVirtual ' )
109109 ->willReturn ($ isNotVirtual );
110+ $ this ->orderMock ->method ('getAllItems ' )
111+ ->willReturn ([]);
110112 if (!$ isNotVirtual ) {
111113 $ this ->orderMock ->method ('getIsVirtual ' )
112114 ->willReturn (!$ isNotVirtual );
113115 $ this ->orderMock ->method ('getStatus ' )
114116 ->willReturn ($ expectedState );
115117 }
116-
117- $ this ->orderMock ->method ('getAllItems ' )
118- ->willReturn ([]);
119- $ this ->orderMock ->method ('isPartiallyRefundedOrderShipped ' )
120- ->willReturn ($ isPartiallyRefundedOrderShipped );
121-
122118 $ this ->state ->check ($ this ->orderMock );
123119 $ this ->assertEquals ($ expectedState , $ this ->orderMock ->getState ());
124120 }
@@ -200,7 +196,7 @@ public function stateCheckDataProvider()
200196 'is_canceled ' => false ,
201197 'can_unhold ' => false ,
202198 'is_not_virtual ' => true ,
203- 'isPartiallyRefundedOrderShipped ' => true
199+ 'isPartiallyRefundedOrderShipped ' => false
204200 ],
205201 'complete - canCreditmemo,!canShip -> complete ' => [
206202 'can_credit_memo ' => true ,
@@ -272,34 +268,6 @@ public function stateCheckDataProvider()
272268 'is_not_virtual ' => true ,
273269 'isPartiallyRefundedOrderShipped ' => false
274270 ],
275- 'processing - canCreditmemo, !canShip, isPartiallyRefundedOrderShipped -> complete ' => [
276- 'can_credit_memo ' => true ,
277- 'can_credit_memo_invoke_count ' => 1 ,
278- 'can_ship ' => false ,
279- 'call_can_skip_num ' => 1 ,
280- 'current_state ' => Order::STATE_PROCESSING ,
281- 'expected_state ' => Order::STATE_COMPLETE ,
282- 'is_in_process ' => true ,
283- 'get_is_in_process_invoke_count ' => 0 ,
284- 'is_canceled ' => false ,
285- 'can_unhold ' => false ,
286- 'is_not_virtual ' => true ,
287- 'isPartiallyRefundedOrderShipped ' => true
288- ],
289- 'processing - canCreditmemo, !canShip, !isPartiallyRefundedOrderShipped -> processing ' => [
290- 'can_credit_memo ' => true ,
291- 'can_credit_memo_invoke_count ' => 1 ,
292- 'can_ship ' => true ,
293- 'call_can_skip_num ' => 1 ,
294- 'current_state ' => Order::STATE_PROCESSING ,
295- 'expected_state ' => Order::STATE_PROCESSING ,
296- 'is_in_process ' => true ,
297- 'get_is_in_process_invoke_count ' => 0 ,
298- 'is_canceled ' => false ,
299- 'can_unhold ' => false ,
300- 'is_not_virtual ' => true ,
301- 'isPartiallyRefundedOrderShipped ' => false
302- ],
303271 'new - canCreditmemo, canShip, !IsInProcess -> new ' => [
304272 'can_credit_memo ' => true ,
305273 'can_credit_memo_invoke_count ' => 0 ,
@@ -370,21 +338,21 @@ public function stateCheckDataProvider()
370338 'is_not_virtual ' => true ,
371339 'isPartiallyRefundedOrderShipped ' => false
372340 ],
373- 'processing - !canCreditmemo !canShip -> complete(virtual product) ' => [
341+ 'processing - !canCreditmemo!canShip -> complete(virtual product) ' => [
374342 'can_credit_memo ' => false ,
375343 'can_credit_memo_invoke_count ' => 1 ,
376344 'can_ship ' => false ,
377- 'call_can_skip_num ' =>2 ,
345+ 'call_can_skip_num ' => 2 ,
378346 'current_state ' => Order::STATE_PROCESSING ,
379347 'expected_state ' => Order::STATE_COMPLETE ,
380348 'is_in_process ' => false ,
381349 'get_is_in_process_invoke_count ' => 0 ,
382350 'is_canceled ' => false ,
383351 'can_unhold ' => false ,
384352 'is_not_virtual ' => false ,
385- 'isPartiallyRefundedOrderShipped ' => true
353+ 'isPartiallyRefundedOrderShipped ' => false
386354 ],
387- 'complete - !canCreditmemo, !canShip !isPartiallyRefundedOrderShipped - closed(virtual product) ' => [
355+ 'complete - !canCreditmemo, !canShip - closed(virtual product) ' => [
388356 'can_credit_memo ' => false ,
389357 'can_credit_memo_invoke_count ' => 1 ,
390358 'can_ship ' => false ,
@@ -395,36 +363,36 @@ public function stateCheckDataProvider()
395363 'get_is_in_process_invoke_count ' => 0 ,
396364 'is_canceled ' => false ,
397365 'can_unhold ' => false ,
398- 'is_not_virtual ' => true ,
399- 'isPartiallyRefundedOrderShipped ' => true
366+ 'is_not_virtual ' => false ,
367+ 'isPartiallyRefundedOrderShipped ' => false
400368 ],
401- 'complete - ! canCreditmemo, !canShip - closed(virtual product) ' => [
402- 'can_credit_memo ' => false ,
369+ 'processing - canCreditmemo, !canShip, !isPartiallyRefundedOrderShipped -> processing ' => [
370+ 'can_credit_memo ' => true ,
403371 'can_credit_memo_invoke_count ' => 1 ,
404- 'can_ship ' => false ,
372+ 'can_ship ' => true ,
405373 'call_can_skip_num ' => 1 ,
406- 'current_state ' => Order::STATE_COMPLETE ,
407- 'expected_state ' => Order::STATE_CLOSED ,
408- 'is_in_process ' => false ,
374+ 'current_state ' => Order::STATE_PROCESSING ,
375+ 'expected_state ' => Order::STATE_PROCESSING ,
376+ 'is_in_process ' => true ,
409377 'get_is_in_process_invoke_count ' => 0 ,
410378 'is_canceled ' => false ,
411379 'can_unhold ' => false ,
412380 'is_not_virtual ' => true ,
413381 'isPartiallyRefundedOrderShipped ' => false
414382 ],
415- 'complete - ! canCreditmemo, !canShip - closed(virtual product) ' => [
416- 'can_credit_memo ' => false ,
383+ 'processing - canCreditmemo, !canShip, isPartiallyRefundedOrderShipped -> complete ' => [
384+ 'can_credit_memo ' => true ,
417385 'can_credit_memo_invoke_count ' => 1 ,
418386 'can_ship ' => false ,
419387 'call_can_skip_num ' => 1 ,
420- 'current_state ' => Order::STATE_COMPLETE ,
421- 'expected_state ' => Order::STATE_CLOSED ,
422- 'is_in_process ' => false ,
388+ 'current_state ' => Order::STATE_PROCESSING ,
389+ 'expected_state ' => Order::STATE_COMPLETE ,
390+ 'is_in_process ' => true ,
423391 'get_is_in_process_invoke_count ' => 0 ,
424392 'is_canceled ' => false ,
425393 'can_unhold ' => false ,
426394 'is_not_virtual ' => true ,
427- 'isPartiallyRefundedOrderShipped ' => false
395+ 'isPartiallyRefundedOrderShipped ' => true
428396 ],
429397 ];
430398 }
0 commit comments