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] [Versions 39 and 310]

Testing the H5PFrameworkInterface interface implementation.

Copyright: 2019 Mihail Geshoski <mihail@moodle.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 2336 lines (89 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

framework_test:: (67 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()
  test_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_saveLibraryDependencies()
  test_deleteContentData()
  test_deleteLibraryUsage()
  test_saveLibraryUsage()
  test_getLibraryUsage_no_skip_content()
  test_getLibraryUsage_skip_content()
  test_loadLibrary_existing_library()
  test_loadLibrary_non_existent_library()
  test_loadLibrarySemantics()
  test_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()
  test_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

test_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_saveLibraryDependencies()   X-Ref
Test the behaviour of saveLibraryDependencies().


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


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

test_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

test_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().