function run() { $retVal = $this->init(); if ($retVal) { $this->message("Running"); $this->assert(TRUE, "Assert auf TRUE"); $this->assert(FALSE, "Assert auf FALSE"); // test isValid //$d = new cSubscriber(33); // $this->assert($d->delete(), "hmmm... should have delete :( "); $c = new cSubscriber(); //mydump($c,"Subscriber"); $this->assert(!$c->save(), "isValid accepted default values"); $c->email = "*****@*****.**"; $this->assert(!$c->save(), "isValid accepted email only"); $c->domain_id = 15; $this->assert($c->save(), "hmmm... should have saved :( "); // test if save works fine if (empty($c->id) || $c->id == 0) { $this->error("what the f.... should have saved and i have no IDea :("); $this->success = false; //check for email $this->assert($c->loadEmail("*****@*****.**"), "error trying to load by email :( "); $this->assert($c->domain_id == 15, 'domain_id is not equal after save'); $this->assert($c->email == '*****@*****.**', 'email is not equal after save'); } else { // remember id and clear object $myid = $c->getID(); // mydump($myid,"Subscriber"); $c = 0; // reread and check values $c = new cSubscriber($myid); //mydump($c,"Subscriber"); $this->assert($c->domain_id == 15, 'domain_id is not equal after save'); $this->assert($c->email == '*****@*****.**', 'email is not equal after save' . $c->email); //set password $c->setPassword('test'); $this->assert($c->passwd == 'test', 'setPassword didnot set any.'); //update $this->assert($c->save(), "hmmm... should have UPDATED :( "); //delete record //$this->assert($c->delete(),"hmmm... should have deleted :( "); } } return $retVal; }
/** * @author dav * @abstract * @return array all topics related to this newsletter */ function getSubscribers() { if (empty($this->_subscribers) || !is_array($this->_subscribers)) { $this->_subscribers = array(); if ($rs = executeQuery("SELECT subscriber.* FROM subscriber LEFT JOIN subscription_form_subscriber ON subscriber.id=subscription_form_subscriber.subscriber_id WHERE newsletter_id='" . $this->getID() . "' ORDER BY subscriber.id")) { while ($row = $rs->getrow()) { $subscriber = new cSubscriber(); $subscriber->set($row); $this->_subscribers[] = $subscriber; } } } return $this->_subscribers; }