/** * the singleton pattern * * @return Addressbook_Setup_DemoData */ public static function getInstance() { if (self::$_instance === NULL) { self::$_instance = new self(); } return self::$_instance; }
/** * tests if creating reduced demodata is possible */ public function testCreateReducedDemoData() { ob_start(); Addressbook_Setup_DemoData::getInstance()->createDemoData(array('locale' => 'de')); ob_end_clean(); $c = Tinebase_Container::getInstance()->getSharedContainer(Tinebase_Core::getUser(), 'Addressbook', FALSE); $id = $c->getId(); $id = $id[1]; $filter = new Addressbook_Model_ContactFilter(array(array('field' => 'container_id', 'operator' => 'equals', 'value' => $id))); $result = Addressbook_Controller_Contact::getInstance()->search($filter); $this->assertEquals(20, count($result)); }
/** * unsets the instance to save memory, be aware that hasBeenRun still needs to work after unsetting! * */ public function unsetInstance() { if (self::$_instance !== NULL) { self::$_instance = null; } }