コード例 #1
0
 public function testCheckCreationAndGetters()
 {
     $data = json_decode(file_get_contents(STUB_PATH . '/checks.json'), true);
     /** @var $item \CarlosIO\Pingdom\Check */
     $item = \CarlosIO\Pingdom\Check::createFromArray($data['checks'][0]);
     $this->assertSame('example.com', $item->getHostname());
     $this->assertSame(85975, $item->getId());
     $this->assertSame(1297446423, $item->getLastErrorTime());
     $this->assertSame(355, $item->getLastResponseTime());
     $this->assertSame(1300977363, $item->getLastTestTime());
     $this->assertSame('My check 1', $item->getName());
     $this->assertSame(1, $item->getResolution());
     $this->assertSame('up', $item->getStatus());
     $this->assertSame('http', $item->getType());
     $this->assertSame(null, $item->getCreated());
 }
コード例 #2
0
 /**
  * Returns a list overview of all checks from current account
  *
  * @throws \Exception
  * @return array<\CarlosIO\Pingdom\Checks> All checks
  */
 public function getChecks($options = array())
 {
     $response = $this->_callMethod('checks', $options);
     $itemList = $response['checks'];
     $result = array();
     foreach ($itemList as $item) {
         $newItem = \CarlosIO\Pingdom\Check::createFromArray($item);
         $newItem->setAccount($this);
         $result[] = $newItem;
     }
     return $result;
 }