* Modify unit test of testcaseModel::getBySearch.
This commit is contained in:
@@ -2,10 +2,11 @@
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/testcase.class.php';
|
||||
su('admin');
|
||||
|
||||
$caseData = zdTable('case');
|
||||
$caseData->gen(10);
|
||||
zdTable('case')->gen('20');
|
||||
zdTable('user')->gen('1');
|
||||
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,24 +14,32 @@ title=测试 testcaseModel->getByOpenedBy();
|
||||
timeout=0
|
||||
cid=1
|
||||
|
||||
- 测试搜索产品1下的用例
|
||||
- 第1条的title属性 @这个是测试用例1
|
||||
- 第2条的title属性 @这个是测试用例2
|
||||
- 第3条的title属性 @这个是测试用例3
|
||||
- 第4条的title属性 @这个是测试用例4
|
||||
- 测试搜索产品1 项目1 下的用例
|
||||
- 第1条的title属性 @这个是测试用例1
|
||||
- 第3条的title属性 @这个是测试用例3
|
||||
- 第5条的title属性 @这个是测试用例5
|
||||
- 第7条的title属性 @这个是测试用例7
|
||||
- 第9条的title属性 @这个是测试用例9
|
||||
|
||||
*/
|
||||
|
||||
$tabList = array('qa', 'project');
|
||||
$projectIdList = array('0', '1', '2');
|
||||
$productIdList = array('0', '1', '2');
|
||||
$branchIdList = array(0, 'all');
|
||||
$autoList = array('no', 'auto');
|
||||
$orderByList = array('id_desc', 'id_asc');
|
||||
|
||||
$testcase = new testcaseTest();
|
||||
r($testcase->getBySearchTest($tabList[0], $projectIdList[0], $productIdList[1])) && p('1:title;2:title;3:title;4:title') && e('这个是测试用例1;这个是测试用例2;这个是测试用例3;这个是测试用例4'); // 测试搜索产品1下的用例
|
||||
r($testcase->getBySearchTest($tabList[1], $projectIdList[1], $productIdList[1])) && p('1:title;3:title;5:title;7:title;9:title') && e('这个是测试用例1;这个是测试用例3;这个是测试用例5;这个是测试用例7;这个是测试用例9'); // 测试搜索产品1 项目1 下的用例
|
||||
|
||||
r($testcase->getBySearchTest($tabList[0], $projectIdList[0], $productIdList[0], $branchIdList[0], 0, $autoList[0], $orderByList[0])) && p() && e('20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1'); // 测试搜索 qa 下 项目 0 产品 0 下的用例
|
||||
r($testcase->getBySearchTest($tabList[0], $projectIdList[0], $productIdList[0], $branchIdList[1], 0, $autoList[0], $orderByList[0])) && p() && e('20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1'); // 测试搜索 qa 下 项目 0 产品 0 分支 all 下的用例
|
||||
r($testcase->getBySearchTest($tabList[0], $projectIdList[0], $productIdList[0], $branchIdList[0], 0, $autoList[1], $orderByList[0])) && p() && e('0'); // 测试搜索 qa 下 项目 0 产品 0 auto auto 下的用例
|
||||
r($testcase->getBySearchTest($tabList[0], $projectIdList[0], $productIdList[0], $branchIdList[0], 0, $autoList[0], $orderByList[1])) && p() && e('1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20'); // 测试搜索 qa 下 项目 0 产品 0 orderBy id_asc 下的用例
|
||||
r($testcase->getBySearchTest($tabList[0], $projectIdList[0], $productIdList[0], $branchIdList[1], 0, $autoList[1], $orderByList[0])) && p() && e('0'); // 测试搜索 qa 下 项目 0 产品 0 分支 all auto auto 下的用例
|
||||
r($testcase->getBySearchTest($tabList[0], $projectIdList[0], $productIdList[0], $branchIdList[1], 0, $autoList[0], $orderByList[1])) && p() && e('1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20'); // 测试搜索 qa 下 项目 0 产品 0 分支 all orderBy id_asc 下的用例
|
||||
r($testcase->getBySearchTest($tabList[0], $projectIdList[0], $productIdList[0], $branchIdList[0], 0, $autoList[1], $orderByList[1])) && p() && e('0'); // 测试搜索 qa 下 项目 0 产品 0 auto auto orderBy id_asc 下的用例
|
||||
r($testcase->getBySearchTest($tabList[0], $projectIdList[0], $productIdList[0], $branchIdList[1], 0, $autoList[1], $orderByList[1])) && p() && e('0'); // 测试搜索 qa 下 项目 0 产品 0 分支 all auto auto orderBy id_asc 下的用例
|
||||
r($testcase->getBySearchTest($tabList[0], $projectIdList[1], $productIdList[0], $branchIdList[0], 0, $autoList[0], $orderByList[0])) && p() && e('20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1'); // 测试搜索 qa 下 项目 1 产品 0 下的用例
|
||||
r($testcase->getBySearchTest($tabList[0], $projectIdList[0], $productIdList[0], $branchIdList[0], 0, $autoList[0], $orderByList[0])) && p() && e('20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1'); // 测试搜索 qa 下 项目 0 产品 0 下的用例
|
||||
|
||||
r($testcase->getBySearchTest($tabList[0], $projectIdList[0], $productIdList[1])) && p() && e('4,3,2,1'); // 测试搜索 qa 下 项目 0 产品 1 下的用例
|
||||
r($testcase->getBySearchTest($tabList[0], $projectIdList[1], $productIdList[1])) && p() && e('4,3,2,1'); // 测试搜索 qa 下 项目 1 产品 1 下的用例
|
||||
|
||||
r($testcase->getBySearchTest($tabList[1], $projectIdList[0], $productIdList[0])) && p() && e('0'); // 测试搜索 project 下 项目 0 产品 0 下的用例
|
||||
r($testcase->getBySearchTest($tabList[1], $projectIdList[1], $productIdList[0])) && p() && e('0'); // 测试搜索 project 下 项目 1 产品 0 下的用例
|
||||
r($testcase->getBySearchTest($tabList[1], $projectIdList[0], $productIdList[1])) && p() && e('0'); // 测试搜索 project 下 项目 0 产品 1 下的用例
|
||||
r($testcase->getBySearchTest($tabList[1], $projectIdList[1], $productIdList[1])) && p() && e('0'); // 测试搜索 project 下 项目 1 产品 1 下的用例
|
||||
|
||||
@@ -302,9 +302,9 @@ class testcaseTest
|
||||
* @param string $orderBy
|
||||
* @param object $pager
|
||||
* @access public
|
||||
* @return array
|
||||
* @return array|string
|
||||
*/
|
||||
public function getBySearchTest(string $tab = 'qa', int $projectID = 0, int $productID = 0, int|string $branch = 0, int $queryID = 0, string $auto = 'no', string $orderBy = 'id_desc', object $pager = null): array
|
||||
public function getBySearchTest(string $tab = 'qa', int $projectID = 0, int $productID = 0, int|string $branch = 0, int $queryID = 0, string $auto = 'no', string $orderBy = 'id_desc', object $pager = null): array|string
|
||||
{
|
||||
global $tester;
|
||||
$tester->app->tab = $tab;
|
||||
@@ -316,7 +316,7 @@ class testcaseTest
|
||||
|
||||
if(dao::isError()) return false;
|
||||
|
||||
return $objects;
|
||||
return implode(',', array_keys($objects));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user