@@ -478,7 +478,7 @@ public function testCountable($collection)
478
478
/**
479
479
* @dataProvider collectionClassProvider
480
480
*/
481
- public function testCountableByWithoutPredicate ($ collection )
481
+ public function testCountByStandalone ($ collection )
482
482
{
483
483
$ c = new $ collection (['foo ' , 'foo ' , 'foo ' , 'bar ' , 'bar ' , 'foobar ' ]);
484
484
$ this ->assertEquals (['foo ' => 3 , 'bar ' => 2 , 'foobar ' => 1 ], $ c ->countBy ()->all ());
@@ -493,7 +493,19 @@ public function testCountableByWithoutPredicate($collection)
493
493
/**
494
494
* @dataProvider collectionClassProvider
495
495
*/
496
- public function testCountableByWithPredicate ($ collection )
496
+ public function testCountByWithKey ($ collection )
497
+ {
498
+ $ c = new $ collection ([
499
+ ['key ' => 'a ' ], ['key ' => 'a ' ], ['key ' => 'a ' ], ['key ' => 'a ' ],
500
+ ['key ' => 'b ' ], ['key ' => 'b ' ], ['key ' => 'b ' ],
501
+ ]);
502
+ $ this ->assertEquals (['a ' => 4 , 'b ' => 3 ], $ c ->countBy ('key ' )->all ());
503
+ }
504
+
505
+ /**
506
+ * @dataProvider collectionClassProvider
507
+ */
508
+ public function testCountableByWithCallback ($ collection )
497
509
{
498
510
$ c = new $ collection (['alice ' , 'aaron ' , 'bob ' , 'carla ' ]);
499
511
$ this ->assertEquals (['a ' => 2 , 'b ' => 1 , 'c ' => 1 ], $ c ->countBy (function ($ name ) {
0 commit comments