Merge branch 'MDL-56459-master' of git://github.com/FMCorz/moodle
authorDan Poltawski <dan@moodle.com>
Mon, 5 Dec 2016 15:48:27 +0000 (15:48 +0000)
committerDan Poltawski <dan@moodle.com>
Mon, 5 Dec 2016 15:48:27 +0000 (15:48 +0000)
competency/classes/external/exporter.php
competency/tests/exporter_test.php

index 1f8f7f7..d54c6c6 100644 (file)
@@ -158,7 +158,7 @@ abstract class exporter {
             } else if ($definition['type'] === PARAM_TEXT) {
                 if (!empty($definition['multiple'])) {
                     foreach ($data->$property as $key => $value) {
-                        $data->$property[$key] = external_format_string($value, $context->id);
+                        $data->{$property}[$key] = external_format_string($value, $context->id);
                     }
                 } else {
                     $data->$property = external_format_string($data->$property, $context->id);
index 101e1b4..a2d2c90 100644 (file)
@@ -111,6 +111,9 @@ class core_competency_exporter_testcase extends advanced_testcase {
         $output = $PAGE->get_renderer('tool_lp');
 
         $result = $exporter->export($output);
+
+        $this->assertSame('Another string', $result->otherstring);
+        $this->assertSame(array('String a', 'String b'), $result->otherstrings);
     }
 }
 
@@ -130,8 +133,8 @@ class core_competency_testable_exporter extends \core_competency\external\export
 
     protected function get_other_values(renderer_base $output) {
         return array(
-            'otherstring' => 'An other string',
-            'otherstrings' => array('String a', 'String b')
+            'otherstring' => 'Another <strong>string</strong>',
+            'otherstrings' => array('String a', 'String <strong>b</strong>')
         );
     }