* Add test case.

This commit is contained in:
caoyanyi
2023-01-12 10:06:45 +08:00
parent f639a027dd
commit 7b0dd36f82
4 changed files with 66 additions and 1 deletions
+2
View File
@@ -5251,6 +5251,8 @@ class executionModel extends model
public function syncNoMultipleSprint($projectID)
{
$project = $this->dao->select('*')->from(TABLE_PROJECT)->where('id')->eq($projectID)->fetch();
if(empty($project)) return 0;
$post = $_POST;
$_POST = array();
+12
View File
@@ -2497,4 +2497,16 @@ class executionTest
{
return $this->objectModel->getSwitcher($executionID, 'execution', $method);
}
/**
* Test sync no multiple sprint.
*
* @param int $projectID
* @access public
* @return void
*/
public function syncNoMultipleSprintTest($projectID)
{
return $this->objectModel->syncNoMultipleSprint($projectID);
}
}
+1 -1
View File
@@ -17,7 +17,7 @@ $execution->gen(5);
su('admin');
/**
title=测试 executionModel::saveState();
title=测试 executionModel::getSwitcher();
cid=1
pid=1
@@ -0,0 +1,51 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/execution.class.php';
$execution = zdTable('project');
$execution->id->range('1-5');
$execution->name->range('项目1,项目2,迭代1,迭代2,迭代3');
$execution->type->range('project{2},sprint,stage,kanban');
$execution->status->range('doing{3},closed,doing');
$execution->parent->range('0,0,1,1,2');
$execution->project->range('0,0,1,1,2');
$execution->grade->range('2{2},1{3}');
$execution->multiple->range("`0`");
$execution->path->range('1,2,`1,3`,`1,4`,`2,5`')->prefix(',')->postfix(',');
$execution->begin->range('20230102 000000:0')->type('timestamp')->format('YY/MM/DD');
$execution->end->range('20230212 000000:0')->type('timestamp')->format('YY/MM/DD');
$execution->gen(5);
$product = zdTable('product');
$product->id->range('1-3');
$product->name->range('1-3')->prefix('产品');
$product->code->range('1-3')->prefix('product');
$product->type->range('normal');
$product->status->range('normal');
$product->gen(3);
$projectproduct = zdTable('projectproduct');
$projectproduct->project->range('2-5');
$projectproduct->product->range('1-3');
$projectproduct->branch->range('1,0');
$projectproduct->gen(5);
su('admin');
/**
title=测试executionModel->syncNoMultipleSprint();
cid=1
pid=1
同步没有执行的项目 >> 5
同步错误的项目 >> 0
*/
$projectIDList = array('2', '15');
$execution = new executionTest();
r($execution->syncNoMultipleSprintTest($projectIDList[0])) && p() && e('5'); // 同步没有执行的项目
r($execution->syncNoMultipleSprintTest($projectIDList[1])) && p() && e('0'); // 同步错误的项目