Differences Between: [Versions 311 and 400] [Versions 400 and 403]
Contains unit tests for core_completion/cm_completion_details.
Copyright: | 2021 Jun Pataleta <jun@moodle.com> |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 462 lines (19 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
cm_completion_details_test:: (11 methods):
setup_data()
has_completion_provider()
test_has_completion()
is_automatic_provider()
test_is_automatic()
overall_completion_provider()
test_get_overall_completion()
get_details_provider()
test_get_details()
get_details_custom_order_provider()
test_get_details_custom_order()
Class: cm_completion_details_test - X-Ref
Class for unit testing core_completion/cm_completion_details.setup_data(?int $completion, array $completionoptions = [],object $mockcompletiondata = null, $modname = 'somenonexistentmod') X-Ref |
Fetches a mocked cm_completion_details instance. return: cm_completion_details param: int|null $completion The completion tracking mode for the module. param: array $completionoptions Completion options (e.g. completionview, completionusegrade, etc.) param: object $mockcompletiondata Mock data to be returned by get_data. param: string $modname The modname to set in the cm if a specific one is required. |
has_completion_provider() X-Ref |
Provides data for test_has_completion(). return: array[] |
test_has_completion(int $completion, bool $expectedresult) X-Ref |
Test for has_completion(). param: int $completion The completion tracking mode. param: bool $expectedresult Expected result. |
is_automatic_provider() X-Ref |
Provides data for test_is_automatic(). return: array[] |
test_is_automatic(int $completion, bool $expectedresult) X-Ref |
Test for is_available(). param: int $completion The completion tracking mode. param: bool $expectedresult Expected result. |
overall_completion_provider() X-Ref |
Data provider for test_get_overall_completion(). return: array[] |
test_get_overall_completion(int $state) X-Ref |
Test for get_overall_completion(). param: int $state |
get_details_provider() X-Ref |
Data provider for test_get_details(). return: array[] |
test_get_details(int $completion, ?int $completionview,?int $completiongrade, ?int $completionpassgrade, array $expecteddetails) X-Ref |
Test for \core_completion\cm_completion_details::get_details(). param: int $completion The completion tracking mode. param: int|null $completionview Completion status of the "view" completion condition. param: int|null $completiongrade Completion status of the "must receive grade" completion condition. param: int|null $completionpassgrade Completion status of the "must receive passing grade" completion condition. param: array $expecteddetails Expected completion details returned by get_details(). |
get_details_custom_order_provider() X-Ref |
Data provider for test_get_details_custom_order(). return: array[] |
test_get_details_custom_order(bool $completionview, bool $completiongrade, array $customcompletionrules,string $modname, array $expectedorder) X-Ref |
Test custom sort order is functioning in \core_completion\cm_completion_details::get_details(). param: bool $completionview Completion status of the "view" completion condition. param: bool $completiongrade Completion status of the "must receive grade" completion condition. param: array $customcompletionrules Custom completion requirements, along with their values. param: string $modname The name of the module having data fetched. param: array $expectedorder The expected order of completion conditions returned about the module. |