Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

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

(no description)

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

Defines 1 class

framework_test:: (69 methods):
  setUp()
  test_getPlatformInfo()
  test_fetchExternalData_no_path_defined()
  test_fetchExternalData_path_defined()
  test_fetchExternalData_url_not_h5p()
  test_fetchExternalData_url_invalid()
  test_setLibraryTutorialUrl()
  test_setErrorMessage()
  test_setInfoMessage()
  test_getMessages_info()
  test_getMessages_error()
  test_t_existing_string_no_args()
  test_t_existing_string_args()
  test_t_non_existent_string()
  test_getLibraryFileUrl()
  test_getLibraryFileUrl_non_existent_library()
  test_getLibraryFileUrl_not_parsable_folder_name()
  test_getLibraryFileUrl_library_has_multiple_versions()
  test_getLibraryFileUrl_library_has_multiple_patch_versions()
  test_getLibraryFileUrl_library_subfolder()
  test_loadAddons()
  test_loadLibraries()
  test_getLibraryId_existing_machine_name()
  test_getLibraryId_non_existent_machine_name()
  test_getLibraryId_non_existent_major_version()
  test_getLibraryId_non_existent_minor_version()
  test_isPatchedLibrary()
  isPatchedLibrary_provider()
  test_isInDevMode()
  test_mayUpdateLibraries()
  test_get_file()
  test_saveLibraryData_new_library()
  test_saveLibraryData_existing_library()
  test_insertContent()
  test_insertContent_latestlibrary()
  test_updateContent()
  test_updateContent_withmetadata()
  test_saveLibraryDependencies()
  test_deleteContentData()
  test_resetContentUserData()
  test_deleteLibraryUsage()
  test_saveLibraryUsage()
  test_getLibraryUsage_no_skip_content()
  test_getLibraryUsage_skip_content()
  test_loadLibrary_existing_library()
  test_loadLibrary_non_existent_library()
  test_loadLibrarySemantics()
  loadLibrarySemantics_provider()
  test_alterLibrarySemantics()
  test_deleteLibraryDependencies_existing_library()
  test_deleteLibraryDependencies_non_existent_library()
  test_deleteLibrary()
  test_loadContent()
  test_loadContentDependencies_no_type_defined()
  test_loadContentDependencies_type_defined()
  test_getOption()
  test_setOption()
  test_updateContentFields()
  test_clearFilteredParameters()
  test_getNumNotFiltered()
  test_getNumContent()
  test_getNumContent_skip_content()
  test_isContentSlugAvailable()
  test_saveCachedAssets()
  test_deleteCachedAssets()
  test_getLibraryContentCount()
  test_libraryHasUpgrade()
  libraryHasUpgrade_provider()
  test_get_latest_library_version()


Class: framework_test  - X-Ref

Test class covering the H5PFrameworkInterface interface implementation.

setUp()   X-Ref
Set up function for tests.


test_getPlatformInfo()   X-Ref
Test the behaviour of getPlatformInfo().


test_fetchExternalData_no_path_defined()   X-Ref
Test the behaviour of fetchExternalData() when the store path is not defined.

This test is intensive and requires downloading content of an external file,
therefore it might take longer time to execute.
In order to execute this test PHPUNIT_LONGTEST should be set to true in phpunit.xml or directly in config.php.

test_fetchExternalData_path_defined()   X-Ref
Test the behaviour of fetchExternalData() when the store path is defined.

This test is intensive and requires downloading content of an external file,
therefore it might take longer time to execute.
In order to execute this test PHPUNIT_LONGTEST should be set to true in phpunit.xml or directly in config.php.

test_fetchExternalData_url_not_h5p()   X-Ref
Test the behaviour of fetchExternalData() when the URL is pointing to an external file that is
not an h5p content.

This test is intensive and requires downloading content of an external file,
therefore it might take longer time to execute.
In order to execute this test PHPUNIT_LONGTEST should be set to true in phpunit.xml or directly in config.php.

