-
Bug
-
Resolution: Fixed
-
Minor
-
2.5.1
-
MOODLE_25_STABLE
-
MOODLE_25_STABLE
-
wip-
MDL-40830-master -
While working on MDL-34397 I replaced the cache and one of the unit tests started to fail. So I figured out that coruse cache is not reset properly in mod_assign_generator. Probably because of reverse order of actions - first module is added to section and then module is created.
To reproduce add the following to the mod_assign_lib_testcase :
public function test_assign_gen1() {
|
global $DB;
|
$this->create_instance();
|
$record = $DB->get_record('course', array('id' => $this->course->id));
|
// Make sure the course cache is cleared
|
$this->assertEmpty($record->modinfo);
|
// Rebuild modinfo and make sure that module is present
|
$modinfo = get_fast_modinfo($this->course->id);
|
$this->assertNotEmpty($modinfo->cms);
|
}
|
It works fine. BUT both assertions here fail:
public function test_assign_gen2() {
|
global $DB;
|
$this->create_instance(array('duedate'=>time()));
|
$record = $DB->get_record('course', array('id' => $this->course->id));
|
// This fails, course cache was not cleared (commented out to show the next failure):
|
// $this->assertEmpty($record->modinfo);
|
// This also fails, because the course cache was generated before the module was added:
|
$modinfo = get_fast_modinfo($this->course->id);
|
$this->assertNotEmpty($modinfo->cms);
|
}
|
Which means that after calling the generator with non-empty duedate the course cache was not properly cleared.
- blocks
-
MDL-34397 Develop course structure caching
-
- Closed
-