MDL-35593 core_webservice_get_site_info returns version number set to PARAM_TEXT and PARAM_FLOAT

This commit is contained in:
Jerome Mouneyrac
2012-12-03 10:47:38 +08:00
parent 47dfbd9eb3
commit 87ede25c9b
2 changed files with 9 additions and 1 deletions
+1 -1
View File
@@ -189,7 +189,7 @@ class core_webservice_external extends external_api {
new external_single_structure(
array(
'name' => new external_value(PARAM_RAW, 'function name'),
'version' => new external_value(PARAM_FLOAT,
'version' => new external_value(PARAM_TEXT,
'The version number of the component to which the function belongs')
), 'functions that are available')
),
+8
View File
@@ -64,6 +64,10 @@ class core_webservice_external_testcase extends externallib_advanced_testcase {
$webservice->downloadfiles = true;
$externalserviceid = $DB->insert_record('external_services', $webservice);
// Add a function to the service
$DB->insert_record('external_services_functions', array('externalserviceid' => $externalserviceid,
'functionname' => 'core_course_get_contents'));
$_POST['wstoken'] = 'testtoken';
$externaltoken = new stdClass();
$externaltoken->token = 'testtoken';
@@ -86,6 +90,10 @@ class core_webservice_external_testcase extends externallib_advanced_testcase {
$this->assertEquals($CFG->release, $siteinfo['release']);
$this->assertEquals($CFG->version, $siteinfo['version']);
$this->assertEquals(get_config('admin', 'mobilecssurl'), $siteinfo['mobilecssurl']);
$this->assertEquals(count($siteinfo['functions']), 1);
$function = array_pop($siteinfo['functions']);
$this->assertEquals($function['name'], 'core_course_get_contents');
$this->assertEquals($function['version'], $siteinfo['version']);
}
}