// Create the completion event.
$CFG->enablecompletion = true;
- \core_completion\api::update_completion_date_event($assign->cmid, 'assign', $assign->id, $time);
+ \core_completion\api::update_completion_date_event($assign->cmid, 'assign', $assign, $time);
// Check that there is now an event in the database.
$events = $DB->get_records('event');
// Create the event.
$CFG->enablecompletion = true;
- \core_completion\api::update_completion_date_event($assign->cmid, 'assign', $assign->id, $time);
+ \core_completion\api::update_completion_date_event($assign->cmid, 'assign', $assign, $time);
// Call it again, but this time with a different time.
- \core_completion\api::update_completion_date_event($assign->cmid, 'assign', $assign->id, $time + DAYSECS);
+ \core_completion\api::update_completion_date_event($assign->cmid, 'assign', $assign, $time + DAYSECS);
// Check that there is still only one event in the database.
$events = $DB->get_records('event');
// Create the event.
$CFG->enablecompletion = true;
- \core_completion\api::update_completion_date_event($assign->cmid, 'assign', $assign->id, $time);
+ \core_completion\api::update_completion_date_event($assign->cmid, 'assign', $assign, $time);
// Call it again, but the time specified as null.
- \core_completion\api::update_completion_date_event($assign->cmid, 'assign', $assign->id, null);
+ \core_completion\api::update_completion_date_event($assign->cmid, 'assign', $assign, null);
// Check that there is no event in the database.
$this->assertEquals(0, $DB->count_records('event'));
// Try and create the completion event with completion disabled.
$CFG->enablecompletion = false;
- \core_completion\api::update_completion_date_event($assign->cmid, 'assign', $assign->id, $time);
+ \core_completion\api::update_completion_date_event($assign->cmid, 'assign', $assign, $time);
// Check that there is no event in the database.
$this->assertEquals(0, $DB->count_records('event'));
// Create the completion event.
$CFG->enablecompletion = true;
- \core_completion\api::update_completion_date_event($assign->cmid, 'assign', $assign->id, $time);
+ \core_completion\api::update_completion_date_event($assign->cmid, 'assign', $assign, $time);
// Disable completion.
$CFG->enablecompletion = false;
// Try and update the completion date.
- \core_completion\api::update_completion_date_event($assign->cmid, 'assign', $assign->id, $time + DAYSECS);
+ \core_completion\api::update_completion_date_event($assign->cmid, 'assign', $assign, $time + DAYSECS);
// Check that there is an event in the database.
$events = $DB->get_records('event');
// Create the completion event.
$CFG->enablecompletion = true;
- \core_completion\api::update_completion_date_event($assign->cmid, 'assign', $assign->id, $time);
+ \core_completion\api::update_completion_date_event($assign->cmid, 'assign', $assign, $time);
// Disable completion.
$CFG->enablecompletion = false;
// Should still be able to delete completion events even when completion is disabled.
- \core_completion\api::update_completion_date_event($assign->cmid, 'assign', $assign->id, null);
+ \core_completion\api::update_completion_date_event($assign->cmid, 'assign', $assign, null);
// Check that there is now no event in the database.
$this->assertEquals(0, $DB->count_records('event'));