Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

Differences Between: [Versions 310 and 400] [Versions 39 and 400]

(no description)

File Size: 471 lines (19 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: tgz_packer_test  - X-Ref

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

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