* Refactor task-pause and add unit test.

This commit is contained in:
liumengyi
2023-05-12 16:19:22 +08:00
parent 773e033434
commit 7625a4fdab
16 changed files with 312 additions and 91 deletions
+11 -14
View File
@@ -2,27 +2,24 @@
<?php
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/task.class.php';
su('admin');
zdTable('task')->config('task_pause')->gen(7);
zdTable('project')->config('project_pause')->gen(1);
/**
title=taskModel->pause();
timeout=0
cid=1
pid=1
wait状态任务暂停 >> status,wait,pause
doing状态任务暂停 >> status,doing,pause
done状态任务暂停 >> status,done,pause
cancel状态任务暂停 >> status,cancel,pause
closed状态任务暂停 >> status,closed,pause
*/
$taskIDList = array('19','20','21','23','24');
$taskIDList = array('1', '2', '3', '4', '5', '7');
$task = new taskTest();
r($task->pauseTest($taskIDList[0])) && p('0:field,old,new') && e('status,wait,pause'); //wait状态任务暂停
r($task->pauseTest($taskIDList[1])) && p('0:field,old,new') && e('status,doing,pause'); //doing状态任务暂停
r($task->pauseTest($taskIDList[2])) && p('0:field,old,new') && e('status,done,pause'); //done状态任务暂停
r($task->pauseTest($taskIDList[3])) && p('0:field,old,new') && e('status,cancel,pause'); //cancel状态任务暂停
r($task->pauseTest($taskIDList[4])) && p('0:field,old,new') && e('status,closed,pause'); //closed状态任务暂停
r($task->pauseTest($taskIDList[0])) && p('0:field,old,new') && e('status,wait,pause'); // wait状态任务暂停
r($task->pauseTest($taskIDList[1])) && p('0:field,old,new') && e('status,doing,pause'); // doing状态任务暂停
r($task->pauseTest($taskIDList[2])) && p('0:field,old,new') && e('status,done,pause'); // done状态任务暂停
r($task->pauseTest($taskIDList[3])) && p('0:field,old,new') && e('status,cancel,pause'); // cancel状态任务暂停
r($task->pauseTest($taskIDList[4])) && p('0:field,old,new') && e('status,closed,pause'); // closed状态任务暂停
r($task->pauseTest($taskIDList[5])) && p('0:field,old,new') && e('status,doing,pause'); // doing状态子任务暂停