See Release Notes
Long Term Support Release
Differences Between: [Versions 310 and 401] [Versions 39 and 401] [Versions 401 and 402] [Versions 401 and 403]
Unit tests for the webservice component.
Copyright: | 2016 Jun Pataleta <jun@moodle.com> |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 446 lines (17 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
lib_test:: (9 methods):
setUp()
test_init_service_class()
test_update_token_lastaccess()
test_get_missing_capabilities_by_users()
get_active_tokens_provider()
test_get_active_tokens()
check_params()
get_struct_info()
in_keydesc()
webservice_dummy:: (8 methods):
__construct()
set_token()
parse_request()
send_response()
send_error()
run()
get_service_methods()
get_service_structs()
setUp() X-Ref |
Setup. |
test_init_service_class() X-Ref |
Test init_service_class(). |
test_update_token_lastaccess() X-Ref |
Tests update_token_lastaccess() function. |
test_get_missing_capabilities_by_users() X-Ref |
Tests for the {@see webservice::get_missing_capabilities_by_users()} implementation. |
get_active_tokens_provider() X-Ref |
Data provider for {@see test_get_active_tokens} return: array |
test_get_active_tokens(int $validuntil, bool $expectedactive) X-Ref |
Test getting active tokens for a user param: int $validuntil param: bool $expectedactive |
check_params($type, $methoddesc, $servicestructs) X-Ref |
Utility method that tests the parameter type of a method info's input/output parameter. param: string $type The parameter type that is being evaluated. param: mixed $methoddesc The method description of the WS function. param: array $servicestructs The list of generated service struct classes. |
get_struct_info($structarray, $structclass) X-Ref |
Gets the struct information from the list of struct classes based on the given struct class name. param: array $structarray The list of generated struct classes. param: string $structclass The name of the struct class. return: object|null The struct class info, or null if it's not found. |
in_keydesc(external_single_structure $keydesc, $propertyname) X-Ref |
Searches the keys of the given external_single_structure object if it contains a certain property name. param: external_single_structure $keydesc param: string $propertyname The property name to be searched for. return: bool True if the property name is found in $keydesc. False, otherwise. |
Class: webservice_dummy - X-Ref
Class webservice_dummy.__construct($authmethod) X-Ref |
webservice_dummy constructor. param: int $authmethod The authentication method. |
set_token($token) X-Ref |
Token setter method. param: string $token The web service token. |
parse_request() X-Ref |
This method parses the request input, it needs to get: 1/ user authentication - username+password or token 2/ function name 3/ function parameters |
send_response() X-Ref |
Send the result of function call to the WS client. |
send_error($ex = null) X-Ref |
Send the error information to the WS client. param: exception $ex |
run() X-Ref |
run() method implementation. |
get_service_methods() X-Ref |
Getter method of servicemethods array. return: array |
get_service_structs() X-Ref |
Getter method of servicestructs array. return: array |