/** * @dataProvider monthsDeltaProvider * * @covers ::addMonths * * @param string $givenDate * @param int $monthDelta * @param int $expectedMonth * @param string $expectedDate */ public function test_addMonths($givenDate, $monthDelta, $expectedMonth, $expectedDate) { // Given $dt = new DateTime($givenDate); // When $dt->addMonths($monthDelta); // Then $this->assertSame($expectedDate, $dt->format()); $this->assertSame($expectedMonth, $dt->getMonth()); $this->assertSame('00:00:00', $dt->format('H:i:s')); }