Skip to content

Commit

Permalink
Properly handle boolean values set to false
Browse files Browse the repository at this point in the history
  • Loading branch information
victorsfleite committed Feb 19, 2024
1 parent c82edec commit b351129
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Checks/PreflightCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ protected function checkConfig(Result $result): Result
$missingKeys = [];

foreach ($this->requiredConfig as $configKey) {
if (! config()->has($configKey) || empty(config($configKey))) {
if (! config()->has($configKey) || ! is_bool(config($configKey)) && empty(config($configKey))) {
$missingKeys[] = $configKey;
}
}
Expand Down
13 changes: 13 additions & 0 deletions tests/Checks/ConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,19 @@ public function testPassesWhenConfigIsSet()
$this->assertPassed($result);
}

/**
* @test
*/
public function testPassesWhenConfigIsBooleanAndSetToFalse()
{
$config = ['test1' => false];
config($config);
$preflightCheck = new Configuration(array_keys($config));

$result = $preflightCheck->check(new Result('Test\Test'));
$this->assertPassed($result);
}

/**
* @test
*/
Expand Down

0 comments on commit b351129

Please sign in to comment.