MDL-48285 calendar: Adapting unit tests to the new behaviour
authorDavid Monllao <davidm@moodle.com>
Wed, 3 Dec 2014 07:24:15 +0000 (15:24 +0800)
committerDan Poltawski <dan@moodle.com>
Thu, 4 Dec 2014 12:14:31 +0000 (12:14 +0000)
Testing also the default value including repeated events.

calendar/tests/externallib_test.php

index b8582ab..4fb8764 100644 (file)
@@ -292,7 +292,7 @@ class core_calendar_externallib_testcase extends externallib_advanced_testcase {
         $events = external_api::clean_returnvalue(core_calendar_external::get_calendar_events_returns(), $events);
 
         // Check to see if we got all events.
-        $this->assertEquals(4, count($events['events']));
+        $this->assertEquals(5, count($events['events']));
         $this->assertEquals(0, count($events['warnings']));
         $options = array ('siteevents' => true, 'userevents' => true, 'timeend' => time() + 7*WEEKSECS);
         $events = core_calendar_external::get_calendar_events($paramevents, $options);
@@ -314,7 +314,7 @@ class core_calendar_externallib_testcase extends externallib_advanced_testcase {
         $this->assertEquals(4, count($events['events'])); // site, user, both course events.
         $this->assertEquals(1, count($events['warnings'])); // group.
 
-        $options = array ('siteevents' => true, 'userevents' => true);
+        $options = array ('siteevents' => true, 'userevents' => true, 'timeend' => time() + HOURSECS);
         $events = core_calendar_external::get_calendar_events($paramevents, $options);
         $events = external_api::clean_returnvalue(core_calendar_external::get_calendar_events_returns(), $events);
         $this->assertEquals(3, count($events['events'])); // site, user, one course event.