From 9529d47ee5c589db3b96a7a8e4337838e6caebfb Mon Sep 17 00:00:00 2001 From: xushenjie Date: Mon, 8 May 2023 07:17:29 +0000 Subject: [PATCH] + Added the unit test scirpt for todoTao::getCycleList(). --- module/todo/test/tao/getcyclelist.php | 28 +++++++++++++++ .../tao/yaml/getcyclelist/getcyclelist.yaml | 35 +++++++++++++++++++ module/todo/test/todo.class.php | 19 ++++++++++ 3 files changed, 82 insertions(+) create mode 100755 module/todo/test/tao/getcyclelist.php create mode 100644 module/todo/test/tao/yaml/getcyclelist/getcyclelist.yaml diff --git a/module/todo/test/tao/getcyclelist.php b/module/todo/test/tao/getcyclelist.php new file mode 100755 index 0000000000..9709a63ac2 --- /dev/null +++ b/module/todo/test/tao/getcyclelist.php @@ -0,0 +1,28 @@ +#!/usr/bin/env php +config('getcyclelist')->gen(5); +} + +/** + +title=测试 todoTao::getCycleList(); +timeout=0 +cid=1 + +- 执行todo模块的getCycleListTest方法,参数是$initCycleData = false @0 + +- 执行todo模块的getCycleListTest方法,参数是$initCycleData = true @1 + +*/ + +initData(); + +$todo = new todoTest(); +r($todo->getCycleListTest($initCycleData = false)) && p() && e('0'); // 获取通过周期待办的生成的待办数据为空的情况 +r($todo->getCycleListTest($initCycleData = true)) && p() && e('1'); // 获取有周期待办生成的待办数据 diff --git a/module/todo/test/tao/yaml/getcyclelist/getcyclelist.yaml b/module/todo/test/tao/yaml/getcyclelist/getcyclelist.yaml new file mode 100644 index 0000000000..bbe7cff1c8 --- /dev/null +++ b/module/todo/test/tao/yaml/getcyclelist/getcyclelist.yaml @@ -0,0 +1,35 @@ +title: todoTao::getCycleList UTC. +desc: todoTao::getCycleList UTC. +author: xushenjie +version: 1.0.0 + +fields: + - field: account + range: 'admin' + - field: name + range: '`周期待办:提前1天,间隔一天生成`, `周期待办:每月的每天,提前1天生成`, `周期待办:每周的每天,提前1天生成`' + - field: date + range: 1-5 + prefix: '2023-05-0' + - field: type + range: 'cycle' + - field: cycle + range: 1 + - field: begin + range: 0800-1100 + - field: end + range: 1800-2000 + - field: assignedTo + range: 'admin' + - field: desc + range: '周期待办描述' + - field: status + range: 'doing' + - field: objectID + range: 0 + - field: assignedBy + range: 'admin' + - field: pri + range: 1-4 + - field: config + range: '`{"specify":{"month":"0","day":"1"},"day":"1","type":"day","beforeDays":1,"end":"2030-05-31","begin":"2023-05-01"}`, `{"specify":{"month":"0","day":"1"},"month":"1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31","type":"month","beforeDays":1,"end":"2030-05-31","begin":"2023-05-01"}`, `{"specify":{"month":"0","day":"1"},"week":"1,2,3,4,5,6,0","type":"week","beforeDays":1,"end":"2030-05-31","begin":"2023-05-01"}`' diff --git a/module/todo/test/todo.class.php b/module/todo/test/todo.class.php index 3124a567ae..c987af6b01 100755 --- a/module/todo/test/todo.class.php +++ b/module/todo/test/todo.class.php @@ -396,4 +396,23 @@ class todoTest return $pri ? 1 : 0; } + + /** + * 根据周期待办,获取这些待办生成的待办数据。 + * Get created cycle list by todo list. + * + * @param int $isInintCycle + * @access public + * @return int + */ + public function getCycleListTest(bool $isInintCycle = true): int + { + $todoList = $this->objectModel->getValidCycleList(); + + if($isInintCycle) $this->objectModel->createBycycle($todoList); + + $cycleList = $this->objectModel->getCycleList($todoList); + + return count($cycleList) > 0 ? 1: 0; + } }