MDL-68667 core_contentbank: Fix content generator to use filename

This commit is contained in:
Amaia Anabitarte
2020-05-25 18:44:53 +02:00
parent 71965a8572
commit f9d2635f7f
+2 -1
View File
@@ -862,6 +862,7 @@ class behat_core_generator extends behat_generator_base {
$content = $contenttype->create_content($record);
if (!empty($data['filepath'])) {
$filename = basename($data['filepath']);
$fs = get_file_storage();
$filerecord = array(
'component' => 'contentbank',
@@ -869,7 +870,7 @@ class behat_core_generator extends behat_generator_base {
'contextid' => $context->id,
'userid' => $data['userid'],
'itemid' => $content->get_id(),
'filename' => $data['contentname'],
'filename' => $filename,
'filepath' => '/'
);
$fs->create_file_from_pathname($filerecord, $CFG->dirroot . $data['filepath']);