* Adjust unit test of programplanModel::isCreateTask().

This commit is contained in:
xushenjie
2023-05-11 07:55:46 +00:00
parent fb3f2ac779
commit 77f44ccc2d
2 changed files with 16 additions and 16 deletions
+13 -13
View File
@@ -4,25 +4,25 @@ include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/programplan.class.php';
su('admin');
function initData()
{
zdTable('project')->config('project')->gen(5);
zdTable('project')->config('stage')->gen(5, $isClear = false);
$task = zdTable('task');
$task->execution->range('1-5');
$task->gen(10);
}
/**
title=测试 programplanModel->isCreateTask();
cid=1
pid=1
测试阶段131下有没有任务 >> 1
测试阶段132下有没有任务 >> 1
测试阶段133下有没有任务 >> 1
测试阶段134下有没有任务 >> 1
测试阶段135下有没有任务 >> 1
*/
$stageIDList = array(131, 132, 133, 134, 135);
$programplan = new programplanTest();
r($programplan->isCreateTaskTest($stageIDList[0])) && p() && e('1'); // 测试阶段131下有没有任务
r($programplan->isCreateTaskTest($stageIDList[1])) && p() && e('1'); // 测试阶段132下有没有任务
r($programplan->isCreateTaskTest($stageIDList[2])) && p() && e('1'); // 测试阶段133下有没有任务
r($programplan->isCreateTaskTest($stageIDList[3])) && p() && e('1'); // 测试阶段134下有没有任务
r($programplan->isCreateTaskTest($stageIDList[4])) && p() && e('1'); // 测试阶段135下有没有任务
r($programplan->isCreateTaskTest(-1)) && p() && e('1'); // 测试 id 为 -1 的阶段下是否创建了任务,结果为 1
r($programplan->isCreateTaskTest(0)) && p() && e('1'); // 测试 id 为 0 的阶段下是否创建了任务,结果为 1
r($programplan->isCreateTaskTest(1)) && p() && e('0'); // 测试 id 为 1 的阶段下是否创建了任务,结果为 0
r($programplan->isCreateTaskTest(6)) && p() && e('0'); // 测试 id 为 6 的阶段下是否创建了任务,结果为 0
@@ -282,11 +282,11 @@ class programplanTest
*/
public function isCreateTaskTest($planID)
{
$object = $this->objectModel->isCreateTask($planID);
$result = $this->objectModel->isCreateTask($planID);
if(dao::isError()) return dao::getError();
if(dao::isError()) return 0;
return $object ? 2 : 1;
return $result;
}
/**