Skip to content

Commit

Permalink
MDL-46375 core_files: Correct filename in mbz test
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
andrewnicols authored and kenneth-hendricks committed Mar 1, 2017
1 parent 1ff7d33 commit 5cf12e0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/filestorage/tests/mbz_packer_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 5cf12e0

Please sign in to comment.