示例#1
0
 /**
  * Tests searching users with messaging disabled.
  */
 public function test_messagearea_search_users_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_users($user->id, 'User');
 }