mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
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:
parent
f9db5892ec
commit
47627abe9d
1 changed files with 3 additions and 3 deletions
|
@ -462,7 +462,7 @@ class h5p_file_storage_testcase extends \advanced_testcase {
|
||||||
];
|
];
|
||||||
$filestorage = new file_storage();
|
$filestorage = new file_storage();
|
||||||
$fs->create_file_from_string($filerecord, 'test string info');
|
$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->assertEquals($expectedfilepath, $filestorage->getUpgradeScript($machinename, $majorversion, $minorversion));
|
||||||
$this->assertNull($filestorage->getUpgradeScript($machinename, $majorversion, 7));
|
$this->assertNull($filestorage->getUpgradeScript($machinename, $majorversion, 7));
|
||||||
}
|
}
|
||||||
|
@ -489,9 +489,9 @@ class h5p_file_storage_testcase extends \advanced_testcase {
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
if (!$file->is_directory) {
|
if (!$file->is_directory) {
|
||||||
$stream = $ziparchive->get_stream($file->index);
|
$stream = $ziparchive->get_stream($file->index);
|
||||||
$items = explode(DIRECTORY_SEPARATOR, $file->pathname);
|
$items = explode('/', $file->pathname);
|
||||||
array_shift($items);
|
array_shift($items);
|
||||||
$path = implode(DIRECTORY_SEPARATOR, $items);
|
$path = implode('/', $items);
|
||||||
$this->h5p_file_storage->saveFileFromZip($this->h5p_tempath, $path, $stream);
|
$this->h5p_file_storage->saveFileFromZip($this->h5p_tempath, $path, $stream);
|
||||||
$filestocheck[] = $path;
|
$filestocheck[] = $path;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue