diff --git a/mod/chat/classes/external.php b/mod/chat/classes/external.php index 0e1dcd16a6fca..da2b4b20a9100 100644 --- a/mod/chat/classes/external.php +++ b/mod/chat/classes/external.php @@ -594,7 +594,8 @@ public static function get_chats_by_courses_returns() { 'intro' => new external_value(PARAM_RAW, 'The Chat intro'), 'introformat' => new external_format_value('intro'), 'introfiles' => new external_files('Files in the introduction text', VALUE_OPTIONAL), - 'chatmethod' => new external_value(PARAM_ALPHA, 'chat method (sockets, daemon)', VALUE_OPTIONAL), + 'chatmethod' => new external_value(PARAM_PLUGIN, 'chat method (sockets, ajax, header_js)', + VALUE_OPTIONAL), 'keepdays' => new external_value(PARAM_INT, 'keep days', VALUE_OPTIONAL), 'studentlogs' => new external_value(PARAM_INT, 'student logs visible to everyone', VALUE_OPTIONAL), 'chattime' => new external_value(PARAM_INT, 'chat time', VALUE_OPTIONAL), diff --git a/mod/chat/tests/externallib_test.php b/mod/chat/tests/externallib_test.php index e9698d29fa296..f17fb2e70a26a 100644 --- a/mod/chat/tests/externallib_test.php +++ b/mod/chat/tests/externallib_test.php @@ -223,9 +223,13 @@ public function test_view_chat() { * Test get_chats_by_courses */ public function test_get_chats_by_courses() { - global $DB, $USER; + global $DB, $USER, $CFG; $this->resetAfterTest(true); $this->setAdminUser(); + + // Set global chat method. + $CFG->chat_method = 'header_js'; + $course1 = self::getDataGenerator()->create_course(); $chatoptions1 = array( 'course' => $course1->id, @@ -272,6 +276,7 @@ public function test_get_chats_by_courses() { $this->assertCount(1, $chats['chats']); $this->assertEquals('Second Chat', $chats['chats'][0]['name']); + $this->assertEquals('header_js', $chats['chats'][0]['chatmethod']); // We see 17 fields. $this->assertCount(17, $chats['chats'][0]); // As an Admin you can see some chat properties like 'section'.