diff --git a/test/lib/init.php b/test/lib/init.php index d08ab930d1..144b7790be 100644 --- a/test/lib/init.php +++ b/test/lib/init.php @@ -12,10 +12,10 @@ * @version $Id: $ * @link http://www.zentao.net */ -$testPath = dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR; /* Set the error reporting. */ error_reporting(E_ALL & E_STRICT); +$testPath = dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR; $frameworkRoot = dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'framework' . DIRECTORY_SEPARATOR; /** @@ -44,7 +44,6 @@ include $frameworkRoot . 'control.class.php'; include $frameworkRoot . 'model.class.php'; include $frameworkRoot . 'helper.class.php'; - $app = router::createApp('pms', dirname(dirname(__FILE__)), 'router'); $tester = $app->loadCommon(); @@ -57,6 +56,7 @@ $config->zdPath = dirname(dirname(__FILE__)) . '/tools/zd'; include $testPath . 'config/config.php'; include $testPath. 'lib/db.class.php'; $db = new db(); + /** * Save variable to $_result. * diff --git a/test/lib/utils.php b/test/lib/utils.php index d3aa784371..8892627b00 100644 --- a/test/lib/utils.php +++ b/test/lib/utils.php @@ -208,22 +208,27 @@ function zdRun($model = '') } } +/** + * copy init DB. + * + * @access public + * @return void + */ function copyDB() { - global $config; - global $dao; + global $config, $dao; - $dumpCommand = "mysqldump -u%s -p%s %s > %s"; - $sqlFile = TEST_BASEHPATH . DS . 'tmp/raw.sql'; + $dumpCommand = "mysqldump -u%s -p%s %s > %s"; + $sqlFile = TEST_BASEHPATH . DS . 'tmp/raw.sql'; $currentDBNum = $dao->query("select count(*) from information_schema.SCHEMATA where SCHEMA_NAME like '" . $config->test->dbPrefix . "%'"); - $dumpCommand = sprintf($dumpCommand, $config->db->user, $config->db->password, $config->test->rawDB, $sqlFile); + $dumpCommand = sprintf($dumpCommand, $config->db->user, $config->db->password, $config->test->rawDB, $sqlFile); shell_exec($dumpCommand); $dbNum = $config->test->dbNum; $dbUsed = array(); - for ($i = 1; $i <= $dbNum; $i++) + for($i = 1; $i <= $dbNum; $i++) { $dbUsed[] = $config->test->dbPrefix . $i; }