Ejemplo n.º 1
0
 /**
  * Runs each of the schemas stored by PHPUnit_Fixture_DynamicDB
  *
  * Primarily used to generate our staging DB structure, ready for
  * integration, functionality & acceptance testing.
  * 
  * @access public
  * @param  PHPUnit_Fixture_DynamicDB	$fixture
  * @return bool										True if sucessful, false otherwise.
  * 
  */
 public function buildSchema($fixture)
 {
     if (!$fixture instanceof PHPUnit_Fixture_DynamicDB) {
         throw new ErrorException('Fixture must extend PHPUnit_Fixture_DynamicDB.');
     }
     $schemas = $fixture->getSchemas();
     if (0 === count($schemas)) {
         throw new Zend_Exception('No schema found.');
     }
     try {
         foreach ($schemas as $sql) {
             echo $sql;
             $this->_runFixtureQuery($sql);
         }
         return true;
     } catch (Exception $e) {
         $e->getMessage();
         $fixture->drop();
     }
     return false;
 }