Increase unit test coverage to 100%

This commit is contained in:
Daniel Winning 2025-04-10 04:17:42 +01:00
parent b9c90339b4
commit 787b91e880
4 changed files with 15 additions and 4 deletions

3
.gitattributes vendored
View file

@ -1,4 +1,5 @@
phpunit.xml export-ignore phpunit.xml export-ignore
tests/ export-ignore tests/ export-ignore
CHANGELOG.md export-ignore CHANGELOG.md export-ignore
package.json export-ignore package.json export-ignore
.gitignore export-ignore

View file

@ -2,9 +2,9 @@
<div> <div>
<!-- Version Badge --> <!-- Version Badge -->
<img src="https://img.shields.io/badge/Version-1.0.1-blue" alt="Version 1.0.1"> <img src="https://img.shields.io/badge/Version-1.0.2-blue" alt="Version 1.0.2">
<!-- PHP Coverage Badge --> <!-- PHP Coverage Badge -->
<img src="https://img.shields.io/badge/PHP%20Coverage-88.24%25-yellow" alt="PHP Coverage 88.24%"> <img src="https://img.shields.io/badge/PHP%20Coverage-100.00%25-green" alt="PHP Coverage 100.00%">
<!-- License Badge --> <!-- License Badge -->
<img src="https://img.shields.io/badge/License-MIT-34ad9b" alt="License MIT"> <img src="https://img.shields.io/badge/License-MIT-34ad9b" alt="License MIT">
</div> </div>

View file

@ -14,7 +14,7 @@
"scripts": { "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" "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", "license": "MIT",
"require-dev": { "require-dev": {
"phpunit/phpunit": "^12.1" "phpunit/phpunit": "^12.1"

View file

@ -35,6 +35,16 @@ class CollectionTest extends TestCase
$this->assertEquals($expectedResult, $collection->count()); $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 public static function addDataProvider(): array
{ {
return [ return [