From 2e96aa886ef235021bb8a4214d4efc863862a599 Mon Sep 17 00:00:00 2001 From: kj Date: Mon, 14 Sep 2026 16:44:31 -0300 Subject: [PATCH] test(validator): rename enum rule to in --- tests/Unit/ValidatorTest.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/tests/Unit/ValidatorTest.php b/tests/Unit/ValidatorTest.php index e456053..348cb3e 100644 --- a/tests/Unit/ValidatorTest.php +++ b/tests/Unit/ValidatorTest.php @@ -81,10 +81,18 @@ final class ValidatorTest extends TestCase #[Test] - public function enumIsLooseComparison(): void + public function inIsLooseComparison(): void { - $this->assertTrue(Validator::checkRule('1', 'enum:1,2,3')); - $this->assertFalse(Validator::checkRule('9', 'enum:1,2,3')); + $this->assertTrue(Validator::checkRule('1', 'in:1,2,3')); + $this->assertFalse(Validator::checkRule('9', 'in:1,2,3')); + } + + #[Test] + + public function enumRuleIsNoLongerRecognized(): void + { + $this->expectException(\Exception::class); + Validator::checkRule('1', 'enum:1,2,3'); } #[Test] @@ -100,7 +108,7 @@ final class ValidatorTest extends TestCase public function parseRule(): void { $this->assertSame(['required', ''], Validator::parseRule('required')); - $this->assertSame(['enum', 'a,b'], Validator::parseRule('enum:a,b')); + $this->assertSame(['in', 'a,b'], Validator::parseRule('in:a,b')); $this->assertSame(['regex', '/^a,b$/'], Validator::parseRule('regex:/^a,b$/')); } @@ -168,7 +176,7 @@ final class ValidatorTest extends TestCase ); $this->assertSame( 'The selected status is invalid. Allowed: a, b, c.', - Validator::message('status.enum:a,b,c') + Validator::message('status.in:a,b,c') ); $this->assertSame( 'The reason field is required when mode is other.',