public function testGetUser() { $item = new Conversation(); $user = User::fromResponse(array('id' => 1)); $item->user = $user; $this->assertInstanceOf(User::class, $item->user); $this->assertEquals($user, $item->user); }
public function testGetPresences() { $this->assertEquals(['online', 'idle', 'offline'], User::getPresences()); }
/** * Set user status. * * @param int $id - userId * @param string $presence - status * @param string $sessionId - session id * * @throws InvalidArgumentException * @throws Exception */ public function setPresence($id, $presence, $sessionId) { if ($this->isEmptyId($id)) { throw new InvalidArgumentException(); } if (!in_array($presence, User::getPresences())) { throw new InvalidArgumentException(); } if (!$sessionId) { throw new InvalidArgumentException(); } $params = ['presence' => $presence, 'session' => $sessionId]; $this->call('users/' . $id . '/setpresence', $params, 'post'); }
public function testGetFrom() { $item = new Message(); $from = User::fromResponse(array('id' => 1)); $item->from = $from; $this->assertInstanceOf(User::class, $item->from); $this->assertEquals($from, $item->from); }