コード例 #1
0
 /**
  * Tests searching users in course with messaging disabled.
  */
 public function test_messagearea_search_users_in_course_messaging_disabled()
 {
     global $CFG;
     $this->resetAfterTest(true);
     // Create some skeleton data just so we can call the WS..
     $user = self::getDataGenerator()->create_user();
     $course = $this->getDataGenerator()->create_course();
     // The person doing the search for another user.
     $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_in_course($user->id, $course->id, 'User');
 }