add design test

This commit is contained in:
liyang
2022-04-07 14:33:10 +08:00
parent 0b8768c1d6
commit a03d2d52d2
20 changed files with 612 additions and 4 deletions
+219
View File
@@ -0,0 +1,219 @@
<?php
class designTest
{
public function __construct()
{
global $tester;
$this->objectModel = $tester->loadModel('design');
}
/**
* Function create test by design
*
* @param int $projectID
* @param array $param
* @access public
* @return object
*/
public function createTest($projectID, $param = array())
{
$labels = array();
$files = array();
$createFields = array('product' => '', 'story' => '', 'type' => '', 'name' => '', 'labels' => $labels, 'files' => $files, 'desc' => '');
foreach($createFields as $field => $defaultValue) $_POST[$field] = $defaultValue;
foreach($param as $key => $value) $_POST[$key] = $value;
$objectID = $this->objectModel->create($projectID);
unset($_POST);
if(dao::isError()) return dao::getError();
$objects = $this->objectModel->getByID($objectID);
return $objects;
}
/**
* Function batchCreate test by desgin
*
* @param int $projectID
* @param int $productID
* @param array $param
* @access public
* @return array
*/
public function batchCreateTest($projectID, $productID, $param = array())
{
global $tester;
$story = array('', '', '', '');
$type = array('', '', '', '');
$name = array('', '', '', '');
$desc = array('', '', '', '');
$createFields = array('story' => $story, 'type' => $type, 'name' => $name, 'desc' => $desc);
foreach($createFields as $field => $defaultValue) $_POST[$field] = $defaultValue;
foreach($param as $key => $value) $_POST[$key] = $value;
$this->objectModel->batchCreate($projectID, $productID);
unset($_POST);
if(dao::isError()) return dao::getError();
$objects = $tester->dao->select('*')->from(TABLE_DESIGN)->where('project')->eq($projectID)->andwhere('product')->eq($productID)->fetchAll();
return $objects;
}
/**
* Function update test by desgin
*
* @param int $designID
* @param array $param
* @access public
* @return array
*/
public function updateTest($designID, $param = array())
{
global $tester;
$labels = array();
$files = array();
$createFields = $tester->dao->select('`product`,`story`,`type`,`name`,`desc`')->from(TABLE_DESIGN)->where('id')->eq($designID)->fetchAll();
$createFields[0]->labels = $labels;
$createFields[0]->files = $files;
foreach($createFields[0] as $field => $defaultValue) $_POST[$field] = $defaultValue;
foreach($param as $key => $value) $_POST[$key] = $value;
$objects = $this->objectModel->update($designID);
unset($_POST);
if(dao::isError()) return dao::getError();
return $objects;
}
public function assignTest($designID, $param = array())
{
global $tester;
$createFields = array('assignedTo' => '', 'comment' => '');
foreach($createFields as $field => $defaultValue) $_POST[$field] = $defaultValue;
foreach($param as $key => $value) $_POST[$key] = $value;
$this->objectModel->assign($designID);
unset($_POST);
if(dao::isError()) return dao::getError();
$objects = $tester->dao->select('*')->from(TABLE_DESIGN)->where('id')->eq($designID)->fetchAll();
return $objects;
}
public function linkCommitTest($designID = 0, $repoID = 0)
{
$objects = $this->objectModel->linkCommit($designID = 0, $repoID = 0);
if(dao::isError()) return dao::getError();
return $objects;
}
public function unlinkCommitTest($designID = 0, $commitID = 0)
{
$objects = $this->objectModel->unlinkCommit($designID = 0, $commitID = 0);
if(dao::isError()) return dao::getError();
return $objects;
}
public function getByIDTest($designID = 0)
{
$objects = $this->objectModel->getByID($designID = 0);
if(dao::isError()) return dao::getError();
return $objects;
}
public function getPairsTest($productID = 0, $type = 'all')
{
$objects = $this->objectModel->getPairs($productID = 0, $type = 'all');
if(dao::isError()) return dao::getError();
return $objects;
}
public function getAffectedScopeTest($design = 0)
{
$objects = $this->objectModel->getAffectedScope($design = 0);
if(dao::isError()) return dao::getError();
return $objects;
}
public function getListTest($projectID = 0, $productID = 0, $type = 'all', $param = 0, $orderBy = 'id_desc', $pager = null)
{
$objects = $this->objectModel->getList($projectID = 0, $productID = 0, $type = 'all', $param = 0, $orderBy = 'id_desc', $pager = null);
if(dao::isError()) return dao::getError();
return $objects;
}
public function getCommitTest($designID = 0, $pager = null)
{
$objects = $this->objectModel->getCommit($designID = 0, $pager = null);
if(dao::isError()) return dao::getError();
return $objects;
}
public function getBySearchTest($projectID = 0, $productID = 0, $queryID = 0, $orderBy = 'id_desc', $pager = null)
{
$objects = $this->objectModel->getBySearch($projectID = 0, $productID = 0, $queryID = 0, $orderBy = 'id_desc', $pager = null);
if(dao::isError()) return dao::getError();
return $objects;
}
public function setMenuTest($projectID, $products, $productID = 0)
{
$objects = $this->objectModel->setMenu($projectID, $products, $productID = 0);
if(dao::isError()) return dao::getError();
return $objects;
}
public function buildSearchFormTest($queryID = 0, $actionURL = '')
{
$objects = $this->objectModel->buildSearchForm($queryID = 0, $actionURL = '');
if(dao::isError()) return dao::getError();
return $objects;
}
public function printAssignedHtmlTest($design = '', $users = '')
{
$objects = $this->objectModel->printAssignedHtml($design = '', $users = '');
if(dao::isError()) return dao::getError();
return $objects;
}
}
+35
View File
@@ -0,0 +1,35 @@
title: table zt_designspec
desc: ""
author: automated export
version: "1.0"
fields:
- field: design
note: ""
range: 1-120
prefix: ""
postfix: ""
format: ""
- field: version
note: ""
range: 1
prefix: ""
postfix: ""
format: ""
- field: name
note: ""
range: 1-10000
prefix: "这是一个设计"
postfix: ""
format: ""
- field: desc
note: ""
range: 1-10000
prefix: "这是设计描述"
postfix: ""
format: ""
- field: files
note: ""
range: ""
prefix: ""
postfix: ""
format: ""
+4 -3
View File
@@ -80,9 +80,10 @@ $builder->doclib = array('rows' => 900, 'extends' => array('doclib'));
$builder->doc = array('rows' => 900, 'extends' => array('doc'));
$builder->doccontent = array('rows' => 900, 'extends' => array('doccontent'));
$builder->build = array('rows' => 20, 'extends' => array('build'));
$builder->release = array('rows' => 10, 'extends' => array('release'));
$builder->design = array('rows' => 120, 'extends' => array('design'));
$builder->build = array('rows' => 20, 'extends' => array('build'));
$builder->release = array('rows' => 10, 'extends' => array('release'));
$builder->design = array('rows' => 120, 'extends' => array('design'));
$builder->designspec = array('rows' => 120, 'extends' => array('designspec'));
$builder->webhook = array('rows' => 7, 'extends' => array('webhook'));
$builder->entry = array('rows' => 1, 'extends' => array('entry'));
+2 -1
View File
@@ -32,6 +32,7 @@ class Processor
{
$this->dao->begin();
$this->initBassicSql();
$this->initDept();
$this->initUser();
$this->initProgram();
@@ -50,7 +51,6 @@ class Processor
$this->initBug();
$this->initTest();
$this->initTodo();
$this->initBassicSql();
$this->dao->commit();
}
@@ -296,6 +296,7 @@ class Processor
{
global $app;
$sqlRoot = $app->getAppRoot();
$this->dao->exec(file_get_contents($sqlRoot . '/data/zt_config.sql'));
$this->dao->exec(file_get_contents($sqlRoot . '/data/zt_lang.sql'));
$this->dao->exec(file_get_contents($sqlRoot . '/data/zt_cron.sql'));
}
+36
View File
@@ -0,0 +1,36 @@
truncate `zt_config`;
INSERT INTO `zt_config` (`id`, `vision`, `owner`, `module`, `section`, `key`, `value`) VALUES
(1, 'rnd', 'system', 'custom', '', 'hourPoint', '0'),
(2, 'rnd', 'system', 'common', '', 'CRProduct', '1'),
(3, 'rnd', 'system', 'common', '', 'CRExecution', '1'),
(4, 'rnd', 'system', 'custom', '', 'URSR', '2'),
(9, 'rnd', 'system', 'common', 'global', 'mode', 'new'),
(6, 'rnd', 'system', 'project', '', 'unitList', 'CNY,USD'),
(7, 'rnd', 'system', 'project', '', 'defaultCurrency', 'CNY'),
(8, 'rnd', 'system', 'story', '', 'reviewRules', 'allpass'),
(10, 'rnd', 'system', 'common', 'global', 'version', '16.5.beta1'),
(11, 'rnd', 'system', 'common', 'global', 'sn', 'c8aa3269e181f2b9258ce96625de1497'),
(12, 'rnd', 'system', 'common', 'global', 'flow', 'full'),
(13, 'rnd', 'system', 'common', 'safe', 'mode', '1'),
(14, 'rnd', 'system', 'common', 'safe', 'changeWeak', '1'),
(15, 'rnd', 'system', 'common', 'global', 'cron', '1'),
(16, 'rnd', 'system', 'common', 'xuanxuan', 'turnon', '1'),
(17, 'rnd', 'system', 'common', 'xuanxuan', 'key', 'd3229cab1d072d31c505a027dbd3cd6e'),
(18, 'rnd', 'system', 'common', 'xuanxuan', 'chatPort', '11444'),
(19, 'rnd', 'system', 'common', 'xuanxuan', 'commonPort', '11443'),
(20, 'rnd', 'system', 'common', 'xuanxuan', 'ip', '0.0.0.0'),
(21, 'rnd', 'system', 'common', 'xuanxuan', 'uploadFileSize', '20'),
(22, 'rnd', 'system', 'common', 'xuanxuan', 'https', 'off'),
(23, 'rnd', 'system', 'cron', 'run', 'status', 'running'),
(24, 'rnd', 'system', 'common', 'global', 'latestVersionList', '[]'),
(25, 'rnd', 'admin', 'common', '', 'URSR', '2'),
(26, 'rnd', 'admin', 'common', '', 'programLink', 'program-browse'),
(27, 'rnd', 'admin', 'common', '', 'productLink', 'product-all'),
(28, 'rnd', 'admin', 'common', '', 'projectLink', 'project-browse'),
(29, 'rnd', 'admin', 'common', '', 'executionLink', 'execution-task'),
(30, 'rnd', 'admin', 'common', '', 'preferenceSetted', '1'),
(31, 'rnd', 'admin', 'my', 'common', 'blockInited', '1'),
(32, 'rnd', 'admin', 'my', 'block', 'initVersion', '2'),
(33, 'rnd', 'system', 'common', 'global', 'skipIntroduction', ',admin'),
(34, 'rnd', 'system', 'common', 'global', 'skipTutorial', ',admin'),
(35, 'rnd', 'system', 'common', 'global', 'skipYoungBlueTheme', ',admin');
+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/design.class.php';
su('admin');
/**
title=测试 designModel->assign();
cid=1
pid=1
*/
$designID = '17';
$normalAssign = array('assignedTo' => 'dev10', 'comment' => '提交信息');
$noAssignedTo = array('comment' => '提交信息');
$design = new designTest();
r($design->assignTest($designID, $normalAssign)) && p('0:assignedTo') && e('dev10');//设置指派人
r($design->assignTest($designID, $noAssignedTo)) && p('0:assignedTo') && e(''); //指派人为空
+37
View File
@@ -0,0 +1,37 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/design.class.php';
su('admin');
/**
title=测试 designModel->batchCreate();
cid=1
pid=1
*/
$projectIDList = array('12', '32', '62', '13', '71', '72', '73', '75');
$productIDList = array('1', '21', '41');
$storys = array('1', '2', '3', '5');
$types = array('HLDS', 'DDS', 'DBDS', 'ADS');
$names = array('设计一', '设计二', '设计三', '设计四');
$desc = array('详情一', '详情二', '详情三', '详情四');
$normalDesign = array('story' => $storys, 'type' => $types, 'name' => $names, 'desc' => $desc);
$noStoryDesign = array('type' => $types, 'name' => $names, 'desc' => $desc);
$noTypeDesign = array('story' => $storys, 'name' => $names, 'desc' => $desc);
$noNameDesign = array('story' => $storys, 'type' => $types, 'desc' => $desc);
$noDescDesign = array('story' => $storys, 'type' => $types, 'name' => $names);
$design = new designTest();
r($design->batchCreateTest($projectIDList[0], $productIDList[0], $normalDesign)) && p('0:name') && e('设计一'); //批量创建敏捷项目设计
r($design->batchCreateTest($projectIDList[1], $productIDList[1], $normalDesign)) && p('0:project') && e('32'); //批量创建瀑布项目设计
r($design->batchCreateTest($projectIDList[2], $productIDList[2], $normalDesign)) && p('0:product') && e('41'); //批量创建看板项目设计
r($design->batchCreateTest($projectIDList[3], $productIDList[0], $noStoryDesign)) && p('0:story') && e(''); //不输入需求
r($design->batchCreateTest($projectIDList[4], $productIDList[0], $noTypeDesign)) && p('type:0') && e('『设计类型』不能为空。');//不输入类型
r($design->batchCreateTest($projectIDList[5], $productIDList[0], $noNameDesign)) && p() && e('0'); //不输入名字
r($design->batchCreateTest($projectIDList[6], $productIDList[0], $noDescDesign)) && p('0:desc') && e(''); //不输入详情
r(count($design->batchCreateTest($projectIDList[7], $productIDList[0], $noDescDesign))) && p() && e('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/design.class.php';
su('admin');
/**
title=测试 designModel->buildSearchForm();
cid=1
pid=1
*/
$design = new designTest();
r($design->buildSearchFormTest()) && p() && e();
+37
View File
@@ -0,0 +1,37 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/design.class.php';
su('admin');
/**
title=测试 designModel->create();
cid=1
pid=1
*/
$projectIDList = array('11', '31', '61');
$products = array('1', '21', '41');
$type = array('HLDS', 'DDS', 'DBDS', 'ADS');
$hldsDesign = array('product' => $products[0], 'story' => '1', 'type' => $type[0], 'name' => 'hlds设计');
$ddsDesign = array('product' => $products[1], 'story' => '2', 'type' => $type[1], 'name' => 'dds设计');
$dbdsDesign = array('product' => $products[2], 'story' => '3', 'type' => $type[2], 'name' => 'dbds设计');
$adsDesign = array('product' => $products[0], 'story' => '1', 'type' => $type[3], 'name' => 'ads设计');
$noProductDesign = array('story' => '1', 'type' => $type[3], 'name' => 'ads设计');
$noStoryDesign = array('product' => $products[0], 'type' => $type[3], 'name' => 'ads设计');
$noTypeDesign = array('product' => $products[0], 'story' => '1', 'name' => 'ads设计');
$noNameDesign = array('product' => $products[0], 'story' => '1', 'type' => $type[3]);
$design = new designTest();
r($design->createTest($projectIDList[0], $hldsDesign)) && p('name') && e('hlds设计'); //创建hlds设计
r($design->createTest($projectIDList[1], $ddsDesign)) && p('story') && e('2'); //创建dds设计
r($design->createTest($projectIDList[2], $dbdsDesign)) && p('product') && e('61'); //创建dbds设计
r($design->createTest($projectIDList[0], $adsDesign)) && p('type') && e('ADS'); //创建ads设计
r($design->createTest($projectIDList[0], $noProductDesign)) && p('product') && e(''); //不输入产品创建设计
r($design->createTest($projectIDList[0], $noStoryDesign)) && p('story') && e(''); //不输入需求创建设计
r($design->createTest($projectIDList[0], $noTypeDesign)) && p('type:0') && e('『设计类型』不能为空。'); //不输入类型创建设计
r($design->createTest($projectIDList[0], $noNameDesign)) && p('name:0') && e('『设计名称』不能为空。'); //不输入名称创建设计
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/design.class.php';
su('admin');
/**
title=测试 designModel->getAffectedScope();
cid=1
pid=1
*/
$design = new designTest();
r($design->getAffectedScopeTest()) && p() && e();
+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/design.class.php';
su('admin');
/**
title=测试 designModel->getByID();
cid=1
pid=1
*/
$design = new designTest();
r($design->getByIDTest()) && p() && e();
+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/design.class.php';
su('admin');
/**
title=测试 designModel->getBySearch();
cid=1
pid=1
*/
$design = new designTest();
r($design->getBySearchTest()) && p() && e();
+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/design.class.php';
su('admin');
/**
title=测试 designModel->getCommit();
cid=1
pid=1
*/
$design = new designTest();
r($design->getCommitTest()) && p() && e();
+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/design.class.php';
su('admin');
/**
title=测试 designModel->getList();
cid=1
pid=1
*/
$design = new designTest();
r($design->getListTest()) && p() && e();
+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/design.class.php';
su('admin');
/**
title=测试 designModel->getPairs();
cid=1
pid=1
*/
$design = new designTest();
r($design->getPairsTest()) && p() && e();
+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/design.class.php';
su('admin');
/**
title=测试 designModel->linkCommit();
cid=1
pid=1
*/
$design = new designTest();
r($design->linkCommitTest()) && p() && e();
+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/design.class.php';
su('admin');
/**
title=测试 designModel->printAssignedHtml();
cid=1
pid=1
*/
$design = new designTest();
r($design->printAssignedHtmlTest()) && p() && e();
+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/design.class.php';
su('admin');
/**
title=测试 designModel->setMenu();
cid=1
pid=1
*/
$design = new designTest();
r($design->setMenuTest()) && p() && e();
+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/design.class.php';
su('admin');
/**
title=测试 designModel->unlinkCommit();
cid=1
pid=1
*/
$design = new designTest();
r($design->unlinkCommitTest()) && p() && e();
+34
View File
@@ -0,0 +1,34 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/design.class.php';
su('admin');
/**
title=测试 designModel->update();
cid=1
pid=1
*/
$designIDList = array('1', '2', '3');
$updateType = array('type' => 'DDS');
$updateStory = array('story' => '17');
$updateProduct = array('product' => '21');
$updateName = array('name' => '修改设计');
$updateDesc = array('desc' => '详情修改');
$noName = array('name' => '');
$noType = array('type' => '');
$design = new designTest();
r($design->updateTest($designIDList[0],$updateType)) && p('0:field,old,new') && e('type,HLDS,DDS'); //修改设计类型
r($design->updateTest($designIDList[1],$updateStory)) && p('0:field,old,new') && e('story,0,17'); //修改设计需求
r($design->updateTest($designIDList[2],$updateProduct)) && p('0:field,old,new') && e('product,31,21'); //修改设计产品
r($design->updateTest($designIDList[0],$updateName)) && p('0:field,old,new') && e('name,这是一个设计1,修改设计');//修改设计名称
r($design->updateTest($designIDList[0],$updateDesc)) && p('0:field,old,new') && e('desc,这是设计描述1,详情修改');//修改设计详情
r($design->updateTest($designIDList[0],$noName)) && p('name:0') && e('『设计名称』不能为空。'); //设计名称不能为空
r($design->updateTest($designIDList[0],$noType)) && p('type:0') && e('『设计类型』不能为空。'); //设计类型不能为空
system("./ztest init");