MDL-53772 externallib: Fix busted webservices context handling

Fix:
$PAGE->context must be reset when calling validate_context

Improve:
Provide wrapper for calling an external function

The wrapper correctly checks the function parameters and return type against
the description of the external function, and stores the PAGE and COURSE global
state variables, restoring them before the function returns.

Fix: buggy unit tests.

These tests are expecting debugging from a bug that was fixed, and calling web
service functions with no user or session.
This commit is contained in:
Damyon Wiese 2016-04-08 13:01:06 +08:00
parent b611ade3ab
commit 56fa860ead
7 changed files with 258 additions and 164 deletions

View file

@ -818,6 +818,7 @@ class core_user_externallib_testcase extends externallib_advanced_testcase {
$device2['pushid'] = "0987654321";
$device2['appid'] = "other.app.com";
$this->setAdminUser();
// Create a user device using the external API function.
core_user_external::add_user_device($device['appid'], $device['name'], $device['model'], $device['platform'],
$device['version'], $device['pushid'], $device['uuid']);