summaryrefslogtreecommitdiff
path: root/tests/Unit/Http/Validation/Rules/MinTest.php
blob: 563508029745ee23ad2e6bd7728b349d6044d9db (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
<?php

namespace Engelsystem\Test\Unit\Http\Validation\Rules;

use Engelsystem\Http\Validation\Rules\Min;
use Engelsystem\Test\Unit\TestCase;

class MinTest extends TestCase
{
    /**
     * @covers \Engelsystem\Http\Validation\Rules\Min
     */
    public function testValidate()
    {
        $rule = new Min(3);
        $this->assertFalse($rule->validate(1));
        $this->assertFalse($rule->validate('2'));
        $this->assertTrue($rule->validate(3));
        $this->assertFalse($rule->validate('AS'));
        $this->assertTrue($rule->validate('TEST'));

        $rule = new Min('2042-01-01');
        $this->assertFalse($rule->validate('2000-01-01'));
        $this->assertTrue($rule->validate('2345-01-01'));
    }
}