Total Complexity | 2 |
Total Lines | 19 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
19 | class DateTest extends \PHPUnit\Framework\TestCase |
||
20 | { |
||
21 | protected $date; |
||
22 | protected $year = '2018'; |
||
23 | protected $month = '11'; |
||
24 | |||
25 | protected function setUp(): void |
||
26 | { |
||
27 | $this->date = new DateTimeImmutable($this->year . '-' . $this->month . '-01'); |
||
28 | } |
||
29 | |||
30 | public function testEnsureValidValue() |
||
31 | { |
||
32 | $year = $this->year; |
||
33 | $month = $this->month; |
||
34 | $this->assertEquals($this->date, Date::ensureValidValue("$year-$month")); |
||
35 | $this->assertEquals($this->date, Date::ensureValidValue("$year-$month-01")); |
||
36 | $this->assertEquals($this->date, Date::ensureValidValue("$month.$year")); |
||
37 | $this->assertEquals($this->date, Date::ensureValidValue("1.$month.$year")); |
||
38 | } |
||
40 |