@@ -48,7 +48,7 @@ protected function setUp()
48
48
]);
49
49
$ this ->creditmemoMock = $ this ->createPartialMock (\Magento \Sales \Model \Order \Creditmemo::class, [
50
50
'setBaseCost ' , 'getAllItems ' , 'getOrder ' , 'getBaseShippingAmount ' , 'roundPrice ' ,
51
- 'setDiscountAmount ' , 'setBaseDiscountAmount '
51
+ 'setDiscountAmount ' , 'setBaseDiscountAmount ' , ' getBaseShippingInclTax ' , ' getBaseShippingTaxAmount '
52
52
]);
53
53
$ this ->creditmemoItemMock = $ this ->createPartialMock (\Magento \Sales \Model \Order \Creditmemo \Item::class, [
54
54
'getHasChildren ' , 'getBaseCost ' , 'getQty ' , 'getOrderItem ' , 'setDiscountAmount ' ,
@@ -127,6 +127,82 @@ public function testCollect()
127
127
$ this ->assertEquals ($ this ->total , $ this ->total ->collect ($ this ->creditmemoMock ));
128
128
}
129
129
130
+ public function testCollectNoBaseShippingAmount ()
131
+ {
132
+ $ this ->creditmemoMock ->expects ($ this ->exactly (2 ))
133
+ ->method ('setDiscountAmount ' )
134
+ ->willReturnSelf ();
135
+ $ this ->creditmemoMock ->expects ($ this ->exactly (2 ))
136
+ ->method ('setBaseDiscountAmount ' )
137
+ ->willReturnSelf ();
138
+ $ this ->creditmemoMock ->expects ($ this ->once ())
139
+ ->method ('getOrder ' )
140
+ ->willReturn ($ this ->orderMock );
141
+ $ this ->creditmemoMock ->expects ($ this ->once ())
142
+ ->method ('getBaseShippingAmount ' )
143
+ ->willReturn (0 );
144
+ $ this ->creditmemoMock ->expects ($ this ->once ())
145
+ ->method ('getBaseShippingInclTax ' )
146
+ ->willReturn (1 );
147
+ $ this ->creditmemoMock ->expects ($ this ->once ())
148
+ ->method ('getBaseShippingTaxAmount ' )
149
+ ->willReturn (0 );
150
+ $ this ->orderMock ->expects ($ this ->once ())
151
+ ->method ('getBaseShippingDiscountAmount ' )
152
+ ->willReturn (1 );
153
+ $ this ->orderMock ->expects ($ this ->exactly (2 ))
154
+ ->method ('getBaseShippingAmount ' )
155
+ ->willReturn (1 );
156
+ $ this ->orderMock ->expects ($ this ->once ())
157
+ ->method ('getShippingAmount ' )
158
+ ->willReturn (1 );
159
+ $ this ->creditmemoMock ->expects ($ this ->once ())
160
+ ->method ('getAllItems ' )
161
+ ->willReturn ([$ this ->creditmemoItemMock ]);
162
+ $ this ->creditmemoItemMock ->expects ($ this ->atLeastOnce ())
163
+ ->method ('getOrderItem ' )
164
+ ->willReturn ($ this ->orderItemMock );
165
+ $ this ->orderItemMock ->expects ($ this ->once ())
166
+ ->method ('isDummy ' )
167
+ ->willReturn (false );
168
+ $ this ->orderItemMock ->expects ($ this ->once ())
169
+ ->method ('getDiscountInvoiced ' )
170
+ ->willReturn (1 );
171
+ $ this ->orderItemMock ->expects ($ this ->once ())
172
+ ->method ('getBaseDiscountInvoiced ' )
173
+ ->willReturn (1 );
174
+ $ this ->orderItemMock ->expects ($ this ->once ())
175
+ ->method ('getQtyInvoiced ' )
176
+ ->willReturn (1 );
177
+ $ this ->orderItemMock ->expects ($ this ->once ())
178
+ ->method ('getDiscountRefunded ' )
179
+ ->willReturn (1 );
180
+ $ this ->orderItemMock ->expects ($ this ->once ())
181
+ ->method ('getQtyRefunded ' )
182
+ ->willReturn (0 );
183
+ $ this ->creditmemoItemMock ->expects ($ this ->once ())
184
+ ->method ('isLast ' )
185
+ ->willReturn (false );
186
+ $ this ->creditmemoItemMock ->expects ($ this ->atLeastOnce ())
187
+ ->method ('getQty ' )
188
+ ->willReturn (1 );
189
+ $ this ->creditmemoItemMock ->expects ($ this ->exactly (1 ))
190
+ ->method ('setDiscountAmount ' )
191
+ ->willReturnSelf ();
192
+ $ this ->creditmemoItemMock ->expects ($ this ->exactly (1 ))
193
+ ->method ('setBaseDiscountAmount ' )
194
+ ->willReturnSelf ();
195
+ $ this ->creditmemoMock ->expects ($ this ->exactly (2 ))
196
+ ->method ('roundPrice ' )
197
+ ->willReturnMap (
198
+ [
199
+ [1 , 'regular ' , true , 1 ],
200
+ [1 , 'base ' , true , 1 ]
201
+ ]
202
+ );
203
+ $ this ->assertEquals ($ this ->total , $ this ->total ->collect ($ this ->creditmemoMock ));
204
+ }
205
+
130
206
public function testCollectZeroShipping ()
131
207
{
132
208
$ this ->creditmemoMock ->expects ($ this ->exactly (2 ))
0 commit comments