getMonths()); self::assertSame($date, $sut->getYear()); $months = [31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; foreach($months as $key => $days) { $index = ++$key; $monthKey = ($index < 10) ? '0' . $index : $index; $month = $sut->getMonth(new \DateTimeImmutable(sprintf('2020-%s-13 13:00:00', $monthKey))); self::assertEquals(sprintf('2020-%s-01', $monthKey), $month->getMonth()->format('Y-m-d')); self::assertCount($days, $month->getDays()); } } }