+ Added the unit test scirpt for todoTao::getCycleList().
This commit is contained in:
Executable
+28
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/todo.class.php';
|
||||
su('admin');
|
||||
|
||||
function initData ()
|
||||
{
|
||||
zdTable('todo')->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'); // 获取有周期待办生成的待办数据
|
||||
@@ -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"}`'
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user