Merge branch 'sprint/unitTest_liumengyi_branch' into 'master'

* Add unit test of branch.

See merge request easycorp/zentaopms!2998
This commit is contained in:
孙广明
2022-04-18 09:01:51 +00:00
21 changed files with 891 additions and 2 deletions
+24
View File
@@ -0,0 +1,24 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/branch.class.php';
su('admin');
/**
title=测试 branchModel->activate();
cid=1
pid=1
*/
$branchID = array(2, 4, 6, 8, 10, 1);
$branch = new branchTest();
r($branch->activateTest($branchID[0])) && p('id,status') && e('2,active'); // 测试激活分支 2
r($branch->activateTest($branchID[1])) && p('id,status') && e('4,active'); // 测试激活分支 4
r($branch->activateTest($branchID[2])) && p('id,status') && e('6,active'); // 测试激活分支 6
r($branch->activateTest($branchID[3])) && p('id,status') && e('8,active'); // 测试激活分支 8
r($branch->activateTest($branchID[4])) && p('id,status') && e('10,active'); // 测试激活分支 10
r($branch->activateTest($branchID[5])) && p('id,status') && e('1,active'); // 测试激活分支 1
+24
View File
@@ -0,0 +1,24 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/branch.class.php';
su('admin');
/**
title=测试 branchModel->batchUpdate();
cid=1
pid=1
*/
$changeName = array('name' => array('9' => '修改分支9的名称', '10' => '修改后的分支10名称'));
$changeDesc = array('desc' => array('9' => '修改分支9的描述', '10' => '修改后的分支10描述'));
$changeStatus = array('status' => array('9' => 'closed', '10' => 'closed'));
$branch = new branchTest();
r($branch->batchUpdateTest($changeName)) && p('field,old,new') && e('name,分支9,修改分支9的名称'); // 测试批量更新名称
r($branch->batchUpdateTest($changeDesc)) && p('field,old,new') && e('desc,,修改分支9的描述'); // 测试批量更新描述
r($branch->batchUpdateTest($changeStatus)) && p('field,old,new') && e('status,active,closed'); // 测试批量更新状态
system("./ztest init");
+21
View File
@@ -0,0 +1,21 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/branch.class.php';
su('admin');
/**
title=测试 branchModel->changeBranchLanguage();
cid=1
pid=1
*/
$productID = array(1, 41, 81, 42);
$branch = new branchTest();
r($branch->changeBranchLanguageTest($productID[0])) && p() && e('新建%s'); // 测试修改productID 1 的分支语言项
r($branch->changeBranchLanguageTest($productID[1])) && p() && e('新建分支'); // 测试修改productID 41 的分支语言项
r($branch->changeBranchLanguageTest($productID[2])) && p() && e('新建平台'); // 测试修改productID 81 的分支语言项
r($branch->changeBranchLanguageTest($productID[3])) && p() && e('新建分支'); // 测试修改productID 42 的分支语言项
+24
View File
@@ -0,0 +1,24 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/branch.class.php';
su('admin');
/**
title=测试 branchModel->checkBranchData();
cid=1
pid=1
*/
$branchID = array(1, 2, 3, 4, 5, 6, 1000001);
$branch = new branchTest();
r($branch->checkBranchDataTest($branchID[0])) && p() && e('2'); // 测试验证branchID 1 的数据
r($branch->checkBranchDataTest($branchID[1])) && p() && e('2'); // 测试验证branchID 2 的数据
r($branch->checkBranchDataTest($branchID[2])) && p() && e('2'); // 测试验证branchID 3 的数据
r($branch->checkBranchDataTest($branchID[3])) && p() && e('2'); // 测试验证branchID 4 的数据
r($branch->checkBranchDataTest($branchID[4])) && p() && e('2'); // 测试验证branchID 5 的数据
r($branch->checkBranchDataTest($branchID[5])) && p() && e('2'); // 测试验证branchID 6 的数据
r($branch->checkBranchDataTest($branchID[6])) && p() && e('1'); // 测试验证branchID 1000001 的数据
+25
View File
@@ -0,0 +1,25 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/branch.class.php';
su('admin');
/**
title=测试 branchModel->close();
cid=1
pid=1
*/
$branchID = array(1, 2, 3, 4, 5, 6);
$branch = new branchTest();
r($branch->closeTest($branchID[0])) && p('id,status') && e('1,closed'); // 测试关闭branchID 1
r($branch->closeTest($branchID[1])) && p('id,status') && e('2,closed'); // 测试关闭branchID 2
r($branch->closeTest($branchID[2])) && p('id,status') && e('3,closed'); // 测试关闭branchID 3
r($branch->closeTest($branchID[3])) && p('id,status') && e('4,closed'); // 测试关闭branchID 4
r($branch->closeTest($branchID[4])) && p('id,status') && e('5,closed'); // 测试关闭branchID 5
r($branch->closeTest($branchID[5])) && p('id,status') && e('6,closed'); // 测试关闭branchID 6
r($branch->closeTest($branchID[0])) && p('id,status') && e('1,closed'); // 测试重复关闭branchID 1
system("./ztest init");
+30
View File
@@ -0,0 +1,30 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/branch.class.php';
su('admin');
/**
title=测试 branchModel->create();
cid=1
pid=1
*/
$productID = 41;
$branch1 = array('name' => '新建分支1', 'desc' => '新建分支1的描述');
$branch2 = array('name' => '新建分支2', 'desc' => '新建分支2的描述');
$repeatName1 = array('name' => '新建分支1', 'desc' => '重名新建分支1的描述');
$repeatName2 = array('name' => '分支1', 'desc' => '重名分支1的描述');
$emptyName = array('name' => '', 'desc' => '分支名为空的分支描述');
$branch = new branchTest();
r($branch->createTest($productID, $branch1)) && p('name,desc') && e('新建分支1,新建分支1的描述'); // 测试新建分支1
r($branch->createTest($productID, $branch2)) && p('name,desc') && e('新建分支2,新建分支2的描述'); // 测试新建分支2
r($branch->createTest($productID, $repeatName1)) && p() && e('分支名称已存在'); // 测试新建 重名新建分支1
r($branch->createTest($productID, $repeatName2)) && p() && e('分支名称已存在'); // 测试新建 重名分支1
r($branch->createTest($productID, $emptyName)) && p() && e('『名称』不能为空。'); // 测试新建 名称为空的分支
system("./ztest init");
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/branch.class.php';
su('admin');
/**
title=测试 branchModel->getAllPairs();
cid=1
pid=1
*/
$params = 'noempty';
$branch = new branchTest();
r($branch->getAllPairsTest()) && p() && e('167'); // 测试获取全部分支名
r($branch->getAllPairsTest($params)) && p() && e('166'); // 测试获取全部分支名
+35
View File
@@ -0,0 +1,35 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/branch.class.php';
su('admin');
/**
title=测试 branchModel->getById();
cid=1
pid=1
*/
$branchID = array(1, 2, 3, '');
$productID = array(41, 81, 1);
$field = '';
$branch = new branchTest();
r($branch->getByIdTest($branchID[0])) && p() && e('分支1'); // 测试获取 branchID 1 的分支信息
r($branch->getByIdTest($branchID[0], $productID[0])) && p() && e('分支1'); // 测试获取 branchID 1 productID 41 的分支信息
r($branch->getByIdTest($branchID[0], $productID[0], $field)) && p('name') && e('分支1'); // 测试获取 branchID 1 productID 41 field 空 的分支信息
r($branch->getByIdTest($branchID[1])) && p() && e('分支2'); // 测试获取 branchID 2 的分支信息
r($branch->getByIdTest($branchID[1], $productID[0])) && p() && e('分支2'); // 测试获取 branchID 2 productID 41 的分支信息
r($branch->getByIdTest($branchID[1], $productID[0], $field)) && p('name') && e('分支2'); // 测试获取 branchID 2 productID 41 field 空 的分支信息
r($branch->getByIdTest($branchID[2])) && p() && e('分支3'); // 测试获取 branchID 3 的分支信息
r($branch->getByIdTest($branchID[2], $productID[0])) && p() && e('分支3'); // 测试获取 branchID 3 productID 41 的分支信息
r($branch->getByIdTest($branchID[2], $productID[0], $field)) && p('name') && e('分支3'); // 测试获取 branchID 3 productID 41 field 空 的分支信息
r($branch->getByIdTest($branchID[3])) && p() && e('0'); // 测试获取 branchID 空 的分支信息
r($branch->getByIdTest($branchID[3], $productID[0])) && p() && e('主干'); // 测试获取 branchID 空 productID 41 的分支信息
r($branch->getByIdTest($branchID[3], $productID[1])) && p() && e('主干'); // 测试获取 branchID 空 productID 81 的分支信息
r($branch->getByIdTest($branchID[3], $productID[2])) && p() && e('主干'); // 测试获取 branchID 空 productID 1 的分支信息
r($branch->getByIdTest($branchID[3], $productID[0], $field)) && p('name') && e('主干'); // 测试获取 branchID 空 productID 41 field 空 的分支信息
r($branch->getByIdTest($branchID[3], $productID[1], $field)) && p('name') && e('主干'); // 测试获取 branchID 空 productID 81 field 空 的分支信息
r($branch->getByIdTest($branchID[3], $productID[2], $field)) && p('name') && e('主干'); // 测试获取 branchID 空 productID 1 field 空 的分支信息
+35
View File
@@ -0,0 +1,35 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/branch.class.php';
su('admin');
/**
title=测试 branchModel->getByProducts();
cid=1
pid=1
*/
$products = array('1,41,42', '2,81,82', '43,83');
$params = array('', 'noclosed', 'ignoreNormal', 'noempty', 'noclosed,ignoreNormal', 'ignoreNormal,noempty');
$appendBranch = '';
$branch = new branchTest();
r($branch->getByProductsTest($products[0])) && p() && e('1:,0;41:,0,1,2;42:,0,3,4;'); // 测试获取产品 41 42 的分支信息
r($branch->getByProductsTest($products[0], $params[0])) && p() && e('1:,0;41:,0,1,2;42:,0,3,4;'); // 测试获取产品 41 42 的分支信息
r($branch->getByProductsTest($products[0], $params[1])) && p() && e('1:,0;41:,0,1;42:,0,3;'); // 测试获取产品 41 42 的分支信息
r($branch->getByProductsTest($products[0], $params[2])) && p() && e('41:,0,1,2;42:,0,3,4;'); // 测试获取产品 41 42 的分支信息
r($branch->getByProductsTest($products[0], $params[3])) && p() && e('1:,0;41:,1,2;42:,3,4;'); // 测试获取产品 41 42 的分支信息
r($branch->getByProductsTest($products[0], $params[4])) && p() && e('41:,0,1;42:,0,3;'); // 测试获取产品 41 42 的分支信息
r($branch->getByProductsTest($products[0], $params[5])) && p() && e('41:,1,2;42:,3,4;'); // 测试获取产品 41 42 的分支信息
r($branch->getByProductsTest($products[0], $params[0], $appendBranch)) && p() && e('1:,0;41:,0,1,2;42:,0,3,4;'); // 测试获取产品 41 42 追加branch20 21 的分支信息
r($branch->getByProductsTest($products[0], $params[1], $appendBranch)) && p() && e('1:,0;41:,0,1;42:,0,3;'); // 测试获取产品 41 42 noclosed 追加branch20 21 的分支信息
r($branch->getByProductsTest($products[0], $params[2], $appendBranch)) && p() && e('41:,0,1,2;42:,0,3,4;'); // 测试获取产品 41 42 ignoreNormal 追加branch20 21 的分支信息
r($branch->getByProductsTest($products[0], $params[3], $appendBranch)) && p() && e('1:,0;41:,1,2;42:,3,4;'); // 测试获取产品 41 42 noempty 追加branch20 21 的分支信息
r($branch->getByProductsTest($products[0], $params[4], $appendBranch)) && p() && e('41:,0,1;42:,0,3;'); // 测试获取产品 41 42 noclosed,ignoreNormal 追加branch20 21 的分支信息
r($branch->getByProductsTest($products[0], $params[5], $appendBranch)) && p() && e('41:,1,2;42:,3,4;'); // 测试获取产品 41 42 ignoreNormal,noempty 追加branch20 21 的分支信息
r($branch->getByProductsTest($products[1])) && p() && e('2:,0;81:,0,81,82;82:,0,83,84;'); // 测试获取产品 81 82 的分支信息
r($branch->getByProductsTest($products[2])) && p() && e('43:,0,5,6;83:,0,85,86;'); // 测试获取产品 43 83 的分支信息
+41
View File
@@ -0,0 +1,41 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/branch.class.php';
su('admin');
/**
title=测试 branchModel->getList();
cid=1
pid=1
*/
$productID = array(41, 42, 43);
$executionID = array(141, 142, 143, null);
$browseType = array('all', 'closed', 'active');
$mainBranch = false;
$branch = new branchTest();
r($branch->getListTest($productID[0])) && p() && e(',0,1'); // 测试获取产品 41的分支信息
r($branch->getListTest($productID[0], $executionID[0])) && p() && e(',0'); // 测试获取产品 41 执行 141的分支信息
r($branch->getListTest($productID[0], $executionID[0], $browseType[0])) && p() && e(',0'); // 测试获取产品 41 执行 141 all 没有主干 的分支信息
r($branch->getListTest($productID[0], $executionID[3], $browseType[0])) && p() && e(',0,1,2'); // 测试获取产品 41 all 没有主干 的分支信息
r($branch->getListTest($productID[0], $executionID[3], $browseType[1])) && p() && e(',2'); // 测试获取产品 41 执行 141 closed 没有主干 的分支信息
r($branch->getListTest($productID[0], $executionID[3], $browseType[2])) && p() && e(',0,1'); // 测试获取产品 41 执行 141 active 没有主干 的分支信息
r($branch->getListTest($productID[0], $executionID[3], $browseType[0], $mainBranch)) && p() && e(',1,2'); // 测试获取产品 41 执行 141 all 没有主干 的分支信息
r($branch->getListTest($productID[1])) && p() && e(',0,3'); // 测试获取产品 42的分支信息
r($branch->getListTest($productID[1], $executionID[1])) && p() && e(',0'); // 测试获取产品 42 执行 142的分支信息
r($branch->getListTest($productID[1], $executionID[1], $browseType[0])) && p() && e(',0'); // 测试获取产品 42 执行 142 all 没有主干 的分支信息
r($branch->getListTest($productID[1], $executionID[3], $browseType[0])) && p() && e(',0,3,4'); // 测试获取产品 42 all 没有主干 的分支信息
r($branch->getListTest($productID[1], $executionID[3], $browseType[1])) && p() && e(',4'); // 测试获取产品 42 执行 142 closed 没有主干 的分支信息
r($branch->getListTest($productID[1], $executionID[3], $browseType[2])) && p() && e(',0,3'); // 测试获取产品 42 执行 142 active 没有主干 的分支信息
r($branch->getListTest($productID[1], $executionID[3], $browseType[0], $mainBranch)) && p() && e(',3,4'); // 测试获取产品 42 执行 142 all 没有主干 的分支信息
r($branch->getListTest($productID[2])) && p() && e(',0,5'); // 测试获取产品 43的分支信息
r($branch->getListTest($productID[2], $executionID[2])) && p() && e(',0'); // 测试获取产品 43 执行 143的分支信息
r($branch->getListTest($productID[2], $executionID[2], $browseType[0])) && p() && e(',0'); // 测试获取产品 43 执行 143 all 没有主干 的分支信息
r($branch->getListTest($productID[2], $executionID[3], $browseType[0])) && p() && e(',0,5,6'); // 测试获取产品 43 all 没有主干 的分支信息
r($branch->getListTest($productID[2], $executionID[3], $browseType[1])) && p() && e(',6'); // 测试获取产品 43 执行 143 closed 没有主干 的分支信息
r($branch->getListTest($productID[2], $executionID[3], $browseType[2])) && p() && e(',0,5'); // 测试获取产品 43 执行 143 active 没有主干 的分支信息
r($branch->getListTest($productID[2], $executionID[3], $browseType[0], $mainBranch)) && p() && e(',5,6'); // 测试获取产品 43 执行 143 all 没有主干 的分支信息
+41
View File
@@ -0,0 +1,41 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/branch.class.php';
su('admin');
/**
title=测试 branchModel->getPairs();
cid=1
pid=1
*/
$productID = array(41, 42, 43);
$param = array('active', 'noempty', 'all', 'withClosed');
$executionID = array(141, 142, 143, null);
$mergedBranches = '1,4';
$branch = new branchTest();
r($branch->getPairsTest($productID[0])) && p() && e(',0,1,2'); // 测试获取 产品41 的分支信息对
r($branch->getPairsTest($productID[0], $param[0])) && p() && e(',0,1'); // 测试获取 产品41 active 的分支信息对
r($branch->getPairsTest($productID[0], $param[1])) && p() && e(',1,2'); // 测试获取 产品41 noempty 的分支信息对
r($branch->getPairsTest($productID[0], $param[2])) && p() && e(',all,0,1,2'); // 测试获取 产品41 all 的分支信息对
r($branch->getPairsTest($productID[0], $param[3])) && p() && e(',0,1,2'); // 测试获取 产品41 withClosed 的分支信息对
r($branch->getPairsTest($productID[0], $param[0], $executionID[0])) && p() && e(',0'); // 测试获取 产品41 active 执行141 的分支信息对
r($branch->getPairsTest($productID[0], $param[0], $executionID[0], $mergedBranches)) && p() && e(',0'); // 测试获取 产品41 active 执行141 合并分支1 4 的分支信息对
r($branch->getPairsTest($productID[1])) && p() && e(',0,3,4'); // 测试获取 产品41 的分支信息对
r($branch->getPairsTest($productID[1], $param[0])) && p() && e(',0,3'); // 测试获取 产品41 active 的分支信息对
r($branch->getPairsTest($productID[1], $param[1])) && p() && e(',3,4'); // 测试获取 产品41 noempty 的分支信息对
r($branch->getPairsTest($productID[1], $param[2])) && p() && e(',all,0,3,4'); // 测试获取 产品41 all 的分支信息对
r($branch->getPairsTest($productID[1], $param[3])) && p() && e(',0,3,4'); // 测试获取 产品41 withClosed 的分支信息对
r($branch->getPairsTest($productID[1], $param[0], $executionID[0])) && p() && e('0'); // 测试获取 产品41 active 执行141 的分支信息对
r($branch->getPairsTest($productID[1], $param[0], $executionID[0], $mergedBranches)) && p() && e('0'); // 测试获取 产品41 active 执行141 合并分支1 4 的分支信息对
r($branch->getPairsTest($productID[2])) && p() && e(',0,5,6'); // 测试获取 产品41 的分支信息对
r($branch->getPairsTest($productID[2], $param[0])) && p() && e(',0,5'); // 测试获取 产品41 active 的分支信息对
r($branch->getPairsTest($productID[2], $param[1])) && p() && e(',5,6'); // 测试获取 产品41 noempty 的分支信息对
r($branch->getPairsTest($productID[2], $param[2])) && p() && e(',all,0,5,6'); // 测试获取 产品41 all 的分支信息对
r($branch->getPairsTest($productID[2], $param[3])) && p() && e(',0,5,6'); // 测试获取 产品41 withClosed 的分支信息对
r($branch->getPairsTest($productID[2], $param[0], $executionID[0])) && p() && e('0'); // 测试获取 产品41 active 执行141 的分支信息对
r($branch->getPairsTest($productID[2], $param[0], $executionID[0], $mergedBranches)) && p() && e('0'); // 测试获取 产品41 active 执行141 合并分支1 4 的分支信息对
+23
View File
@@ -0,0 +1,23 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/branch.class.php';
su('admin');
/**
title=测试 branchModel->getProductType();
cid=1
pid=1
*/
$branchID = array(1, 3, 81, 83, 161, 163);
$branch = new branchTest();
r($branch->getProductTypeTest($branchID[0])) && p() && e('branch'); // 测试获取分支 1 的项目类型
r($branch->getProductTypeTest($branchID[1])) && p() && e('branch'); // 测试获取分支 3 的项目类型
r($branch->getProductTypeTest($branchID[2])) && p() && e('platform'); // 测试获取分支 81 的项目类型
r($branch->getProductTypeTest($branchID[3])) && p() && e('platform'); // 测试获取分支 83 的项目类型
r($branch->getProductTypeTest($branchID[4])) && p() && e('normal'); // 测试获取分支 161 的项目类型
r($branch->getProductTypeTest($branchID[5])) && p() && e('normal'); // 测试获取分支 163 的项目类型
+39
View File
@@ -0,0 +1,39 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/branch.class.php';
su('admin');
/**
title=测试 branchModel->mergeBranch();
cid=1
pid=1
*/
$productID = array(41, 42);
$mergedBranches = array('1', '2', '3,4');
$mergeBranch1 = new stdclass();
$mergeBranch1->createBranch = 0;
$mergeBranch1->mergedBranchIDList = array(1);
$mergeBranch1->targetBranch = 2;
$mergeBranch2 = new stdclass();
$mergeBranch2->name = '新建合并的分支';
$mergeBranch2->desc = '合并分支的描述';
$mergeBranch2->createBranch = 1;
$mergeBranch2->mergedBranchIDList = array(2);
$mergeBranch2->targetBranch = 0;
$mergeBranch3 = new stdclass();
$mergeBranch3->createBranch = 0;
$mergeBranch3->mergedBranchIDList = array(3, 4);
$mergeBranch3->targetBranch = 0;
$branch = new branchTest();
r($branch->mergeBranchTest($productID[0], $mergedBranches[0], $mergeBranch1)) && p() && e('2'); // 测试合并分支 1 到 分支 2
r($branch->mergeBranchTest($productID[0], $mergedBranches[1], $mergeBranch2)) && p() && e('2'); // 测试合并分支 2 到 新建分支
r($branch->mergeBranchTest($productID[1], $mergedBranches[2], $mergeBranch3)) && p() && e('12'); // 测试合并分支 3 4 到 主干
system("./ztest init");
+17
View File
@@ -0,0 +1,17 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/branch.class.php';
su('admin');
/**
title=测试 branchModel->setDefault();
cid=1
pid=1
*/
$branch = new branchTest();
r($branch->setDefaultTest()) && p() && e();
+31
View File
@@ -0,0 +1,31 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/branch.class.php';
su('admin');
/**
title=测试 branchModel->showBranch();
cid=1
pid=1
*/
$productID = array(1, 41, 81);
$moduleID = array(0, 1821, 1981, 2141);
$executionID = array(0, 101, 231, 181);
$branch = new branchTest();
r($branch->showBranchTest($productID[0])) && p() && e('2'); // 测试验证产品 1 是否显示分支标签
r($branch->showBranchTest($productID[0], $moduleID[1])) && p() && e('2'); // 测试验证产品 1 模块 1821 是否显示分支标签
r($branch->showBranchTest($productID[0], $moduleID[0], $executionID[1])) && p() && e('2'); // 测试验证产品 1 执行 101 是否显示分支标签
r($branch->showBranchTest($productID[0], $moduleID[1], $executionID[1])) && p() && e('2'); // 测试验证产品 1 模块 1821 执行 101 是否显示分支标签
r($branch->showBranchTest($productID[1])) && p() && e('1'); // 测试验证产品 41 是否显示分支标签
r($branch->showBranchTest($productID[1], $moduleID[2])) && p() && e('1'); // 测试验证产品 41 模块 1981 是否显示分支标签
r($branch->showBranchTest($productID[1], $moduleID[0], $executionID[2])) && p() && e('1'); // 测试验证产品 41 执行 231 是否显示分支标签
r($branch->showBranchTest($productID[1], $moduleID[2], $executionID[2])) && p() && e('1'); // 测试验证产品 41 模块 1981 执行 231 是否显示分支标签
r($branch->showBranchTest($productID[2])) && p() && e('1'); // 测试验证产品 81 是否显示分支标签
r($branch->showBranchTest($productID[2], $moduleID[3])) && p() && e('1'); // 测试验证产品 81 模块 2141 是否显示分支标签
r($branch->showBranchTest($productID[2], $moduleID[0], $executionID[3])) && p() && e('1'); // 测试验证产品 81 执行 181 是否显示分支标签
r($branch->showBranchTest($productID[2], $moduleID[3], $executionID[3])) && p() && e('1'); // 测试验证产品 81 模块 2141 执行 181 是否显示分支标签
+27
View File
@@ -0,0 +1,27 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/branch.class.php';
su('admin');
/**
title=测试 branchModel->sort();
cid=1
pid=1
*/
$branches = array('0,2,1', '0,4,3', '0,6,5', '0,8,7');
$order = 'order';
$branch = new branchTest();
r($branch->sortTest($branches[0])) && p() && e('1,2'); // 测试产品 41 排序
r($branch->sortTest($branches[1])) && p() && e('3,4'); // 测试产品 42 排序
r($branch->sortTest($branches[2])) && p() && e('5,6'); // 测试产品 43 排序
r($branch->sortTest($branches[3])) && p() && e('7,8'); // 测试产品 44 排序
r($branch->sortTest($branches[0], $order)) && p() && e('2,1'); // 测试产品 41 order 排序
r($branch->sortTest($branches[1], $order)) && p() && e('4,3'); // 测试产品 42 order 排序
r($branch->sortTest($branches[2], $order)) && p() && e('6,5'); // 测试产品 43 order 排序
r($branch->sortTest($branches[3], $order)) && p() && e('8,7'); // 测试产品 44 order 排序
system("./ztest init");
+27
View File
@@ -0,0 +1,27 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/branch.class.php';
su('admin');
/**
title=测试 branchModel->update();
cid=1
pid=1
*/
$changeName = array('name' => '修改后的分支1');
$changeStatus = array('status' => 'closed');
$changeDesc = array('desc' => '修改后的分支1描述');
$emptyName = array('name' => '');
$repeatName = array('name' => '分支2');
$branch = new branchTest();
r($branch->updateTest($changeName)) && p('0:field,old,new') && e('name,分支1,修改后的分支1'); // 测试修改分支名称
r($branch->updateTest($changeStatus)) && p('0:field,old,new') && e('status,active,closed'); // 测试修改分支状态
r($branch->updateTest($changeDesc)) && p('0:field,old,new') && e('desc,,修改后的分支1描述'); // 测试修改分支描述
r($branch->updateTest($emptyName)) && p('name:0') && e('『名称』不能为空。'); // 测试修改分支名称
r($branch->updateTest($repeatName)) && p('name:0') && e('分支名称已存在'); // 测试修改分支名称
system("./ztest init");