test_fetchExternalData_url_invalid()   X-Ref
Test the behaviour of fetchExternalData() when the URL is invalid.


test_setLibraryTutorialUrl()   X-Ref
Test the behaviour of setLibraryTutorialUrl().


test_setErrorMessage()   X-Ref
Test the behaviour of setErrorMessage().


test_setInfoMessage()   X-Ref
Test the behaviour of setInfoMessage().


test_getMessages_info()   X-Ref
Test the behaviour of getMessages() when requesting the info messages.


test_getMessages_error()   X-Ref
Test the behaviour of getMessages() when requesting the error messages.


test_t_existing_string_no_args()   X-Ref
Test the behaviour of t() when translating existing string that does not require any arguments.


test_t_existing_string_args()   X-Ref
Test the behaviour of t() when translating existing string that does require parameters.


test_t_non_existent_string()   X-Ref
Test the behaviour of t() when translating non-existent string.


test_getLibraryFileUrl()   X-Ref
Test the behaviour of getLibraryFileUrl() when requesting a file URL from an existing library and
the folder name is parsable.


test_getLibraryFileUrl_non_existent_library()   X-Ref
Test the behaviour of getLibraryFileUrl() when requesting a file URL from a non-existent library and
the folder name is parsable.


test_getLibraryFileUrl_not_parsable_folder_name()   X-Ref
Test the behaviour of getLibraryFileUrl() when requesting a file URL from an existing library and
the folder name is not parsable.


test_getLibraryFileUrl_library_has_multiple_versions()   X-Ref
Test the behaviour of getLibraryFileUrl() when requesting a file URL from a library that has multiple
versions and the folder name is parsable.


test_getLibraryFileUrl_library_has_multiple_patch_versions()   X-Ref
Test the behaviour of getLibraryFileUrl() when requesting a file URL from a library that has multiple
patch versions and the folder name is parsable.


test_getLibraryFileUrl_library_subfolder()   X-Ref
Test the behaviour of getLibraryFileUrl() when requesting a file URL from a sub-folder
of an existing library and the folder name is parsable.


test_loadAddons()   X-Ref
Test the behaviour of loadAddons().


test_loadLibraries()   X-Ref
Test the behaviour of loadLibraries().


test_getLibraryId_existing_machine_name()   X-Ref
Test the behaviour of test_getLibraryId() when requesting an existing machine name.


test_getLibraryId_non_existent_machine_name()   X-Ref
Test the behaviour of test_getLibraryId() when requesting a non-existent machine name.


test_getLibraryId_non_existent_major_version()   X-Ref
Test the behaviour of test_getLibraryId() when requesting a non-existent major version.


test_getLibraryId_non_existent_minor_version()   X-Ref
Test the behaviour of test_getLibraryId() when requesting a non-existent minor version.


test_isPatchedLibrary(array $libraryrecords, array $testlibrary, bool $expected)   X-Ref
Test the behaviour of isPatchedLibrary().

param: array $libraryrecords Array containing data for the library creation
param: array $testlibrary Array containing the test library data
param: bool $expected The expectation whether the library is patched or not

isPatchedLibrary_provider()   X-Ref
Data provider for test_isPatchedLibrary().

return: array

test_isInDevMode()   X-Ref
Test the behaviour of isInDevMode().


test_mayUpdateLibraries()   X-Ref
Test the behaviour of mayUpdateLibraries().


test_get_file()   X-Ref
Test the behaviour of get_file() and set_file().


test_saveLibraryData_new_library()   X-Ref
Test the behaviour of saveLibraryData() when saving data for a new library.


test_saveLibraryData_existing_library()   X-Ref
Test the behaviour of saveLibraryData() when saving (updating) data for an existing library.


test_insertContent()   X-Ref
Test the behaviour of insertContent().


test_insertContent_latestlibrary()   X-Ref
Test the behaviour of insertContent().


