| Total Complexity | 7 |
| Total Lines | 53 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 10 | class DateTest extends TestCase |
||
| 11 | { |
||
| 12 | |||
| 13 | /** |
||
| 14 | * @dataProvider dataProvider |
||
| 15 | * |
||
| 16 | * @param string $dateString |
||
| 17 | * @param int $day |
||
| 18 | */ |
||
| 19 | public function testGetWeekDay(string $dateString, int $day) |
||
| 23 | } |
||
| 24 | |||
| 25 | |||
| 26 | public function dataProvider() |
||
| 35 | ]; |
||
| 36 | } |
||
| 37 | |||
| 38 | |||
| 39 | public function testCreateNow() |
||
| 40 | { |
||
| 41 | $date = ScheduleDate::createNow(); |
||
| 42 | $actualDayNumber = (int)date('N'); |
||
| 43 | if (date('H') < 4) { |
||
| 44 | $actualDayNumber = $actualDayNumber === 1 ? 7 : $actualDayNumber - 1; |
||
| 45 | } |
||
| 46 | |||
| 47 | $this->assertEquals($actualDayNumber, $date->getWeekDay()); |
||
| 48 | } |
||
| 49 | |||
| 50 | |||
| 51 | public function testCreateWeekend() |
||
| 52 | { |
||
| 53 | $date = ScheduleDate::createWeekend(); |
||
| 54 | $this->assertEquals(7, $date->getWeekDay()); |
||
| 55 | $this->assertTrue($date->isWeekend()); |
||
| 56 | } |
||
| 57 | |||
| 58 | |||
| 59 | public function testCreateWorkday() |
||
| 63 | } |
||
| 64 | } |
||
| 65 |