@@ -1348,6 +1348,12 @@ public function testReplaceArray($collection)
1348
1348
{
1349
1349
$ c = new $ collection (['a ' , 'b ' , 'c ' ]);
1350
1350
$ this ->assertEquals (['a ' , 'd ' , 'e ' ], $ c ->replace ([1 => 'd ' , 2 => 'e ' ])->all ());
1351
+
1352
+ $ c = new $ collection (['a ' , 'b ' , 'c ' ]);
1353
+ $ this ->assertEquals (['a ' , 'd ' , 'e ' , 'f ' , 'g ' ], $ c ->replace ([1 => 'd ' , 2 => 'e ' , 3 => 'f ' , 4 => 'g ' ])->all ());
1354
+
1355
+ $ c = new $ collection (['name ' => 'amir ' , 'family ' => 'otwell ' ]);
1356
+ $ this ->assertEquals (['name ' => 'taylor ' , 'family ' => 'otwell ' , 'age ' => 26 ], $ c ->replace (['name ' => 'taylor ' , 'age ' => 26 ])->all ());
1351
1357
}
1352
1358
1353
1359
/**
@@ -1360,6 +1366,18 @@ public function testReplaceCollection($collection)
1360
1366
['a ' , 'd ' , 'e ' ],
1361
1367
$ c ->replace (new $ collection ([1 => 'd ' , 2 => 'e ' ]))->all ()
1362
1368
);
1369
+
1370
+ $ c = new $ collection (['a ' , 'b ' , 'c ' ]);
1371
+ $ this ->assertEquals (
1372
+ ['a ' , 'd ' , 'e ' , 'f ' , 'g ' ],
1373
+ $ c ->replace (new $ collection ([1 => 'd ' , 2 => 'e ' , 3 => 'f ' , 4 => 'g ' ]))->all ()
1374
+ );
1375
+
1376
+ $ c = new $ collection (['name ' => 'amir ' , 'family ' => 'otwell ' ]);
1377
+ $ this ->assertEquals (
1378
+ ['name ' => 'taylor ' , 'family ' => 'otwell ' , 'age ' => 26 ],
1379
+ $ c ->replace (new $ collection (['name ' => 'taylor ' , 'age ' => 26 ]))->all ()
1380
+ );
1363
1381
}
1364
1382
1365
1383
/**
@@ -1378,6 +1396,9 @@ public function testReplaceRecursiveArray($collection)
1378
1396
{
1379
1397
$ c = new $ collection (['a ' , 'b ' , ['c ' , 'd ' ]]);
1380
1398
$ this ->assertEquals (['z ' , 'b ' , ['c ' , 'e ' ]], $ c ->replaceRecursive (['z ' , 2 => [1 => 'e ' ]])->all ());
1399
+
1400
+ $ c = new $ collection (['a ' , 'b ' , ['c ' , 'd ' ]]);
1401
+ $ this ->assertEquals (['z ' , 'b ' , ['c ' , 'e ' ], 'f ' ], $ c ->replaceRecursive (['z ' , 2 => [1 => 'e ' ], 'f ' ])->all ());
1381
1402
}
1382
1403
1383
1404
/**
0 commit comments