From d356128f05b23e399fcd0bbdf28259719ef82095 Mon Sep 17 00:00:00 2001 From: Jun Pataleta Date: Wed, 7 Jun 2017 23:09:17 +0800 Subject: [PATCH] MDL-59101 calendar: Properly calculate expected until date --- calendar/tests/rrule_manager_test.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/calendar/tests/rrule_manager_test.php b/calendar/tests/rrule_manager_test.php index f14eb724a67..ca285085b86 100644 --- a/calendar/tests/rrule_manager_test.php +++ b/calendar/tests/rrule_manager_test.php @@ -705,7 +705,9 @@ class core_calendar_rrule_manager_testcase extends advanced_testcase { $rrule = "FREQ=MONTHLY;INTERVAL=12;BYMONTHDAY=2"; $mang = new rrule_manager($rrule); - $until = time() + (YEARSECS * $mang::TIME_UNLIMITED_YEARS); + $untildate = new DateTime(); + $untildate->add(new DateInterval('P' . $mang::TIME_UNLIMITED_YEARS . 'Y')); + $until = $untildate->getTimestamp(); $mang->parse_rrule(); $mang->create_events($this->event); @@ -860,7 +862,9 @@ class core_calendar_rrule_manager_testcase extends advanced_testcase { $rrule = "FREQ=MONTHLY;INTERVAL=12;BYDAY=1MO"; $mang = new rrule_manager($rrule); - $until = time() + (YEARSECS * $mang::TIME_UNLIMITED_YEARS); + $untildate = new DateTime(); + $untildate->add(new DateInterval('P' . $mang::TIME_UNLIMITED_YEARS . 'Y')); + $until = $untildate->getTimestamp(); $mang->parse_rrule(); $mang->create_events($this->event);