Skip to content

Commit

Permalink
don't match if there are no conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
danslo committed Feb 10, 2025
1 parent 2437f78 commit 62bf16c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Model/Rule.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,6 @@ public function matches(RequestInterface $request): bool
return false;
}
}
return true;
return count($this->conditions) > 0;
}
}
6 changes: 6 additions & 0 deletions Test/Model/RuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,10 @@ public function testRuleWithMultipleConditions()

$this->assertTrue($rule->matches($request));
}

public function testRuleWithoutConditions()
{
$rule = new Rule(new IP(), 'block', []);
$this->assertFalse($rule->matches($this->createMock(Http::class)));
}
}

0 comments on commit 62bf16c

Please sign in to comment.