Skip to content

Commit

Permalink
Merge branch 'MDL-59810-master' of git://github.com/lameze/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed Aug 15, 2017
2 parents fa43567 + 5d942f5 commit b66c2f5
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions calendar/tests/externallib_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -1267,4 +1267,27 @@ public function test_get_action_events_by_courses() {
$this->assertCount(1, $groupedbycourse[$course2->id]);
$this->assertEquals('Event 3', $groupedbycourse[$course2->id][0]['name']);
}

/**
* Test for deleting module events.
*/
public function test_delete_calendar_events_for_modules() {
$this->resetAfterTest();
$this->setAdminUser();
$course = $this->getDataGenerator()->create_course();
$nexttime = time() + DAYSECS;
$this->getDataGenerator()->create_module('assign', ['course' => $course->id, 'duedate' => $nexttime]);
$events = calendar_get_events(time(), $nexttime, true, true, true);
$this->assertCount(1, $events);
$params = [];
foreach ($events as $event) {
$params[] = [
'eventid' => $event->id,
'repeat' => false
];
}

$this->expectException('moodle_exception');
core_calendar_external::delete_calendar_events($params);
}
}

0 comments on commit b66c2f5

Please sign in to comment.