Completed
Push — master ( 3d7536...3ced6b )
by Marcin
02:56
created

DateTest::testDateInvalid()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 4
rs 10
c 1
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
/**
3
 * Validator
4
 *
5
 * Copyright (c) 2017 pudelek.org.pl
6
 *
7
 * @license MIT License (MIT)
8
 *
9
 * For the full copyright and license information, please view source file
10
 * that is bundled with this package in the file LICENSE
11
 *
12
 * @author Marcin Pudełek <[email protected]>
13
 */
14
15
namespace mrcnpdlk\Validator;
16
17
18
use mrcnpdlk\Validator\Types\Date;
19
20
class DateTest extends TestCase
21
{
22
    public function testPnaValidShort()
23
    {
24
        $defNr = '2017-10-01';
25
        $this->assertTrue(Date::isValid($defNr, false));
26
        $res   = new Date($defNr);
27
        $this->assertEquals('2017-10-01', $res->get());
28
        $this->assertEquals('2017', $res->getYear());
29
        $this->assertEquals('10', $res->getMonth());
30
        $this->assertEquals('01', $res->getDay());
31
    }
32
33
    /**
34
     * @expectedException \mrcnpdlk\Validator\Exception
35
     */
36
    public function testDateInvalid()
37
    {
38
        Date::isValid('2017-10-34', true);
39
    }
40
41
}
42