From 5540c0979b10fad273779d73e7d9665f84190119 Mon Sep 17 00:00:00 2001 From: Marina Glancy Date: Tue, 4 Jul 2017 11:16:08 +0800 Subject: [PATCH] MDL-59441 calendar: unittest fix for modules without generators --- calendar/tests/container_test.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/calendar/tests/container_test.php b/calendar/tests/container_test.php index 3f08efbee438f..0742729ce678c 100644 --- a/calendar/tests/container_test.php +++ b/calendar/tests/container_test.php @@ -296,7 +296,13 @@ public function test_delete_module_delete_events() { $group = $this->getDataGenerator()->create_group(['courseid' => $course->id]); foreach (core_component::get_plugin_list('mod') as $modname => $unused) { - $module = $this->getDataGenerator()->create_module($modname, ['course' => $course->id]); + try { + $generator = $this->getDataGenerator()->get_plugin_generator('mod_'.$modname); + } catch (coding_exception $e) { + // Module generator is not implemented. + continue; + } + $module = $generator->create_instance(['course' => $course->id]); // Create bunch of events of different type (user override, group override, module event). $this->create_event(['userid' => $user->id, 'modulename' => $modname, 'instance' => $module->id]);