Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 310 and 311] [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403]

Unit tests for /lib/filestorage/tgz_packer.php and tgz_extractor.php.

Copyright: 2013 The Open University
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 467 lines (19 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: core_files_tgz_packer_testcase  - X-Ref

file_put_contents_at_time($path, $contents, $mtime)   X-Ref
Puts contents with specified time.

param: string $path File path
param: string $contents Contents of file
param: int $mtime Time modified

prepare_file_list()   X-Ref
Set up some files to be archived.

return: array Array listing files of all types

test_get_packer()   X-Ref
Tests getting the item.


test_to_normal_files()   X-Ref
Tests basic archive and extract to file paths.


test_to_stored_files()   X-Ref
Tests archive and extract to Moodle file system.


test_only_specified_files()   X-Ref
Tests extracting with a list of specified files.


test_extract_to_pathname_returnvalue_successful()   X-Ref
Tests extracting files returning only a boolean state with success.


test_extract_to_pathname_returnvalue_failure()   X-Ref
Tests extracting files returning only a boolean state with failure.


test_file_progress()   X-Ref
Tests the progress reporting.


test_list_files()   X-Ref
Tests the list_files function with and without an index file.


convert_info_for_assert(array $files)   X-Ref
Utility function to convert the file info array into a simpler format
for making comparisons.

param: array $files Array from list_files result

test_is_tgz_file()   X-Ref
No description

check_progress_toward_max()   X-Ref
Checks that progress reported is numeric rather than indeterminate,
and follows the progress reporting rules.


progress($progress = file_progress::INDETERMINATE, $max = file_progress::INDETERMINATE)   X-Ref
Handles file_progress interface.

param: int $progress
param: int $max