MDL-75913 behat: Add support for file uploads in generators
This commit is contained in:
committed by
David Woloszyn
parent
64b701190d
commit
1f553279d2
@@ -200,6 +200,7 @@ abstract class testing_module_generator extends component_generator_base {
|
||||
'conditionfieldgroup' => array(),
|
||||
'conditioncompletiongroup' => array()
|
||||
);
|
||||
|
||||
foreach ($defaults as $key => $value) {
|
||||
if (!isset($moduleinfo->$key)) {
|
||||
$moduleinfo->$key = $value;
|
||||
@@ -277,9 +278,21 @@ abstract class testing_module_generator extends component_generator_base {
|
||||
$moduleinfo = add_moduleinfo($record, $course);
|
||||
|
||||
// Prepare object to return with additional field cmid.
|
||||
$instance = $DB->get_record($this->get_modulename(), array('id' => $moduleinfo->instance), '*', MUST_EXIST);
|
||||
$modulename = $this->get_modulename();
|
||||
$instance = $DB->get_record($modulename, ['id' => $moduleinfo->instance], '*', MUST_EXIST);
|
||||
$instance->cmid = $moduleinfo->coursemodule;
|
||||
|
||||
// Insert files for the 'intro' file area.
|
||||
$instance = $this->insert_files(
|
||||
$instance,
|
||||
$record,
|
||||
$modulename,
|
||||
\context_module::instance($instance->cmid),
|
||||
"mod_{$modulename}",
|
||||
'intro',
|
||||
0
|
||||
);
|
||||
|
||||
// If the theme was initialised while creating the module instance, something somewhere called an output
|
||||
// function. Rather than leaving this as a hard-to-debug situation, let's make it fail with a clear error.
|
||||
$outputstartedafter = $PAGE->get_where_theme_was_initialised();
|
||||
|
||||
Reference in New Issue
Block a user