MDL-58810 calendar: Add coverage for UUID in recurring events
authorJun Pataleta <jun@moodle.com>
Thu, 4 May 2017 02:23:38 +0000 (10:23 +0800)
committerJun Pataleta <jun@moodle.com>
Mon, 8 May 2017 01:33:47 +0000 (09:33 +0800)
calendar/tests/rrule_manager_test.php

index 9178329..3c3e7c0 100644 (file)
@@ -466,11 +466,21 @@ class core_calendar_rrule_manager_testcase extends advanced_testcase {
         $records = $DB->get_records('event', array('repeatid' => $this->event->id), 'timestart ASC');
 
         $expecteddate = clone($startdatetime);
+        $first = true;
         foreach ($records as $record) {
             $this->assertLessThanOrEqual($until, $record->timestart);
             $this->assertEquals($expecteddate->format('Y-m-d H:i:s'), date('Y-m-d H:i:s', $record->timestart));
             // Go to next iteration.
             $expecteddate->add($interval);
+            // Check UUID.
+            if ($first) {
+                // The first instance of the event contains the UUID.
+                $this->assertEquals('uuid', $record->uuid);
+                $first = false;
+            } else {
+                // Succeeding instances will not contain the UUID.
+                $this->assertEmpty($record->uuid);
+            }
         }
     }