diff --git a/tests/CollectionTest.php b/tests/CollectionTest.php index a03fe0a..ae3379c 100644 --- a/tests/CollectionTest.php +++ b/tests/CollectionTest.php @@ -28,6 +28,13 @@ class CollectionTest extends TestCase $this->assertEquals($expectedResult, $collection->toArray()); } + #[DataProvider('countDataProvider')] + public function testCount(array $items, int $expectedResult): void + { + $collection = new Collection($items); + $this->assertEquals($expectedResult, $collection->count()); + } + public static function addDataProvider(): array { return [ @@ -69,4 +76,22 @@ class CollectionTest extends TestCase ], ]; } + + public static function countDataProvider(): array + { + return [ + [ + 'items' => ['A', 'B', 'C'], + 'expectedResult' => 3, + ], + [ + 'items' => [], + 'expectedResult' => 0, + ], + [ + 'items' => [1, 2, 3, 4, 5], + 'expectedResult' => 5, + ], + ]; + } } \ No newline at end of file