diff --git a/composer.json b/composer.json index fbdbba7..459ed3e 100644 --- a/composer.json +++ b/composer.json @@ -28,13 +28,6 @@ } ], - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/PhpGt" - } - ], - "autoload": { "psr-4": { "Gt\\Config\\": "./src" @@ -44,5 +37,26 @@ "psr-4": { "Gt\\Config\\Test\\": "./test/phpunit" } - } + }, + + "scripts": { + "phpunit": "vendor/bin/phpunit --configuration phpunit.xml", + "phpunit:coverage": "XDEBUG_MODE=coverage vendor/bin/phpunit --configuration phpunit.xml --coverage-text", + "phpstan": "vendor/bin/phpstan analyse --level 6 src", + "phpcs": "vendor/bin/phpcs src --standard=phpcs.xml", + "phpmd": "vendor/bin/phpmd src/ text phpmd.xml", + "test": [ + "@phpunit", + "@phpstan", + "@phpcs", + "@phpmd" + ] + }, + + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/PhpGt" + } + ] } diff --git a/composer.lock b/composer.lock index efe49a4..ce4356e 100644 --- a/composer.lock +++ b/composer.lock @@ -1534,16 +1534,16 @@ }, { "name": "sebastian/environment", - "version": "8.0.3", + "version": "8.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "24a711b5c916efc6d6e62aa65aa2ec98fef77f68" + "reference": "7b8842c2d8e85d0c3a5831236bf5869af6ab2a11" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/24a711b5c916efc6d6e62aa65aa2ec98fef77f68", - "reference": "24a711b5c916efc6d6e62aa65aa2ec98fef77f68", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/7b8842c2d8e85d0c3a5831236bf5869af6ab2a11", + "reference": "7b8842c2d8e85d0c3a5831236bf5869af6ab2a11", "shasum": "" }, "require": { @@ -1586,7 +1586,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/environment/issues", "security": "https://github.com/sebastianbergmann/environment/security/policy", - "source": "https://github.com/sebastianbergmann/environment/tree/8.0.3" + "source": "https://github.com/sebastianbergmann/environment/tree/8.0.4" }, "funding": [ { @@ -1606,7 +1606,7 @@ "type": "tidelift" } ], - "time": "2025-08-12T14:11:56+00:00" + "time": "2026-03-15T07:05:40+00:00" }, { "name": "sebastian/exporter", diff --git a/src/ConfigSection.php b/src/ConfigSection.php index 226586b..fd03d85 100644 --- a/src/ConfigSection.php +++ b/src/ConfigSection.php @@ -86,4 +86,9 @@ public function offsetUnset($offset):void { public function getName():string { return $this->name; } + + /** @return array */ + public function asArray():array { + return $this->data; + } } diff --git a/test/phpunit/ConfigFactoryConfigTest.php b/test/phpunit/ConfigFactoryTest.php similarity index 97% rename from test/phpunit/ConfigFactoryConfigTest.php rename to test/phpunit/ConfigFactoryTest.php index ac6ac9f..acd5e02 100644 --- a/test/phpunit/ConfigFactoryConfigTest.php +++ b/test/phpunit/ConfigFactoryTest.php @@ -4,7 +4,7 @@ use Gt\Config\ConfigFactory; use Gt\Config\Test\Helper\Helper; -class ConfigFactoryConfigTest extends ConfigTestCase { +class ConfigFactoryTest extends ConfigTestCase { public function testCreateForProject():void { $filePath = implode(DIRECTORY_SEPARATOR, [ $this->tmp, diff --git a/test/phpunit/ConfigSectionConfigTest.php b/test/phpunit/ConfigSectionTest.php similarity index 90% rename from test/phpunit/ConfigSectionConfigTest.php rename to test/phpunit/ConfigSectionTest.php index 3827ab7..87b2a22 100644 --- a/test/phpunit/ConfigSectionConfigTest.php +++ b/test/phpunit/ConfigSectionTest.php @@ -4,7 +4,7 @@ use Gt\Config\ConfigSection; use BadMethodCallException; -class ConfigSectionConfigTest extends ConfigTestCase { +class ConfigSectionTest extends ConfigTestCase { public function testGet() { $data = [ "name" => "unit test", @@ -86,4 +86,14 @@ public function testWith() { self::assertNull($sutOriginal->get("added")); self::assertEquals("new value", $sut->get("added")); } + + public function testAsArray():void { + $data = [ + "name" => "unit test", + "number" => "123", + ]; + + $sut = new ConfigSection("example", $data); + self::assertSame($data, $sut->asArray()); + } }