mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 04:30:15 +01:00
Merge branch 'MDL-55876-master' of git://github.com/lameze/moodle
This commit is contained in:
commit
77391e9f09
@ -2776,6 +2776,11 @@ function update_course($data, $editoroptions = NULL) {
|
||||
|
||||
$data->timemodified = time();
|
||||
|
||||
// Prevent changes on front page course.
|
||||
if ($data->id == SITEID) {
|
||||
throw new moodle_exception('invalidcourse', 'error');
|
||||
}
|
||||
|
||||
$oldcourse = course_get_format($data->id)->get_course();
|
||||
$context = context_course::instance($oldcourse->id);
|
||||
|
||||
|
@ -3124,4 +3124,17 @@ class core_course_courselib_testcase extends advanced_testcase {
|
||||
$adminoptions = course_get_user_administration_options($course, $context);
|
||||
$this->assertFalse($adminoptions->badges);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test test_update_course_frontpage_category.
|
||||
*/
|
||||
public function test_update_course_frontpage_category() {
|
||||
// Fetch front page course.
|
||||
$course = get_course(SITEID);
|
||||
// Test update information on front page course.
|
||||
$course->category = 99;
|
||||
$this->expectException('moodle_exception');
|
||||
$this->expectExceptionMessage(get_string('invalidcourse', 'error'));
|
||||
update_course($course);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user