From 0c9490c7e98f1bd5b647cd049676c2e4dc0405b0 Mon Sep 17 00:00:00 2001 From: liugang Date: Mon, 11 Sep 2023 17:43:31 +0800 Subject: [PATCH] * testtask: refactor script to test the start method. --- module/testtask/test/model/start.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/module/testtask/test/model/start.php b/module/testtask/test/model/start.php index a20a65bc9f..b253e65f48 100755 --- a/module/testtask/test/model/start.php +++ b/module/testtask/test/model/start.php @@ -3,7 +3,7 @@ include dirname(__FILE__, 5) . '/test/lib/init.php'; include dirname(__FILE__, 2) . '/testtask.class.php'; -zdTable('testtask')->gen(4); +zdTable('testtask')->gen(5); su('admin'); @@ -15,14 +15,17 @@ pid=1 */ +$uid = uniqid(); + $task1 = array('id' => 0); $task2 = array('id' => ''); $task3 = array('id' => 'id'); $task4 = array('id' => 2); $task5 = array('id' => 3); $task6 = array('id' => 4); -$task7 = array('id' => 5); -$task8 = array('id' => 1, 'status' => 'doing', 'realBegan' => '2023-09-11', 'comment' => 'comment'); +$task7 = array('id' => 6); +$task8 = array('id' => 1, 'status' => 'doing', 'realBegan' => '2023-09-11', 'uid' => $uid, 'comment' => ''); +$task9 = array('id' => 5, 'status' => 'doing', 'realBegan' => '2023-09-11', 'uid' => $uid, 'comment' => 'comment'); $testtask = new testtaskTest(); @@ -34,4 +37,5 @@ r($testtask->startTest($task5)) && p() && e(0); // 测试单 ID 对应的测试 r($testtask->startTest($task6)) && p() && e(0); // 测试单 ID 对应的测试单状态为 blocked 返回 false。 r($testtask->startTest($task7)) && p() && e(0); // 测试单 ID 对应的测试单不存在返回 false。 -r($testtask->startTest($task8)) && p('task:id|status|realBegan;action:objectType|action|comment;history[0]:field|old|new;history[1]:field|old|new', '|') && e('1|doing|2023-09-11;testtask|started|comment;status|wait|doing;realBegan|~~|2023-09-11'); // 开始测试单 1 成功后检测测试单信息和日志。 +r($testtask->startTest($task8)) && p('task:id|status|realBegan;action:objectType|action|comment;history[0]:field|old|new;history[1]:field|old|new', '|') && e('1|doing|2023-09-11;testtask|started|~~;status|wait|doing;realBegan|~~|2023-09-11'); // 开始状态为 wait 的测试单,备注为空,成功后检测测试单信息和日志。 +r($testtask->startTest($task9)) && p('task:id|status|realBegan;action:objectType|action|comment;history[0]:field|old|new;history[1]:field|old|new', '|') && e('5|doing|2023-09-11;testtask|started|comment;status|wait|doing;realBegan|~~|2023-09-11'); // 开始状态为 wait 的测试单,备注不为空,成功后检测测试单信息和日志。