コード例 #1
0
 /**
  * Tests retrieving most recent message with messaging disabled.
  */
 public function test_messagearea_get_most_recent_message_messaging_disabled()
 {
     global $CFG;
     $this->resetAfterTest(true);
     // Create some skeleton data just so we can call the WS.
     $user1 = self::getDataGenerator()->create_user();
     $user2 = self::getDataGenerator()->create_user();
     // The person asking for the most recent message.
     $this->setUser($user1);
     // Disable messaging.
     $CFG->messaging = 0;
     // Ensure an exception is thrown.
     $this->expectException('moodle_exception');
     core_message_external::data_for_messagearea_get_most_recent_message($user1->id, $user2->id);
 }