Commit 38c6a307 authored by Andrew Nicols's avatar Andrew Nicols
Browse files

Merge branch 'MDL-52586-master' of git://github.com/jleyva/moodle

parents 64858d43 333e7770
......@@ -193,6 +193,9 @@ class core_webservice_external extends external_api {
// User max upload file size. -1 means the user can ignore the upload file size.
$siteinfo['usermaxuploadfilesize'] = get_user_max_upload_file_size($context, $CFG->maxbytes);
// User home page.
$siteinfo['userhomepage'] = get_home_page();
return $siteinfo;
}
......@@ -251,7 +254,10 @@ class core_webservice_external extends external_api {
'user quota (bytes). 0 means user can ignore the quota', VALUE_OPTIONAL),
'usermaxuploadfilesize' => new external_value(PARAM_INT,
'user max upload file size (bytes). -1 means the user can ignore the upload file size',
VALUE_OPTIONAL)
VALUE_OPTIONAL),
'userhomepage' => new external_value(PARAM_INT,
'the default home page for the user: 0 for the site home, 1 for dashboard',
VALUE_OPTIONAL)
)
);
}
......
......@@ -124,6 +124,8 @@ class core_webservice_externallib_testcase extends externallib_advanced_testcase
$this->assertEquals(get_max_upload_file_size($maxbytes), $siteinfo['usermaxuploadfilesize']);
$this->assertEquals(true, $siteinfo['usercanmanageownfiles']);
$this->assertEquals(HOMEPAGE_MY, $siteinfo['userhomepage']);
// Now as admin.
$this->setAdminUser();
......@@ -138,6 +140,11 @@ class core_webservice_externallib_testcase extends externallib_advanced_testcase
$externaltoken->creatorid = $USER->id;
$externaltoken->timecreated = time();
$DB->insert_record('external_tokens', $externaltoken);
// Set a home page by user preferences.
$CFG->defaulthomepage = HOMEPAGE_USER;
set_user_preference('user_home_page_preference', HOMEPAGE_SITE);
$siteinfo = core_webservice_external::get_site_info();
// We need to execute the return values cleaning process to simulate the web service server.
......@@ -147,6 +154,8 @@ class core_webservice_externallib_testcase extends externallib_advanced_testcase
$this->assertEquals(USER_CAN_IGNORE_FILE_SIZE_LIMITS, $siteinfo['usermaxuploadfilesize']);
$this->assertEquals(true, $siteinfo['usercanmanageownfiles']);
$this->assertEquals(HOMEPAGE_SITE, $siteinfo['userhomepage']);
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment