* Fix untest db config.
This commit is contained in:
+2
-1
@@ -172,7 +172,8 @@ $dbConfig = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'db.php';
|
||||
if(file_exists($dbConfig)) include $dbConfig;
|
||||
|
||||
/* 引用自定义的配置。 Include the custom config file. */
|
||||
$myConfig = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'my.php';
|
||||
$myConfigRoot = (defined('RUN_MODE') and RUN_MODE == 'test') ? dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR . 'config' : dirname(__FILE__);
|
||||
$myConfig = $myConfigRoot . DIRECTORY_SEPARATOR . 'my.php';
|
||||
if(file_exists($myConfig)) include $myConfig;
|
||||
|
||||
/* 禅道配置文件。zentaopms settings. */
|
||||
|
||||
@@ -28,11 +28,15 @@ function initData()
|
||||
/**
|
||||
|
||||
title=测试 projectModel::getByID;
|
||||
timeout=0
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
获取ID等于2的项目 >> project2,project
|
||||
获取不存在的项目 >> 0
|
||||
- 执行project模块的getByID方法,参数是2, 'project
|
||||
- 属性code @project2
|
||||
- 属性type @project
|
||||
|
||||
- 执行project模块的getByID方法,参数是1, 'project,属性code @0
|
||||
|
||||
|
||||
*/
|
||||
|
||||
@@ -42,4 +46,4 @@ $tester->loadModel('project');
|
||||
initData();
|
||||
|
||||
r($tester->project->getByID(2, 'project')) && p('code,type') && e('project2,project'); //获取ID等于11的项目
|
||||
r($tester->project->getByID(1, 'project')) && p('code,type') && e('0'); //获取不存在的项目
|
||||
r($tester->project->getByID(1, 'project')) && p('code') && e('0'); //获取不存在的项目
|
||||
@@ -1,9 +0,0 @@
|
||||
<?php
|
||||
$config->test = new stdclass;
|
||||
$config->test->dbPrefix = "db_"; //复制数据库的数据库前缀,便于区分复制数据库
|
||||
$config->test->rawDB = 'zentaounittest'; //要复制的数据库,也就是ztest init初始化的数据库,例子:zentaounittest
|
||||
$config->test->dbNum = 10; //复制数据库的数量,可以根据自己的需要自行调节
|
||||
|
||||
$config->test->base = ''; //api测试基准路径,例子:http://liyang.oop.cc:8072/max/api.php/v1
|
||||
$config->test->account = ''; //api测试登录账户,例子:admin
|
||||
$config->test->password = ''; //api测试账户密码,例子:Ly123456
|
||||
+3
-8
@@ -14,6 +14,7 @@
|
||||
*/
|
||||
/* Set the error reporting. */
|
||||
error_reporting(E_ALL);
|
||||
define('RUN_MODE', 'test');
|
||||
|
||||
$testPath = dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'test' . DIRECTORY_SEPARATOR;
|
||||
$frameworkRoot = dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR . 'framework' . DIRECTORY_SEPARATOR;
|
||||
@@ -58,15 +59,9 @@ $config->ztfPath = dirname(dirname(__FILE__)) . '/tools/ztf';
|
||||
$config->zdPath = dirname(dirname(__FILE__)) . '/tools/zd';
|
||||
|
||||
/* init testDB. */
|
||||
include $testPath . 'config/config.php';
|
||||
include $testPath . 'lib/db.class.php';
|
||||
include $testPath . 'lib/yaml.class.php';
|
||||
include $testPath . 'lib/rest.php';
|
||||
|
||||
if(getenv('DB_ZENTAOPMS_UNIT')) $config->db->name = getenv('DB_ZENTAOPMS_UNIT');
|
||||
|
||||
$db = new db();
|
||||
|
||||
if(!empty($config->test->account) and !empty($config->test->password) and !empty($config->test->base))
|
||||
{
|
||||
$rest = new rest($config->test->base);
|
||||
@@ -149,9 +144,9 @@ function parseScript($expect)
|
||||
$delimiter = $_delimiter;
|
||||
$file = $debugInfo[count($debugInfo)-1]['file'];
|
||||
$contents = file_get_contents($file);
|
||||
|
||||
|
||||
list($moduleName, $methodName, $methodParam) = genParamsByRPE($contents);
|
||||
|
||||
|
||||
$isGrup = false;
|
||||
$stepDesc = '';
|
||||
$expects = empty($expect) ? array() : explode($delimiter, $expect);
|
||||
|
||||
Reference in New Issue
Block a user