public function testExpected() { $wefact = new Module(); $model = Model::getInstance(); $this->getSecureProperty($wefact, '_registrarId')->setValue($wefact, 1); $response = $this->getSecureProperty($model, '_response'); $expected = array('be', 'eu', 'com'); $response->setValue($model, $expected); self::assertEquals($expected, $wefact->getAvailableTlds()); $response->setValue($model, null); }
/** * Returns either NULL or array of available TLDs * Helpful for domain synchronization, that was ODR will filter only supported TLDs, less time for you, less requests for us * * @return array|null */ public function getAvailableTlds() { if ($this->_availableTlds !== null) { return $this->_availableTlds; } if ($this->_registrarId === null) { return null; } $this->_availableTlds = array(); $pdoStatement = Database_Model::getInstance()->prepare('SELECT `Tld` FROM `WeFact_TopLevelDomain` WHERE `Registrar` = :registrar'); $pdoStatement->bindValue(':registrar', $this->_registrarId); $pdoStatement->execute(); $this->_availableTlds = (array) $pdoStatement->fetchAll(PDO::FETCH_COLUMN); return empty($this->_availableTlds) ? array() : $this->_availableTlds; }