Beispiel #1
0
 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);
 }
Beispiel #2
0
 /**
  * Get user by ID.
  *
  * @param int $id
  * @param bool $isSystem
  *
  * @return User
  *
  * @throws InvalidArgumentException
  * @throws Exception
  */
 public function getUser($id, $isSystem = true)
 {
     if ($this->isEmptyId($id)) {
         throw new InvalidArgumentException();
     }
     $params = ['by_user_id' => !$isSystem, 'props' => true, 'props_events' => false, 'props_custom' => false, 'presence_details' => true, 'events' => false, 'segments' => false, 'notes' => false];
     return User::fromResponse($this->call('users/' . $id, $params, 'get'));
 }
Beispiel #3
0
 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);
 }