예제 #1
0
 public function testGetMessages()
 {
     $this->prepareConfig();
     if ($this->apiKey) {
         ChatworkSDK::setApiKey($this->apiKey);
         $room = new ChatworkRoom($this->roomId);
         $messages = $room->getMessages();
         $this->assertInternalType('array', $messages);
         $checkClass = true;
         $lastMessage = null;
         foreach ($messages as $message) {
             if (!$message instanceof wataridori\ChatworkSDK\ChatworkMessage) {
                 $checkClass = false;
             }
             $lastMessage = $message;
         }
         $this->assertTrue($checkClass);
         if ($lastMessage) {
             $room->resetMessage();
             $room->appendReplyInRoom($lastMessage);
             $room->appendQuote($lastMessage);
             $room->appendInfo('Test Quote, Reply, Info text', 'Test from Chatwork-SDK');
             $room->sendMessage();
         }
     }
     $this->assertTrue(true);
 }
예제 #2
0
 public function testGetRooms()
 {
     $this->prepareConfig();
     if ($this->apiKey) {
         ChatworkSDK::setApiKey($this->apiKey);
         $api = new ChatworkApi();
         $api->getRooms();
     }
     $this->assertTrue(true);
 }