diff --git a/Model/Rule.php b/Model/Rule.php index 8f7a979..d7170de 100644 --- a/Model/Rule.php +++ b/Model/Rule.php @@ -122,6 +122,6 @@ public function matches(RequestInterface $request): bool return false; } } - return true; + return count($this->conditions) > 0; } } diff --git a/Test/Model/RuleTest.php b/Test/Model/RuleTest.php index 5f1b0a6..4229210 100644 --- a/Test/Model/RuleTest.php +++ b/Test/Model/RuleTest.php @@ -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))); + } }