/** * @param DateTimeParseResult $result * * @return MonthDay * * @throws DateTimeException If the month-day is not valid. * @throws DateTimeParseException If required fields are missing from the result. */ public static function from(DateTimeParseResult $result) { return MonthDay::of((int) $result->getField(Field\MonthOfYear::NAME), (int) $result->getField(Field\DayOfMonth::NAME)); }
/** * @dataProvider providerAtMonthDay * * @param integer $year The base year. * @param integer $month The month-of-year of the month-day to apply. * @param integer $day The day-of-month of the month-day to apply. * @param integer $expectedDay The expected day of the resulting date. */ public function testAtMonthDay($year, $month, $day, $expectedDay) { $monthDay = MonthDay::of($month, $day); $this->assertLocalDateIs($year, $month, $expectedDay, Year::of($year)->atMonthDay($monthDay)); }
/** * @dataProvider providerToString * * @param integer $month The month of the month-day to test. * @param integer $day The day of the month-day to test. * @param string $string The expected result string. */ public function testToString($month, $day, $string) { $this->assertSame($string, (string) MonthDay::of($month, $day)); }