From 820e76146287ffb0cc65e710e4e4ece9d52cc5b2 Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Thu, 12 Jun 2025 15:47:33 +0800 Subject: [PATCH] * [unittest] Add the unit test file of executionModel::delete. --- .../test/lib/execution.unittest.class.php | 15 ++++++++++ module/execution/test/model/delete.php | 28 +++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 module/execution/test/model/delete.php diff --git a/module/execution/test/lib/execution.unittest.class.php b/module/execution/test/lib/execution.unittest.class.php index 40b64108e6..b074607c63 100644 --- a/module/execution/test/lib/execution.unittest.class.php +++ b/module/execution/test/lib/execution.unittest.class.php @@ -3097,4 +3097,19 @@ class executionTest $return = $this->executionModel->getToAndCcList($execution); return $return; } + + /** + * 删除一个执行。 + * Delete an execution. + * + * @param string $table + * @param int $executionID + * @access public + * @return void + */ + public function deleteTest(int $executionID = 0) + { + $this->executionModel->delete(TABLE_EXECUTION, $executionID); + return $this->executionModel->dao->select('deleted')->from(TABLE_EXECUTION)->where('id')->eq($executionID)->fetch('deleted'); + } } diff --git a/module/execution/test/model/delete.php b/module/execution/test/model/delete.php new file mode 100644 index 0000000000..a2f8049db1 --- /dev/null +++ b/module/execution/test/model/delete.php @@ -0,0 +1,28 @@ +#!/usr/bin/env php +gen(5); +su('admin'); + +/** + +title=测试executionModel->activateTest(); +cid=0 + +- 测试删除迭代5 @1 +- 测试删除迭代6 @1 +- 测试删除迭代7 @1 +- 测试删除迭代8 @1 +- 测试删除迭代9 @1 + +*/ + +zenData('project')->loadYaml('execution')->gen(10); + +$execution = new executionTest(); +r($execution->deleteTest(101)) && p() && e('1'); //测试删除迭代5 +r($execution->deleteTest(102)) && p() && e('1'); //测试删除迭代6 +r($execution->deleteTest(103)) && p() && e('1'); //测试删除迭代7 +r($execution->deleteTest(104)) && p() && e('1'); //测试删除迭代8 +r($execution->deleteTest(105)) && p() && e('1'); //测试删除迭代9