diff --git a/composer.json b/composer.json index 0ad0c5e..39f88fe 100644 --- a/composer.json +++ b/composer.json @@ -40,7 +40,7 @@ "scripts": { "test": "phpunit" }, - "version": "2.1.7", + "version": "2.1.8", "config": { "platform": { "php": "8.0" diff --git a/composer.lock b/composer.lock index 574acb6..d0985dc 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "24c08f7285b85900f049559ef8ae5d36", + "content-hash": "27fc028f22fea63ea3b5a5868cfdca3d", "packages": [ { "name": "brick/math", @@ -1151,16 +1151,16 @@ }, { "name": "nikic/php-parser", - "version": "v5.6.1", + "version": "v5.6.2", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "f103601b29efebd7ff4a1ca7b3eeea9e3336a2a2" + "reference": "3a454ca033b9e06b63282ce19562e892747449bb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/f103601b29efebd7ff4a1ca7b3eeea9e3336a2a2", - "reference": "f103601b29efebd7ff4a1ca7b3eeea9e3336a2a2", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/3a454ca033b9e06b63282ce19562e892747449bb", + "reference": "3a454ca033b9e06b63282ce19562e892747449bb", "shasum": "" }, "require": { @@ -1203,9 +1203,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v5.6.1" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.6.2" }, - "time": "2025-08-13T20:13:15+00:00" + "time": "2025-10-21T19:32:17+00:00" }, { "name": "phar-io/manifest", @@ -2768,16 +2768,16 @@ }, { "name": "theseer/tokenizer", - "version": "1.2.3", + "version": "1.3.1", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2" + "reference": "b7489ce515e168639d17feec34b8847c326b0b3c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", - "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/b7489ce515e168639d17feec34b8847c326b0b3c", + "reference": "b7489ce515e168639d17feec34b8847c326b0b3c", "shasum": "" }, "require": { @@ -2806,7 +2806,7 @@ "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", "support": { "issues": "https://github.com/theseer/tokenizer/issues", - "source": "https://github.com/theseer/tokenizer/tree/1.2.3" + "source": "https://github.com/theseer/tokenizer/tree/1.3.1" }, "funding": [ { @@ -2814,7 +2814,7 @@ "type": "github" } ], - "time": "2024-03-03T12:36:25+00:00" + "time": "2025-11-17T20:03:58+00:00" } ], "aliases": [], diff --git a/src/Config/ConfigLoader.php b/src/Config/ConfigLoader.php index 66b4c2d..0d2262d 100644 --- a/src/Config/ConfigLoader.php +++ b/src/Config/ConfigLoader.php @@ -131,7 +131,7 @@ private function overrideWithEnvVariables(): void $this->config->setRootSuite($value); break; case "qase_debug": - $this->config->setDebug($value); + $this->config->setDebug(filter_var($value, FILTER_VALIDATE_BOOLEAN)); break; case "qase_logging_console": $this->parseLoggingConsole($value); @@ -146,7 +146,7 @@ private function overrideWithEnvVariables(): void $this->config->testops->setProject($value); break; case "qase_testops_defect": - $this->config->testops->setDefect($value); + $this->config->testops->setDefect(filter_var($value, FILTER_VALIDATE_BOOLEAN)); break; case "qase_testops_show_public_report_link": $this->config->testops->setShowPublicReportLink(filter_var($value, FILTER_VALIDATE_BOOLEAN)); @@ -167,7 +167,7 @@ private function overrideWithEnvVariables(): void $this->config->testops->run->setDescription($value); break; case "qase_testops_run_complete": - $this->config->testops->run->setComplete($value); + $this->config->testops->run->setComplete(filter_var($value, FILTER_VALIDATE_BOOLEAN)); break; case "qase_testops_run_tags": $this->config->testops->run->setTags(array_map('trim', explode(',', $value))); @@ -188,7 +188,7 @@ private function overrideWithEnvVariables(): void $this->parseConfigurationValues($value); break; case "qase_testops_configurations_create_if_not_exists": - $this->config->testops->configurations->setCreateIfNotExists($value); + $this->config->testops->configurations->setCreateIfNotExists(filter_var($value, FILTER_VALIDATE_BOOLEAN)); break; case "qase_testops_status_filter": $this->parseStatusFilter($value); diff --git a/tests/ConfigLoaderTest.php b/tests/ConfigLoaderTest.php index 01d7df3..4ff058f 100644 --- a/tests/ConfigLoaderTest.php +++ b/tests/ConfigLoaderTest.php @@ -155,4 +155,84 @@ public function testStatusFilterFromEnvEmpty(): void // Clean up putenv('QASE_TESTOPS_STATUS_FILTER'); } + + /** + * @dataProvider booleanProvider + */ + public function testDebugFromEnv(bool $expected): void + { + // Set environment variable with spaces + putenv("QASE_DEBUG=$expected"); + + $configLoader = new ConfigLoader($this->logger); + $config = $configLoader->getConfig(); + + $debug = $config->getDebug(); + $this->assertEquals($expected, $debug); + + // Clean up + putenv('QASE_DEBUG'); + } + + /** + * @dataProvider booleanProvider + */ + public function testDefectFromEnv(bool $expected): void + { + // Set environment variable with spaces + putenv("QASE_TESTOPS_DEFECT=$expected"); + + $configLoader = new ConfigLoader($this->logger); + $config = $configLoader->getConfig(); + + $isDefect = $config->testops->isDefect(); + $this->assertEquals($expected, $isDefect); + + // Clean up + putenv('QASE_TESTOPS_DEFECT'); + } + + /** + * @dataProvider booleanProvider + */ + public function testRunCompleteFromEnv(bool $expected): void + { + // Set environment variable with spaces + putenv("QASE_TESTOPS_RUN_COMPLETE=$expected"); + + $configLoader = new ConfigLoader($this->logger); + $config = $configLoader->getConfig(); + + $isComplete = $config->testops->run->isComplete(); + $this->assertEquals($expected, $isComplete); + + // Clean up + putenv('QASE_TESTOPS_RUN_COMPLETE'); + } + + /** + * @dataProvider booleanProvider + */ + public function testCreateConfigurationsIfNotExistFromEnv(bool $expected): void + { + // Set environment variable with spaces + putenv("QASE_TESTOPS_CONFIGURATIONS_CREATE_IF_NOT_EXISTS=$expected"); + + $configLoader = new ConfigLoader($this->logger); + $config = $configLoader->getConfig(); + + $isCreateIfNotExists = $config->testops->configurations->isCreateIfNotExists(); + $this->assertEquals($expected, $isCreateIfNotExists); + + // Clean up + putenv('QASE_TESTOPS_CONFIGURATIONS_CREATE_IF_NOT_EXISTS'); + } + + public static function booleanProvider(): array + { + return [ + [true], + [false], + ]; + } }