コード例 #1
0
function initDbDump()
{
    static $done = false;
    if ($done) {
        throw new Exception("init already done");
    }
    include_once 'unit/dbMaintenance.php';
    $dbM = new dbMaintenance();
    $dbM->dumpDB();
    $done = true;
}
コード例 #2
0
 /**
  * Unset everything before the next test.
  */
 protected function tearDown()
 {
     unset($this->oUpdateHandler);
     if ($this->restore) {
         $dbMaintenance = new dbMaintenance();
         $dbMaintenance->restoreDB();
     }
 }
コード例 #3
0
 /**
  * check current DB checksums (vs initial)
  *
  * @todo move to separate class instead of static
  *
  * @param PHPUnit_Framework_TestCase $oTest
  * @param PHPUnit_Framework_TestResult $result
  */
 public static function checkDbChecksums(PHPUnit_Framework_TestCase $oTest = null, PHPUnit_Framework_TestResult $result = null)
 {
     $aDiff = array_diff(self::getDbChecksum(), self::_getInitialDbChecksum());
     if (count($aDiff) > 0) {
         if ($oTest && $result) {
             $result->addError($oTest, new RuntimeException("Changed tables: " . implode(" ", array_keys($aDiff))), 0);
         }
         $dbM = new dbMaintenance();
         $dbM->restoreDB(MAINTENANCE_WHOLETABLES, MAINTENANCE_MODE_ONLYRESET);
         echo "|";
     }
 }
コード例 #4
0
 /**
  * Unset everything before the next test.
  */
 protected function tearDown()
 {
     if ($this->restore) {
         $dbMaintenance = new dbMaintenance();
         $dbMaintenance->restoreDB();
     }
 }