/** * Tests retrieving a user's profile as another user. */ public function test_messagearea_profile_as_other_user() { $this->resetAfterTest(true); // The person asking for the profile information. $this->setAdminUser(); // Create some users. $user1 = self::getDataGenerator()->create_user(); $user2 = new stdClass(); $user2->country = 'AU'; $user2->city = 'Perth'; $user2 = self::getDataGenerator()->create_user($user2); // Get the profile. $result = core_message_external::data_for_messagearea_get_profile($user1->id, $user2->id); // We need to execute the return values cleaning process to simulate the web service server. $result = external_api::clean_returnvalue(core_message_external::data_for_messagearea_get_profile_returns(), $result); $this->assertEquals($user2->id, $result['userid']); $this->assertEquals($user2->email, $result['email']); $this->assertEquals(get_string($user2->country, 'countries'), $result['country']); $this->assertEquals($user2->city, $result['city']); $this->assertEquals(fullname($user2), $result['fullname']); $this->assertFalse($result['isonline']); $this->assertFalse($result['isblocked']); $this->assertFalse($result['iscontact']); }