Example #1
0
 public function testGetTypes()
 {
     $this->assertEquals(['reply_admin', 'reply_user', 'reply_django_user', 'note', 'tag_added', 'tag_deleted', 'assigned', 'closed', 'opened', 'service'], Message::getTypes());
 }
Example #2
0
 /**
  * Get messages from conversation.
  *
  * @param int $id conversation id
  * @param int $count
  * @param int $offset
  *
  * @return Message
  *
  * @throws InvalidArgumentException
  * @throws Exception
  */
 public function getMessages($id, $limit = 20, $offset = 0)
 {
     if ($this->isEmptyId($id)) {
         throw new InvalidArgumentException();
     }
     $params = ['count' => $limit, 'after' => $offset];
     $data = $this->call('conversations/' . $id . '/parts', $params, 'get');
     $array = [];
     if ($data) {
         foreach ($data as $msg) {
             $array[] = Message::fromResponse($msg);
         }
     }
     return $array;
 }
Example #3
0
 public function testGetPartLast()
 {
     $item = new Conversation();
     $message = Message::fromResponse(array('id' => 1));
     $item->partLast = $message;
     $this->assertInstanceOf(Message::class, $item->partLast);
     $this->assertEquals($message, $item->partLast);
 }