/** * Builds an instance object of this class only if there is no one. * * @return object * m_instance A CampConfig instance */ public static function singleton() { if (!isset(self::$m_instance)) { self::$m_instance = new CampDatabase(); } return self::$m_instance; } // fn singleton
public function testIsConnected() { global $g_ado_db; $this->m_dbObj = CampDatabase::singleton(); $this->assertEquals(true, $this->m_dbObj->m_db->IsConnected()); $g_ado_db = $this->m_dbObj->m_db; $this->assertEquals(true, $g_ado_db->IsConnected()); }
/** * Returns a CampDatabase instance. * * @return object * A CampDatabase instance. */ public static function GetDatabaseInstance() { return CampDatabase::singleton(); } // fn GetDatabase