* Added the todoModel::getPriByTodoType() unit test script.
This commit is contained in:
Executable
+40
@@ -0,0 +1,40 @@
|
||||
#!/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('todo')->gen(10);
|
||||
zdTable('bug')->gen(10);
|
||||
zdTable('task')->gen(10);
|
||||
zdTable('story')->gen(10);
|
||||
zdTable('testtask')->gen(10);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
title=测试 todoModel->create();
|
||||
timeout=0
|
||||
cid=1
|
||||
|
||||
- 执行todoTest模块的getPriByTodoTypeTest方法,参数是$type, $objectID @1
|
||||
|
||||
- 执行todoTest模块的getPriByTodoTypeTest方法,参数是$inValidType, $inValidObjectID @1
|
||||
|
||||
*/
|
||||
|
||||
initData();
|
||||
|
||||
$validTypeList = array('bug','task','story','testtask');
|
||||
$validObjectIdList = array_combine(range(1,10), range(1,10));
|
||||
$type = $validTypeList[array_rand($validTypeList, 1)];
|
||||
$objectID = $validObjectIdList[array_rand($validObjectIdList, 1)];
|
||||
$inValidType = 'invalidType';
|
||||
$inValidObjectID = 0;
|
||||
|
||||
$todoTest = new todoTest();
|
||||
r($todoTest->getPriByTodoTypeTest($type, $objectID)) && p() && e('1');
|
||||
r($todoTest->getPriByTodoTypeTest($inValidType, $inValidObjectID)) && p() && e('1');
|
||||
@@ -0,0 +1,35 @@
|
||||
title: Get pri for todoModel::getPriByTodoType UTC.
|
||||
desc: Get pri for todoModel::getPriByTodoType UTC.
|
||||
author: xushenjie
|
||||
version: 1.0.0
|
||||
|
||||
fields:
|
||||
- field: account
|
||||
range: 'admin'
|
||||
- field: name
|
||||
range: 1-10
|
||||
prefix: '待办'
|
||||
- field: date
|
||||
range: 1-9
|
||||
prefix: '2023-05-0'
|
||||
- field: type
|
||||
range: 'custom'
|
||||
- field: begin
|
||||
range: 1000-1100
|
||||
- field: end
|
||||
range: 1200-1300
|
||||
- field: assignedTo
|
||||
range: 'admin'
|
||||
- field: desc
|
||||
range: 1-100
|
||||
prefix: '待办描述'
|
||||
- field: status
|
||||
range: 'wait,doing,doing,doing,wait'
|
||||
- field: objectID
|
||||
range: 0
|
||||
- field: assignedBy
|
||||
range: 'admin'
|
||||
- field: type
|
||||
range: 'custom,bug,task,story,testtask'
|
||||
- field: objectID
|
||||
range: 1-10
|
||||
@@ -379,4 +379,38 @@ class todoTest
|
||||
{
|
||||
return $this->objectModel->getByExportList($orderBy, $formData, $queryCondition, $checkedItem);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取导出的待办数据。
|
||||
* Get data for export todo.
|
||||
*
|
||||
* @param string $orderBy
|
||||
* @param object $formData
|
||||
* @param string $queryCondition
|
||||
* @param string $checkedItem
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getByExportListTest(string $orderBy, object $formData, string $queryCondition , string $checkedItem): array
|
||||
{
|
||||
return $this->objectModel->getByExportList($orderBy, $formData, $queryCondition, $checkedItem);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据待办类型,对象ID获取优先级。
|
||||
* Get pri by todo type and object id.
|
||||
*
|
||||
* @param string $todoType
|
||||
* @param int $objectID
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function getPriByTodoTypeTest(string $todoType, int $objectID): int
|
||||
{
|
||||
$pri = $this->objectModel->getPriByTodoType($todoType, $objectID);
|
||||
|
||||
if(dao::isError()) return 0;
|
||||
|
||||
return $pri ? 1 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user