/** * Tests searching messages with messaging disabled */ public function test_messagearea_search_messages_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 doing the search . $this->setUser($user); // Disable messaging. $CFG->messaging = 0; // Ensure an exception is thrown. $this->expectException('moodle_exception'); core_message_external::data_for_messagearea_search_messages($user->id, 'Search'); }