Merge branch 'MDL-55019-master' of git://github.com/jleyva/moodle

This commit is contained in:
Dan Poltawski 2016-07-04 15:29:19 +01:00
commit 7fddfd3768
2 changed files with 10 additions and 1 deletions

View File

@ -195,9 +195,11 @@ class core_course_external extends external_api {
$sectionvalues['id'] = $section->id;
$sectionvalues['name'] = get_section_name($course, $section);
$sectionvalues['visible'] = $section->visible;
$options = (object) array('noclean' => true);
list($sectionvalues['summary'], $sectionvalues['summaryformat']) =
external_format_text($section->summary, $section->summaryformat,
$context->id, 'course', 'section', $section->id);
$context->id, 'course', 'section', $section->id, $options);
$sectionvalues['section'] = $section->section;
$sectioncontents = array();

View File

@ -686,6 +686,7 @@ class core_course_externallib_testcase extends externallib_advanced_testcase {
* @return array A list with the course object and course modules objects
*/
private function prepare_get_course_contents_test() {
global $DB;
$course = self::getDataGenerator()->create_course();
$forumdescription = 'This is the forum description';
$forum = $this->getDataGenerator()->create_module('forum',
@ -710,6 +711,10 @@ class core_course_externallib_testcase extends externallib_advanced_testcase {
$roleid = $this->assignUserCapability('moodle/course:view', $context->id);
$this->assignUserCapability('moodle/course:update', $context->id, $roleid);
$conditions = array('course' => $course->id, 'section' => 2);
$DB->set_field('course_sections', 'summary', 'Text with iframe <iframe src="https://moodle.org"></iframe>', $conditions);
rebuild_course_cache($course->id, true);
return array($course, $forumcm, $datacm, $pagecm, $labelcm, $urlcm);
}
@ -755,6 +760,8 @@ class core_course_externallib_testcase extends externallib_advanced_testcase {
$this->assertCount(4, $firstsection['modules']);
$this->assertCount(1, $lastsection['modules']);
$this->assertEquals(2, $lastsection['section']);
$this->assertContains('<iframe', $lastsection['summary']);
$this->assertContains('</iframe>', $lastsection['summary']);
try {
$sections = core_course_external::get_course_contents($course->id,