Skip to content
Permalink
Browse files

Merge branch 'MDL-37381-master' of git://github.com/mouneyrac/moodle

  • Loading branch information...
danpoltawski committed Jan 15, 2013
2 parents 0efd8de + c5f7628 commit 2429051d2f9e4695079925826ba1dc28d816263d
Showing with 11 additions and 4 deletions.
  1. +5 −2 lib/external/externallib.php
  2. +6 −2 lib/external/tests/externallib_test.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'))
));
}
}
@@ -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 2429051

Please sign in to comment.
You can’t perform that action at this time.