* Code formatter for pivot's unit test.
This commit is contained in:
@@ -19,10 +19,10 @@ $pivot = new pivotTest();
|
||||
|
||||
$idList = array(0, 1001, 1002, 1003, 1004, 1005, 1006, 1007);
|
||||
|
||||
r($pivot->getByIDTest($idList[0])) && p('id,name,group') && e('0,0,0'); //测试不存在的透视表
|
||||
r($pivot->getByIDTest($idList[0])) && p('id,name,group') && e('0,0,0'); //测试获取不存在的透视表,返回为空。
|
||||
$res = $pivot->getByIDTest($idList[1]);
|
||||
r($res) && p('id,name,group') && e('1001,完成项目工时透视表,85'); //测试id为1001的透视表
|
||||
r($res) && p('id,name,group') && e('1001,完成项目工时透视表,85'); //测试获取id为1001的透视表,是否能正常获取到数据。
|
||||
$fields = get_object_vars($res->fieldSettings);
|
||||
r(array_keys($fields)) && p('0,9') && e('项目名称,closedDate'); //测试id为1001的透视表的字段生成是否正确
|
||||
r($res->filters) && p('0:field') && e('closedDate'); //测试id为1001的透视表的筛选器生成是否正确
|
||||
r($pivot->getByIDTest($idList[3])) && p('id,name,group') && e('1003,产品完成度统计表,59'); //测试id为1003的透视表
|
||||
r(array_keys($fields)) && p('0,9') && e('项目名称,closedDate'); //测试获取id为1001的透视表,以及检查字段生成是否正确。
|
||||
r($res->filters) && p('0:field') && e('closedDate'); //测试获取id为1001的透视表,以及检查筛选器生成是否正确。
|
||||
r($pivot->getByIDTest($idList[3])) && p('id,name,group') && e('1003,产品完成度统计表,59'); //测试获取id为1003的透视表,是否能正常获取到数据。
|
||||
|
||||
@@ -8,6 +8,11 @@ title=测试 pivotModel->processPivot();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试传入数组的情况下返回是否是数组 >> 1
|
||||
测试传入对象的情况下返回是否是对象 >> 1
|
||||
测试函数执行以后sql是否被修改 >> 1
|
||||
测试函数执行以后返回的setting是否是数组 >> 1
|
||||
测试函数执行以后返回的used是否是true >> 1
|
||||
|
||||
*/
|
||||
|
||||
@@ -19,11 +24,12 @@ $pivotList = array();
|
||||
global $tester;
|
||||
foreach($pivotIDList as $pivotID) $pivotList[] = $tester->dao->select('*')->from(TABLE_PIVOT)->where('id')->eq($pivotID)->fetch();
|
||||
|
||||
r(is_array($pivot->processPivot(array($pivotList[0]),false))) && p('') && e(1); //测试传入数组的返回是否是数组
|
||||
r(is_object($pivot->processPivot($pivotList[1], true))) && p('') && e(1); //测试传入对象的返回是否是对象
|
||||
r(is_array($pivot->processPivot(array($pivotList[0]),false))) && p('') && e(1); //测试传入数组的情况下返回是否是数组
|
||||
r(is_object($pivot->processPivot($pivotList[1], true))) && p('') && e(1); //测试传入对象的情况下返回是否是对象
|
||||
|
||||
$add = ';;;;;;;;';
|
||||
$pivotList[2]->sql .= $add;
|
||||
$pivot->processPivot($pivotList[2], true);
|
||||
r(strpos($pivotList[2]->sql, $add) === false) && p('') && e(1); //测试sql是否被修改
|
||||
r(is_array($pivotList[2]->settings)) && p('') && e(1); //测试返回的setting是否是数组
|
||||
r(strpos($pivotList[2]->sql, $add) === false) && p('') && e(1); //测试函数执行以后sql是否被修改
|
||||
r(is_array($pivotList[2]->settings)) && p('') && e(1); //测试函数执行以后返回的setting是否是数组
|
||||
r($pivotList[2]->used) && p('') && e(1); //测试函数执行以后返回的used是否是true
|
||||
|
||||
Reference in New Issue
Block a user