/** * Tests retrieving conversations with messaging disabled. */ public function test_messagearea_conversations_messaging_disabled() { global $CFG; $this->resetAfterTest(true); // Create some skeleton data just so we can call the WS. $user = self::getDataGenerator()->create_user(); // The person retrieving the conversations. $this->setUser($user); // Disable messaging. $CFG->messaging = 0; // Ensure an exception is thrown. $this->expectException('moodle_exception'); core_message_external::data_for_messagearea_conversations($user->id); }