@@ -196,14 +196,30 @@ private function initTestData()
196
196
'root_category_id ' => '1 ' ,
197
197
'default_store_id ' => '1 ' ,
198
198
'code ' => 'default ' ,
199
+ ],
200
+ 2 => [
201
+ 'group_id ' => '1 ' ,
202
+ 'website_id ' => '1 ' ,
203
+ 'name ' => 'Default1 ' ,
204
+ 'default_store_id ' => '1 ' ,
205
+ 'code ' => 'default1 ' ,
199
206
]
200
207
];
201
- $ this ->trimmedGroup = [
202
- 'name ' => 'Default ' ,
203
- 'root_category_id ' => '1 ' ,
204
- 'code ' => 'default ' ,
205
- 'default_store_id ' => '1 ' ,
206
- ];
208
+ $ this ->trimmedGroup =
209
+ [
210
+ 0 => [
211
+ 'name ' => 'Default ' ,
212
+ 'root_category_id ' => '1 ' ,
213
+ 'code ' => 'default ' ,
214
+ 'default_store_id ' => '1 ' ,
215
+ ],
216
+ 1 => [
217
+ 'name ' => 'Default1 ' ,
218
+ 'root_category_id ' => '0 ' ,
219
+ 'code ' => 'default1 ' ,
220
+ 'default_store_id ' => '1 '
221
+ ]
222
+ ];
207
223
$ this ->stores = [
208
224
'default ' => [
209
225
'store_id ' => '1 ' ,
@@ -280,46 +296,46 @@ public function testRunGroup()
280
296
[ScopeInterface::SCOPE_GROUPS , $ this ->groups , $ this ->groups ],
281
297
]);
282
298
283
- $ this ->websiteMock ->expects ($ this ->once ( ))
299
+ $ this ->websiteMock ->expects ($ this ->exactly ( 2 ))
284
300
->method ('getResource ' )
285
301
->willReturn ($ this ->abstractDbMock );
286
302
287
- $ this ->groupMock ->expects ($ this ->once ( ))
303
+ $ this ->groupMock ->expects ($ this ->exactly ( 2 ))
288
304
->method ('setData ' )
289
- ->with ($ this ->trimmedGroup )
290
- ->willReturnSelf ();
291
- $ this ->groupMock ->expects ($ this ->exactly (3 ))
305
+ ->withConsecutive (
306
+ [$ this ->equalTo ($ this ->trimmedGroup [0 ])],
307
+ [$ this ->equalTo ($ this ->trimmedGroup [1 ])]
308
+ )->willReturnSelf ();
309
+
310
+ $ this ->groupMock ->expects ($ this ->exactly (6 ))
292
311
->method ('getResource ' )
293
312
->willReturn ($ this ->abstractDbMock );
294
- $ this ->groupMock ->expects ($ this ->once ())
295
- ->method ('setRootCategoryId ' )
296
- ->with (0 );
297
- $ this ->groupMock ->expects ($ this ->once ())
313
+ $ this ->groupMock ->expects ($ this ->exactly (2 ))
298
314
->method ('getDefaultStoreId ' )
299
315
->willReturn ($ defaultStoreId );
300
- $ this ->groupMock ->expects ($ this ->once ( ))
316
+ $ this ->groupMock ->expects ($ this ->exactly ( 2 ))
301
317
->method ('setDefaultStoreId ' )
302
318
->with ($ storeId );
303
- $ this ->groupMock ->expects ($ this ->once ( ))
319
+ $ this ->groupMock ->expects ($ this ->exactly ( 2 ))
304
320
->method ('setWebsite ' )
305
321
->with ($ this ->websiteMock );
306
322
307
- $ this ->storeMock ->expects ($ this ->once ( ))
323
+ $ this ->storeMock ->expects ($ this ->exactly ( 2 ))
308
324
->method ('getResource ' )
309
325
->willReturn ($ this ->abstractDbMock );
310
- $ this ->storeMock ->expects ($ this ->once ( ))
326
+ $ this ->storeMock ->expects ($ this ->exactly ( 2 ))
311
327
->method ('getStoreId ' )
312
328
->willReturn ($ storeId );
313
329
314
330
$ this ->abstractDbMock ->expects ($ this ->any ())
315
331
->method ('load ' )
316
332
->withConsecutive ([$ this ->websiteMock , 'base ' , 'code ' ], [$ this ->storeMock , 'default ' , 'code ' ])
317
333
->willReturnSelf ();
318
- $ this ->abstractDbMock ->expects ($ this ->exactly (2 ))
334
+ $ this ->abstractDbMock ->expects ($ this ->exactly (4 ))
319
335
->method ('save ' )
320
336
->with ($ this ->groupMock )
321
337
->willReturnSelf ();
322
- $ this ->abstractDbMock ->expects ($ this ->once ( ))
338
+ $ this ->abstractDbMock ->expects ($ this ->exactly ( 2 ))
323
339
->method ('addCommitCallback ' )
324
340
->willReturnCallback (function ($ function ) {
325
341
return $ function ();
0 commit comments