Beispiel #1
0
 public function testSendAsyncWithoutCallbackAndLoop()
 {
     $arpPrint = new Request('/ip/arp/print');
     $arpPrint->setTag('arp');
     $this->object->sendAsync($arpPrint);
     $this->object->loop();
     $list = $this->object->extractNewResponses('arp');
     $this->assertInstanceOf(ROS_NAMESPACE . '\\ResponseCollection', $list, 'The list is not a collection');
     $this->assertGreaterThan(0, count($list), 'No responses.');
     $ping = new Request('/ping');
     $ping->setArgument('address', HOSTNAME)->setArgument('interval', '0.5')->setTag('ping');
     $this->object->sendAsync($ping);
     $this->object->loop(2);
     $list = $this->object->extractNewResponses('ping');
     $this->assertInstanceOf(ROS_NAMESPACE . '\\ResponseCollection', $list, 'The list is not a collection');
     $this->assertGreaterThan(0, count($list), 'No responses.');
     $this->assertEquals(0, count($list->getAllOfType(Response::TYPE_FINAL)), 'The command should not be finished yet.');
     $this->assertEquals(count($list), count($list->getAllOfType(Response::TYPE_DATA)), 'There should be only data responses.');
     $this->object->cancelRequest('ping');
 }