summaryrefslogtreecommitdiff
path: root/tests/Unit/Http/Validation/Rules/StringInputLengthTest.php
diff options
context:
space:
mode:
authorIgor Scheller <igor.scheller@igorshp.de>2019-10-07 21:59:40 +0200
committerIgor Scheller <igor.scheller@igorshp.de>2019-10-07 21:59:40 +0200
commit8d090438b659b641dd0f6cbc99193f3b48b2fc4b (patch)
tree030e2b069d4583e6ad6e498612c959c15850c8e6 /tests/Unit/Http/Validation/Rules/StringInputLengthTest.php
parentfaf74150e9481ad9338eb6cc2428d02b24e9fc43 (diff)
Validation rules: min/max/between: Use string length to compare strings
Diffstat (limited to 'tests/Unit/Http/Validation/Rules/StringInputLengthTest.php')
-rw-r--r--tests/Unit/Http/Validation/Rules/StringInputLengthTest.php37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/Unit/Http/Validation/Rules/StringInputLengthTest.php b/tests/Unit/Http/Validation/Rules/StringInputLengthTest.php
new file mode 100644
index 00000000..5c4dc512
--- /dev/null
+++ b/tests/Unit/Http/Validation/Rules/StringInputLengthTest.php
@@ -0,0 +1,37 @@
+<?php
+
+namespace Engelsystem\Test\Unit\Http\Validation\Rules;
+
+use Engelsystem\Test\Unit\Http\Validation\Rules\Stub\UsesStringInputLength;
+use Engelsystem\Test\Unit\TestCase;
+
+class StringInputLengthTest extends TestCase
+{
+ /**
+ * @covers \Engelsystem\Http\Validation\Rules\StringInputLength::validate
+ * @covers \Engelsystem\Http\Validation\Rules\StringInputLength::isDateTime
+ * @dataProvider validateProvider
+ * @param mixed $input
+ * @param mixed $expectedInput
+ */
+ public function testValidate($input, $expectedInput)
+ {
+ $rule = new UsesStringInputLength();
+ $rule->validate($input);
+
+ $this->assertEquals($expectedInput, $rule->lastInput);
+ }
+
+ /**
+ * @return array[]
+ */
+ public function validateProvider()
+ {
+ return [
+ ['TEST', 4],
+ ['?', 1],
+ ['2042-01-01 00:00', '2042-01-01 00:00'],
+ ['3', '3'],
+ ];
+ }
+}