MDL-59093 calendar: Use a fixed start day for forever BYMONTH test
authorJun Pataleta <jun@moodle.com>
Wed, 31 May 2017 07:01:34 +0000 (15:01 +0800)
committerJun Pataleta <jun@moodle.com>
Wed, 31 May 2017 07:01:34 +0000 (15:01 +0800)
calendar/tests/rrule_manager_test.php

index 2c050f4..f14eb72 100644 (file)
@@ -1024,8 +1024,8 @@ class core_calendar_rrule_manager_testcase extends advanced_testcase {
     public function test_yearly_september_every_two_years_forever() {
         global $DB;
 
-        // Change the start date for forever events to 9am on the month of September of the current year using the current day.
-        $this->change_event_startdate(date('Y09d\T090000'));
+        // Change the start date for forever events to 9am on the 2nd day of September of the current year.
+        $this->change_event_startdate(date('Y0902\T090000'));
 
         $rrule = "FREQ=YEARLY;BYMONTH=9;INTERVAL=2"; // Forever event.
         $mang = new rrule_manager($rrule);
@@ -1038,7 +1038,7 @@ class core_calendar_rrule_manager_testcase extends advanced_testcase {
         $records = $DB->get_records('event', ['repeatid' => $this->event->id], 'timestart ASC', 'id, repeatid, timestart');
 
         $interval = new DateInterval('P2Y');
-        $expecteddate = new DateTime(date('Y09d\T090000'));
+        $expecteddate = new DateTime(date('Y0902\T090000'));
         foreach ($records as $record) {
             $this->assertLessThanOrEqual($untiltimestamp, $record->timestart);
             $this->assertEquals($expecteddate->format('Y-m-d H:i:s'), date('Y-m-d H:i:s', $record->timestart));