test_updateContent()   X-Ref
Test the behaviour of updateContent().


test_updateContent_withmetadata()   X-Ref
Test the behaviour of updateContent() with metadata.


test_saveLibraryDependencies()   X-Ref
Test the behaviour of saveLibraryDependencies().


test_deleteContentData()   X-Ref
Test the behaviour of deleteContentData().


test_resetContentUserData()   X-Ref
Test the behaviour of resetContentUserData().


test_deleteLibraryUsage()   X-Ref
Test the behaviour of deleteLibraryUsage().


test_saveLibraryUsage()   X-Ref
Test the behaviour of test_saveLibraryUsage().


test_getLibraryUsage_no_skip_content()   X-Ref
Test the behaviour of getLibraryUsage() without skipping a particular h5p content.


test_getLibraryUsage_skip_content()   X-Ref
Test the behaviour of getLibraryUsage() when skipping a particular content.


test_loadLibrary_existing_library()   X-Ref
Test the behaviour of loadLibrary() when requesting an existing library.


test_loadLibrary_non_existent_library()   X-Ref
Test the behaviour of loadLibrary() when requesting a non-existent library.


test_loadLibrarySemantics(array $libraryrecords, array $testlibrary, string $expected)   X-Ref
Test the behaviour of loadLibrarySemantics().

param: array $libraryrecords Array containing data for the library creation
param: array $testlibrary Array containing the test library data
param: string $expected The expected semantics value

loadLibrarySemantics_provider()   X-Ref
Data provider for test_loadLibrarySemantics().

return: array

test_alterLibrarySemantics()   X-Ref
Test the behaviour of alterLibrarySemantics().


test_deleteLibraryDependencies_existing_library()   X-Ref
Test the behaviour of deleteLibraryDependencies() when requesting to delete the
dependencies of an existing library.


test_deleteLibraryDependencies_non_existent_library()   X-Ref
Test the behaviour of deleteLibraryDependencies() when requesting to delete the
dependencies of a non-existent library.


test_deleteLibrary()   X-Ref
Test the behaviour of deleteLibrary().


test_loadContent()   X-Ref
Test the behaviour of loadContent().


test_loadContentDependencies_no_type_defined()   X-Ref
Test the behaviour of loadContentDependencies() when requesting content dependencies
without specifying the dependency type.


test_loadContentDependencies_type_defined()   X-Ref
Test the behaviour of loadContentDependencies() when requesting content dependencies
with specifying the dependency type.


test_getOption()   X-Ref
Test the behaviour of getOption().


test_setOption()   X-Ref
Test the behaviour of setOption().


test_updateContentFields()   X-Ref
Test the behaviour of updateContentFields().


test_clearFilteredParameters()   X-Ref
Test the behaviour of clearFilteredParameters().


test_getNumNotFiltered()   X-Ref
Test the behaviour of getNumNotFiltered().


test_getNumContent()   X-Ref
Test the behaviour of getNumContent().


test_getNumContent_skip_content()   X-Ref
Test the behaviour of getNumContent() when certain contents are being skipped.


test_isContentSlugAvailable()   X-Ref
Test the behaviour of isContentSlugAvailable().


test_saveCachedAssets()   X-Ref
Test that a record is stored for cached assets.


test_deleteCachedAssets()   X-Ref
Test that the correct libraries are removed from the cached assets table


test_getLibraryContentCount()   X-Ref
Test the behaviour of getLibraryContentCount().


test_libraryHasUpgrade(array $libraryrecords, array $testlibrary, bool $expected)   X-Ref
Test the behaviour of test_libraryHasUpgrade().

param: array $libraryrecords Array containing data for the library creation
param: array $testlibrary Array containing the test library data
param: bool $expected The expectation whether the library is patched or not

libraryHasUpgrade_provider()   X-Ref
Data provider for test_libraryHasUpgrade().

return: array

test_get_latest_library_version()   X-Ref
Test the behaviour of get_latest_library_version().