add test by dept and data

This commit is contained in:
liyang
2022-03-23 15:24:41 +08:00
parent ad24792c5f
commit f4810a274e
27 changed files with 737 additions and 90 deletions
+99 -33
View File
@@ -209,6 +209,14 @@ class deptTest
return $objects;
}
/**
* function getAllChildId test by dept
*
* @param string $deptID
* @param string $count
* @access public
* @return array
*/
public function getAllChildIdTest($deptID, $count)
{
$objects = $this->objectModel->getAllChildId($deptID);
@@ -219,74 +227,132 @@ class deptTest
return $objects;
}
public function getParentsTest($deptID)
/**
* function getParents test by dept
*
* @param string $deptID
* @param string $count
* @access public
* @return array
*/
public function getParentsTest($deptID, $count)
{
$objects = $this->objectModel->getParents($deptID);
if(dao::isError()) return dao::getError();
if($count == '1') return count($objects);
return $objects;
}
/**
* function updateOrder test by dept
*
* @param array $orders
* @access public
* @return array
*/
public function updateOrderTest($orders)
{
global $tester;
$objects = $this->objectModel->updateOrder($orders);
if(dao::isError()) return dao::getError();
$objects = $tester->dao->select('*')->from(TABLE_DEPT)->where('id')->eq($orders[0])->fetchAll('id');
return $objects;
}
public function manageChildTest($parentDeptID, $childs)
/**
* function manageChild test by dept
*
* @param string $parentDeptID
* @param array $childs
* @param string $count
* @access public
* @return arrray
*/
public function manageChildTest($parentDeptID, $childs, $count)
{
$objects = $this->objectModel->manageChild($parentDeptID, $childs);
if(dao::isError()) return dao::getError();
if($count == '1') return count($objects);
return $objects;
}
public function getUsersTest($browseType = 'inside', $deptID = 0, $pager = null, $orderBy = 'id')
/**
* function getUsers test by dept
*
* @param string $browseType
* @param string $deptID
* @param string $count
* @param string $orderBy
* @param null $pager
* @access public
* @return array
*/
public function getUsersTest($browseType = 'inside', $deptID = 0, $count, $orderBy = 'id', $pager = null)
{
$objects = $this->objectModel->getUsers($browseType = 'inside', $deptID = 0, $pager = null, $orderBy = 'id');
$objects = $this->objectModel->getUsers($browseType, $deptID, $pager, $orderBy);
if(dao::isError()) return dao::getError();
if($count == '1') return count($objects);
return $objects;
}
/**
* function getDeptUserPairs test by dept
*
* @param int $deptID
* @param int $count
* @param string $key
* @param string $type
* @param string $params
* @access public
* @return array
*/
public function getDeptUserPairsTest($deptID = 0, $count, $key = 'account', $type = 'inside', $params = '')
{
$objects = $this->objectModel->getDeptUserPairs($deptID, $key, $type, $params);
if(dao::isError()) return dao::getError();
if($count == '1') return count($objects);
return $objects;
}
/**
* function delete test by dept
*
* @param int $deptID
* @access public
* @return int
*/
public function deleteTest($deptID)
{
global $tester;
$this->objectModel->delete($deptID);
$objects = $tester->dao->select('*')->from(TABLE_DEPT)->fetchAll();
if(dao::isError()) return dao::getError();
return $objects;
return count($objects);
}
public function getDeptUserPairsTest($deptID = 0, $key = 'account', $type = 'inside', $params = '')
{
$objects = $this->objectModel->getDeptUserPairs($deptID = 0, $key = 'account', $type = 'inside', $params = '');
if(dao::isError()) return dao::getError();
return $objects;
}
public function deleteTest($deptID, $null = null)
{
$objects = $this->objectModel->delete($deptID, $null = null);
if(dao::isError()) return dao::getError();
return $objects;
}
public function fixDeptPathTest()
{
$objects = $this->objectModel->fixDeptPath();
if(dao::isError()) return dao::getError();
return $objects;
}
public function getDataStructureTest()
public function getDataStructureTest($count)
{
$objects = $this->objectModel->getDataStructure();
if(dao::isError()) return dao::getError();
if($count == '1') return count($objects);
return $objects;
}
+283
View File
@@ -0,0 +1,283 @@
title: table zt_story
desc: "需求"
author: automated export
version: "1.0"
fields:
- field: id
range: 401-10000
- field: parent
note: "父需求ID"
range: 351-400
prefix: ""
postfix: ""
loop: 0
format: ""
- field: product
note: "所属产品"
range: 88{2},89-100{4}
prefix: ""
postfix: ""
loop: 0
format: ""
- field: branch
note: "分支/平台"
range: 0
prefix: ""
postfix: ""
loop: 0
format: ""
- field: module
note: "所属模块"
range: 2171-10000
prefix: ""
postfix: ""
loop: 0
format: ""
- field: plan
note: "所属计划"
range: 0
prefix: ""
postfix: ""
loop: 0
format: ""
- field: source
note: "需求来源"
range: customer,user,po,market,service,operation,support,competitor,partner,dev,tester,bug,forum,other
prefix: ""
postfix: ""
loop: 0
format: ""
- field: sourceNote
note: "来源备注"
range: 1-10000
prefix: "这里是需求来源备注"
postfix: ""
loop: 0
format: ""
- field: fromBug
note: "来源Bug"
range: 0
prefix: ""
postfix: ""
loop: 0
format: ""
- field: title
note: "需求名称"
fields:
- field: field1
range: [用户子需求,软件子需求]
- field: field2
range: 1-10000
prefix: ""
postfix: ""
loop: 0
format: ""
- field: keywords
note: "关键词"
range: 1-10000
prefix: "关键词"
postfix: ""
loop: 0
format: ""
- field: type
note: "需求类型"
range: requirement,story
prefix: ""
postfix: ""
loop: 0
format: ""
- field: pri
note: "优先级"
range: 1-4
prefix: ""
postfix: ""
loop: 0
format: ""
- field: estimate
note: "预计工时"
range: 0-20:2
prefix: ""
postfix: ""
loop: 0
format: ""
- field: status
note: "当前状态"
range: draft,active,closed,changed
prefix: ""
postfix: ""
loop: 0
format: ""
- field: subStatus
note: "子状态"
range: 0
prefix: ""
postfix: ""
loop: 0
format: ""
- field: color
note: "标题颜色"
from: common.color.v1.yaml
use: color
prefix: ""
postfix: ""
loop: 0
format: ""
- field: stage
note: "所处阶段"
range: wait,planned,projected,developing,developed,testing,tested,verified,released,closed
prefix: ""
postfix: ""
loop: 0
format: ""
- field: stagedBy
note: "设置阶段者"
from: common.user.v1.yaml
use: user
prefix: ""
postfix: ""
loop: 0
format: ""
- field: mailto
note: "抄送给"
from: common.user.v1.yaml
use: user
prefix: ""
postfix: ""
loop: 0
format: ""
- field: openedBy
note: "由谁创建"
from: common.user.v1.yaml
use: user
prefix: ""
postfix: ""
loop: 0
format: ""
- field: openedDate
note: "创建日期"
from: common.date.v1.yaml
use: dateA
prefix: ""
postfix: ""
loop: 0
format: ""
- field: assignedTo
note: "指派给"
from: common.user.v1.yaml
use: user
prefix: ""
postfix: ""
loop: 0
format: ""
- field: assignedDate
note: "指派日期"
from: common.date.v1.yaml
use: dateA
prefix: ""
postfix: ""
loop: 0
format: ""
- field: lastEditedBy
note: "最后修改者"
from: common.user.v1.yaml
use: user
prefix: ""
postfix: ""
loop: 0
format: ""
- field: lastEditedDate
note: "最后修改日期"
from: common.date.v1.yaml
use: dateA
prefix: ""
postfix: ""
loop: 0
format: ""
- field: reviewedBy
note: "评审者"
from: common.user.v1.yaml
use: user
prefix: ""
postfix: ""
loop: 0
format: ""
- field: reviewedDate
note: "评审日期"
from: common.date.v1.yaml
use: dateA
prefix: ""
postfix: ""
loop: 0
format: ""
- field: closedBy
note: "关闭者"
from: common.user.v1.yaml
use: user
prefix: ""
postfix: ""
loop: 0
format: ""
- field: closedDate
note: "关闭日期"
from: common.date.v1.yaml
use: dateA
prefix: ""
postfix: ""
loop: 0
format: ""
- field: closedReason
note: "关闭原因"
range: done,subdivided,duplicate,postponed,willnotdo,cancel,bydesign
prefix: ""
postfix: ""
loop: 0
format: ""
- field: toBug
note: "转Bug"
range: 0
prefix: ""
postfix: ""
loop: 0
format: ""
- field: childStories
note: "细分需求"
range: 0
prefix: ""
postfix: ""
loop: 0
format: ""
- field: linkStories
note: "相关需求"
range: 0
prefix: ""
postfix: ""
loop: 0
format: ""
- field: duplicateStory
note: "重复需求ID"
range: 0
prefix: ""
postfix: ""
loop: 0
format: ""
- field: version
note: "版本号"
range: 1{50}
prefix: ""
postfix: ""
loop: 0
format: ""
- field: URChanged
note: "用户需求变更"
range: 0
prefix: ""
postfix: ""
loop: 0
format: ""
- field: deleted
note: "是否删除"
range: 0
prefix: ""
postfix: ""
loop: 0
format: ""
+4 -4
View File
@@ -25,9 +25,9 @@ fields:
note: "日期"
range: "(M)-(w)"
type: timestamp
prefix: "DateTime"
prefix: ""
postfix: ""
format: "YY/MM/DD"
format: "YY-MM-DD"
- field: begin
note: "开始"
range: "1000-1059:2"
@@ -125,9 +125,9 @@ fields:
note: "指派日期"
range: "(M)-(w):60m"
type: timestamp
prefix: "DateTime"
prefix: ""
postfix: ""
format: "YY/MM/DD hh:mm:ss"
format: "YY-MM-DD hh:mm:ss"
- field: finishedBy
note: "由谁完成"
from: common.user.v1.yaml
+149
View File
@@ -0,0 +1,149 @@
title: table zt_todo
desc: "待办"
author: ly
version: "1.0"
fields:
- field: id
note: "ID"
range: 2001-10000
prefix: ""
postfix: ""
loop: 0
format: ""
- field: account
note: "用户名"
range: admin
prefix: ""
postfix: ""
loop: 0
format: ""
- field: date
note: "日期"
range: "(M)-(w)"
type: timestamp
prefix: ""
postfix: ""
format: "YY-MM-DD"
- field: begin
note: "开始"
range: "1000-1059:2"
prefix: ""
postfix: ""
loop: 0
format: ""
- field: end
note: "结束"
range: "1400-1459:2"
prefix: ""
postfix: ""
loop: 0
format: ""
- field: type
note: "类型"
range: cycle
prefix: ""
postfix: ""
- field: cycle
note: "周期"
range: 1,0
prefix: ""
postfix: ""
- field: idvalue
note: "关联编号"
range: 0,2001,0,2003,0
prefix: ""
postfix: ""
loop: 0
format: ""
- field: pri
note: "优先级"
range: 3
prefix: ""
postfix: ""
loop: 0
format: ""
- field: name
note: "待办名称"
range: 天周期{2},周周期{2},月周期
prefix: ""
postfix: "待办"
loop: 0
format: ""
- field: desc
note: "描述"
range: 1-10000
prefix: "这是一个待办的描述"
postfix: ""
loop: 0
format: ""
- field: status
note: "状态"
range: wait
prefix: ""
postfix: ""
loop: 0
format: ""
- field: private
note: "私人事务"
range: 0
prefix: ""
postfix: ""
loop: 0
format: ""
- field: config
note: "配置"
range: ""
prefix: ""
postfix: ""
format: ""
- field: assignedTo
note: "指派给"
range: admin
prefix: ""
postfix: ""
format: ""
- field: assignedBy
note: "由谁指派"
range: admin
prefix: ""
postfix: ""
format: ""
- field: assignedDate
note: "指派日期"
range: "(M)-(w):60m"
type: timestamp
prefix: ""
postfix: ""
format: "YY/MM/DD hh:mm:ss"
- field: finishedBy
note: "由谁完成"
from: common.user.v1.yaml
use: user
prefix: ""
postfix: ""
loop: 0
format: ""
- field: finishedDate
note: "完成时间"
from: common.date.v1.yaml
use: dateA
prefix: ""
postfix: ""
loop: 0
format: ""
- field: closedBy
note: "由谁关闭"
from: common.user.v1.yaml
use: user
prefix: ""
postfix: ""
loop: 0
format: ""
- field: closedDate
note: "关闭时间"
from: common.date.v1.yaml
use: dateA
prefix: ""
postfix: ""
loop: 0
format: ""
+2
View File
@@ -4,6 +4,7 @@ $builder = new stdclass();
$builder->company = array('rows' => 2, 'extends' => array('company'));
$builder->user = array('rows' => 1000, 'extends' => array('user'));
$builder->todo = array('rows' => 2000, 'extends' => array('todo'));
$builder->todocycle = array('rows' => 5, 'extends' => array('todo','todocycle'));
$builder->effort = array('rows' => 100, 'extends' => array('effort'));
$builder->usergroup = array('rows' => 600, 'extends' => array('usergroup'));
$builder->usercontact = array('rows' => 61, 'extends' => array('usercontact'));
@@ -16,6 +17,7 @@ $builder->project = array('rows' => 90, 'extends' => array('project', 'pro
$builder->sprint = array('rows' => 600, 'extends' => array('project', 'execution'));
$builder->story = array('rows' => 400, 'extends' => array('story'));
$builder->childstory = array('rows' => 50, 'extends' => array('story','childstory'));
$builder->storymodule = array('rows' => 800, 'extends' => array('module','storymodule'));
$builder->storyplan = array('rows' => 400, 'extends' => array('planstory'));
$builder->storyspec = array('rows' => 60, 'extends' => array('storyspec'));
+17
View File
@@ -48,6 +48,7 @@ class Processor
$this->initStory();
$this->initBug();
$this->initTest();
$this->initTodo();
$this->dao->commit();
}
@@ -313,6 +314,22 @@ class Processor
$this->dao->query("INSERT INTO `zt_userquery` (`id`, `account`, `module`, `title`, `form`, `sql`, `shortcut`) VALUES (3, 'admin', 'user', '用户测试条件', 'a:48:{s:13:\"fieldrealname\";s:0:\"\";s:10:\"fieldemail\";s:0:\"\";s:9:\"fielddept\";s:0:\"\";s:12:\"fieldaccount\";s:0:\"\";s:9:\"fieldrole\";s:0:\"\";s:10:\"fieldphone\";s:0:\"\";s:9:\"fieldjoin\";s:0:\"\";s:12:\"fieldvisions\";s:3:\"rnd\";s:7:\"fieldid\";s:0:\"\";s:13:\"fieldcommiter\";s:1:\"0\";s:11:\"fieldgender\";s:1:\"m\";s:7:\"fieldqq\";s:0:\"\";s:10:\"fieldskype\";s:0:\"\";s:13:\"fielddingding\";s:0:\"\";s:11:\"fieldweixin\";s:0:\"\";s:10:\"fieldslack\";s:0:\"\";s:13:\"fieldwhatsapp\";s:0:\"\";s:12:\"fieldaddress\";s:0:\"\";s:12:\"fieldzipcode\";s:0:\"\";s:6:\"andOr1\";s:3:\"AND\";s:6:\"field1\";s:8:\"realname\";s:9:\"operator1\";s:7:\"include\";s:6:\"value1\";s:9:\"白名单\";s:6:\"andOr2\";s:3:\"and\";s:6:\"field2\";s:5:\"email\";s:9:\"operator2\";s:7:\"include\";s:6:\"value2\";s:0:\"\";s:6:\"andOr3\";s:3:\"and\";s:6:\"field3\";s:4:\"dept\";s:9:\"operator3\";s:6:\"belong\";s:6:\"value3\";s:0:\"\";s:10:\"groupAndOr\";s:3:\"and\";s:6:\"andOr4\";s:3:\"AND\";s:6:\"field4\";s:7:\"account\";s:9:\"operator4\";s:7:\"include\";s:6:\"value4\";s:0:\"\";s:6:\"andOr5\";s:3:\"and\";s:6:\"field5\";s:4:\"role\";s:9:\"operator5\";s:1:\"=\";s:6:\"value5\";s:0:\"\";s:6:\"andOr6\";s:3:\"and\";s:6:\"field6\";s:5:\"phone\";s:9:\"operator6\";s:7:\"include\";s:6:\"value6\";s:0:\"\";s:6:\"module\";s:4:\"user\";s:9:\"actionURL\";s:74:\"/index.php?m=company&f=browse&browseType=all&param=myQueryID&type=bysearch\";s:10:\"groupItems\";s:1:\"3\";s:8:\"formType\";s:4:\"lite\";}', '(( 1 AND `realname` LIKE \'%白名单%\' ) AND ( 1 ))', '0');");
}
private function initTodo()
{
$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.'"}';
$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();
$this->dao->update(TABLE_TODO)->SET('config')->eq($str2)->where('id')->eq('2003')->exec();
$this->dao->update(TABLE_TODO)->SET('config')->eq($str3)->where('id')->eq('2005')->exec();
}
/**
* Init initUpdateKanban.
*
+5 -1
View File
@@ -1,3 +1,4 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/dept.class.php';
@@ -9,10 +10,13 @@ title=测试 deptModel->buildMenuQuery();
cid=1
pid=1
不输入部门id >> SELECT * FROM `zt_dept` ORDER BY `grade` desc,`order`
输入部门id >> ,2,
*/
$deptIDList = array('', '2');
$dept = new deptTest();
r($dept->buildMenuQueryTest($deptIDList[0])) && p() && e('SELECT * FROM `zt_dept` ORDER BY `grade` desc,`order` '); //不输入部门id
r($dept->buildMenuQueryTest($deptIDList[1])) && p() && e(',2,'); //输入部门id
r($dept->buildMenuQueryTest($deptIDList[1])) && p() && e(',2,'); //输入部门id
@@ -1,3 +1,4 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/dept.class.php';
@@ -9,11 +10,12 @@ title=测试 deptModel->createGroupManageMemberLink();
cid=1
pid=1
权限分组2开发部链接组成 >> dept2
*/
$deptIDList = array('2', '5');
$groupIDList = array('2', '12');
$dept = new deptTest();
r($dept->createGroupManageMemberLinkTest($deptIDList[0], $groupIDList[0])) && p() && e('>开发部<'); //权限分组2开发部链接组成
r($dept->createGroupManageMemberLinkTest($deptIDList[1], $groupIDList[1])) && p() && e('>开发部1<'); //权限分组12开发部1链接组成
r($dept->createGroupManageMemberLinkTest($deptIDList[0], $groupIDList[0])) && p() && e('dept2'); //权限分组2开发部链接组成
+8 -2
View File
@@ -1,3 +1,4 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/dept.class.php';
@@ -9,12 +10,17 @@ title=测试 deptModel->createManageLink();
cid=1
pid=1
编辑链接 >> 编辑
下级部门 >> 下级部门
删除链接 >> 删除
数量 >> orders[5]
*/
$deptID = '5';
$dept = new deptTest();
r($dept->createManageLinkTest($deptID)) && p() && e('编辑'); //编辑链接
r($dept->createManageLinkTest($deptID)) && p() && e('删除'); //删除链接
r($dept->createManageLinkTest($deptID)) && p() && e('下级部门'); //下级部门
r($dept->createManageLinkTest($deptID)) && p() && e('orders[5]'); //数量
r($dept->createManageLinkTest($deptID)) && p() && e('删除'); //删除链接
r($dept->createManageLinkTest($deptID)) && p() && e('orders[5]'); //数量
@@ -1,3 +1,4 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/dept.class.php';
@@ -9,12 +10,12 @@ title=测试 deptModel->createManageProjectAdminLink();
cid=1
pid=1
权限分组2开发部链接组成 >> dept2
*/
$deptIDList = array('2', '5');
$groupIDList = array('2', '12');
$dept = new deptTest();
r($dept->createManageProjectAdminLinkTest($deptIDList[0], $groupIDList[0])) && p() && e('开发部'); //权限分组2开发部链接组成
r($dept->createManageProjectAdminLinkTest($deptIDList[1], $groupIDList[1])) && p() && e('开发部1'); //权限分组2开发部链接组成
r($dept->createManageProjectAdminLinkTest($deptIDList[0], $groupIDList[0])) && p() && e('dept2'); //权限分组2开发部链接组成
+4 -1
View File
@@ -1,3 +1,4 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/dept.class.php';
@@ -9,9 +10,11 @@ title=测试 deptModel->createMemberLink();
cid=1
pid=1
>> >开发部<
*/
$deptID = '2';
$dept = new deptTest();
r($dept->createMemberLinkTest($deptID)) && p() && e('>开发部<');
r($dept->createMemberLinkTest($deptID)) && p() && e('>开发部<');
+8 -2
View File
@@ -1,3 +1,4 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/dept.class.php';
@@ -9,8 +10,13 @@ title=测试 deptModel->delete();
cid=1
pid=1
删除后统计数量 >> 99
*/
$dept = new deptTest();
$deptID = '11';
r() && p() && e();
$dept = new deptTest();
r($dept->deleteTest($deptID)) && p() && e('99'); //删除后统计数量
system("./ztest init");
-16
View File
@@ -1,16 +0,0 @@
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/dept.class.php';
su('admin');
/**
title=测试 deptModel->fixDeptPath();
cid=1
pid=1
*/
$dept = new deptTest();
r() && p() && e();
+7 -1
View File
@@ -1,3 +1,4 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/dept.class.php';
@@ -9,6 +10,11 @@ title=测试 deptModel->getAllChildId();
cid=1
pid=1
有子部门查询 >> 5
无子部门查询 >> 5
子部门数量统计 >> 3
无子部门数量统计 >> 1
*/
$deptIDList = array('2', '5');
@@ -18,4 +24,4 @@ $dept = new deptTest();
r($dept->getAllChildIdTest($deptIDList[0], $count[0])) && p('1') && e('5'); //有子部门查询
r($dept->getAllChildIdTest($deptIDList[1], $count[0])[0]) && p() && e('5'); //无子部门查询
r($dept->getAllChildIdTest($deptIDList[0], $count[1])) && p() && e('3'); //子部门数量统计
r($dept->getAllChildIdTest($deptIDList[1], $count[1])) && p() && e('1'); //无子部门数量统计
r($dept->getAllChildIdTest($deptIDList[1], $count[1])) && p() && e('1'); //无子部门数量统计
+6 -2
View File
@@ -1,3 +1,4 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/dept.class.php';
@@ -9,10 +10,13 @@ title=测试 deptModel->getByID();
cid=1
pid=1
*/
查找id为1的部门 >> 产品部
查找id不存在的部门 >> 0
*/
$deptIDList = array('1','0');
$dept = new deptTest();
r($dept->getByIDTest($deptIDList[0])) && p('name') && e('产品部'); //查找id为1的部门
r($dept->getByIDTest($deptIDList[1])) && p() && e('0'); //查找id不存在的部门
r($dept->getByIDTest($deptIDList[1])) && p() && e('0'); //查找id不存在的部门
+8 -2
View File
@@ -1,3 +1,4 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/dept.class.php';
@@ -9,8 +10,13 @@ title=测试 deptModel->getDataStructure();
cid=1
pid=1
全部查询 >> 100,其他部门63
全部查询统计 >> 78
*/
$dept = new deptTest();
$count = array('0', '1');
r() && p() && e();
$dept = new deptTest();
r($dept->getDataStructureTest($count[0])) && p('77:id,name') && e('100,其他部门63'); //全部查询
r($dept->getDataStructureTest($count[1])) && p() && e('78'); //全部查询统计
+6 -1
View File
@@ -1,3 +1,4 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/dept.class.php';
@@ -9,6 +10,10 @@ title=测试 deptModel->getDeptPairs();
cid=1
pid=1
查询全部部门统计 >> 100
查询id为2的部门 >> 开发部
查询id为2的部门数量 >> 100
*/
$deptIDlist = array('0', '2');
@@ -17,4 +22,4 @@ $count = array('0', '1');
$dept = new deptTest();
r($dept->getDeptPairsTest($deptIDlist[0], $count[1])) && p() && e('100'); //查询全部部门统计
r($dept->getDeptPairsTest($deptIDlist[1], $count[0])) && p('2') && e('开发部'); //查询id为2的部门
r($dept->getDeptPairsTest($deptIDlist[1], $count[1])) && p() && e('100'); //查询id为2的部门数量
r($dept->getDeptPairsTest($deptIDlist[1], $count[1])) && p() && e('100'); //查询id为2的部门数量
+28 -2
View File
@@ -1,3 +1,4 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/dept.class.php';
@@ -9,8 +10,33 @@ title=测试 deptModel->getDeptUserPairs();
cid=1
pid=1
查询所有内部用户 >> 测试1
查询所有外部用户 >> 用户1
根据部门查询用户 >> 测试10
键值为account查询 >> 测试40
键值为out查询 >> 测试10
type为out查询 >> 测试10
查询所有内部用户统计 >> 999
查询所有外部用户统计 >> 1
根据部门查询用户统计 >> 30
查询全部用户统计 >> 1000
*/
$dept = new deptTest();
$deptIDList = array('0', '2', '5');
$key = array('id', 'account', 'out');
$type = array('inside', 'outside', 'out');
$count = array('0', '1');
$params = 'all';
r() && p() && e();
$dept = new deptTest();
r($dept->getDeptUserPairsTest($deptIDList[0], $count[0], $key[0], $type[0])) && p('101') && e('测试1'); //查询所有内部用户
r($dept->getDeptUserPairsTest($deptIDList[0], $count[0], $key[0], $type[1])) && p('901') && e('用户1'); //查询所有外部用户
r($dept->getDeptUserPairsTest($deptIDList[1], $count[0], $key[0], $type[0])) && p('11') && e('测试10'); //根据部门查询用户
r($dept->getDeptUserPairsTest($deptIDList[2], $count[0], $key[1], $type[0])) && p('user40') && e('测试40'); //键值为account查询
r($dept->getDeptUserPairsTest($deptIDList[1], $count[0], $key[2], $type[0])) && p('user10') && e('测试10'); //键值为out查询
r($dept->getDeptUserPairsTest($deptIDList[1], $count[0], $key[1], $type[2])) && p('user10') && e('测试10'); //type为out查询
r($dept->getDeptUserPairsTest($deptIDList[0], $count[1], $key[0], $type[0])) && p() && e('999'); //查询所有内部用户统计
r($dept->getDeptUserPairsTest($deptIDList[0], $count[1], $key[0], $type[1])) && p() && e('1'); //查询所有外部用户统计
r($dept->getDeptUserPairsTest($deptIDList[1], $count[1], $key[0], $type[0])) && p() && e('30'); //根据部门查询用户统计
r($dept->getDeptUserPairsTest($deptIDList[0], $count[1], $key[0], $type[0], $params)) && p() && e('1000'); //查询全部用户统计
+9 -1
View File
@@ -1,3 +1,4 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/dept.class.php';
@@ -9,6 +10,13 @@ title=测试 deptModel->getOptionMenu();
cid=1
pid=1
父级部门查询 >> /产品部
多级部门查询 >> 开发部
全部部门查询 >> /开发部/开发部1
父级部门查询统计 >> 2
多级部门查询统计 >> 4
全部部门查询统计 >> 101
*/
$deptIDList = array('0', '1', '2');
@@ -20,4 +28,4 @@ r($dept->getOptionMenuTest($deptIDList[2], $count[0])) && p('2') && e('开发部
r($dept->getOptionMenuTest($deptIDList[0], $count[0])) && p('5') && e('/开发部/开发部1'); //全部部门查询
r($dept->getOptionMenuTest($deptIDList[1], $count[1])) && p() && e('2'); //父级部门查询统计
r($dept->getOptionMenuTest($deptIDList[2], $count[1])) && p() && e('4'); //多级部门查询统计
r($dept->getOptionMenuTest($deptIDList[0], $count[1])) && p() && e('101'); //全部部门查询统计
r($dept->getOptionMenuTest($deptIDList[0], $count[1])) && p() && e('101'); //全部部门查询统计
+13 -2
View File
@@ -1,3 +1,4 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/dept.class.php';
@@ -9,8 +10,18 @@ title=测试 deptModel->getParents();
cid=1
pid=1
父级部门查询父级 >> 2,开发部,0
子级部门查询父级 >> 2,开发部,0
父级部门查询父级统计 >> 1
子级部门查询父级统计 >> 2
*/
$dept = new deptTest();
$deptIDList = array('2', '5');
$count = array('0', '1');
r() && p() && e();
$dept = new deptTest();
r($dept->getParentsTest($deptIDList[0], $count[0])) && p('0:id,name,parent') && e('2,开发部,0'); //父级部门查询父级
r($dept->getParentsTest($deptIDList[1], $count[0])) && p('0:id,name,parent') && e('2,开发部,0'); //子级部门查询父级
r($dept->getParentsTest($deptIDList[0], $count[1])) && p() && e('1'); //父级部门查询父级统计
r($dept->getParentsTest($deptIDList[1], $count[1])) && p() && e('2'); //子级部门查询父级统计
+6 -1
View File
@@ -1,3 +1,4 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/dept.class.php';
@@ -9,6 +10,10 @@ title=测试 deptModel->getSons();
cid=1
pid=1
有子部门查询 >> 开发部1,2,,2,5,
无子部门查询 >> 0
子部门数量统计 >> 2
*/
$deptIDList = array('2', '5');
@@ -17,4 +22,4 @@ $count = array('0', '1');
$dept = new deptTest();
r($dept->getSonsTest($deptIDList[0], $count[0])) && p('0:name,parent,path') && e('开发部1,2,,2,5,'); //有子部门查询
r($dept->getSonsTest($deptIDList[1], $count[0])) && p() && e('0'); //无子部门查询
r($dept->getSonsTest($deptIDList[0], $count[1])) && p() && e('2'); //子部门数量统计
r($dept->getSonsTest($deptIDList[0], $count[1])) && p() && e('2'); //子部门数量统计
+8 -3
View File
@@ -1,3 +1,4 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/dept.class.php';
@@ -9,12 +10,16 @@ title=测试 deptModel->getTreeMenu();
cid=1
pid=1
全部部门树结构查询 >> 产品部
无子部门树结构查询 >> 下级部门
有子部门树结构查询 >> 删除
*/
$deptIDList = array('0', '1', '2');
$userFunc = array('deptmodel', 'createManageLink');
$dept = new deptTest();
r($dept->getTreeMenuTest($deptIDList[0], $userFunc)) && p() && e('<li>开发部 <a'); //全部部门树结构查询
r($dept->getTreeMenuTest($deptIDList[1], $userFunc)) && p() && e('<li>产品部 <a'); //无子部门树结构查询
r($dept->getTreeMenuTest($deptIDList[2], $userFunc)) && p() && e('<li>开发部部1 <a'); //有子部门树结构查询
r($dept->getTreeMenuTest($deptIDList[0], $userFunc)) && p() && e('产品部'); //全部部门树结构查询
r($dept->getTreeMenuTest($deptIDList[1], $userFunc)) && p() && e('下级部门'); //无子部门树结构查询
r($dept->getTreeMenuTest($deptIDList[2], $userFunc)) && p() && e('删除'); //有子部门树结构查询
+21 -2
View File
@@ -1,3 +1,4 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/dept.class.php';
@@ -9,8 +10,26 @@ title=测试 deptModel->getUsers();
cid=1
pid=1
全部用户查询 >> outside100,100,其他100
外部用户查询 >> outside1,91,用户1
根据部门查询用户 >> user10,2,测试10
根据account排序 >> user40,5,测试40
全部用户查询统计 >> 999
外部用户查询统计 >> 1
根据部门查询用户统计 >> 10
*/
$dept = new deptTest();
$deptIDList = array('0', '2', '5');
$browseType = array('inside', 'outside');
$count = array('0', '1');
$orderBy = array('id', 'account');
r() && p() && e();
$dept = new deptTest();
r($dept->getUsersTest($browseType[0], $deptIDList[0], $count[0], $orderBy[0])) && p('998:account,dept,realname') && e('outside100,100,其他100'); //全部用户查询
r($dept->getUsersTest($browseType[1], $deptIDList[0], $count[0], $orderBy[0])) && p('0:account,dept,realname') && e('outside1,91,用户1'); //外部用户查询
r($dept->getUsersTest($browseType[0], $deptIDList[1], $count[0], $orderBy[0])) && p('0:account,dept,realname') && e('user10,2,测试10'); //根据部门查询用户
r($dept->getUsersTest($browseType[0], $deptIDList[2], $count[0], $orderBy[1])) && p('0:account,dept,realname') && e('user40,5,测试40'); //根据account排序
r($dept->getUsersTest($browseType[0], $deptIDList[0], $count[1], $orderBy[0])) && p() && e('999'); //全部用户查询统计
r($dept->getUsersTest($browseType[1], $deptIDList[0], $count[1], $orderBy[0])) && p() && e('1'); //外部用户查询统计
r($dept->getUsersTest($browseType[0], $deptIDList[1], $count[1], $orderBy[0])) && p() && e('10'); //根据部门查询用户统计
+16 -1
View File
@@ -1,3 +1,4 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/dept.class.php';
@@ -9,8 +10,22 @@ title=测试 deptModel->manageChild();
cid=1
pid=1
三级部门下添加四级部门 >> 102
三级部门下添加四级部门统计 >> 3
无父级部门下添加子级部门 >> 108
无父级部门下添加子级部门统计 >> 3
无部门名称 >> 0
*/
$parentDeptID = '28';
$depts = array('四级部门一', '四级部门二', '四级部门三');
$count = array('0', '1');
$dept = new deptTest();
r($dept->manageChildTest($parentDeptID, $depts, $count[0])) && p('1') && e('102'); //三级部门下添加四级部门
r($dept->manageChildTest($parentDeptID, $depts, $count[1])) && p() && e('3'); //三级部门下添加四级部门统计
r($dept->manageChildTest('', $depts, $count[0])) && p('1') && e('108'); //无父级部门下添加子级部门
r($dept->manageChildTest('', $depts, $count[1])) && p() && e('3'); //无父级部门下添加子级部门统计
r($dept->manageChildTest($parentDeptID, $depts = array(), $count[0])) && p() && e('0'); //无部门名称
r() && p() && e();
system("./ztest init");
+13 -6
View File
@@ -1,3 +1,4 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/dept.class.php';
@@ -9,6 +10,12 @@ title=测试 deptModel->update();
cid=1
pid=1
修改父级 >> 修改后部门,0,,16,,dev1
修改子级 >> 子级部门修改,1,,1,18,,dev2
不输入上级部门 >> 『上级部门』应当是数字。
部门名称为空 >> 『部门名称』不能为空。
无负责人 >> 无负责人部门,1,,1,20,,
*/
$deptIDList = array('16', '17', '18', '19', '20');
@@ -20,10 +27,10 @@ $noName = array('parent' => '0', 'manager' => 'test2');
$noManager = array('parent' => '1', 'name' => '无负责人部门');
$dept = new deptTest();
r($dept->updateTest($deptIDList[0], $parentDept)) && p('16:name,parent,path,manager') && e('修改后部门,0,,16,,dev1');
r($dept->updateTest($deptIDList[2], $childDept)) && p('18:name,parent,path,manager') && e('子级部门修改,1,,1,18,,dev2');
r($dept->updateTest($deptIDList[1], $noParent)) && p('parent:0') && e('『上级部门』应当是数字。');
r($dept->updateTest($deptIDList[3], $noName)) && p('name:0') && e('『部门名称』不能为空。');
r($dept->updateTest($deptIDList[4], $noManager)) && p('20:name,parent,path,manager') && e('无负责人部门,1,,1,20,,');
r($dept->updateTest($deptIDList[0], $parentDept)) && p('16:name,parent,path,manager') && e('修改后部门,0,,16,,dev1'); //修改父级
r($dept->updateTest($deptIDList[2], $childDept)) && p('18:name,parent,path,manager') && e('子级部门修改,1,,1,18,,dev2'); //修改子级
r($dept->updateTest($deptIDList[1], $noParent)) && p('parent:0') && e('『上级部门』应当是数字。'); //不输入上级部门
r($dept->updateTest($deptIDList[3], $noName)) && p('name:0') && e('『部门名称』不能为空。'); //部门名称为空
r($dept->updateTest($deptIDList[4], $noManager)) && p('20:name,parent,path,manager') && e('无负责人部门,1,,1,20,,'); //无负责人
system("./ztest init");
system("./ztest init");
+6 -2
View File
@@ -1,3 +1,4 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/dept.class.php';
@@ -9,8 +10,11 @@ title=测试 deptModel->updateOrder();
cid=1
pid=1
修改部门排序 >> 17
*/
$dept = new deptTest();
$orders = array('17');
r() && p() && e();
$dept = new deptTest();
r($dept->updateOrderTest($orders)) && p('17:order') && e('17'); //修改部门排序
+3
View File
@@ -43,6 +43,9 @@ switch($argv[1])
case 'company':
ztfRun('model/company');
break;
case 'dept':
ztfRun('model/dept');
break;
case 'model':
ztfRun('model');
break;