Commit 80ab4596 authored by Aaron Wells's avatar Aaron Wells

Further fixes for ensuring Behat test dirs exist

Change-Id: Ic4e6caffb1e5239a69be80ab73632f2b63f29d8f
parent 73e65355
......@@ -101,6 +101,7 @@ class BehatConfigManager {
$contents = self::get_config_file_contents($suites);
// Stores the file.
check_dir_exists(dirname($configfilepath), true, true);
if (!file_put_contents($configfilepath, $contents)) {
behat_error(BEHAT_MAHARA_EXITCODE_BADPERMISSIONS, 'File ' . $configfilepath . ' can not be created');
}
......
......@@ -232,8 +232,15 @@ function check_test_site_config() {
$contents = '$CFG->behat_wwwroot, $CFG->behat_dbprefix and $CFG->behat_dataroot' .
' are currently used as $CFG->wwwroot, $CFG->dbprefix and $CFG->dataroot';
$filepath = self::get_test_file_path();
check_dir_exists(dirname($filepath), true);
check_dir_exists(dirname($filepath), true, true);
if (!file_put_contents($filepath, $contents)) {
// workaround earlier bug that could create this file as a directory
if (is_dir($filepath)) {
rmdirr($filepath);
if (file_put_contents($filepath, $contents)) {
return;
}
}
behat_error(BEHAT_MAHARA_EXITCODE_NOTWRITABLEDATAROOT, 'File ' . $filepath . ' can not be created');
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment