MDL-68055 core_course: export content item description as markdown
authorJake Dallimore <jake@moodle.com>
Wed, 26 Feb 2020 02:20:01 +0000 (10:20 +0800)
committerJake Dallimore <jake@moodle.com>
Wed, 4 Mar 2020 03:44:26 +0000 (11:44 +0800)
course/classes/local/exporters/course_content_item_exporter.php
course/tests/exporters_content_item_test.php

index 3123418..470b29f 100644 (file)
@@ -119,7 +119,7 @@ class course_content_item_exporter extends exporter {
             'title' => $this->contentitem->get_title()->get_value(),
             'link' => $this->contentitem->get_link()->out(false),
             'icon' => $this->contentitem->get_icon(),
-            'help' => $this->contentitem->get_help(),
+            'help' => format_text($this->contentitem->get_help(), FORMAT_MARKDOWN),
             'archetype' => $this->contentitem->get_archetype(),
             'componentname' => $this->contentitem->get_component_name(),
             'favourite' => $favourite,
index 872ece6..1aa2860 100644 (file)
@@ -65,7 +65,7 @@ class exporters_course_content_item_testcase extends \advanced_testcase {
         $this->assertObjectHasAttribute('icon', $exporteditem);
         $this->assertEquals($exporteditem->icon, $contentitem->get_icon());
         $this->assertObjectHasAttribute('help', $exporteditem);
-        $this->assertEquals($exporteditem->help, $contentitem->get_help());
+        $this->assertEquals($exporteditem->help, format_text($contentitem->get_help(), FORMAT_MARKDOWN));
         $this->assertObjectHasAttribute('archetype', $exporteditem);
         $this->assertEquals($exporteditem->archetype, $contentitem->get_archetype());
         $this->assertObjectHasAttribute('componentname', $exporteditem);
@@ -89,7 +89,8 @@ class exporters_course_content_item_testcase extends \advanced_testcase {
             new \core_course\local\entity\string_title('test_title'),
             new \moodle_url(''),
             '',
-            '',
+            '* First point
+            * Another point',
             MOD_ARCHETYPE_OTHER,
             'core_test'
         );
@@ -109,7 +110,7 @@ class exporters_course_content_item_testcase extends \advanced_testcase {
         $this->assertObjectHasAttribute('icon', $exporteditem);
         $this->assertEquals($exporteditem->icon, $contentitem->get_icon());
         $this->assertObjectHasAttribute('help', $exporteditem);
-        $this->assertEquals($exporteditem->help, $contentitem->get_help());
+        $this->assertEquals($exporteditem->help, format_text($contentitem->get_help(), FORMAT_MARKDOWN));
         $this->assertObjectHasAttribute('archetype', $exporteditem);
         $this->assertEquals($exporteditem->archetype, $contentitem->get_archetype());
         $this->assertObjectHasAttribute('componentname', $exporteditem);