From 787b91e880df3fe95be9976b5731bf148e612977 Mon Sep 17 00:00:00 2001 From: Daniel Winning Date: Thu, 10 Apr 2025 04:17:42 +0100 Subject: [PATCH] Increase unit test coverage to 100% --- .gitattributes | 3 ++- README.md | 4 ++-- composer.json | 2 +- tests/CollectionTest.php | 10 ++++++++++ 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.gitattributes b/.gitattributes index 08c377c..24dd05c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,4 +1,5 @@ phpunit.xml export-ignore tests/ export-ignore CHANGELOG.md export-ignore -package.json export-ignore \ No newline at end of file +package.json export-ignore +.gitignore export-ignore \ No newline at end of file diff --git a/README.md b/README.md index 841033b..b294f7c 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,9 @@
-Version 1.0.1 +Version 1.0.2 -PHP Coverage 88.24% +PHP Coverage 100.00% License MIT
diff --git a/composer.json b/composer.json index 86aeff8..70bacd0 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ "scripts": { "test": "php -d xdebug.mode=coverage ./vendor/bin/phpunit --testdox --colors=always --coverage-html coverage --coverage-clover coverage/coverage.xml --testdox-html coverage/testdox.html && npx badger --phpunit ./coverage/coverage.xml && npx badger --version ./composer.json && npx badger --license ./composer.json" }, - "version": "1.0.1", + "version": "1.0.2", "license": "MIT", "require-dev": { "phpunit/phpunit": "^12.1" diff --git a/tests/CollectionTest.php b/tests/CollectionTest.php index ae3379c..d740e71 100644 --- a/tests/CollectionTest.php +++ b/tests/CollectionTest.php @@ -35,6 +35,16 @@ class CollectionTest extends TestCase $this->assertEquals($expectedResult, $collection->count()); } + public function testIteration(): void + { + $array = ['A', 'B', 'C']; + $collection = new Collection($array); + + foreach ($collection as $key => $value) { + $this->assertEquals($array[$key], $value); + } + } + public static function addDataProvider(): array { return [