@@ -133,25 +133,31 @@ protected function setUp(): void
133
133
{
134
134
parent ::setUp ();
135
135
136
- $ this ->entityModel = $ this ->createPartialMock (Product::class, [
137
- 'getErrorAggregator ' ,
138
- 'getBehavior ' ,
139
- 'getNewSku ' ,
140
- 'getNextBunch ' ,
141
- 'isRowAllowedToImport ' ,
142
- 'getRowScope ' ,
143
- 'getConnection '
144
- ]);
136
+ $ this ->entityModel = $ this ->createPartialMock (
137
+ Product::class,
138
+ [
139
+ 'getErrorAggregator ' ,
140
+ 'getBehavior ' ,
141
+ 'getNewSku ' ,
142
+ 'getNextBunch ' ,
143
+ 'isRowAllowedToImport ' ,
144
+ 'getRowScope ' ,
145
+ 'getConnection ' ,
146
+ 'getMultipleValueSeparator '
147
+ ]
148
+ );
149
+ $ this ->entityModel ->method ('getMultipleValueSeparator ' )->willReturn (', ' );
145
150
$ this ->entityModel ->method ('getErrorAggregator ' )->willReturn ($ this ->getErrorAggregatorObject ());
146
151
$ this ->connection = $ this ->getMockBuilder (Mysql::class)
147
152
->addMethods (['joinLeft ' ])
148
- ->onlyMethods ([
149
- 'select ' ,
150
- 'fetchAll ' ,
151
- 'fetchPairs ' ,
152
- 'insertOnDuplicate ' ,
153
- 'delete ' ,
154
- 'quoteInto ' ,
153
+ ->onlyMethods (
154
+ [
155
+ 'select ' ,
156
+ 'fetchAll ' ,
157
+ 'fetchPairs ' ,
158
+ 'insertOnDuplicate ' ,
159
+ 'delete ' ,
160
+ 'quoteInto ' ,
155
161
'fetchAssoc '
156
162
])
157
163
->disableOriginalConstructor ()
@@ -242,57 +248,65 @@ public function testSaveData($skus, $bunch, $allowImport)
242
248
$ this ->entityModel ->expects ($ this ->once ())->method ('getNewSku ' )->willReturn ($ skus ['newSku ' ]);
243
249
$ this ->entityModel ->expects ($ this ->at (2 ))->method ('getNextBunch ' )->willReturn ([$ bunch ]);
244
250
$ this ->entityModel ->expects ($ this ->any ())->method ('isRowAllowedToImport ' )->willReturn ($ allowImport );
245
- $ scope = $ this ->getMockBuilder (ScopeInterface::class)
246
- ->getMockForAbstractClass ();
251
+ $ scope = $ this ->getMockBuilder (ScopeInterface::class)->getMockForAbstractClass ();
247
252
$ this ->scopeResolver ->expects ($ this ->any ())->method ('getScope ' )->willReturn ($ scope );
248
- $ this ->connection ->expects ($ this ->any ())->method ('fetchAssoc ' )->with ($ this ->select )->willReturn ([
249
- '1 ' => [
250
- 'option_id ' => '1 ' ,
251
- 'parent_id ' => '1 ' ,
252
- 'required ' => '1 ' ,
253
- 'position ' => '1 ' ,
254
- 'type ' => 'bundle ' ,
255
- 'value_id ' => '1 ' ,
256
- 'title ' => 'Bundle1 ' ,
257
- 'name ' => 'bundle1 ' ,
258
- 'selections ' => [
259
- ['name ' => 'Bundlen1 ' ,
260
- 'type ' => 'dropdown ' ,
253
+ $ this ->connection ->method ('fetchPairs ' )->willReturn ([1 => 'sku ' ]);
254
+ $ this ->connection ->expects ($ this ->any ())
255
+ ->method ('fetchAssoc ' )
256
+ ->with ($ this ->select )
257
+ ->willReturn (
258
+ [
259
+ '1 ' => [
260
+ 'option_id ' => '1 ' ,
261
+ 'parent_id ' => '1 ' ,
261
262
'required ' => '1 ' ,
262
- 'sku ' => '1 ' ,
263
- 'price ' => '10 ' ,
264
- 'price_type ' => 'fixed ' ,
265
- 'shipment_type ' => '1 ' ,
266
- 'default_qty ' => '1 ' ,
267
- 'is_default ' => '1 ' ,
268
263
'position ' => '1 ' ,
269
- 'option_id ' => '1 ' ]
270
- ]
271
- ],
272
- '2 ' => [
273
- 'option_id ' => '6 ' ,
274
- 'parent_id ' => '6 ' ,
275
- 'required ' => '6 ' ,
276
- 'position ' => '6 ' ,
277
- 'type ' => 'bundle ' ,
278
- 'value_id ' => '6 ' ,
279
- 'title ' => 'Bundle6 ' ,
280
- 'selections ' => [
281
- ['name ' => 'Bundlen6 ' ,
282
- 'type ' => 'dropdown ' ,
283
- 'required ' => '1 ' ,
284
- 'sku ' => '222 ' ,
285
- 'price ' => '10 ' ,
286
- 'price_type ' => 'percent ' ,
287
- 'shipment_type ' => 0 ,
288
- 'default_qty ' => '2 ' ,
289
- 'is_default ' => '1 ' ,
264
+ 'type ' => 'bundle ' ,
265
+ 'value_id ' => '1 ' ,
266
+ 'title ' => 'Bundle1 ' ,
267
+ 'name ' => 'bundle1 ' ,
268
+ 'selections ' => [
269
+ [
270
+ 'name ' => 'Bundlen1 ' ,
271
+ 'type ' => 'dropdown ' ,
272
+ 'required ' => '1 ' ,
273
+ 'sku ' => '1 ' ,
274
+ 'price ' => '10 ' ,
275
+ 'price_type ' => 'fixed ' ,
276
+ 'shipment_type ' => '1 ' ,
277
+ 'default_qty ' => '1 ' ,
278
+ 'is_default ' => '1 ' ,
279
+ 'position ' => '1 ' ,
280
+ 'option_id ' => '1 '
281
+ ]
282
+ ]
283
+ ],
284
+ '2 ' => [
285
+ 'option_id ' => '6 ' ,
286
+ 'parent_id ' => '6 ' ,
287
+ 'required ' => '6 ' ,
290
288
'position ' => '6 ' ,
291
- 'option_id ' => '6 '
289
+ 'type ' => 'bundle ' ,
290
+ 'value_id ' => '6 ' ,
291
+ 'title ' => 'Bundle6 ' ,
292
+ 'selections ' => [
293
+ [
294
+ 'name ' => 'Bundlen6 ' ,
295
+ 'type ' => 'dropdown ' ,
296
+ 'required ' => '1 ' ,
297
+ 'sku ' => '222 ' ,
298
+ 'price ' => '10 ' ,
299
+ 'price_type ' => 'percent ' ,
300
+ 'shipment_type ' => 0 ,
301
+ 'default_qty ' => '2 ' ,
302
+ 'is_default ' => '1 ' ,
303
+ 'position ' => '6 ' ,
304
+ 'option_id ' => '6 '
305
+ ]
306
+ ]
292
307
]
293
308
]
294
- ]
295
- ]);
309
+ );
296
310
$ bundle = $ this ->bundle ->saveData ();
297
311
$ this ->assertNotNull ($ bundle );
298
312
}
0 commit comments