public function testContactCreationAndGetters() { $data = json_decode(file_get_contents(STUB_PATH . '/contacts.json'), true); /** @var $item \CarlosIO\Pingdom\Contact */ $item = \CarlosIO\Pingdom\Contact::createFromArray($data['contacts'][0]); $this->assertSame(111250, $item->getId()); $this->assertSame('John Doe', $item->getName()); $this->assertSame('*****@*****.**', $item->getEmail()); $this->assertSame('46-5555555', $item->getCellphone()); $this->assertSame('SE', $item->getCountryIso()); $this->assertSame('clickatell', $item->getDefaultSmsProvider()); $this->assertSame(false, $item->getDirectTwitter()); $this->assertSame(false, $item->getPaused()); // Not existing properties $this->assertSame(null, $item->getAndroidTokens()); $this->assertSame(null, $item->getIphoneTokens()); $this->assertSame(null, $item->getTwitterUser()); }
/** * Returns a list of all contacts from current account * * @throws \Exception * @return array<\CarlosIO\Pingdom\Checks> All contacts */ public function getContacts($options = array()) { $response = $this->_callMethod('contacts', $options); $itemList = $response['contacts']; $result = array(); foreach ($itemList as $item) { $newItem = \CarlosIO\Pingdom\Contact::createFromArray($item); $newItem->setAccount($this); $result[] = $newItem; } return $result; }