@@ -118,10 +118,11 @@ protected function setUp(): void
118
118
119
119
/**
120
120
* @param bool $freeshipping
121
+ * @param bool $isShipSeparately
121
122
* @dataProvider collectRatesWithGlobalFreeShippingDataProvider
122
123
* @return void
123
124
*/
124
- public function testCollectRatesWithGlobalFreeShipping ($ freeshipping )
125
+ public function testCollectRatesWithGlobalFreeShipping ($ freeshipping, $ isShipSeparately )
125
126
{
126
127
$ rate = [
127
128
'price ' => 15 ,
@@ -177,11 +178,17 @@ public function testCollectRatesWithGlobalFreeShipping($freeshipping)
177
178
$ this ->resultFactoryMock ->expects ($ this ->once ())->method ('create ' )->willReturn ($ result );
178
179
179
180
$ product ->expects ($ this ->any ())->method ('isVirtual ' )->willReturn (false );
180
-
181
181
$ item ->expects ($ this ->any ())->method ('getProduct ' )->willReturn ($ product );
182
- $ item ->expects ($ this ->any ())->method ('getFreeShipping ' )->willReturn (1 );
183
182
$ item ->expects ($ this ->any ())->method ('getQty ' )->willReturn (1 );
184
-
183
+ if ($ isShipSeparately ) {
184
+ $ freeShippingReturnValue = true ;
185
+ $ item ->expects ($ this ->any ())->method ('getHasChildren ' )->willReturn (1 );
186
+ $ item ->expects ($ this ->any ())->method ('isShipSeparately ' )->willReturn (1 );
187
+ $ item ->expects ($ this ->any ())->method ('getChildren ' )->willReturn ([$ item ]);
188
+ } else {
189
+ $ freeShippingReturnValue = "1 " ;
190
+ }
191
+ $ item ->expects ($ this ->any ())->method ('getFreeShipping ' )->willReturn ($ freeShippingReturnValue );
185
192
$ request ->expects ($ this ->any ())->method ('getAllItems ' )->willReturn ([$ item ]);
186
193
$ request ->expects ($ this ->any ())->method ('getPackageQty ' )->willReturn (1 );
187
194
@@ -225,8 +232,9 @@ private function captureArg(&$captureVar)
225
232
public function collectRatesWithGlobalFreeShippingDataProvider ()
226
233
{
227
234
return [
228
- ['freeshipping ' => true ],
229
- ['freeshipping ' => false ]
235
+ ['freeshipping ' => true , 'isShipSeparately ' => false ],
236
+ ['freeshipping ' => false , 'isShipSeparately ' => false ],
237
+ ['freeshipping ' => true , 'isShipSeparately ' => true ]
230
238
];
231
239
}
232
240
}
0 commit comments