This commit is contained in:
Dan Poltawski 2016-07-18 14:49:48 +01:00
commit 3ed88885e5
2 changed files with 9 additions and 6 deletions

View File

@ -798,7 +798,7 @@ abstract class testing_util {
if (file_exists(self::get_dataroot() . '/filedir')) {
$handle = opendir(self::get_dataroot() . '/filedir');
while (false !== ($item = readdir($handle))) {
if (in_array('filedir/' . $item, $childclassname::$datarootskiponreset)) {
if (in_array('filedir' . DIRECTORY_SEPARATOR . $item, $childclassname::$datarootskiponreset)) {
continue;
}
if (is_dir(self::get_dataroot()."/filedir/$item")) {
@ -1054,8 +1054,10 @@ abstract class testing_util {
if (!file_exists($jsonfilepath)) {
$listfiles = array();
$listfiles['filedir/.'] = 'filedir/.';
$listfiles['filedir/..'] = 'filedir/..';
$currentdir = 'filedir' . DIRECTORY_SEPARATOR . '.';
$parentdir = 'filedir' . DIRECTORY_SEPARATOR . '..';
$listfiles[$currentdir] = $currentdir;
$listfiles[$parentdir] = $parentdir;
$filedir = self::get_dataroot() . '/filedir';
if (file_exists($filedir)) {

View File

@ -1025,6 +1025,7 @@ EOF;
'filename' => $filename,
);
$file = self::create_draft_file($filerecord);
$draftitemid = $file->get_itemid();
$maxbytes = $CFG->userquota;
$maxareabytes = $CFG->userquota;
@ -1034,7 +1035,7 @@ EOF;
'areamaxbytes' => $maxareabytes);
// Add new file.
file_merge_files_from_draft_area_into_filearea($file->get_itemid(), $usercontext->id, 'user', 'private', 0, $options);
file_merge_files_from_draft_area_into_filearea($draftitemid, $usercontext->id, 'user', 'private', 0, $options);
$files = $fs->get_area_files($usercontext->id, 'user', 'private', 0);
// Directory and file.
@ -1051,12 +1052,12 @@ EOF;
// Add two more files.
$filerecord = array(
'itemid' => $file->get_itemid(),
'itemid' => $draftitemid,
'filename' => 'second.txt',
);
self::create_draft_file($filerecord);
$filerecord = array(
'itemid' => $file->get_itemid(),
'itemid' => $draftitemid,
'filename' => 'third.txt',
);
$file = self::create_draft_file($filerecord);