Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"scripts": {
"test": "phpunit"
},
"version": "2.1.7",
"version": "2.1.8",
"config": {
"platform": {
"php": "8.0"
Expand Down
26 changes: 13 additions & 13 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions src/Config/ConfigLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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));
Expand All @@ -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)));
Expand All @@ -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);
Expand Down
80 changes: 80 additions & 0 deletions tests/ConfigLoaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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],
];
}
}