Differences Between: [Versions 310 and 402] [Versions 311 and 402] [Versions 39 and 402]
Testing the H5P API.
Copyright: | 2020 Sara Arjona <sara@moodle.com> |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 1251 lines (47 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
api_test:: (19 methods):
test_delete_library()
delete_library_provider()
test_get_dependent_libraries()
get_dependent_libraries_provider()
test_get_library()
get_library_provider()
test_get_content_from_pluginfile_url()
test_get_original_content_from_pluginfile_url()
test_can_edit_content()
can_edit_content_provider()
test_create_content_from_pluginfile_url()
test_delete_content_from_pluginfile_url()
test_get_export_info_from_context_id()
test_set_library_enabled()
set_library_enabled_provider()
test_is_library_enabled()
is_library_enabled_provider()
test_is_valid_package()
is_valid_package_provider()
test_delete_library(string $libraryname, int $expectedh5p, int $expectedlibraries,int $expectedcontents, int $expecteddependencies) X-Ref |
Test the behaviour of delete_library(). param: string $libraryname Machine name of the library to delete. param: int $expectedh5p Total of H5P contents expected after deleting the library. param: int $expectedlibraries Total of H5P libraries expected after deleting the library. param: int $expectedcontents Total of H5P content_libraries expected after deleting the library. param: int $expecteddependencies Total of H5P library dependencies expected after deleting the library. |
delete_library_provider() X-Ref |
Data provider for test_delete_library(). return: array |
test_get_dependent_libraries(string $libraryname, int $expectedvalue) X-Ref |
Test the behaviour of get_dependent_libraries(). param: string $libraryname Machine name of the library to delete. param: int $expectedvalue Total of H5P required libraries expected. |
get_dependent_libraries_provider() X-Ref |
Data provider for test_get_dependent_libraries(). return: array |
test_get_library(string $libraryname, bool $emptyexpected) X-Ref |
Test the behaviour of get_library(). param: string $libraryname Machine name of the library to delete. param: bool $emptyexpected Wether the expected result is empty or not. |
get_library_provider() X-Ref |
Data provider for test_get_library(). return: array |
test_get_content_from_pluginfile_url() X-Ref |
Test the behaviour of get_content_from_pluginfile_url(). |
test_get_original_content_from_pluginfile_url() X-Ref |
Test the behaviour of get_original_content_from_pluginfile_url(). |
test_can_edit_content(string $currentuser, string $fileauthor, string $filecomponent, bool $expected,$filearea = 'unittest') X-Ref |
Test the behaviour of can_edit_content(). param: string $currentuser User who will call the method. param: string $fileauthor Author of the file to check. param: string $filecomponent Component of the file to check. param: bool $expected Expected result after calling the can_edit_content method. param: string $filearea Area of the file to check. return: void |
can_edit_content_provider() X-Ref |
Data provider for test_can_edit_content(). return: array |
test_create_content_from_pluginfile_url() X-Ref |
Test the behaviour of create_content_from_pluginfile_url(). |
test_delete_content_from_pluginfile_url() X-Ref |
Test the behaviour of delete_content_from_pluginfile_url(). |
test_get_export_info_from_context_id() X-Ref |
Test the behaviour of get_export_info_from_context_id(). |
test_set_library_enabled(string $libraryname, string $action, int $expected) X-Ref |
Test the behaviour of set_library_enabled(). param: string $libraryname Library name to enable/disable. param: string $action Action to be done with the library. Supported values: enable, disable. param: int $expected Expected value for the enabled library field. -1 will be passed if the library doesn't exist. |
set_library_enabled_provider() X-Ref |
Data provider for test_set_library_enabled(). return: array |
test_is_library_enabled(string $libraryname, bool $expected, bool $exception = false,bool $useid = false, bool $uselibraryname = true) X-Ref |
Test the behaviour of is_library_enabled(). param: string $libraryname Library name to check. param: bool $expected Expected result after calling the method. param: bool $exception Exception expected or not. param: bool $useid Whether to use id for calling is_library_enabled method. param: bool $uselibraryname Whether to use libraryname for calling is_library_enabled method. |
is_library_enabled_provider() X-Ref |
Data provider for test_is_library_enabled(). return: array |
test_is_valid_package(string $filename, bool $expected, bool $isadmin = false, bool $onlyupdatelibs = false,bool $skipcontent = false) X-Ref |
Test the behaviour of is_valid_package(). param: string $filename The H5P content to validate. param: bool $expected Expected result after calling the method. param: bool $isadmin Whether the user calling the method will be admin or not. param: bool $onlyupdatelibs Whether new libraries can be installed or only the existing ones can be updated. param: bool $skipcontent Should the content be skipped (so only the libraries will be saved)? |
is_valid_package_provider() X-Ref |
Data provider for test_is_valid_package(). return: array |