* [misc] Enhance unit tests for branchModel::getStatusList() method
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -83,6 +83,22 @@ class branchTest
|
||||
return $objects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get status list.
|
||||
*
|
||||
* @param int $productID
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getStatusListTest($productID)
|
||||
{
|
||||
$result = $this->objectModel->getStatusList($productID);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test create a branch.
|
||||
*
|
||||
|
||||
Regular → Executable
+27
-16
@@ -1,27 +1,38 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
|
||||
zenData('branch')->loadYaml('branch')->gen(10);
|
||||
zenData('user')->gen(5);
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 branchModel->getStatusList();
|
||||
title=测试 branchModel::getStatusList();
|
||||
timeout=0
|
||||
cid=1
|
||||
cid=0
|
||||
|
||||
- 获取正常产品的分支状态列表 @0
|
||||
- 获取多分支产品的分支状态列表属性1 @active
|
||||
- 获取不存在产品的分支状态列表 @0
|
||||
- 执行branchTest模块的getStatusListTest方法,参数是101 属性1 @active
|
||||
- 执行branchTest模块的getStatusListTest方法,参数是999 @0
|
||||
- 执行branchTest模块的getStatusListTest方法 @0
|
||||
- 执行branchTest模块的getStatusListTest方法,参数是102 属性3 @active
|
||||
- 执行branchTest模块的getStatusListTest方法,参数是103 属性6 @closed
|
||||
|
||||
*/
|
||||
|
||||
$productIdList = array(1, 6, 11);
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/lib/branch.unittest.class.php';
|
||||
|
||||
global $tester;
|
||||
$tester->loadModel('branch');
|
||||
r($tester->branch->getStatusList($productIdList[0])) && p() && e('0'); // 获取正常产品的分支状态列表
|
||||
r($tester->branch->getStatusList($productIdList[1])) && p('1') && e('active'); // 获取多分支产品的分支状态列表
|
||||
r($tester->branch->getStatusList($productIdList[2])) && p() && e('0'); // 获取不存在产品的分支状态列表
|
||||
$branch = zenData('branch');
|
||||
$branch->id->range('1-10');
|
||||
$branch->product->range('101{2},102{3},103{2},104{1}');
|
||||
$branch->name->range('主分支,开发分支,测试分支,发布分支,hotfix分支');
|
||||
$branch->status->range('active{5},closed{5}');
|
||||
$branch->deleted->range('0');
|
||||
$branch->gen(10);
|
||||
|
||||
zenData('user')->gen(5);
|
||||
su('admin');
|
||||
|
||||
$branchTest = new branchTest();
|
||||
|
||||
r($branchTest->getStatusListTest(101)) && p('1') && e('active');
|
||||
r($branchTest->getStatusListTest(999)) && p() && e('0');
|
||||
r($branchTest->getStatusListTest(0)) && p() && e('0');
|
||||
r($branchTest->getStatusListTest(102)) && p('3') && e('active');
|
||||
r($branchTest->getStatusListTest(103)) && p('6') && e('closed');
|
||||
Reference in New Issue
Block a user