From e42284deca807915e2d9c5a042fba4377d453ad8 Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Sun, 1 Mar 2020 02:39:06 +0100 Subject: [PATCH] Added Checked validation --- src/Http/Validation/Rules/Checked.php | 13 ++++++++ .../Http/Validation/Rules/CheckedTest.php | 32 +++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 src/Http/Validation/Rules/Checked.php create mode 100644 tests/Unit/Http/Validation/Rules/CheckedTest.php diff --git a/src/Http/Validation/Rules/Checked.php b/src/Http/Validation/Rules/Checked.php new file mode 100644 index 00000000..d4778919 --- /dev/null +++ b/src/Http/Validation/Rules/Checked.php @@ -0,0 +1,13 @@ +assertTrue($rule->validate('yes')); + $this->assertTrue($rule->validate('on')); + $this->assertTrue($rule->validate(1)); + $this->assertTrue($rule->validate('1')); + $this->assertTrue($rule->validate('true')); + $this->assertTrue($rule->validate(true)); + + $this->assertFalse($rule->validate('no')); + $this->assertFalse($rule->validate('off')); + $this->assertFalse($rule->validate(0)); + $this->assertFalse($rule->validate('0')); + $this->assertFalse($rule->validate('false')); + $this->assertFalse($rule->validate(false)); + $this->assertFalse($rule->validate(null)); + } +}