Merge branch 'MDL-55876-31' of git://github.com/lameze/moodle into MOODLE_31_STABLE

This commit is contained in:
Andrew Nicols
2016-09-20 09:11:10 +08:00
2 changed files with 17 additions and 0 deletions
+5
View File
@@ -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);
+12
View File
@@ -2913,4 +2913,16 @@ class core_course_courselib_testcase extends advanced_testcase {
$this->assertNotEmpty($res->prevpageurl);
$this->assertEmpty($res->nextpageurl);
}
/**
* 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->setExpectedException('moodle_exception');
update_course($course);
}
}