@@ -37,8 +37,8 @@ protected function setUp()
37
37
'canShip ' ,
38
38
'getBaseGrandTotal ' ,
39
39
'canCreditmemo ' ,
40
- 'getState ' ,
41
- 'setState ' ,
40
+ // 'getState',
41
+ // 'setState',
42
42
'getTotalRefunded ' ,
43
43
'hasForcedCanCreditmemo ' ,
44
44
'getIsInProcess ' ,
@@ -76,13 +76,13 @@ public function testCheck(
76
76
int $ callCanSkipNum ,
77
77
string $ currentState ,
78
78
string $ expectedState = '' ,
79
- int $ callSetStateNum = 0 ,
80
79
bool $ isInProcess = false ,
81
80
int $ callGetIsInProcessNum = 0 ,
82
81
bool $ isCanceled = false ,
83
82
bool $ canUnhold = false ,
84
83
bool $ canInvoice = false
85
84
) {
85
+ $ this ->orderMock ->setState ($ currentState );
86
86
$ this ->orderMock ->expects ($ this ->any ())
87
87
->method ('isCanceled ' )
88
88
->willReturn ($ isCanceled );
@@ -98,50 +98,46 @@ public function testCheck(
98
98
$ this ->orderMock ->expects ($ this ->exactly ($ callCanCreditmemoNum ))
99
99
->method ('canCreditmemo ' )
100
100
->willReturn ($ canCreditmemo );
101
- $ this ->orderMock ->expects ($ this ->once ())
102
- ->method ('getState ' )
103
- ->willReturn ($ currentState );
104
101
$ this ->orderMock ->expects ($ this ->exactly ($ callGetIsInProcessNum ))
105
102
->method ('getIsInProcess ' )
106
103
->willReturn ($ isInProcess );
107
- $ this ->orderMock ->expects ($ this ->exactly ($ callSetStateNum ))
108
- ->method ('setState ' )
109
- ->with ($ expectedState )
110
- ->will ($ this ->returnSelf ());
111
104
$ this ->state ->check ($ this ->orderMock );
105
+ $ this ->assertEquals ($ expectedState , $ this ->orderMock ->getState ());
112
106
}
113
107
114
108
public function stateCheckDataProvider ()
115
109
{
116
110
return [
117
111
'processing - !canCreditmemo!canShip -> closed ' =>
118
- [false , 1 , false , 0 , Order::STATE_PROCESSING , Order::STATE_CLOSED , 1 ],
112
+ [false , 1 , false , 0 , Order::STATE_PROCESSING , Order::STATE_CLOSED ],
119
113
'complete - !canCreditmemo,!canShip -> closed ' =>
120
- [false , 1 , false , 0 , Order::STATE_COMPLETE , Order::STATE_CLOSED , 1 ],
114
+ [false , 1 , false , 0 , Order::STATE_COMPLETE , Order::STATE_CLOSED ],
121
115
'processing - !canCreditmemo,canShip -> closed ' =>
122
- [false , 1 , true , 0 , Order::STATE_PROCESSING , Order::STATE_CLOSED , 1 ],
116
+ [false , 1 , true , 0 , Order::STATE_PROCESSING , Order::STATE_CLOSED ],
123
117
'complete - !canCreditmemo,canShip -> closed ' =>
124
- [false , 1 , true , 0 , Order::STATE_COMPLETE , Order::STATE_CLOSED , 1 ],
118
+ [false , 1 , true , 0 , Order::STATE_COMPLETE , Order::STATE_CLOSED ],
125
119
'processing - canCreditmemo,!canShip -> complete ' =>
126
- [true , 1 , false , 1 , Order::STATE_PROCESSING , Order::STATE_COMPLETE , 1 ],
120
+ [true , 1 , false , 1 , Order::STATE_PROCESSING , Order::STATE_COMPLETE ],
127
121
'complete - canCreditmemo,!canShip -> complete ' =>
128
- [true , 1 , false , 0 , Order::STATE_COMPLETE ],
122
+ [true , 1 , false , 0 , Order::STATE_COMPLETE , Order:: STATE_COMPLETE ],
129
123
'processing - canCreditmemo, canShip -> processing ' =>
130
- [true , 1 , true , 1 , Order::STATE_PROCESSING ],
124
+ [true , 1 , true , 1 , Order::STATE_PROCESSING , Order:: STATE_PROCESSING ],
131
125
'complete - canCreditmemo, canShip -> complete ' =>
132
- [true , 1 , true , 0 , Order::STATE_COMPLETE ],
126
+ [true , 1 , true , 0 , Order::STATE_COMPLETE , Order:: STATE_COMPLETE ],
133
127
'new - canCreditmemo, canShip, IsInProcess -> processing ' =>
134
- [true , 0 , true , 0 , Order::STATE_NEW , Order::STATE_PROCESSING , 1 , true , 1 ],
128
+ [true , 1 , true , 1 , Order::STATE_NEW , Order::STATE_PROCESSING , true , 1 ],
129
+ 'new - canCreditmemo, !canShip, IsInProcess -> processing ' =>
130
+ [true , 1 , false , 1 , Order::STATE_NEW , Order::STATE_COMPLETE , true , 1 ],
135
131
'new - canCreditmemo, canShip, !IsInProcess -> new ' =>
136
- [true , 0 , true , 0 , Order::STATE_NEW , '' , 0 , false , 1 ],
132
+ [true , 0 , true , 0 , Order::STATE_NEW , Order:: STATE_NEW , false , 1 ],
137
133
'hold - canUnhold -> hold ' =>
138
- [true , 0 , true , 0 , Order::STATE_HOLDED , '' , 0 , false , 0 , false , true , false ],
134
+ [true , 0 , true , 0 , Order::STATE_HOLDED , Order:: STATE_HOLDED , false , 0 , false , true , false ],
139
135
'payment_review - canUnhold -> payment_review ' =>
140
- [true , 0 , true , 0 , Order::STATE_PAYMENT_REVIEW , '' , 0 , false , 0 , false , false , false ],
136
+ [true , 0 , true , 0 , Order::STATE_PAYMENT_REVIEW , Order:: STATE_PAYMENT_REVIEW , false , 0 , false , false , false ],
141
137
'pending_payment - canUnhold -> pending_payment ' =>
142
- [true , 0 , true , 0 , Order::STATE_PENDING_PAYMENT , '' , 0 , false , 0 , false , false , false ],
138
+ [true , 0 , true , 0 , Order::STATE_PENDING_PAYMENT , Order:: STATE_PENDING_PAYMENT , false , 0 , false , false , false ],
143
139
'cancelled - isCanceled -> cancelled ' =>
144
- [true , 0 , true , 0 , Order::STATE_HOLDED , '' , 0 , false , 0 , true , false , false ],
140
+ [true , 0 , true , 0 , Order::STATE_HOLDED , Order:: STATE_HOLDED , false , 0 , true , false , false ],
145
141
];
146
142
}
147
143
}
0 commit comments