Skip to content

Commit

Permalink
CTP-4147 Fix calendar PHPUnit test
Browse files Browse the repository at this point in the history
Populate $cmid in mod_coursework_generator->create_instance() as this
is needed by core PHPUnit tests, for example, when calling
course_delete_module().  Previously core test
core_calendar\container_test::test_delete_module_delete_events failed
because $cmid was missing.
  • Loading branch information
leonstr committed Dec 6, 2024
1 parent 0698138 commit e9b5667
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/generator/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,10 @@ public function create_instance($record = null, array $options = null) {
$record->moderatorallocationstrategy = 'none';
}

return coursework::find(parent::create_instance($record, $options)->id);

$module = parent::create_instance($record, $options);
$coursework = coursework::find($module->id);
$coursework->cmid = $module->cmid;
return $coursework;
}

/**
Expand Down

0 comments on commit e9b5667

Please sign in to comment.