From 5914c8da771fbbb5a66086ccea31cec28e95a880 Mon Sep 17 00:00:00 2001 From: Kabirou ALASSANE Date: Fri, 17 Nov 2023 18:27:15 +0100 Subject: [PATCH] Fix tests failed issues --- src/Rules/{AcceptedIf.php => AcceptedIfRule.php} | 0 src/Rules/{ActiveURL.php => ActiveURLRule.php} | 0 tests/Feature/RuleTest.php | 15 ++++----------- 3 files changed, 4 insertions(+), 11 deletions(-) rename src/Rules/{AcceptedIf.php => AcceptedIfRule.php} (100%) rename src/Rules/{ActiveURL.php => ActiveURLRule.php} (100%) diff --git a/src/Rules/AcceptedIf.php b/src/Rules/AcceptedIfRule.php similarity index 100% rename from src/Rules/AcceptedIf.php rename to src/Rules/AcceptedIfRule.php diff --git a/src/Rules/ActiveURL.php b/src/Rules/ActiveURLRule.php similarity index 100% rename from src/Rules/ActiveURL.php rename to src/Rules/ActiveURLRule.php diff --git a/tests/Feature/RuleTest.php b/tests/Feature/RuleTest.php index c7b729b..63004c1 100644 --- a/tests/Feature/RuleTest.php +++ b/tests/Feature/RuleTest.php @@ -169,7 +169,7 @@ it('validates in rule successfully', function () { $validValues = ['value1', 'value2', 'value3']; - $validator = new InRule([$validValues]); + $validator = new InRule($validValues); expect($validator->passes('field', 'value2', []))->toBeTrue(); expect($validator->passes('field', 'invalidValue', []))->toBeFalse(); @@ -217,22 +217,15 @@ it('validates active URL rule successfully', function () { $validator = new ActiveURLRule([]); + $data = []; + // When the URL is valid and has an active DNS record, the validation should pass. - $data = [ - 'field' => 'https://www.example.com', - ]; - expect($validator->passes('field', 'https://www.example.com', $data))->toBeTrue(); + expect($validator->passes('field', 'https://example.com', $data))->toBeTrue(); // When the URL is valid but doesn't have an active DNS record, the validation should fail. - $data = [ - 'field' => 'https://nonexistent.example.com', - ]; expect($validator->passes('field', 'https://nonexistent.example.com', $data))->toBeFalse(); // When the URL is not valid, the validation should fail. - $data = [ - 'field' => 'invalid-url', - ]; expect($validator->passes('field', 'invalid-url', $data))->toBeFalse(); expect($validator->message())->toBe(