MDL-62029 core_course: Site format is not a standard plugin
authorDavid Monllao <davidm@moodle.com>
Fri, 11 May 2018 18:15:27 +0000 (20:15 +0200)
committerDavid Monllao <davidm@moodle.com>
Fri, 11 May 2018 18:15:27 +0000 (20:15 +0200)
course/classes/privacy/provider.php
course/tests/privacy_test.php

index 41a8136..4d1941a 100644 (file)
@@ -158,13 +158,14 @@ class provider implements
 
         foreach ($coursedata as $course) {
             $context = \context_course::instance($course->id);
+            $courseformat = $course->format !== 'site' ? get_string('pluginname', 'format_' . $course->format) : get_string('site');
             $data = (object) [
                 'fullname' => $course->fullname,
                 'shortname' => $course->shortname,
                 'idnumber' => $course->idnumber,
                 'summary' => writer::with_context($context)->rewrite_pluginfile_urls([], 'course', 'summary', 0,
                                                                                      format_string($course->summary)),
-                'format' => get_string('pluginname', 'format_' . $course->format),
+                'format' => $courseformat,
                 'startdate' => transform::datetime($course->startdate),
                 'enddate' => transform::datetime($course->enddate)
             ];
index b2d9033..3f4ecee 100644 (file)
@@ -105,7 +105,7 @@ class core_course_privacy_testcase extends \core_privacy\tests\provider_testcase
         $this->resetAfterTest();
 
         // Create a course and a single module.
-        $course1 = $this->getDataGenerator()->create_course(['fullname' => 'Course 1', 'shortname' => 'C1']);
+        $course1 = $this->getDataGenerator()->create_course(['fullname' => 'Course 1', 'shortname' => 'C1', 'format' => 'site']);
         $context1 = context_course::instance($course1->id);
         $modassign = $this->getDataGenerator()->create_module('assign', ['course' => $course1->id, 'name' => 'assign test 1']);
         $assigncontext = context_module::instance($modassign->cmid);