MDL-67156 core_h5p: change DIRECTORY_SEPARATOR by slashes

In Windows, the value of DIRECTORY_SEPARATOR is "\", causing failures in
the tests when compared to the path strings that use "/".
This commit is contained in:
Víctor Déniz Falcón 2019-11-08 22:18:11 +00:00
parent f9db5892ec
commit 47627abe9d

View File

@ -462,7 +462,7 @@ class h5p_file_storage_testcase extends \advanced_testcase {
];
$filestorage = new file_storage();
$fs->create_file_from_string($filerecord, 'test string info');
$expectedfilepath = DIRECTORY_SEPARATOR . file_storage::LIBRARY_FILEAREA . $filepath . 'upgrade.js';
$expectedfilepath = '/' . file_storage::LIBRARY_FILEAREA . $filepath . 'upgrade.js';
$this->assertEquals($expectedfilepath, $filestorage->getUpgradeScript($machinename, $majorversion, $minorversion));
$this->assertNull($filestorage->getUpgradeScript($machinename, $majorversion, 7));
}
@ -489,9 +489,9 @@ class h5p_file_storage_testcase extends \advanced_testcase {
foreach ($files as $file) {
if (!$file->is_directory) {
$stream = $ziparchive->get_stream($file->index);
$items = explode(DIRECTORY_SEPARATOR, $file->pathname);
$items = explode('/', $file->pathname);
array_shift($items);
$path = implode(DIRECTORY_SEPARATOR, $items);
$path = implode('/', $items);
$this->h5p_file_storage->saveFileFromZip($this->h5p_tempath, $path, $stream);
$filestocheck[] = $path;
}