From 76db32a24e53e50959aadce5810f24e1b2cdf39a Mon Sep 17 00:00:00 2001 From: Daniel Winning Date: Thu, 10 Apr 2025 04:02:47 +0100 Subject: [PATCH 1/5] Minor package description update --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 12d7b94..2186c99 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "loomlabs/utility.collection", - "description": "An object-oriented way to work with arrays", + "description": "An object-oriented way to work with arrays.", "autoload": { "psr-4": { "Loom\\Utility\\Collection\\": "src/" From 69eed6681a7bc35171db6aeb219f0eefde80c008 Mon Sep 17 00:00:00 2001 From: Daniel Winning Date: Thu, 10 Apr 2025 04:11:14 +0100 Subject: [PATCH 2/5] Implement code coverage and badges --- .gitattributes | 3 ++- .gitignore | 3 +++ README.md | 9 +++++++++ composer.json | 3 +++ package.json | 5 +++++ 5 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 package.json diff --git a/.gitattributes b/.gitattributes index 7c5444c..08c377c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,3 +1,4 @@ phpunit.xml export-ignore tests/ export-ignore -CHANGELOG.md export-ignore \ No newline at end of file +CHANGELOG.md export-ignore +package.json export-ignore \ No newline at end of file diff --git a/.gitignore b/.gitignore index 62ead3c..d51e7cc 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,7 @@ /.idea /vendor +/node_modules +/coverage composer.lock +package-lock.json .phpunit.result.cache \ No newline at end of file diff --git a/README.md b/README.md index 5459b52..f7be89b 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,14 @@ # Loom Utilities | Collection +
+ +Version 1.0.1 + +PHP Coverage 88.24% + +License MIT +
+ A Collection library for an object-oriented way to work with arrays. ## Installation diff --git a/composer.json b/composer.json index 2186c99..86aeff8 100644 --- a/composer.json +++ b/composer.json @@ -11,6 +11,9 @@ "Loom\\Utility\\Collection\\Tests\\": "tests/" } }, + "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", "license": "MIT", "require-dev": { diff --git a/package.json b/package.json new file mode 100644 index 0000000..e77a1de --- /dev/null +++ b/package.json @@ -0,0 +1,5 @@ +{ + "devDependencies": { + "@dannyxcii/badger": "^0.5.0" + } +} From b9c90339b41c89b88ccd1f4211f68d0f4a27cc1e Mon Sep 17 00:00:00 2001 From: Daniel Winning Date: Thu, 10 Apr 2025 04:12:42 +0100 Subject: [PATCH 3/5] Update encoding in PHP Coverage badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f7be89b..841033b 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Version 1.0.1 -PHP Coverage 88.24% +PHP Coverage 88.24% License MIT From 787b91e880df3fe95be9976b5731bf148e612977 Mon Sep 17 00:00:00 2001 From: Daniel Winning Date: Thu, 10 Apr 2025 04:17:42 +0100 Subject: [PATCH 4/5] 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 [ From a986b85d2ffc73d00f3c2cdb4b4948491eab7e27 Mon Sep 17 00:00:00 2001 From: Daniel Winning Date: Thu, 10 Apr 2025 04:19:13 +0100 Subject: [PATCH 5/5] Update CHANGELOG --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0432230..773df51 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.0.2] - 2025-04-10 +### Changed +- Increased unit test coverage to 100% + ## [1.0.1] - 2025-04-10 ### Added - Added description to `composer.json` to provide a description on Packagist.