Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

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

(no description)

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

Defines 1 class


Class: file_storage_test  - X-Ref

Test class covering the H5PFileStorage interface implementation.

setUp()   X-Ref
No description

test_saveLibrary()   X-Ref
Test that given the main directory of a library that all files are saved
into the file system.


test_saveContent()   X-Ref
Test that a content file can be saved.


test_deleteContent()   X-Ref
Test that content files located on the file system can be deleted.


test_getTmpPath()   X-Ref
Test that returning a temp path returns what is expected by the h5p library.


test_exportContent()   X-Ref
Test that the content files can be exported to a specified location.


test_exportLibrary()   X-Ref
Test that libraries on the file system can be exported to a specified location.


test_saveExport()   X-Ref
Test that an export file can be saved into the file system.


test_deleteExport()   X-Ref
Test that an exort file can be deleted from the file system.

return: [type] [description]

test_hasExport()   X-Ref
Test to check if an export file already exists on the file system.


test_cacheAssets()   X-Ref
Test that all the library files for an H5P activity can be concatenated into "cache" files. One for js and another for css.


test_getCachedAssets()   X-Ref
Test that cached files can be retrieved via a key.


test_deleteCachedAssets()   X-Ref
Test that cache files in the files system can be removed.


test_getContent()   X-Ref
Retrieve content from a file given a specific path.


test_getUpgradeScript()   X-Ref
Test that an upgrade script can be found on the file system.


test_saveFileFromZip()   X-Ref
Test that information from a source can be saved to the specified path.
The zip file has the following contents
- h5ptest
|- content
|     |- content.json
|- testFont
|     |- testfont.min.css
|- testJavaScript
|     |- testscript.min.js
|- h5p.json


test_delete_library()   X-Ref
Test that a library is fully deleted from the file system


test_get_icon_url(string $filename, bool $expected)   X-Ref
Test get_icon_url() function behaviour.

param: string  $filename  The name of the H5P file to load.
param: bool    $expected  Whether the icon should exist or not.

get_icon_url_provider()   X-Ref
Data provider for test_get_icon_url().

return: array

test_get_file()   X-Ref
Test the private method get_file, a wrapper for getting an H5P content file.


test_move_file()   X-Ref
Test that a single file is added to Moodle files.


test_cloneContentFile()   X-Ref
Test that a file is copied from another H5P content or the H5P editor.

return: void

test_getContentFile()   X-Ref
Test that a given file exists in an H5P content.

return: void

test_moveContentDiretory()   X-Ref
Tests that the content folder of an H5P content is imported in the Moodle filesystem.


test_removeContentFile()   X-Ref
Test that an H5P content file is removed.