diff --git a/test/class/task.class.php b/test/class/task.class.php index bbb57bbf81..5f653813bb 100644 --- a/test/class/task.class.php +++ b/test/class/task.class.php @@ -603,8 +603,15 @@ class taskTest else { $object = $this->objectModel->getById($taskID); - if(!empty($object) and $object->parent > 0) $parentObject = $this->objectModel->getById($object->parent); - return isset($parentObject) ? $parentObject : $object; + + if(empty($object)) return 0; + + if($object->parent > 0) $object = $this->objectModel->getById($object->parent); + + + $estStartedDiff = date_diff(date_create($object->estStarted), date_create(helper::now())); + $deadlineDiff = date_diff(date_create($object->deadline), date_create(helper::now())); + return array('estStartedDiff' => $estStartedDiff->d, 'deadlineDiff' => $deadlineDiff->d); } } @@ -692,8 +699,35 @@ class taskTest } } - public function processData4ReportTest($tasks, $children, $field) + public function processData4ReportTest($children, $field) { + global $tester; + $tasks = $tester->dao->select('*')->from(TABLE_TASK)->where('`execution`')->eq('101')->andWhere('deleted')->eq(0)->fetchAll('id'); + $parents = array(); + foreach($tasks as $task) + { + if($task->parent > 0) $parents[$task->parent] = $task->parent; + } + $parents = $tester->dao->select('*')->from(TABLE_TASK)->where('id')->in($parents)->fetchAll('id'); + foreach($tasks as $task) + { + if($task->parent > 0) + { + if(isset($tasks[$task->parent])) + { + $tasks[$task->parent]->children[$task->id] = $task; + } + else + { + $parent = $parents[$task->parent]; + $task->parentName = $parent->name; + } + } + $task->date = '0000-00-00'; + } + + $children = $children ? $tasks[601]->children + $tasks[602]->children + $tasks[603]->children : array(); + $object = $this->objectModel->processData4Report($tasks, $children, $field); $object['void'] = isset($object['']) ? $object[''] : 'void'; @@ -895,4 +929,51 @@ class taskTest return $object; } } + + public function updateParentStatusTest($taskID, $parentID = 0, $createAction = true) + { + $object = $this->objectModel->updateParentStatus($taskID, $parentID, $createAction); + if(!$object) $object = $this->objectModel->getByID($taskID); + + if(dao::isError()) + { + return dao::getError(); + } + else + { + return $object; + } + } + + public function isClickableTest($task, $action) + { + $object = $this->objectModel->isClickable($task, $action); + + if(dao::isError()) + { + return dao::getError(); + } + else + { + return $object ? 1 : 2; + } + } + public function addTaskEstimateTest($data) + { + $data->date = date("Y-m-d"); + $this->objectModel->addTaskEstimate($data); + + global $tester; + $objectID = $tester->dao->lastInsertID(); + $object = $this->objectModel->getEstimateById($objectID); + + if(dao::isError()) + { + return dao::getError(); + } + else + { + return $object; + } + } } diff --git a/test/model/task/activate.php b/test/model/task/activate.php index 2415b55cbc..2db7f61fd2 100755 --- a/test/model/task/activate.php +++ b/test/model/task/activate.php @@ -26,4 +26,4 @@ r($task->activateTest($taskIDList[1])) && p('0:field,old,new') && e('status,done r($task->activateTest($taskIDList[2])) && p('0:field,old,new') && e('status,pause,doing'); //pause状态任务激活 r($task->activateTest($taskIDList[3])) && p('0:field,old,new') && e('status,cancel,doing'); //cancel状态任务激活 r($task->activateTest($taskIDList[4])) && p('0:field,old,new') && e('status,closed,doing'); //closed状态任务激活 -system("./ztest init"); \ No newline at end of file +system("./ztest init"); diff --git a/test/model/task/addtaskestimate.php b/test/model/task/addtaskestimate.php new file mode 100755 index 0000000000..311fa4822f --- /dev/null +++ b/test/model/task/addtaskestimate.php @@ -0,0 +1,57 @@ +#!/usr/bin/env php +addTaskEstimate(); +cid=1 +pid=1 + +插入task为1 left为0 consumed为3的任务 >> 601,1,0,3 +插入task为601 left为0 consumed为3的任务 >> 602,601,0,3 +插入task为601 left为1 consumed为4的任务 >> 603,602,1,4 +插入task为904 left为3 consumed为6的任务 >> 604,904,3,6 +插入task为907 left为6 consumed为9的任务 >> 605,907,6,9 + +*/ + +$record1 = new stdclass(); +$record1->account = 'po82'; +$record1->task = 1; +$record1->left = 0; +$record1->consumed = 3; + +$record2 = new stdclass(); +$record2->account = 'po82'; +$record2->task = 601; +$record2->left = 0; +$record2->consumed = 3; + +$record3 = new stdclass(); +$record3->account = 'po82'; +$record3->task = 602; +$record3->left = 1; +$record3->consumed = 4; + +$record4 = new stdclass(); +$record4->account = 'po82'; +$record4->task = 904; +$record4->left = 3; +$record4->consumed = 6; + +$record5 = new stdclass(); +$record5->account = 'po82'; +$record5->task = 907; +$record5->left = 6; +$record5->consumed = 9; + +$task = new taskTest(); +r($task->addTaskEstimateTest($record1)) && p('id,task,left,consumed') && e("601,1,0,3"); // 插入task为1 left为0 consumed为3的任务 +r($task->addTaskEstimateTest($record2)) && p('id,task,left,consumed') && e("602,601,0,3"); // 插入task为601 left为0 consumed为3的任务 +r($task->addTaskEstimateTest($record3)) && p('id,task,left,consumed') && e("603,602,1,4"); // 插入task为601 left为1 consumed为4的任务 +r($task->addTaskEstimateTest($record4)) && p('id,task,left,consumed') && e("604,904,3,6"); // 插入task为904 left为3 consumed为6的任务 +r($task->addTaskEstimateTest($record5)) && p('id,task,left,consumed') && e("605,907,6,9"); // 插入task为907 left为6 consumed为9的任务 +system("./ztest init"); diff --git a/test/model/task/assign.php b/test/model/task/assign.php index 6d31ef02ff..12ccf55113 100755 --- a/test/model/task/assign.php +++ b/test/model/task/assign.php @@ -10,7 +10,7 @@ title=taskModel->assign(); cid=1 pid=1 -wite状态任务指派 >> assignedTo,po82,user92 +wait状态任务指派 >> assignedTo,po82,user92 doing状态任务指派 >> assignedTo,,user93 done状态任务指派 >> assignedTo,,user94 pause状态任务指派 >> assignedTo,,user95 @@ -21,7 +21,7 @@ closed状态任务指派 >> assignedTo,,user97 $taskIDlist = array('1','2','3','4','5','6'); -$waitTask = array('assignedTo' => 'user92','status' => 'wait'); +$waitTask = array('assignedTo' => 'user92','status' => 'wait', 'left' => '1'); $doingTask = array('assignedTo' => 'user93','status' => 'doing'); $doneTask = array('assignedTo' => 'user94','status' => 'done'); $pauseTask = array('assignedTo' => 'user95','status' => 'pause'); @@ -29,7 +29,7 @@ $cancelTask = array('assignedTo' => 'user96','status' => 'cancel'); $closedTask = array('assignedTo' => 'user97','status' => 'closed'); $task = new taskTest(); -r($task->assignTest($taskIDlist[0],$waitTask)) && p('0:field,old,new') && e('assignedTo,po82,user92'); // wite状态任务指派 +r($task->assignTest($taskIDlist[0],$waitTask)) && p('0:field,old,new') && e('assignedTo,po82,user92'); // wait状态任务指派 r($task->assignTest($taskIDlist[1],$doingTask)) && p('0:field,old,new') && e('assignedTo,,user93'); // doing状态任务指派 r($task->assignTest($taskIDlist[2],$doneTask)) && p('0:field,old,new') && e('assignedTo,,user94'); // done状态任务指派 r($task->assignTest($taskIDlist[3],$pauseTask)) && p('0:field,old,new') && e('assignedTo,,user95'); // pause状态任务指派 diff --git a/test/model/task/computeBeginAndEnd.php b/test/model/task/computeBeginAndEnd.php index 7a77dd45b1..ad50088305 100755 --- a/test/model/task/computeBeginAndEnd.php +++ b/test/model/task/computeBeginAndEnd.php @@ -10,8 +10,8 @@ title=taskModel->computeBeginAndEnd(); cid=1 pid=1 -根据taskID计算没有父计划的开始结束时间 >> 1,2022-03-14,0000-00-00 00:00:00,2022-03-21 -根据taskID计算有父计划的父开始结束时间 >> 601,,0000-00-00 00:00:00,2022-03-07 +根据taskID计算没有父计划的开始结束时间 >> 0,6 +根据taskID计算有父计划的父开始结束时间 >> 0,7 根据不存在的taskID计划开始结束时间 >> 0 */ @@ -19,7 +19,7 @@ pid=1 $taskIDList = array('1', '901', '100001'); $task = new taskTest(); -r($task->computeBeginAndEndTest($taskIDList[0])) && p('id,estStarted,realStarted,deadline') && e('1,2022-03-14,0000-00-00 00:00:00,2022-03-21'); //根据taskID计算没有父计划的开始结束时间 -r($task->computeBeginAndEndTest($taskIDList[1])) && p('id,estStarted,realStarted,deadline') && e('601,,0000-00-00 00:00:00,2022-03-07'); //根据taskID计算有父计划的父开始结束时间 -r($task->computeBeginAndEndTest($taskIDList[2])) && p('id,estStarted,realStarted,deadline') && e('0'); //根据不存在的taskID计算开始结束时间 +r($task->computeBeginAndEndTest($taskIDList[0])) && p('estStartedDiff,deadlineDiff') && e('0,6'); //根据taskID计算没有父计划的开始结束时间 +r($task->computeBeginAndEndTest($taskIDList[1])) && p('estStartedDiff,deadlineDiff') && e('0,7'); //根据taskID计算有父计划的父开始结束时间 +r($task->computeBeginAndEndTest($taskIDList[2])) && p('estStartedDiff,deadlineDiff') && e('0'); //根据不存在的taskID计算开始结束时间 system("./ztest init"); diff --git a/test/model/task/isclickable.php b/test/model/task/isclickable.php new file mode 100755 index 0000000000..5e4d175f64 --- /dev/null +++ b/test/model/task/isclickable.php @@ -0,0 +1,123 @@ +#!/usr/bin/env php +isClickable(); +cid=1 +pid=1 + +计算任务为父任务 状态为wait 能否进行start操作 >> 1 +计算任务为父任务 状态为doing 能否进行finished操作 >> 1 +计算任务为父任务 状态为done 能否进行pause操作 >> 2 +计算任务为父任务 状态为pause 能否进行assignto操作 >> 1 +计算任务为父任务 状态为closed 能否进行close操作 >> 2 +计算任务为父任务 状态为cancel 能否进行batchcreate操作 >> 1 +计算任务为普通任务 状态为wait 能否进行recordestimate操作 >> 2 +计算任务为普通任务 状态为doing 能否进行delete操作 >> 2 +计算任务为普通任务 状态为done 能否进行start操作 >> 2 +计算任务为普通任务 状态为pause 能否进行finished操作 >> 1 +计算任务为普通任务 状态为closed 能否进行restart操作 >> 2 +计算任务为普通任务 状态为cancel 能否进行pause操作 >> 2 +计算任务为子任务 状态为wait 能否进行assignto操作 >> 1 +计算任务为子任务 状态为doing 能否进行close操作 >> 2 +计算任务为子任务 状态为done 能否进行batchcreate操作 >> 2 +计算任务为子任务 状态为pause 能否进行recordestimate操作 >> 1 +计算任务为子任务 状态为closed 能否进行delete操作 >> 1 +计算任务为子任务 状态为cancel 能否进行start操作 >> 2 +*/ + +$task1 = new stdclass(); +$task1->parent = 0; +$task1->status = 'wait'; + +$task2 = new stdclass(); +$task2->parent = 0; +$task2->status = 'doing'; + +$task3 = new stdclass(); +$task3->parent = 0; +$task3->status = 'done'; + +$task4 = new stdclass(); +$task4->parent = 0; +$task4->status = 'pause'; + +$task5 = new stdclass(); +$task5->parent = 0; +$task5->status = 'closed'; + +$task6 = new stdclass(); +$task6->parent = 0; +$task6->status = 'cancel'; + +$task7 = new stdclass(); +$task7->parent = -1; +$task7->status = 'wait'; + +$task8 = new stdclass(); +$task8->parent = -1; +$task8->status = 'doing'; + +$task9 = new stdclass(); +$task9->parent = -1; +$task9->status = 'done'; + +$task10 = new stdclass(); +$task10->parent = -1; +$task10->status = 'pause'; + +$task11 = new stdclass(); +$task11->parent = -1; +$task11->status = 'closed'; + +$task12 = new stdclass(); +$task12->parent = -1; +$task12->status = 'cancel'; + +$task13 = new stdclass(); +$task13->parent = 1; +$task13->status = 'wait'; + +$task14 = new stdclass(); +$task14->parent = 1; +$task14->status = 'doing'; + +$task15 = new stdclass(); +$task15->parent = 1; +$task15->status = 'done'; + +$task16 = new stdclass(); +$task16->parent = 1; +$task16->status = 'pause'; + +$task17 = new stdclass(); +$task17->parent = 1; +$task17->status = 'closed'; + +$task18 = new stdclass(); +$task18->parent = 1; +$task18->status = 'cancel'; + +$task = new taskTest(); +r($task->isClickableTest($task1, 'start')) && p('1') && e("1"); //计算任务为父任务 状态为wait 能否进行start操作 +r($task->isClickableTest($task2, 'finished')) && p('1') && e("1"); //计算任务为父任务 状态为doing 能否进行finished操作 +r($task->isClickableTest($task3, 'pause')) && p('2') && e("2"); //计算任务为父任务 状态为done 能否进行pause操作 +r($task->isClickableTest($task4, 'assignto')) && p('1') && e("1"); //计算任务为父任务 状态为pause 能否进行assignto操作 +r($task->isClickableTest($task5, 'close')) && p('2') && e("2"); //计算任务为父任务 状态为closed 能否进行close操作 +r($task->isClickableTest($task6, 'batchcreate')) && p('1') && e("1"); //计算任务为父任务 状态为cancel 能否进行batchcreate操作 +r($task->isClickableTest($task7, 'recordestimate')) && p('2') && e("2"); //计算任务为普通任务 状态为wait 能否进行recordestimate操作 +r($task->isClickableTest($task8, 'delete')) && p('2') && e("2"); //计算任务为普通任务 状态为doing 能否进行delete操作 +r($task->isClickableTest($task9, 'start')) && p('2') && e("2"); //计算任务为普通任务 状态为done 能否进行start操作 +r($task->isClickableTest($task10, 'finished')) && p('1') && e("1"); //计算任务为普通任务 状态为pause 能否进行finished操作 +r($task->isClickableTest($task11, 'restart')) && p('2') && e("2"); //计算任务为普通任务 状态为closed 能否进行restart操作 +r($task->isClickableTest($task12, 'pause')) && p('2') && e("2"); //计算任务为普通任务 状态为cancel 能否进行pause操作 +r($task->isClickableTest($task13, 'assignto')) && p('1') && e("1"); //计算任务为子任务 状态为wait 能否进行assignto操作 +r($task->isClickableTest($task14, 'close')) && p('2') && e("2"); //计算任务为子任务 状态为doing 能否进行close操作 +r($task->isClickableTest($task15, 'batchcreate')) && p('2') && e("2"); //计算任务为子任务 状态为done 能否进行batchcreate操作 +r($task->isClickableTest($task16, 'recordestimate')) && p('1') && e("1"); //计算任务为子任务 状态为pause 能否进行recordestimate操作 +r($task->isClickableTest($task17, 'delete')) && p('1') && e("1"); //计算任务为子任务 状态为closed 能否进行delete操作 +r($task->isClickableTest($task18, 'start')) && p('2') && e("2"); //计算任务为子任务 状态为cancel 能否进行start操作 diff --git a/test/model/task/processdata4report.php b/test/model/task/processdata4report.php index 1cc90c703a..89be3ea6d7 100755 --- a/test/model/task/processdata4report.php +++ b/test/model/task/processdata4report.php @@ -34,53 +34,27 @@ pid=1 */ -$now = helper::now(); -$tasks = $dao->select('*')->from(TABLE_TASK)->where('`execution`')->eq('101')->andWhere('deleted')->eq(0)->fetchAll('id'); -$parents = array(); -foreach($tasks as $task) -{ - if($task->parent > 0) $parents[$task->parent] = $task->parent; -} -$parents = $dao->select('*')->from(TABLE_TASK)->where('id')->in($parents)->fetchAll('id'); -foreach($tasks as $task) -{ - if($task->parent > 0) - { - if(isset($tasks[$task->parent])) - { - $tasks[$task->parent]->children[$task->id] = $task; - } - else - { - $parent = $parents[$task->parent]; - $task->parentName = $parent->name; - } - } - $task->date = '0000-00-00'; -} - -$children = $tasks[601]->children + $tasks[602]->children + $tasks[603]->children; $task = new taskTest(); -r($task->processData4ReportTest($tasks, '', "execution")) && p('101:name,value') && e('101,14'); //计算executionID为101的执行下按迭代任务数统计的图表数据 101 -r($task->processData4ReportTest($tasks, '', 'module')) && p('27:name,value') && e('27,1'); //计算executionID为101的执行下按模块任务统计的图表数据 27 -r($task->processData4ReportTest($tasks, '', 'module')) && p('21:name,value') && e('21,12'); //计算executionID为101的执行下按模块任务统计的图表数据 21 -r($task->processData4ReportTest($tasks, '', 'assignedTo')) && p('po82:name,value') && e('po82,1'); //计算executionID为101的执行下按指派给统计的图表数据 -r($task->processData4ReportTest($tasks, '', 'type')) && p('ui:name,value') && e('ui,1'); //计算executionID为101的执行下按任务类型统计的图表数据 ui -r($task->processData4ReportTest($tasks, '', 'type')) && p('test:name,value') && e('test,2'); //计算executionID为101的执行下按任务类型统计的图表数据 test -r($task->processData4ReportTest($tasks, '', 'pri')) && p('1:name,value') && e('1,5'); //计算executionID为101的执行下按优先级统计的图表数据 1 -r($task->processData4ReportTest($tasks, '', 'pri')) && p('2:name,value') && e('2,4'); //计算executionID为101的执行下按优先级统计的图表数据 2 -r($task->processData4ReportTest($tasks, '', 'deadline')) && p('0:value') && e("2"); //计算executionID为101的执行下按任务状态统计的图表数据 -8day -r($task->processData4ReportTest($tasks, '', 'deadline')) && p('1:value') && e("1"); //计算executionID为101的执行下按任务状态统计的图表数据 -15day -r($task->processData4ReportTest($tasks, '', 'estimate')) && p('0:name,value') && e('0,3'); //计算executionID为101的执行下按截止时间统计的图表数据 0 -r($task->processData4ReportTest($tasks, '', 'estimate')) && p('5:name,value') && e('5,1'); //计算executionID为101的执行下按截止时间统计的图表数据 5 -r($task->processData4ReportTest($tasks, $children, 'left')) && p('0:name,value') && e('0,2'); //计算executionID为101的执行下按预计时间统计的图表数据 0 -r($task->processData4ReportTest($tasks, $children, 'left')) && p('6:name,value') && e('6,1'); //计算executionID为101的执行下按预计时间统计的图表数据 6 -r($task->processData4ReportTest($tasks, $children, 'consumed')) && p('3:name,value') && e('3,2'); //计算executionID为101的执行下按剩余时间统计的图表数据 3 -r($task->processData4ReportTest($tasks, $children, 'consumed')) && p('7:name,value') && e('7,1'); //计算executionID为101的执行下按剩余时间统计的图表数据 7 -r($task->processData4ReportTest($tasks, $children, 'finishedBy')) && p('void:name,value') && e(',11'); //计算executionID为101的执行下按消耗时间统计的图表数据 -r($task->processData4ReportTest($tasks, '', 'closedReason')) && p('void:name,value') && e(',14'); //计算executionID为101的执行下按由谁完成统计的图表数据 -r($task->processData4ReportTest($tasks, '', 'date')) && p('void') && e('void'); //计算executionID为101的执行下按关闭原因统计的图表数据 -r($task->processData4ReportTest($tasks, '', 'status')) && p('wait:name,value') && e('wait,4'); //计算executionID为101的执行下按每天完成统计的图表数据 wait -r($task->processData4ReportTest($tasks, '', 'status')) && p('done:name,value') && e('done,3'); //计算executionID为101的执行下按每天完成统计的图表数据 done +r($task->processData4ReportTest('', "execution")) && p('101:name,value') && e('101,14'); //计算executionID为101的执行下按迭代任务数统计的图表数据 101 +r($task->processData4ReportTest('', 'module')) && p('27:name,value') && e('27,1'); //计算executionID为101的执行下按模块任务统计的图表数据 27 +r($task->processData4ReportTest('', 'module')) && p('21:name,value') && e('21,12'); //计算executionID为101的执行下按模块任务统计的图表数据 21 +r($task->processData4ReportTest('', 'assignedTo')) && p('po82:name,value') && e('po82,1'); //计算executionID为101的执行下按指派给统计的图表数据 +r($task->processData4ReportTest('', 'type')) && p('ui:name,value') && e('ui,1'); //计算executionID为101的执行下按任务类型统计的图表数据 ui +r($task->processData4ReportTest('', 'type')) && p('test:name,value') && e('test,2'); //计算executionID为101的执行下按任务类型统计的图表数据 test +r($task->processData4ReportTest('', 'pri')) && p('1:name,value') && e('1,5'); //计算executionID为101的执行下按优先级统计的图表数据 1 +r($task->processData4ReportTest('', 'pri')) && p('2:name,value') && e('2,4'); //计算executionID为101的执行下按优先级统计的图表数据 2 +r($task->processData4ReportTest('', 'deadline')) && p('0:value') && e("2"); //计算executionID为101的执行下按任务状态统计的图表数据 -8day +r($task->processData4ReportTest('', 'deadline')) && p('1:value') && e("1"); //计算executionID为101的执行下按任务状态统计的图表数据 -15day +r($task->processData4ReportTest('', 'estimate')) && p('0:name,value') && e('0,3'); //计算executionID为101的执行下按截止时间统计的图表数据 0 +r($task->processData4ReportTest('', 'estimate')) && p('5:name,value') && e('5,1'); //计算executionID为101的执行下按截止时间统计的图表数据 5 +r($task->processData4ReportTest('1', 'left')) && p('0:name,value') && e('0,2'); //计算executionID为101的执行下按预计时间统计的图表数据 0 +r($task->processData4ReportTest('1', 'left')) && p('6:name,value') && e('6,1'); //计算executionID为101的执行下按预计时间统计的图表数据 6 +r($task->processData4ReportTest('1', 'consumed')) && p('3:name,value') && e('3,2'); //计算executionID为101的执行下按剩余时间统计的图表数据 3 +r($task->processData4ReportTest('1', 'consumed')) && p('7:name,value') && e('7,1'); //计算executionID为101的执行下按剩余时间统计的图表数据 7 +r($task->processData4ReportTest('1', 'finishedBy')) && p('void:name,value') && e(',11'); //计算executionID为101的执行下按消耗时间统计的图表数据 +r($task->processData4ReportTest('', 'closedReason')) && p('void:name,value') && e(',14'); //计算executionID为101的执行下按由谁完成统计的图表数据 +r($task->processData4ReportTest('', 'date')) && p('void') && e('void'); //计算executionID为101的执行下按关闭原因统计的图表数据 +r($task->processData4ReportTest('', 'status')) && p('wait:name,value') && e('wait,4'); //计算executionID为101的执行下按每天完成统计的图表数据 wait +r($task->processData4ReportTest('', 'status')) && p('done:name,value') && e('done,3'); //计算executionID为101的执行下按每天完成统计的图表数据 done diff --git a/test/model/task/update.php b/test/model/task/update.php index 88c0fa6562..8d9f3fb2c8 100755 --- a/test/model/task/update.php +++ b/test/model/task/update.php @@ -18,29 +18,29 @@ pid=1 测试修改任务状态 >> status,cancel,doing 测试修改任务优先级 >> pri,2,1 测试修改任务所属执行 >> execution,107,101 -测试修改任务预计开始时间 >> estStarted,2022-03-14,2022-02-27 -测试修改任务截止时间 >> deadline,2022-03-13,2022-03-29 +测试修改任务截止时间 >> deadline,2022-03-29 测试修改任务关闭原因 >> 『关闭原因』必须为空。 */ -$estStarted = '2022-02-27'; $deadline = '2022-03-29'; $taskIDList = array('1','2','3','4','5','6','7','8','9'); -$changename = array('name' => '任务名修改','estStarted' => $estStarted,'deadline' => $deadline); +$changename = array('name' => '任务名修改','deadline' => $deadline); $changemodule = array('module' => '25'); $changeassign = array('assignedTo' => 'user94'); $changetype = array('type' => 'devel'); $changestatus = array('status' => 'doing'); $changepri = array('pri' => '1'); $changeexecution = array('execution' => '101'); -$changeestStarted = array('estStarted' => $estStarted); $changedeadline = array('deadline' => $deadline); $ckclosedReason = array('closedReason' => '关闭原因'); +$today = helper::today(); +$oldDeadline = $dao->select("date_sub('$today', interval 1 day) as date")->fetch()->date; + $task = new taskTest(); -r($task->updateObject($taskIDList[0], $changename)) && p('2:field,old,new') && e('name,开发任务11,任务名修改'); // 测试修改任务名称 +r($task->updateObject($taskIDList[0], $changename)) && p('1:field,old,new') && e('name,开发任务11,任务名修改'); // 测试修改任务名称 r($task->updateObject($taskIDList[0], $changename)) && p() && e('没有数据更新'); // 测试无修改 r($task->updateObject($taskIDList[1], $changemodule)) && p('0:field,old,new') && e('module,24,25'); // 测试修改任务模块 r($task->updateObject($taskIDList[2], $changeassign)) && p('1:field,old,new') && e('assignedTo,,user94'); // 测试修改任务指派人 @@ -48,8 +48,7 @@ r($task->updateObject($taskIDList[3], $changetype)) && p('0:field,old,new' r($task->updateObject($taskIDList[4], $changestatus)) && p('0:field,old,new') && e('status,cancel,doing'); // 测试修改任务状态 r($task->updateObject($taskIDList[5], $changepri)) && p('0:field,old,new') && e('pri,2,1'); // 测试修改任务优先级 r($task->updateObject($taskIDList[6], $changeexecution)) && p('0:field,old,new') && e('execution,107,101'); // 测试修改任务所属执行 -r($task->updateObject($taskIDList[7], $changeestStarted)) && p('0:field,old,new') && e('estStarted,2022-03-14,2022-02-27'); // 测试修改任务预计开始时间 -r($task->updateObject($taskIDList[8], $changedeadline)) && p('0:field,old,new') && e('deadline,2022-03-13,2022-03-29'); // 测试修改任务截止时间 +r($task->updateObject($taskIDList[8], $changedeadline)) && p('0:field,new') && e("deadline,2022-03-29"); // 测试修改任务截止时间 r($task->updateObject($taskIDList[0], $ckclosedReason)) && p('closedReason:0') && e(' 『关闭原因』必须为空。'); // 测试修改任务关闭原因 system("./ztest init"); diff --git a/test/model/task/updateparentstatus.php b/test/model/task/updateparentstatus.php new file mode 100755 index 0000000000..8adf00e110 --- /dev/null +++ b/test/model/task/updateparentstatus.php @@ -0,0 +1,41 @@ +#!/usr/bin/env php +updateParentStatus(); +cid=1 +pid=1 + +更新任务ID为1 创建动态的任务的父任务 >> 1 +更新任务ID为601 创建动态的任务的父任务 >> 1 +更新任务ID为601 父ID为601 创建动态的任务的父任务 >> doing,更多任务1 +更新任务ID为901 创建动态的任务的父任务 >> wait,子任务1 +更新任务ID为901 父ID为601 创建动态的任务的父任务 >> wait,子任务1 +更新任务ID为901 父ID为601 不创建动态的任务的父任务 >> wait,子任务1 +更新任务ID为901 父ID为902 创建动态的任务的父任务 >> 1 +更新任务ID为不存在的100001 父ID为601 创建动态的任务的父任务 >> 0 +更新任务ID为不存在的100001 父ID为601 不创建动态的任务的父任 >> 0 +更新任务ID为不存在的100001 父ID为902 创建动态的任务的父任务 >> 1 + +*/ + +$taskIDList = array('1', '601', '901', '100001'); +$parentIDList = array('601', '902'); + + +$task = new taskTest(); +r($task->updateParentStatusTest($taskIDList[0])) && p('status,name') && e('1'); //更新任务ID为1 创建动态的任务的父任务 +r($task->updateParentStatusTest($taskIDList[1])) && p('status,name') && e('1'); //更新任务ID为601 创建动态的任务的父任务 +r($task->updateParentStatusTest($taskIDList[1], $parentIDList[0])) && p('status,name') && e('doing,更多任务1'); //更新任务ID为601 父ID为601 创建动态的任务的父任务 +r($task->updateParentStatusTest($taskIDList[2])) && p('status,name') && e('wait,子任务1'); //更新任务ID为901 创建动态的任务的父任务 +r($task->updateParentStatusTest($taskIDList[2], $parentIDList[0])) && p('status,name') && e('wait,子任务1'); //更新任务ID为901 父ID为601 创建动态的任务的父任务 +r($task->updateParentStatusTest($taskIDList[2], $parentIDList[0], false)) && p('status,name') && e('wait,子任务1'); //更新任务ID为901 父ID为601 不创建动态的任务的父任务 +r($task->updateParentStatusTest($taskIDList[2], $parentIDList[1])) && p('status,name') && e('1'); //更新任务ID为901 父ID为902 创建动态的任务的父任务 +r($task->updateParentStatusTest($taskIDList[3], $parentIDList[0])) && p('status,name') && e('0'); //更新任务ID为不存在的100001 父ID为601 创建动态的任务的父任务 +r($task->updateParentStatusTest($taskIDList[3], $parentIDList[0], false)) && p('status,name') && e('0'); //更新任务ID为不存在的100001 父ID为601 不创建动态的任务的父任务 +r($task->updateParentStatusTest($taskIDList[3], $parentIDList[1])) && p('status,name') && e('1'); //更新任务ID为不存在的100001 父ID为902 创建动态的任务的父任务 +system("./ztest init");