@@ -143,4 +143,71 @@ public function testCollect()
143
143
);
144
144
$ this ->assertEquals ($ this ->total , $ this ->total ->collect ($ this ->creditmemoMock ));
145
145
}
146
+
147
+ public function testCollectZeroShipping ()
148
+ {
149
+ $ this ->creditmemoMock ->expects ($ this ->exactly (2 ))
150
+ ->method ('setDiscountAmount ' )
151
+ ->willReturnSelf ();
152
+ $ this ->creditmemoMock ->expects ($ this ->exactly (2 ))
153
+ ->method ('setBaseDiscountAmount ' )
154
+ ->willReturnSelf ();
155
+ $ this ->creditmemoMock ->expects ($ this ->once ())
156
+ ->method ('getOrder ' )
157
+ ->willReturn ($ this ->orderMock );
158
+ $ this ->creditmemoMock ->expects ($ this ->once ())
159
+ ->method ('getBaseShippingAmount ' )
160
+ ->willReturn ('0.0000 ' );
161
+ $ this ->orderMock ->expects ($ this ->never ())
162
+ ->method ('getBaseShippingDiscountAmount ' );
163
+ $ this ->orderMock ->expects ($ this ->never ())
164
+ ->method ('getBaseShippingAmount ' );
165
+ $ this ->orderMock ->expects ($ this ->never ())
166
+ ->method ('getShippingAmount ' );
167
+ $ this ->creditmemoMock ->expects ($ this ->once ())
168
+ ->method ('getAllItems ' )
169
+ ->willReturn ([$ this ->creditmemoItemMock ]);
170
+ $ this ->creditmemoItemMock ->expects ($ this ->atLeastOnce ())
171
+ ->method ('getOrderItem ' )
172
+ ->willReturn ($ this ->orderItemMock );
173
+ $ this ->orderItemMock ->expects ($ this ->once ())
174
+ ->method ('isDummy ' )
175
+ ->willReturn (false );
176
+ $ this ->orderItemMock ->expects ($ this ->once ())
177
+ ->method ('getDiscountInvoiced ' )
178
+ ->willReturn (1 );
179
+ $ this ->orderItemMock ->expects ($ this ->once ())
180
+ ->method ('getBaseDiscountInvoiced ' )
181
+ ->willReturn (1 );
182
+ $ this ->orderItemMock ->expects ($ this ->once ())
183
+ ->method ('getQtyInvoiced ' )
184
+ ->willReturn (1 );
185
+ $ this ->orderItemMock ->expects ($ this ->once ())
186
+ ->method ('getDiscountRefunded ' )
187
+ ->willReturn (1 );
188
+ $ this ->orderItemMock ->expects ($ this ->once ())
189
+ ->method ('getQtyRefunded ' )
190
+ ->willReturn (0 );
191
+ $ this ->creditmemoItemMock ->expects ($ this ->once ())
192
+ ->method ('isLast ' )
193
+ ->willReturn (false );
194
+ $ this ->creditmemoItemMock ->expects ($ this ->atLeastOnce ())
195
+ ->method ('getQty ' )
196
+ ->willReturn (1 );
197
+ $ this ->creditmemoItemMock ->expects ($ this ->exactly (1 ))
198
+ ->method ('setDiscountAmount ' )
199
+ ->willReturnSelf ();
200
+ $ this ->creditmemoItemMock ->expects ($ this ->exactly (1 ))
201
+ ->method ('setBaseDiscountAmount ' )
202
+ ->willReturnSelf ();
203
+ $ this ->creditmemoMock ->expects ($ this ->exactly (2 ))
204
+ ->method ('roundPrice ' )
205
+ ->willReturnMap (
206
+ [
207
+ [1 , 'regular ' , true , 1 ],
208
+ [1 , 'base ' , true , 1 ]
209
+ ]
210
+ );
211
+ $ this ->assertEquals ($ this ->total , $ this ->total ->collect ($ this ->creditmemoMock ));
212
+ }
146
213
}
0 commit comments