mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 16:32:18 +02:00
Merge branch 'MDL-80318-master' of https://github.com/jleyva/moodle
This commit is contained in:
commit
494064288c
@ -3349,9 +3349,11 @@ class core_course_external extends external_api {
|
||||
instancetype: 'coursecommunication',
|
||||
instanceid: $course->id
|
||||
);
|
||||
$coursesdata[$course->id]['communicationroomname'] = \core_external\util::format_string($communication->get_room_name(), $context);
|
||||
// This will be usually an URL, however, it is better to consider that can be anything a plugin might return, this is why we will use PARAM_RAW.
|
||||
$coursesdata[$course->id]['communicationroomurl'] = $communication->get_communication_room_url();
|
||||
if ($communication->get_provider()) {
|
||||
$coursesdata[$course->id]['communicationroomname'] = \core_external\util::format_string($communication->get_room_name(), $context);
|
||||
// This will be usually an URL, however, it is better to consider that can be anything a plugin might return, this is why we will use PARAM_RAW.
|
||||
$coursesdata[$course->id]['communicationroomurl'] = $communication->get_communication_room_url();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3094,6 +3094,17 @@ class externallib_test extends externallib_advanced_testcase {
|
||||
$course = reset($result['courses']);
|
||||
$this->assertEquals($roomname, $course['communicationroomname']);
|
||||
$this->assertEquals($telegramlink, $course['communicationroomurl']);
|
||||
|
||||
// Course without comm tools.
|
||||
$course = $this->getDataGenerator()->create_course();
|
||||
$result = external_api::clean_returnvalue(
|
||||
core_course_external::get_courses_by_field_returns(),
|
||||
core_course_external::get_courses_by_field('id', $course->id)
|
||||
);
|
||||
|
||||
$course = reset($result['courses']);
|
||||
$this->assertNotContains('communicationroomname', $course);
|
||||
$this->assertNotContains('communicationroomurl', $course);
|
||||
}
|
||||
|
||||
public function test_get_courses_by_field_invalid_field() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user