| Total Complexity | 5 |
| Total Lines | 54 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | class DayInMonthTest extends TestCase |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * @test |
||
| 15 | * @expectedException \TypeError |
||
| 16 | */ |
||
| 17 | public function constructor_GivenInvalidDayInMonthType_ShouldThrowTypeErrorException() |
||
| 18 | { |
||
| 19 | new DayInMonth('invalid'); |
||
|
|
|||
| 20 | } |
||
| 21 | |||
| 22 | public function getInvalidDayDataProvider() |
||
| 23 | { |
||
| 24 | return [ |
||
| 25 | [0], |
||
| 26 | [32], |
||
| 27 | ]; |
||
| 28 | } |
||
| 29 | |||
| 30 | /** |
||
| 31 | * @test |
||
| 32 | * @dataProvider getInvalidDayDataProvider |
||
| 33 | * @expectedException \Exception |
||
| 34 | * @param int $day |
||
| 35 | */ |
||
| 36 | public function constructor_GivenInvalidDay_ShouldThrowAnException(int $day) |
||
| 37 | { |
||
| 38 | new DayInMonth($day); |
||
| 39 | } |
||
| 40 | |||
| 41 | /** |
||
| 42 | * @test |
||
| 43 | */ |
||
| 44 | public function includes_GivenDateAtSameMonthDay_ShouldReturnTrue() |
||
| 45 | { |
||
| 46 | $date = new DateTime('2015-04-12'); |
||
| 47 | $expr = new DayInMonth(12); |
||
| 48 | |||
| 49 | $isIncluded = $expr->includes($date); |
||
| 50 | |||
| 51 | $this->assertThat($isIncluded, $this->isTrue()); |
||
| 52 | } |
||
| 53 | |||
| 54 | /** |
||
| 55 | * @test |
||
| 56 | */ |
||
| 57 | public function includes_GivenDateAtDifferentMonthDay_ShouldReturnFalse() |
||
| 65 | } |
||
| 66 | } |
||
| 67 |