[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/webservice/tests/ -> lib_test.php (summary)

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: 285 lines (10 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 2 classes

webservice_test:: (5 methods):
  setUp()
  test_init_service_class()
  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()


Class: webservice_test  - X-Ref

Unit tests for the webservice component.

setUp()   X-Ref
Setup.


test_init_service_class()   X-Ref
Test init_service_class().


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.

Dummy webservice class for testing the webservice_base_server class and enable us to expose variables we want to test.

__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



Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1