* Refactor case of the getReleasedBuilds method.

This commit is contained in:
tianshujie
2023-10-09 14:14:42 +08:00
parent c53ee0e42b
commit a39acb136b
2 changed files with 22 additions and 37 deletions
+22 -20
View File
@@ -1,33 +1,35 @@
#!/usr/bin/env php
<?php
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/release.class.php';
su('admin');
/**
title=测试 releaseModel->getReleasedBuilds();
timeout=0
cid=1
pid=1
branch为'all'时数据查询查询 >> 1,3
branch为'0'时数据查询查询 >> 1,3
branch为'1'时数据查询查询 >> 0
branch为'2'时数据查询查询 >> 0
branch为''时数据查询查询 >> 1,3
产品ID为空查询 >> 0
产品ID不存在查询 >> 0
*/
$productID = array('','1','10000');
$brachArray = array('all','0','1','2','');
$release = zdTable('release')->config('release');
$release->build->range('1-5');
$release->branch->range('1-5');
$release->gen(5);
$release = new releaseTest();
r($release->getReleasedBuildsTest($productID[1], $brachArray[0])) && p('0,1') && e('1,3'); //branch为'all'时数据查询查询
r($release->getReleasedBuildsTest($productID[1], $brachArray[1])) && p('0,1') && e('1,3'); //branch为'0'时数据查询查询
r($release->getReleasedBuildsTest($productID[1], $brachArray[2])) && p() && e('0'); //branch为'1'时数据查询查询
r($release->getReleasedBuildsTest($productID[1], $brachArray[3])) && p() && e('0'); //branch为'2'时数据查询查询
r($release->getReleasedBuildsTest($productID[1], $brachArray[4])) && p('0,1') && e('1,3'); //branch为''时数据查询查询
r($release->getReleasedBuildsTest($productID[0], $brachArray[0])) && p() && e('0'); //产品ID为空查询
r($release->getReleasedBuildsTest($productID[2], $brachArray[0])) && p() && e('0'); //产品ID不存在查询
zdTable('product')->config('product')->gen(6);
zdTable('branch')->config('branch')->gen(5);
zdTable('user')->gen(5);
su('admin');
$products = array(0, 1, 10);
$branches = array('all', '0', '1', '2', '');
global $tester;
$tester->loadModel('release');
r($tester->release->getReleasedBuilds($products[1], $branches[0])) && p('1') && e('0'); // branch为'all'时数据查询查询
r($tester->release->getReleasedBuilds($products[1], $branches[1])) && p('1') && e('0'); // branch为'0'时数据查询查询
r($tester->release->getReleasedBuilds($products[1], $branches[2])) && p('0') && e('1'); // branch为'1'时数据查询查询
r($tester->release->getReleasedBuilds($products[1], $branches[3])) && p('0') && e('2'); // branch为'2'时数据查询查询
r($tester->release->getReleasedBuilds($products[1], $branches[4])) && p('1') && e('0'); // branch为''时数据查询查询
r($tester->release->getReleasedBuilds($products[0], $branches[0])) && p() && e('0'); // 产品ID为空查询
r($tester->release->getReleasedBuilds($products[2], $branches[0])) && p() && e('0'); // 产品ID不存在查询
-17
View File
@@ -60,23 +60,6 @@ class releaseTest
return $objects;
}
/**
* Get released test builds from product .
*
* @param int $productID
* @param string|int $branch
* @access public
* @return void
*/
public function getReleasedBuildsTest($productID, $branch = 'all')
{
$objects = $this->objectModel->getReleasedBuilds($productID, $branch);
if(dao::isError()) return dao::getError();
return $objects;
}
/**
* 创建一个发布。
* Create a release.