public function __destruct()
 {
     if (!$this->persistDB) {
         $Registry = new Registry();
         try {
             $Ini = $Registry->Ini;
             $aConfig = $Ini->getSection('MONGO');
             $realDbname = $aConfig['db'];
             $oMongo = new \Lampcms\Mongo\DB($Ini);
         } catch (\Exception $e) {
             return;
         }
         /**
          * Being Careful - if for some reason
          * the dbname used for this MongoInstance
          * is our actual database then don't do anything
          *
          */
         if ($realDbname !== $oMongo->getDbName()) {
             echo ' Test complete. You can remove the test mongo database: ' . $oMongo->getDbName();
             //$oMongo->getDb()->drop();
         } else {
             echo 'Not going to drop db. This is the actual DB!';
         }
     }
 }
Ejemplo n.º 2
0
 /**
  *
  * @depends testConstructor
  */
 public function testInsertData()
 {
     $aData = array('one' => 1, 'two' => 2);
     $oMongo = new \Lampcms\Mongo\DB($this->Registry->Ini);
     $res = $oMongo->insertData($this->COLLNAME, $aData);
     $this->assertTrue($res instanceof \MongoId);
 }