Merge branch 'sprint/autoTest_liumengyi_todo' into 'master'
* Add auto test of todo. See merge request easycorp/zentaopms!2494
This commit is contained in:
@@ -5,6 +5,7 @@ class todoTest
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('todo');
|
||||
$tester->app->loadClass('dao');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -276,10 +277,13 @@ class todoTest
|
||||
|
||||
$todo->config = str_replace('2022-03-23', date('Y-m-d', time()), $todo->config);
|
||||
|
||||
$this->objectModel->createByCycle(array('1' => $todo));
|
||||
|
||||
global $tester;
|
||||
$objects = $tester->dao->select('id')->from(TABLE_TODO)->where('idvalue')->eq('100001')->andWhere('name')->eq($todo->name)->andWhere('config')->eq($todo->config)->andWhere('deleted')->eq('0')->fetchAll();
|
||||
$tester->dao->insert(TABLE_TODO)->data($todo)->autoCheck()->exec();
|
||||
$todoID = $tester->dao->lastInsertID();
|
||||
|
||||
$this->objectModel->createByCycle(array($todoID => $todo));
|
||||
|
||||
$objects = $tester->dao->select('id')->from(TABLE_TODO)->where('idvalue')->eq($todoID)->andWhere('deleted')->eq('0')->fetchAll();
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
|
||||
@@ -45,12 +45,12 @@ fields:
|
||||
postfix: ""
|
||||
- field: cycle
|
||||
note: "周期"
|
||||
range: 1,0
|
||||
range: 1
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
- field: idvalue
|
||||
note: "关联编号"
|
||||
range: 0,2001,0,2003,0
|
||||
range: 0
|
||||
prefix: ""
|
||||
postfix: ""
|
||||
loop: 0
|
||||
|
||||
@@ -319,9 +319,9 @@ class Processor
|
||||
$toDay = date('y-m-d');
|
||||
$addDay = date('Y-m-d',strtotime("+1 day"));
|
||||
|
||||
$str = '{"day":"1","specify":{"month":"0","day":"1"},"type":"day","beforeDays":1,"end":"","begin":"'.$toDay.'"}';
|
||||
$str2 = '{"specify":{"month":"0","day":"1"},"week":"3","type":"week","beforeDays":1,"end":"","begin":"'.$toDay.'"}';
|
||||
$str3 = '{"specify":{"month":"0","day":"1"},"month":"17","type":"month","beforeDays":0,"end":"","begin":"'.$toDay.'"}';
|
||||
$str = '{"day":"1","specify":{"month":"0","day":"1"},"type":"day","beforeDays":11,"end":"","begin":"'.$toDay.'"}';
|
||||
$str2 = '{"specify":{"month":"0","day":"1"},"week":"1,3","type":"week","beforeDays":31,"end":"","begin":"'.$toDay.'"}';
|
||||
$str3 = '{"specify":{"month":"0","day":"1"},"month":"5,17,29","type":"month","beforeDays":301,"end":"","begin":"'.$toDay.'"}';
|
||||
|
||||
$this->dao->update(TABLE_TODO)->SET('config')->eq($str)->where('id')->eq('2001')->exec();
|
||||
$this->dao->update(TABLE_TODO)->SET('date')->eq($addDay)->where('id')->eq('2002')->exec();
|
||||
|
||||
@@ -10,11 +10,15 @@ title=测试 todoModel->createByCycle();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
测试创建周期日待办 >> 11
|
||||
测试创建周期周待办 >> 9
|
||||
测试创建周期月待办 >> 30
|
||||
|
||||
*/
|
||||
|
||||
$todo1 = new stdclass();
|
||||
$todo1->name = 'cycle生成的待办1';
|
||||
$todo1->config = '{"specify":{"month":"0","day":"1"},"days":"1","type":"day","beforeDays":11,"end":"","begin":"2022-03-23"}';
|
||||
$todo1->config = '{"specify":{"month":"0","day":"1"},"day":"1","type":"day","beforeDays":11,"end":"","begin":"2022-03-23"}';
|
||||
|
||||
$todo2 = new stdclass();
|
||||
$todo2->name = 'cycle生成的待办2';
|
||||
@@ -26,4 +30,6 @@ $todo3->config = '{"specify":{"month":"0","day":"1"},"month":"1,8,13
|
||||
|
||||
$todo = new todoTest();
|
||||
|
||||
r($todo->createByCycleTest($todo1)) && p() && e('');
|
||||
r($todo->createByCycleTest($todo1)) && p() && e('11'); // 测试创建周期日待办
|
||||
r($todo->createByCycleTest($todo2)) && p() && e('9'); // 测试创建周期周待办
|
||||
r($todo->createByCycleTest($todo3)) && p() && e('30'); // 测试创建周期月待办
|
||||
|
||||
Reference in New Issue
Block a user