summaryrefslogtreecommitdiff
path: root/tests/Unit/Http/Validation/Rules/MaxTest.php
blob: 3f4d95163b5e7720ab2dcde14fc4240e6ec999e1 (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\Max;
use Engelsystem\Test\Unit\TestCase;

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

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