From 93fe4d2a11ec2965a4bee7f888712c0dbfb39631 Mon Sep 17 00:00:00 2001 From: Ankit Agarwal Date: Fri, 11 Oct 2013 17:35:11 +0800 Subject: [PATCH] MDL-42293 behat: Add suport for custom admin paths to the behat upload repository step --- repository/upload/tests/behat/behat_repository_upload.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/repository/upload/tests/behat/behat_repository_upload.php b/repository/upload/tests/behat/behat_repository_upload.php index bf090acb4b9..08697fe694c 100644 --- a/repository/upload/tests/behat/behat_repository_upload.php +++ b/repository/upload/tests/behat/behat_repository_upload.php @@ -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);