Permalink
Browse files

MDL-35593 core_webservice_get_site_info returns version number set to…

… PARAM_TEXT and PARAM_FLOAT
  • Loading branch information...
1 parent c545dca commit e20e67161ce79618326daaa8fda6575f71016284 @mouneyrac mouneyrac committed with Sam Hemelryk Dec 3, 2012
Showing with 9 additions and 1 deletion.
  1. +1 −1 webservice/externallib.php
  2. +8 −0 webservice/tests/externallib_test.php
@@ -189,7 +189,7 @@ public static function get_site_info_returns() {
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')
),
@@ -64,6 +64,10 @@ public function test_get_site_info() {
$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 @@ public function test_get_site_info() {
$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']);
}
}

0 comments on commit e20e671

Please sign in to comment.