summaryrefslogtreecommitdiff
path: root/tests/Unit/Http/Validation/Rules/StringInputLengthTest.php
blob: 5c4dc512f4b90ff69716de1fd583adc88d8bb67a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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'],
        ];
    }
}