mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 09:26:35 +02:00
MDL-40830 Clear course cache in mod_assign generator
This commit is contained in:
parent
838d78a9ff
commit
0e4954ecff
2 changed files with 7 additions and 3 deletions
|
@ -78,6 +78,7 @@ class mod_assign_generator extends testing_module_generator {
|
|||
|
||||
$record->coursemodule = $this->precreate_course_module($record->course, $options);
|
||||
$id = assign_add_instance($record, null);
|
||||
rebuild_course_cache($record->course, true);
|
||||
return $this->post_add_instance($id, $record->coursemodule);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,23 +40,26 @@ require_once($CFG->dirroot . '/mod/assign/tests/base_test.php');
|
|||
class mod_assign_lib_testcase extends mod_assign_base_testcase {
|
||||
|
||||
public function test_assign_print_overview() {
|
||||
global $DB;
|
||||
$this->setUser($this->editingteachers[0]);
|
||||
$this->create_instance();
|
||||
$this->create_instance(array('duedate'=>time()));
|
||||
|
||||
$courses = $DB->get_records('course', array('id' => $this->course->id));
|
||||
|
||||
$this->setUser($this->students[0]);
|
||||
$overview = array();
|
||||
assign_print_overview(array($this->course->id => $this->course), $overview);
|
||||
assign_print_overview($courses, $overview);
|
||||
$this->assertEquals(count($overview), 1);
|
||||
|
||||
$this->setUser($this->teachers[0]);
|
||||
$overview = array();
|
||||
assign_print_overview(array($this->course->id => $this->course), $overview);
|
||||
assign_print_overview($courses, $overview);
|
||||
$this->assertEquals(count($overview), 1);
|
||||
|
||||
$this->setUser($this->editingteachers[0]);
|
||||
$overview = array();
|
||||
assign_print_overview(array($this->course->id => $this->course), $overview);
|
||||
assign_print_overview($courses, $overview);
|
||||
$this->assertEquals(1, count($overview));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue