Skip to content
Browse files

Merge branch 'MDL-37381-stable24' of git://github.com/mouneyrac/moodl…

…e into MOODLE_24_STABLE
  • Loading branch information...
2 parents 9d49ca3 + 7059a42 commit 37784b037e4cc0c146148259747a02893e61a89d @danpoltawski danpoltawski committed Jan 15, 2013
Showing with 11 additions and 4 deletions.
  1. +5 −2 lib/external/externallib.php
  2. +6 −2 lib/external/tests/externallib_test.php
View
7 lib/external/externallib.php
@@ -236,7 +236,10 @@ public static function get_component_strings($component, $lang = null) {
$wsstrings = array();
$componentstrings = $stringmanager->load_component_strings($params['component'], $params['lang']);
foreach($componentstrings as $stringid => $string) {
- $wsstrings[$stringid] = $string;
+ $wsstring = array();
+ $wsstring['stringid'] = $stringid;
+ $wsstring['string'] = $string;
+ $wsstrings[] = $wsstring;
}
return $wsstrings;
@@ -252,7 +255,7 @@ public static function get_component_strings_returns() {
return new external_multiple_structure(
new external_single_structure(array(
'stringid' => new external_value(PARAM_STRINGID, 'string id'),
- 'string' => new external_value(PARAM_TEXT, 'translated string'))
+ 'string' => new external_value(PARAM_RAW, 'translated string'))
));
}
}
View
8 lib/external/tests/externallib_test.php
@@ -105,9 +105,13 @@ public function test_get_component_strings() {
$wsstrings = $stringmanager->load_component_strings('webservice', current_language());
$componentstrings = core_external::get_component_strings('webservice');
+
+ // We need to execute the return values cleaning process to simulate the web service server.
+ $componentstrings = external_api::clean_returnvalue(core_external::get_component_strings_returns(), $componentstrings);
+
$this->assertEquals(count($componentstrings), count($wsstrings));
- foreach($wsstrings as $name => $string) {
- $this->assertEquals($string, $componentstrings[$name]);
+ foreach($componentstrings as $string) {
+ $this->assertEquals($string['string'], $wsstrings[$string['stringid']]);
}
}
}

0 comments on commit 37784b0

Please sign in to comment.
Something went wrong with that request. Please try again.