From 5cf12e0237088335f9daa123bbc1e37413cd6396 Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Wed, 8 Feb 2017 13:14:51 +0800 Subject: [PATCH] MDL-46375 core_files: Correct filename in mbz test I noticed during the file system abstraction that this test was incorrect. Since both $storagefalse, and $storagetrue are in the same context, component, area, itemid, and folder, the fact that they had the same filename meant that they constantly overwrote one another. As part of archive_to_storage, existing files in the same location are found, the files themselves deleted, and the existing file record in the files table is deleted. The tests continued to pass because: * the existing variables were not affected by the deletion of the file record and file so the comparisons were successful; and * subsequent calls to fetch the content of the file meant that the files themselves were restored from the trash directory. --- lib/filestorage/tests/mbz_packer_test.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/filestorage/tests/mbz_packer_test.php b/lib/filestorage/tests/mbz_packer_test.php index 682ec47bd7..df6917b1a7 100644 --- a/lib/filestorage/tests/mbz_packer_test.php +++ b/lib/filestorage/tests/mbz_packer_test.php @@ -54,7 +54,7 @@ public function test_archive_with_both_options() { $this->assertNotEmpty($packer->archive_to_pathname($files, $filetrue)); $context = context_system::instance(); $this->assertNotEmpty($storagetrue = $packer->archive_to_storage( - $files, $context->id, 'phpunit', 'data', 0, '/', 'false.mbz')); + $files, $context->id, 'phpunit', 'data', 0, '/', 'true.mbz')); // Check the sizes are different (indicating different formats). $this->assertNotEquals(filesize($filefalse), filesize($filetrue));