@@ -4606,6 +4606,11 @@ public function testCollectionFromBackedEnum($collection)
4606
4606
public function testSplitCollectionWithADivisableCount ($ collection )
4607
4607
{
4608
4608
$ data = new $ collection (['a ' , 'b ' , 'c ' , 'd ' ]);
4609
+ $ split = $ data ->split (2 );
4610
+
4611
+ $ this ->assertSame (['a ' , 'b ' ], $ split ->get (0 )->all ());
4612
+ $ this ->assertSame (['c ' , 'd ' ], $ split ->get (1 )->all ());
4613
+ $ this ->assertInstanceOf ($ collection , $ split );
4609
4614
4610
4615
$ this ->assertEquals (
4611
4616
[['a ' , 'b ' ], ['c ' , 'd ' ]],
@@ -4615,6 +4620,10 @@ public function testSplitCollectionWithADivisableCount($collection)
4615
4620
);
4616
4621
4617
4622
$ data = new $ collection ([1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 ]);
4623
+ $ split = $ data ->split (2 );
4624
+
4625
+ $ this ->assertSame ([1 , 2 , 3 , 4 , 5 ], $ split ->get (0 )->all ());
4626
+ $ this ->assertSame ([6 , 7 , 8 , 9 , 10 ], $ split ->get (1 )->all ());
4618
4627
4619
4628
$ this ->assertEquals (
4620
4629
[[1 , 2 , 3 , 4 , 5 ], [6 , 7 , 8 , 9 , 10 ]],
@@ -4630,6 +4639,10 @@ public function testSplitCollectionWithADivisableCount($collection)
4630
4639
public function testSplitCollectionWithAnUndivisableCount ($ collection )
4631
4640
{
4632
4641
$ data = new $ collection (['a ' , 'b ' , 'c ' ]);
4642
+ $ split = $ data ->split (2 );
4643
+
4644
+ $ this ->assertSame (['a ' , 'b ' ], $ split ->get (0 )->all ());
4645
+ $ this ->assertSame (['c ' ], $ split ->get (1 )->all ());
4633
4646
4634
4647
$ this ->assertEquals (
4635
4648
[['a ' , 'b ' ], ['c ' ]],
@@ -4645,6 +4658,10 @@ public function testSplitCollectionWithAnUndivisableCount($collection)
4645
4658
public function testSplitCollectionWithCountLessThenDivisor ($ collection )
4646
4659
{
4647
4660
$ data = new $ collection (['a ' ]);
4661
+ $ split = $ data ->split (2 );
4662
+
4663
+ $ this ->assertSame (['a ' ], $ split ->get (0 )->all ());
4664
+ $ this ->assertNull ($ split ->get (1 ));
4648
4665
4649
4666
$ this ->assertEquals (
4650
4667
[['a ' ]],
@@ -4660,6 +4677,11 @@ public function testSplitCollectionWithCountLessThenDivisor($collection)
4660
4677
public function testSplitCollectionIntoThreeWithCountOfFour ($ collection )
4661
4678
{
4662
4679
$ data = new $ collection (['a ' , 'b ' , 'c ' , 'd ' ]);
4680
+ $ split = $ data ->split (3 );
4681
+
4682
+ $ this ->assertSame (['a ' , 'b ' ], $ split ->get (0 )->all ());
4683
+ $ this ->assertSame (['c ' ], $ split ->get (1 )->all ());
4684
+ $ this ->assertSame (['d ' ], $ split ->get (2 )->all ());
4663
4685
4664
4686
$ this ->assertEquals (
4665
4687
[['a ' , 'b ' ], ['c ' ], ['d ' ]],
@@ -4675,6 +4697,11 @@ public function testSplitCollectionIntoThreeWithCountOfFour($collection)
4675
4697
public function testSplitCollectionIntoThreeWithCountOfFive ($ collection )
4676
4698
{
4677
4699
$ data = new $ collection (['a ' , 'b ' , 'c ' , 'd ' , 'e ' ]);
4700
+ $ split = $ data ->split (3 );
4701
+
4702
+ $ this ->assertSame (['a ' , 'b ' ], $ split ->get (0 )->all ());
4703
+ $ this ->assertSame (['c ' , 'd ' ], $ split ->get (1 )->all ());
4704
+ $ this ->assertSame (['e ' ], $ split ->get (2 )->all ());
4678
4705
4679
4706
$ this ->assertEquals (
4680
4707
[['a ' , 'b ' ], ['c ' , 'd ' ], ['e ' ]],
@@ -4690,6 +4717,14 @@ public function testSplitCollectionIntoThreeWithCountOfFive($collection)
4690
4717
public function testSplitCollectionIntoSixWithCountOfTen ($ collection )
4691
4718
{
4692
4719
$ data = new $ collection (['a ' , 'b ' , 'c ' , 'd ' , 'e ' , 'f ' , 'g ' , 'h ' , 'i ' , 'j ' ]);
4720
+ $ split = $ data ->split (6 );
4721
+
4722
+ $ this ->assertSame (['a ' , 'b ' ], $ split ->get (0 )->all ());
4723
+ $ this ->assertSame (['c ' , 'd ' ], $ split ->get (1 )->all ());
4724
+ $ this ->assertSame (['e ' , 'f ' ], $ split ->get (2 )->all ());
4725
+ $ this ->assertSame (['g ' , 'h ' ], $ split ->get (3 )->all ());
4726
+ $ this ->assertSame (['i ' ], $ split ->get (4 )->all ());
4727
+ $ this ->assertSame (['j ' ], $ split ->get (5 )->all ());
4693
4728
4694
4729
$ this ->assertEquals (
4695
4730
[['a ' , 'b ' ], ['c ' , 'd ' ], ['e ' , 'f ' ], ['g ' , 'h ' ], ['i ' ], ['j ' ]],
@@ -4705,6 +4740,10 @@ public function testSplitCollectionIntoSixWithCountOfTen($collection)
4705
4740
public function testSplitEmptyCollection ($ collection )
4706
4741
{
4707
4742
$ data = new $ collection ;
4743
+ $ split = $ data ->split (2 );
4744
+
4745
+ $ this ->assertNull ($ split ->get (0 ));
4746
+ $ this ->assertNull ($ split ->get (1 ));
4708
4747
4709
4748
$ this ->assertEquals (
4710
4749
[],
0 commit comments