* Add unit test.

This commit is contained in:
sunguangming
2023-11-25 09:33:49 +08:00
parent 31b2b32063
commit f3a3974530
2 changed files with 48 additions and 1 deletions
+1 -1
View File
@@ -137,7 +137,7 @@ class commonModel extends model
* @access public
* @return object|false $parentExecution
*/
public function syncExecutionByChild(object $execution)
public function syncExecutionByChild(object $execution): object|false
{
if($execution->grade == 1) return false;
+47
View File
@@ -0,0 +1,47 @@
#!/usr/bin/env php
<?php
include dirname(__FILE__, 5) . '/test/lib/init.php';
su('admin');
zdTable('project')->gen(100);
zdTable('project')->config('execution')->gen(200, false);
zdTable('task')->gen(100);
/**
title=测试 commonModel->syncExecutionStatus();
timeout=0
cid=1
- 执行$execution1属性status @wait
- 执行$execution2属性status @doing
- 执行$execution3属性status @wait
- 任务开始将执行的状态设为doing属性status @doing
- 任务开始将执行的状态设为doing属性status @doing
- 任务开始将执行的状态设为doing属性status @doing
*/
global $tester;
$tester->loadModel('execution');
$tester->loadModel('common');
$execution1 = $tester->execution->getById(101);
$execution2 = $tester->execution->getById(102);
$execution3 = $tester->execution->getById(103);
r($execution1) && p('status') && e('wait');
r($execution2) && p('status') && e('doing');
r($execution3) && p('status') && e('wait');
$tester->common->syncExecutionStatus(1);
$tester->common->syncExecutionStatus(2);
$tester->common->syncExecutionStatus(3);
$execution1 = $tester->execution->getById(101);
$execution2 = $tester->execution->getById(102);
$execution3 = $tester->execution->getById(103);
r($execution1) && p('status') && e('doing'); // 任务开始将执行的状态设为doing
r($execution2) && p('status') && e('doing'); // 任务开始将执行的状态设为doing
r($execution3) && p('status') && e('doing'); // 任务开始将执行的状态设为doing