summaryrefslogtreecommitdiff
path: root/tests/Unit/Http/Validation/Rules/BetweenTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Unit/Http/Validation/Rules/BetweenTest.php')
-rw-r--r--tests/Unit/Http/Validation/Rules/BetweenTest.php28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/Unit/Http/Validation/Rules/BetweenTest.php b/tests/Unit/Http/Validation/Rules/BetweenTest.php
new file mode 100644
index 00000000..130d2f93
--- /dev/null
+++ b/tests/Unit/Http/Validation/Rules/BetweenTest.php
@@ -0,0 +1,28 @@
+<?php
+
+namespace Engelsystem\Test\Unit\Http\Validation\Rules;
+
+use Engelsystem\Http\Validation\Rules\Between;
+use Engelsystem\Test\Unit\TestCase;
+
+class BetweenTest extends TestCase
+{
+ /**
+ * @covers \Engelsystem\Http\Validation\Rules\Between
+ */
+ public function testValidate()
+ {
+ $rule = new Between(3, 10);
+ $this->assertFalse($rule->validate(1));
+ $this->assertFalse($rule->validate('11'));
+ $this->assertTrue($rule->validate(5));
+ $this->assertFalse($rule->validate('AS'));
+ $this->assertFalse($rule->validate('TestContentThatCounts'));
+ $this->assertTrue($rule->validate('TESTING'));
+
+ $rule = new Between('2042-01-01', '2042-10-10');
+ $this->assertFalse($rule->validate('2000-01-01'));
+ $this->assertFalse($rule->validate('3000-01-01'));
+ $this->assertTrue($rule->validate('2042-05-11'));
+ }
+}