Skip to content

Commit

Permalink
#9
Browse files Browse the repository at this point in the history
  • Loading branch information
PiotrFedak committed Jun 5, 2024
1 parent e4b1e45 commit 6fd1493
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Features/Traits/Environment.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Behat\Gherkin\Node\TableNode;
use Blumilk\BLT\Bootstrapping\LaravelBootstrapper;
use Blumilk\BLT\Helpers\BooleanHelper;

trait Environment
{
Expand All @@ -21,7 +22,7 @@ public function castConfigBoolValues(TableNode $configTable): array
$value = $row["value"];

if (in_array($value, ["true", "false"], true)) {
$value = $value === "true";
$value = BooleanHelper::toBoolean($value);
}
$config[$key] = $value;
}
Expand Down
13 changes: 13 additions & 0 deletions src/Helpers/BooleanHelper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

declare(strict_types=1);

namespace Blumilk\BLT\Helpers;

class BooleanHelper
{
public static function toBoolean(string $value): bool
{
return filter_var($value, FILTER_VALIDATE_BOOLEAN);
}
}
13 changes: 13 additions & 0 deletions src/Helpers/NullableHelper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

declare(strict_types=1);

namespace Blumilk\BLT\Helpers;

class NullableHelper
{
public static function behatNull(string $nullable): ?string
{
return $nullable !== "null" ? $nullable : null;
}
}

0 comments on commit 6fd1493

Please sign in to comment.