Skip to content

Commit

Permalink
use filter_var for skip config (#60)
Browse files Browse the repository at this point in the history
  • Loading branch information
tudorrrrrr authored Sep 19, 2022
1 parent 7a765fa commit 3f98bd0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ClamavValidator/ClamavValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function __construct(
*/
public function validateClamav(string $attribute, $value, array $parameters): bool
{
if (true === Config::get('clamav.skip_validation')) {
if (filter_var(Config::get('clamav.skip_validation'), FILTER_VALIDATE_BOOLEAN)) {
return true;
}

Expand Down
14 changes: 14 additions & 0 deletions tests/ClamavValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,20 @@ public function testValidatesSkipped()
$this->assertTrue($validator->passes());
}

public function testValidatesSkippedForBoolValidatedConfigValues()
{
$this->setConfig(['skip' => '1']);

$validator = new ClamavValidator(
$this->translator,
$this->clean_data,
['file' => 'clamav'],
$this->messages
);

$this->assertTrue($validator->passes());
}

public function testValidatesClean()
{
$this->setConfig();
Expand Down

0 comments on commit 3f98bd0

Please sign in to comment.