diff --git a/module/todo/test/tao/getvalidsofbatchcreate.php b/module/todo/test/tao/getvalidsofbatchcreate.php new file mode 100755 index 0000000000..8b0f3d2f0c --- /dev/null +++ b/module/todo/test/tao/getvalidsofbatchcreate.php @@ -0,0 +1,36 @@ +#!/usr/bin/env php +getValidsOfBatchCreate(); +cid=1 +pid=1 + * +- 执行todoTest模块的getValidsOfBatchCreateTest方法,参数是$todos, $loop = 1, $assignedTo @1 + +- 执行todoTest模块的getValidsOfBatchCreateTest方法,参数是$invalidEndTodos, $loop = 1, $assignedTo @0 +*/ + +$today = date('Y-m-d'); +$assignedTo = 'admin'; +$names = array('批量创建待办1', '批量创建待办2', '批量创建待办3', '批量创建待办4', '批量创建待办5', '批量创建待办6', '批量创建待办7', '批量创建待办8'); +$types = array('custom', 'custom', 'custom', 'custom', 'custom', 'custom', 'custom', 'custom'); +$pris = array(1, 2, 3, 4, 1, 2, 3, 4); +$descs = array('desc1', 'desc2', 'desc3', 'desc4', '' , '', '', ''); +$begins = array('0830', '0900', '0930', '1000', '1030', '1100', '1130', '1200'); +$ends = array('0900', '0930', '1000','1030', '1100', '1130', '1200', '1230'); +$assignedTos = array('admin', 'productManager', 'projectManager', 'dev1', 'dev2', 'dev3', 'tester1', 'tester2',); +$todos = array('types' => $types, 'pris' => $pris, 'names' => $names, 'descs' => $descs, 'begins' => $begins, 'ends' => $ends, 'assignedTos' => $assignedTos, 'date' => $today, 'switchDate' => ''); + +$invalidEnds = array('0800', '0830', '0800', '0800', '0800', '0800', '0800', '0800'); +$invalidEndTodos = $todos; +$invalidEndTodos['ends'] = $invalidEnds; + +$todoTest = new todoTest(); +r($todoTest->getValidsOfBatchCreateTest($todos, $loop = 1, $assignedTo)) && p() && e('1'); +r($todoTest->getValidsOfBatchCreateTest($invalidEndTodos, $loop = 1, $assignedTo)) && p() && e('0'); + diff --git a/module/todo/test/todo.class.php b/module/todo/test/todo.class.php index 0e71cd0db4..6b970811f3 100755 --- a/module/todo/test/todo.class.php +++ b/module/todo/test/todo.class.php @@ -386,7 +386,7 @@ class todoTest * @param string $todoType * @param int $objectID * @access public - * @return string + * @return int */ public function getPriByTodoTypeTest(string $todoType, int $objectID): int { @@ -401,15 +401,15 @@ class todoTest * 根据周期待办,获取这些待办生成的待办数据。 * Get created cycle list by todo list. * - * @param int $isInintCycle + * @param bool $isInitCycle * @access public * @return int */ - public function getCycleListTest(bool $isInintCycle = true): int + public function getCycleListTest(bool $isInitCycle = true): int { $todoList = $this->objectModel->getValidCycleList(); - if($isInintCycle) $this->objectModel->createBycycle($todoList); + if($isInitCycle) $this->objectModel->createBycycle($todoList); $cycleList = $this->objectModel->getCycleList($todoList); @@ -436,5 +436,22 @@ class todoTest $testResut->isClosed = $isClosed; return $testResut; + + /** + * 获取批量创建待办的有效数据。 + * Get valid todo list of batch create. + * + * @param array $todos + * @param int $loop + * @param string $assignedTo + * @access public + * @return int + */ + public function getValidsOfBatchCreateTest(array $todos, int $loop, string $assignedTo): int + { + $todos = json_decode(json_encode($todos)); + $this->objectModel->getValidsOfBatchCreate($todos, $loop, $assignedTo); + + return dao::isError() ? 0 : 1; } }