MDL-42293 behat: Add suport for custom admin paths to the behat upload repository step

This commit is contained in:
Ankit Agarwal
2013-10-15 13:46:03 +08:00
parent 5c740905f5
commit a48e5399a1
@@ -79,6 +79,11 @@ class behat_repository_upload extends behat_files {
$submit = $this->find_button(get_string('upload', 'repository'));
// Attaching specified file to the node.
// Replace 'admin/' if it is in start of path with $CFG->admin .
$pos = strpos($filepath, 'admin/');
if ($pos === 0) {
$filepath = $CFG->admin . DIRECTORY_SEPARATOR . substr($filepath, 6);
}
$filepath = str_replace('/', DIRECTORY_SEPARATOR, $filepath);
$fileabsolutepath = $CFG->dirroot . DIRECTORY_SEPARATOR . $filepath;
$file->attachFile($fileabsolutepath);