* Add unit test.
This commit is contained in:
@@ -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
@@ -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
|
||||
Reference in New Issue
Block a user