Esempio n. 1
0
 function setUp()
 {
     VF_Singleton::reset();
     VF_Singleton::getInstance(true);
     VF_Singleton::getInstance()->setRequest(new Zend_Controller_Request_Http());
     $database = new VF_TestDbAdapter(array('dbname' => VAF_DB_NAME, 'username' => VAF_DB_USERNAME, 'password' => VAF_DB_PASSWORD));
     VF_Singleton::getInstance()->setReadAdapter($database);
     $schemaGenerator = new VF_Schema_Generator();
     $schemaGenerator->dropExistingTables();
     $schemaGenerator->execute(array('make', 'model', 'year'));
     VF_Schema::reset();
 }
Esempio n. 2
0
 protected function switchSchema($levels, $force = false)
 {
     if (!$force) {
         try {
             $schema = new VF_Schema();
             if ($levels == implode(',', $schema->getLevels())) {
                 $this->startTransaction();
                 return;
             }
         } catch (Zend_Db_Statement_Mysqli_Exception $e) {
         } catch (Zend_Db_Statement_Exception $e) {
         }
     }
     $schemaGenerator = new VF_Schema_Generator();
     $schemaGenerator->dropExistingTables();
     $schemaGenerator->execute(explode(',', $levels));
     VF_Schema::reset();
     $this->startTransaction();
 }