* Add user test unit.

This commit is contained in:
sgm0422
2022-03-17 13:40:02 +08:00
parent e865920607
commit bcc2100a0a
36 changed files with 403 additions and 101 deletions

132
test/class/user.class.php Normal file → Executable file
View File

@@ -520,14 +520,8 @@ class userTest
{
$myObjects = $this->objectModel->getObjects($account, $type, $status, $orderBy);
if(dao::isError())
{
return dao::getError();
}
else
{
return $myObjects;
}
if(dao::isError()) return dao::getError();
return $myObjects;
}
/**
@@ -542,14 +536,8 @@ class userTest
{
$contacts = $this->objectModel->getContactLists($account, $params);
if(dao::isError())
{
return dao::getError();
}
else
{
return $contacts;
}
if(dao::isError()) return dao::getError();
return $contacts;
}
/**
@@ -597,7 +585,7 @@ class userTest
*/
public function getContactUserPairsTest($accountList)
{
return $this->objectModel->getContactListByID($listID);
return $this->objectModel->getContactUserPairs($accountList);
}
/**
@@ -612,14 +600,8 @@ class userTest
{
$listID = $this->objectModel->createContactList($listName, $userList);
if(dao::isError())
{
return dao::getError();
}
else
{
return $listID;
}
if(dao::isError()) return dao::getError();
return $this->objectModel->getContactListByID($listID);
}
/**
@@ -635,13 +617,97 @@ class userTest
{
$this->objectModel->updateContactList($listID, $listName, $userList);
if(dao::isError())
{
return dao::getError();
}
else
{
return $this->objectModel->getContactListByID($listID);
}
if(dao::isError()) return dao::getError();
return $this->objectModel->getContactListByID($listID);
}
/**
* Test delete a contact list.
*
* @param int $listID
* @access public
* @return void
*/
public function deleteContactListTest($listID)
{
$this->objectModel->deleteContactList($listID);
if(dao::isError()) return dao::getError();
return $this->objectModel->getContactListByID($listID);
}
/**
* Test delete a contact list.
*
* @param object $user
* @access public
* @return void
*/
public function getDataInJSONTest($user)
{
$user = $this->objectModel->getDataInJSON($user);
if(dao::isError()) return dao::getError();
return $user;
}
/**
* Test get weak users.
*
* @access public
* @return void
*/
public function getWeakUsersTest()
{
$users = $this->objectModel->getWeakUsers();
if(dao::isError()) return dao::getError();
return $users;
}
/**
* Test compute password strength.
*
* @access public
* @return void
*/
public function computePasswordStrengthTest($password)
{
$strength = $this->objectModel->computePasswordStrength($password);
if(dao::isError()) return dao::getError();
return $strength;
}
/**
* Test compute user view.
*
* @param string $account
* @param bool $force
* @access public
* @return void
*/
public function computeUserViewTest($account, $force = false)
{
$userview = $this->objectModel->computeUserView($account, $force);
if(dao::isError()) return dao::getError();
return $userview;
}
/**
* Test get product members.
*
* @param string $account
* @param bool $force
* @access public
* @return void
*/
public function getProductMembersTest($allProducts)
{
$members = $this->objectModel->getProductMembers($allProducts);
if(dao::isError()) return dao::getError();
return $members;
}
}

6
test/model/user/authorize.php Normal file → Executable file
View File

@@ -10,6 +10,10 @@ title=userModel->authorizeTest();
cid=1
pid=1
获取用户的权限,返回权限列表 >> 1
获取用户的权限,返回权限列表 >> 1
获取空用户名的权限,返回空 >> 0
*/
$user = new userTest();
@@ -18,4 +22,4 @@ $rights = $user->authorizeTest('test2');
r($rights['rights']) && p('action:comment') && e('1'); //获取用户的权限,返回权限列表
r($rights['rights']) && p('testtask:activate') && e('1'); //获取用户的权限,返回权限列表
r($user->authorizeTest('sadf!!@#a')) && p('projects') && e(''); //获取不存在的用户的权限,返回空
r($user->authorizeTest('')) && p('') && e('0'); //获取空用户名的权限,返回空
r($user->authorizeTest('')) && p('') && e('0'); //获取空用户名的权限,返回空

12
test/model/user/batchcreate.php Normal file → Executable file
View File

@@ -10,14 +10,8 @@ title=userModel->batchCreateTest();
cid=1
pid=1
密码较弱的情况 >> 您的密码强度小于系统设定。
Visions为空的情况 >> 『版本类型』不能为空。
用户名为空的情况 >> 『用户名』不能为空。
用户名特殊的情况 >> 『用户名』只能是字母、数字或下划线的组合三位以上。
两次密码不相同的情况 >> 两次密码应该相同。
插入重复的用户名,返回报错信息 >> 『用户名』已经有『admin』这条记录了。如果您确定该记录已删除请到后台-系统-数据-回收站还原。
正常插入用户返回新插入的ID、真实姓名 >> 1001,新的测试用户
正常插入用户,返回新插入的真实姓名 >> 新的测试用户
获取插入的第一个用户的account >> newtestuser1
获取插入的最后一个用户的realname >> 新测试用户3
*/
@@ -33,4 +27,4 @@ $normalUser['password'] = array(1 => 'e10adc3949ba59abbe56e057f20f883e', 2 => 'e
r($user->batchCreateUserTest($normalUser)) && p('0:account') && e('newtestuser1'); //获取插入的第一个用户的account
r($user->batchCreateUserTest($normalUser)) && p('2:realname') && e('新测试用户3'); //获取插入的最后一个用户的realname
system("./ztest init");
system("./ztest init");

12
test/model/user/batchedit.php Normal file → Executable file
View File

@@ -10,14 +10,8 @@ title=userModel->batchEditTest();
cid=1
pid=1
密码较弱的情况 >> 您的密码强度小于系统设定。
Visions为空的情况 >> 『版本类型』不能为空。
用户名为空的情况 >> 『用户名』不能为空。
用户名特殊的情况 >> 『用户名』只能是字母、数字或下划线的组合三位以上。
两次密码不相同的情况 >> 两次密码应该相同。
插入重复的用户名,返回报错信息 >> 『用户名』已经有『admin』这条记录了。如果您确定该记录已删除请到后台-系统-数据-回收站还原。
正常插入用户返回新插入的ID、真实姓名 >> 1001,新的测试用户
正常插入用户,返回新插入的真实姓名 >> 新的测试用户
获取编辑后的第一个用户的account >> newtestuser1
获取编辑的最后一个用户的真实姓名 >> 新测试用户3
*/
@@ -33,4 +27,4 @@ $normalUser['password'] = array(998 => 'e10adc3949ba59abbe56e057f20f883e', 999 =
r($user->batchEditUserTest($normalUser)) && p('998:account') && e('newtestuser1'); //获取编辑后的第一个用户的account
r($user->batchEditUserTest($normalUser)) && p('1000:realname') && e('新测试用户3'); //获取编辑的最后一个用户的真实姓名
system("./ztest init");
system("./ztest init");

12
test/model/user/checkpassword.php Normal file → Executable file
View File

@@ -10,14 +10,10 @@ title=userModel->checkPasswordTest();
cid=1
pid=1
密码较弱的情况 >> 您的密码强度小于系统设定。
Visions为空的情况 >> 『版本类型』不能为空。
用户名为空的情况 >> 『用户名』不能为空。
用户名特殊的情况 >> 『用户名』只能是字母、数字或下划线的组合三位以上。
正常的用户密码 >> 无报错
两次密码不相同的情况 >> 两次密码应该相同。
插入重复的用户名,返回报错信息 >> 『用户名』已经有『admin』这条记录了。如果您确定该记录已删除请到后台-系统-数据-回收站还原
正常插入用户返回新插入的ID、真实姓名 >> 1001,新的测试用户
正常插入用户,返回新插入的真实姓名 >> 新的测试用户
密码强度小于系统设定 >> 您的密码强度小于系统设定
使用常见简单密码,给出错误提示 >> 密码不能使用【123456,password,12345,12345678,qwerty,123456789,1234,1234567,abc123,111111,123123】这些常用弱口令。
*/
@@ -41,4 +37,4 @@ r($user->checkPasswordTest($normalUser)) && p('password') && e('无
r($user->checkPasswordTest($differentPassword)) && p('password:0') && e('两次密码应该相同。'); //两次密码不相同的情况
r($user->checkPasswordTest($weakPassword)) && p('password1:0') && e('您的密码强度小于系统设定。'); //密码强度小于系统设定
r($user->checkPasswordTest($simplePassword)) && p('password1:0') && e('密码不能使用【123456,password,12345,12345678,qwerty,123456789,1234,1234567,abc123,111111,123123】这些常用弱口令。'); //使用常见简单密码,给出错误提示
system("./ztest init");
system("./ztest init");

View File

@@ -0,0 +1,27 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/user.class.php';
su('admin');
/**
title=userModel->computePasswordStrengthTest();
cid=1
pid=1
获取空密码的强度 >> 0
获取[123456]密码的强度 >> 0
获取[qaz123]密码的强度 >> 0
获取[qaz67911334]密码的强度 >> 1
获取[ZENFBQfy3xpRarDwG3lN]密码的强度 >> 2
*/
$user = new userTest();
r($user->computePasswordStrengthTest('')) && p() && e('0'); //获取空密码的强度
r($user->computePasswordStrengthTest('123456')) && p() && e('0'); //获取[123456]密码的强度
r($user->computePasswordStrengthTest('qaz123')) && p() && e('0'); //获取[qaz123]密码的强度
r($user->computePasswordStrengthTest('qaz67911334')) && p() && e('1'); //获取[qaz67911334]密码的强度
r($user->computePasswordStrengthTest('ZENFBQfy3xpRarDwG3lN')) && p() && e('2'); //获取[ZENFBQfy3xpRarDwG3lN]密码的强度

View File

@@ -0,0 +1,31 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/user.class.php';
su('admin');
/**
title=userModel->computeUserViewTest();
cid=1
pid=1
获取admin账户可见的前两个项目ID >> ,1,3,
获取admin账户可见的前两个产品ID >> ,1,2,
获取user10账户可见的产品ID >> 99
用户名传null则获取当前登录账户的views >> admin
*/
$user = new userTest();
$adminViews = $user->computeUserViewTest('admin', true);
$adminProjects = substr($adminViews->projects, 0, 5);
$adminProducts = substr($adminViews->products, 0, 5);
r($adminProjects) && p() && e(',1,3,'); //获取admin账户可见的前两个项目ID
r($adminProducts) && p() && e(',1,2,'); //获取admin账户可见的前两个产品ID
r($user->computeUserViewTest('user10')) && p('products') && e('99'); //获取user10账户可见的产品ID
r($user->computeUserViewTest('test2')) && p('projects') && e(''); //获取test2账户可见的项目ID
r($user->computeUserViewTest(null)) && p('account') && e('admin'); //用户名传null则获取当前登录账户的views
system("./ztest init");

2
test/model/user/create.php Normal file → Executable file
View File

@@ -57,4 +57,4 @@ r($user->createUserTest($differentPassword)) && p('password:0') && e('两次密
r($user->createUserTest($existUser)) && p('account:0') && e('『用户名』已经有『admin』这条记录了。如果您确定该记录已删除请到后台-系统-数据-回收站还原。'); //插入重复的用户名,返回报错信息
r($user->createUserTest($normalUser)) && p('id,realname') && e('1001,新的测试用户'); //正常插入用户返回新插入的ID、真实姓名
r($user->createUserTest($normalUser)) && p('realname') && e('新的测试用户'); //正常插入用户,返回新插入的真实姓名
system("./ztest init");
system("./ztest init");

View File

@@ -0,0 +1,24 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/user.class.php';
su('admin');
/**
title=userModel->createContactListTest();
cid=1
pid=1
插入一条联系人列表,获取插入的联系人列表名称 >> 新的列表名称1
插入一条联系人列表,获取插入的联系人列表名称 >> 新的列表名称2
*/
$user = new userTest();
$userList = array('admin,test2,user29,assfjg');
r($user->createContactListTest('新的列表名称1', $userList)) && p('listName') && e('新的列表名称1'); //插入一条联系人列表,获取插入的联系人列表名称
r($user->createContactListTest('新的列表名称2', $userList)) && p('listName') && e('新的列表名称2'); //插入一条联系人列表,获取插入的联系人列表名称
r($user->createContactListTest('新的列表名称3', array())) && p('userList') && e(''); //插入一条联系人列表,获取插入的联系人列表
system("./ztest init");

View File

@@ -0,0 +1,26 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/user.class.php';
su('admin');
/**
title=userModel->deleteContactListTest();
cid=1
pid=1
删除ID为1的联系人列表 >> 0
删除ID为2的联系人列表 >> 0
删除ID为null的联系人列表 >> 0
删除ID为1000的联系人列表 >> 0
*/
$user = new userTest();
r($user->deleteContactListTest(1)) && p('listName') && e('0'); //删除ID为1的联系人列表
r($user->deleteContactListTest(2)) && p('listName') && e('0'); //删除ID为2的联系人列表
r($user->deleteContactListTest(null)) && p('userLsit') && e('0'); //删除ID为null的联系人列表
r($user->deleteContactListTest(1000)) && p('userList') && e('0'); //删除ID为1000的联系人列表
system("./ztest init");

0
test/model/user/getavatarpairs.php Normal file → Executable file
View File

0
test/model/user/getbyquery.php Normal file → Executable file
View File

0
test/model/user/getcommiters.php Normal file → Executable file
View File

16
test/model/user/getcontactlistbyid.php Normal file → Executable file
View File

@@ -10,12 +10,18 @@ title=测试 userModel::getContactListByIDTest();
cid=1
pid=1
获取ID为1的联系人列表名称 >> 联系人列表1
获取ID为60的联系人列表创建者 >> admin
获取ID为1000的联系人列表返回空 >> 0
获取ID为false的联系人列表返回空 >> 0
获取ID为null的联系人列表返回空 >> 0
*/
$user = new userTest();
r($user->getContactListByIDTest(1)) && p() && e('0'); //
r($user->getContactListByIDTest(2)) && p() && e('0'); //
r($user->getContactListByIDTest(1000)) && p() && e('0'); //
r($user->getContactListByIDTest(false)) && p() && e('0'); //
r($user->getContactListByIDTest(null)) && p() && e('0'); //
r($user->getContactListByIDTest(1)) && p('listName') && e('联系人列表1'); //获取ID为1的联系人列表名称
r($user->getContactListByIDTest(60)) && p('account') && e('admin'); //获取ID为60的联系人列表创建者
r($user->getContactListByIDTest(1000)) && p() && e('0'); //获取ID为1000的联系人列表返回空
r($user->getContactListByIDTest(false)) && p() && e('0'); //获取ID为false的联系人列表返回空
r($user->getContactListByIDTest(null)) && p() && e('0'); //获取ID为null的联系人列表返回空

4
test/model/user/getcontactlists.php Normal file → Executable file
View File

@@ -10,6 +10,8 @@ title=测试 userModel::getContactListsTest();
cid=1
pid=1
获取admin的联系人列表 >> 0
*/
$user = new userTest();
$adminContactList1 = $user->getContactListsTest('admin', 'withempty|withnote');
@@ -17,4 +19,4 @@ $adminContactList2 = $user->getContactListsTest('admin', '');
$test2ContactList = $user->getContactListsTest('test2');
$emptyContactList = $user->getContactListsTest('', '');
r($adminContactList) && p() && e('0'); // 获取admin的联系人列表
r($adminContactList) && p() && e('0'); // 获取admin的联系人列表

10
test/model/user/getcontactuserpairs.php Normal file → Executable file
View File

@@ -10,8 +10,14 @@ title=userModel->getContactUserPairsTest();
cid=1
pid=1
根据传入的accountList获取admin真实姓名 >> admin
根据传入的accountList获取test2真实姓名 >> 测试2
*/
$user = new userTest();
$accountList = array('admin', 'test2');
$accountList = array('admin', 'test2', 'asdffg', null);
r($user->getContactUserPairsTest($accountList)) && p('') && e(''); //
r($user->getContactUserPairsTest($accountList)) && p('admin') && e('admin'); //根据传入的accountList获取admin真实姓名
r($user->getContactUserPairsTest($accountList)) && p('test2') && e('测试2'); //根据传入的accountList获取test2真实姓名
r($user->getContactUserPairsTest($accountList)) && p('asdffg') && e(''); //根据传入的accountList获取asdffg真实姓名
r($user->getContactUserPairsTest($accountList)) && p('null') && e(''); //根据传入的accountList获取null真实姓名

View File

@@ -0,0 +1,29 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/user.class.php';
su('admin');
/**
title=userModel->getDataInJSON();
cid=1
pid=1
传入admin用户信息返回公司信息 >> 易软天创网络科技有限公司
传入admin用户信息返回用户名信息 >> admin
传入null用户信息返回公司信息 >> 易软天创网络科技有限公司
*/
$user = new userTest();
$admin = new stdclass();
$admin->id = 1;
$admin->account = 'admin';
$admin->password = '123456';
$admin->deleted = '1';
r($user->getDataInJSONTest($admin)) && p('user:company') && e('易软天创网络科技有限公司'); //传入admin用户信息返回公司信息
r($user->getDataInJSONTest($admin)) && p('user:account') && e('admin'); //传入admin用户信息返回用户名信息
r($user->getDataInJSONTest($admin)) && p('user:password') && e(''); //传入admin用户信息返回密码信息
r($user->getDataInJSONTest(null)) && p('user:company') && e('易软天创网络科技有限公司'); //传入null用户信息返回公司信息

6
test/model/user/getgroups.php Normal file → Executable file
View File

@@ -10,9 +10,13 @@ title=测试 userModel::getGroupsTest();
cid=1
pid=1
获取admin所在的分组,为空 >> 0
通过test2所在的分组数量1个 >> 1
传空用户名,返回空 >> 0
*/
$user = new userTest();
r($user->getGroupsTest('admin')) && p() && e('0'); // 获取admin所在的分组,为空
r(count($user->getGroupsTest('test2'))) && p() && e('1'); // 通过test2所在的分组数量1个
r($user->getGroupsTest('')) && p() && e('0'); // 传空用户名,返回空
r($user->getGroupsTest('')) && p() && e('0'); // 传空用户名,返回空

7
test/model/user/getgroupsbyvisions.php Normal file → Executable file
View File

@@ -10,10 +10,15 @@ title=测试 userModel::getGroupsByVisionsTest();
cid=1
pid=1
获取系统中所有研发界面分组的数量 >> 14
获取系统中所有迅捷界面分组的数量 >> 3
传空Visions返回空数组 >> 0
获取系统中所有用户分组的数量 >> 17
*/
$user = new userTest();
r(count($user->getGroupsByVisionsTest(array('rnd')))) && p() && e('14'); // 获取系统中所有研发界面分组的数量
r(count($user->getGroupsByVisionsTest(array('lite')))) && p() && e('3'); // 获取系统中所有迅捷界面分组的数量
r($user->getGroupsByVisionsTest(array())) && p() && e('0'); // 传空Visions返回空数组
r(count($user->getGroupsByVisionsTest(array('rnd','lite')))) && p() && e('17'); // 获取系统中所有用户分组的数量
r(count($user->getGroupsByVisionsTest(array('rnd','lite')))) && p() && e('17'); // 获取系统中所有用户分组的数量

0
test/model/user/getlist.php Normal file → Executable file
View File

6
test/model/user/getlistbyaccount.php Normal file → Executable file
View File

@@ -10,6 +10,10 @@ title=测试 userModel::getListByAccount();
cid=1
pid=1
获取admin的联系人列表 >> 0
获取admin的联系人列表 >> 0
获取admin的联系人列表 >> 0
*/
$user = new userTest();
$adminContactList = $user->getListByAccountTest('admin');
@@ -18,4 +22,4 @@ $emptyContactList = $user->getListByAccountTest('');
r($adminContactList) && p() && e('0'); // 获取admin的联系人列表
r($test2ContactList) && p() && e('0'); // 获取admin的联系人列表
r($emptyContactList) && p() && e('0'); // 获取admin的联系人列表
r($emptyContactList) && p() && e('0'); // 获取admin的联系人列表

0
test/model/user/getlistbyaccounts.php Normal file → Executable file
View File

9
test/model/user/getobjects.php Normal file → Executable file
View File

@@ -10,6 +10,13 @@ title=测试 userModel::getObjectsTest();
cid=1
pid=1
获取admin的所属项目列表,取ID为11的项目名字 >> 项目1
获取admin的所属项目列表,取ID为11的项目类型 >> project
获取admin的所属执行列表,取ID为120的项目名字 >> 迭代20
获取admin的已完成的所属项目列表,返回空 >> 0
获取test2用户的所属项目列表返回空 >> 0
传入一个空用户名字段,返回空 >> 0
*/
$user = new userTest();
$adminProjects = $user->getObjectsTest('admin', 'project', 'all', 'id_desc');
@@ -23,4 +30,4 @@ r($adminProjects) && p('11:type') && e('project'); //获取admin的所属
r($adminExecutions) && p('120:name') && e('迭代20'); //获取admin的所属执行列表,取ID为120的项目名字
r($adminDoneProjects) && p('') && e('0'); //获取admin的已完成的所属项目列表,返回空
r($test2Projects) && p('') && e('0'); //获取test2用户的所属项目列表返回空
r($emptyUser) && p('') && e('0'); //传入一个空用户名字段,返回空
r($emptyUser) && p('') && e('0'); //传入一个空用户名字段,返回空

0
test/model/user/getpairs.php Normal file → Executable file
View File

9
test/model/user/getparentstageauthedusers.php Normal file → Executable file
View File

@@ -10,10 +10,15 @@ title=测试 userModel::getParentStageAuthedUsersTest();
cid=1
pid=1
传入ID为0的情况获取有权限的用户 >> 0
传入一个阶段ID获取有权限的用户 >> admin
传入一个项目集ID获取有权限的用户 >> 0
传入一个看板类型的项目ID获取有权限的用户 >> admin
*/
$user = new userTest();
r($user->getParentStageAuthedUsersTest(0)) && p() && e('0'); //传入ID为0的情况获取有权限的用户
r($user->getParentStageAuthedUsersTest(131)) && p('wwccss') && e('wwccss'); //传入一个阶段ID获取有权限的用户
r($user->getParentStageAuthedUsersTest(131)) && p('admin') && e('admin'); //传入一个阶段ID获取有权限的用户
r($user->getParentStageAuthedUsersTest(1)) && p() && e('0'); //传入一个项目集ID获取有权限的用户
r($user->getParentStageAuthedUsersTest(161)) && p('wwccss') && e('wwccss'); //传入一个看板类型的项目ID获取有权限的用户
r($user->getParentStageAuthedUsersTest(161)) && p('admin') && e('admin'); //传入一个看板类型的项目ID获取有权限的用户

View File

@@ -0,0 +1,32 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/user.class.php';
su('admin');
/**
title=userModel->getProductMembersTest();
cid=1
pid=1
获取ID为1的产品的团队成员判断是否包含pm92 >> pm92
获取ID为4的产品的团队成员判断是否包含user5 >> user5
获取ID为2的产品的干系人判断是否包含po3 >> po3
获取ID为3的产品的干系人判断是否包含user14 >> user14
*/
$user = new userTest();
$products = array(1 => 1, 2 => 2, 3 => 3, 4 => 4);
$members = $user->getProductMembersTest($products);
$teamGroups = $members[0];
$stakeholderGroups = $members[0];
r($teamGroups) && p('1:pm92') && e('pm92'); //获取ID为1的产品的团队成员判断是否包含pm92
r($teamGroups) && p('4:user5') && e('user5'); //获取ID为4的产品的团队成员判断是否包含user5
r($stakeholderGroups) && p('2:po3') && e('po3'); //获取ID为2的产品的干系人判断是否包含po3
r($stakeholderGroups) && p('3:user14') && e('user14'); //获取ID为3的产品的干系人判断是否包含user14
system("./ztest init");

0
test/model/user/getrealnameandemails.php Normal file → Executable file
View File

0
test/model/user/getuserdisplayinfos.php Normal file → Executable file
View File

0
test/model/user/getuserroles.php Normal file → Executable file
View File

View File

@@ -0,0 +1,19 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/user.class.php';
su('admin');
/**
title=userModel->getWeakUsersTest();
cid=1
pid=1
获取密码较弱的用户 >> 0
*/
$user = new userTest();
a($user->getWeakUsersTest());die;
r($user->getWeakUsersTest()) && p('') && e('0'); //获取密码较弱的用户

6
test/model/user/identify.php Normal file → Executable file
View File

@@ -10,10 +10,14 @@ title=userModel->identifyTest();
cid=1
pid=1
用户名密码皆正确,返回验证登录的用户 >> admin
验证一个不存在的用户,返回空 >> 0
验证一个不传用户名和密码的用户,返回空 >> 0
*/
$user = new userTest();
r($user->identifyTest('admin', '78302615c8b79cac8df6d2607f8a83ee')) && p('realname') && e('admin'); //用户名密码皆正确,返回验证登录的用户
r($user->identifyTest('asdjaf12', '78302615c8b79cac8df6d2607f8a83ee')) && p() && e('0'); //验证一个不存在的用户,返回空
r($user->identifyTest('', '')) && p() && e('0'); //验证一个不传用户名和密码的用户,返回空
r($user->identifyTest('', '')) && p() && e('0'); //验证一个不传用户名和密码的用户,返回空

6
test/model/user/login.php Normal file → Executable file
View File

@@ -10,6 +10,10 @@ title=userModel->loginTest();
cid=1
pid=1
使用admin登录返回此用户为超级管理员 >> 1
使用Admin登录返回权限列表的数量 >> 3
使用空账号登录返回权限列表数量为0 >> 0
*/
$userClass = new userTest();
@@ -26,4 +30,4 @@ $emptyAccount = $userClass->loginTest($emptyAccount);
r($admin) && p('admin') && e('1'); //使用admin登录返回此用户为超级管理员
r(count($admin->rights)) && p() && e('3'); //使用Admin登录返回权限列表的数量
r(count($emptyAccount->group)) && p() && e('0'); //使用空账号登录返回权限列表数量为0
r(count($emptyAccount->group)) && p() && e('0'); //使用空账号登录返回权限列表数量为0

12
test/model/user/resetpassword.php Normal file → Executable file
View File

@@ -10,14 +10,10 @@ title=userModel->resetPasswordTest();
cid=1
pid=1
密码较弱的情况 >> 您的密码强度小于系统设定。
Visions为空的情况 >> 『版本类型』不能为空。
用户名为空的情况 >> 『用户名』不能为空。
用户名特殊的情况 >> 『用户名』只能是字母、数字或下划线的组合三位以上。
重设用户密码,返回重设后的加密后的密码 >> 367ef140036b0feb2f90d70d33255eea
两次密码不相同的情况 >> 两次密码应该相同。
插入重复的用户名,返回报错信息 >> 『用户名』已经有『admin』这条记录了。如果您确定该记录已删除请到后台-系统-数据-回收站还原
正常插入用户返回新插入的ID、真实姓名 >> 1001,新的测试用户
正常插入用户,返回新插入的真实姓名 >> 新的测试用户
密码强度小于系统设定 >> 您的密码强度小于系统设定
使用常见简单密码,给出错误提示 >> 密码不能使用【123456,password,12345,12345678,qwerty,123456789,1234,1234567,abc123,111111,123123】这些常用弱口令。
*/
@@ -42,4 +38,4 @@ r($user->resetPasswordTest($normalUser)) && p('password') && e('367ef
r($user->resetPasswordTest($differentPassword)) && p('password:0') && e('两次密码应该相同。'); //两次密码不相同的情况
r($user->resetPasswordTest($weakPassword)) && p('password1:0') && e('您的密码强度小于系统设定。'); //密码强度小于系统设定
r($user->resetPasswordTest($simplePassword)) && p('password1:0') && e('密码不能使用【123456,password,12345,12345678,qwerty,123456789,1234,1234567,abc123,111111,123123】这些常用弱口令。'); //使用常见简单密码,给出错误提示
system("./ztest init");
system("./ztest init");

12
test/model/user/update.php Normal file → Executable file
View File

@@ -10,14 +10,10 @@ title=userModel->updateUserTest();
cid=1
pid=1
密码较弱的情况 >> 您的密码强度小于系统设定。
Visions为空的情况 >> 『版本类型』不能为空
用户名为空的情况 >> 『用户名』不能为空。
用户名特殊的情况 >> 『用户名』只能是字母、数字或下划线的组合三位以上。
编辑用户,返回新的用户名 >> newtestuser4
编辑用户,有重名用户的情况 >> 『用户名』已经有『newtestuser4』这条记录了。如果您确定该记录已删除请到后台-系统-数据-回收站还原
两次密码不相同的情况 >> 两次密码应该相同。
插入重复的用户名,返回报错信息 >> 『用户名』已经有『admin』这条记录了。如果您确定该记录已删除请到后台-系统-数据-回收站还原
正常插入用户返回新插入的ID、真实姓名 >> 1001,新的测试用户
正常插入用户,返回新插入的真实姓名 >> 新的测试用户
用户名包含特殊字符的情况 >> 『用户名』只能是字母、数字或下划线的组合三位以上
*/
@@ -44,4 +40,4 @@ r($user->updateUserTest(1000, $normalUser)) && p('account') && e('new
r($user->updateUserTest(1000, $existUser)) && p('account:0') && e('『用户名』已经有『newtestuser4』这条记录了。如果您确定该记录已删除请到后台-系统-数据-回收站还原。');//编辑用户,有重名用户的情况
r($user->updateUserTest(1000, $differentPassword)) && p('password:0') && e('两次密码应该相同。'); //两次密码不相同的情况
r($user->updateUserTest(1000, $specialUser)) && p('account:0') && e('『用户名』只能是字母、数字或下划线的组合三位以上。'); //用户名包含特殊字符的情况
system("./ztest init");
system("./ztest init");

View File

@@ -0,0 +1,26 @@
#!/usr/bin/env php
<?php
include dirname(dirname(dirname(__FILE__))) . '/lib/init.php';
include dirname(dirname(dirname(__FILE__))) . '/class/user.class.php';
su('admin');
/**
title=userModel->updateContactList();
cid=1
pid=1
更新ID为1的联系人列表获取更新的联系人列表名称 >> 新的列表名称1
更新ID为2的联系人列表获取更新的联系人列表名称 >> 新的列表名称2
更新ID为1000的联系人列表获取更新的联系人列表 >> 0
*/
$user = new userTest();
$userList = array('admin,test2,user29,assfjg');
r($user->updateContactListTest(1, '新的列表名称1', $userList)) && p('listName') && e('新的列表名称1'); //更新ID为1的联系人列表获取更新的联系人列表名称
r($user->updateContactListTest(2, '新的列表名称2', $userList)) && p('listName') && e('新的列表名称2'); //更新ID为2的联系人列表获取更新的联系人列表名称
r($user->updateContactListTest(3, '新的列表名称3', '')) && p('userLsit') && e(''); //更新ID为3的联系人列表获取更新的联系人列表
r($user->updateContactListTest(1000, '新的列表名称4', $userList)) && p('userList') && e('0'); //更新ID为1000的联系人列表获取更新的联系人列表
system("./ztest init");

11
test/model/user/updatepassword.php Normal file → Executable file
View File

@@ -10,14 +10,9 @@ title=userModel->updatePasswordTest();
cid=1
pid=1
密码较弱的情况 >> 您的密码强度小于系统设定。
Visions为空的情况 >> 『版本类型』不能为空。
用户名为空的情况 >> 『用户名』不能为空。
用户名特殊的情况 >> 『用户名』只能是字母、数字或下划线的组合三位以上。
编辑用户密码,返回编辑后的密码 >> dcf859ce8dd8f998bdfe4ae6c22c329e
两次密码不相同的情况 >> 两次密码应该相同。
插入重复的用户名,返回报错信息 >> 『用户名』已经有『admin』这条记录了。如果您确定该记录已删除请到后台-系统-数据-回收站还原
正常插入用户返回新插入的ID、真实姓名 >> 1001,新的测试用户
正常插入用户,返回新插入的真实姓名 >> 新的测试用户
密码小于设定强度的情况 >> 您的密码强度小于系统设定
*/
@@ -38,4 +33,4 @@ r($user->updatePasswordTest(1000, $normalUser)) && p('password') && e
r($user->updatePasswordTest(1000, $differentPassword)) && p('password:0') && e('两次密码应该相同。'); //两次密码不相同的情况
r($user->updatePasswordTest(1000, $weakPassword)) && p('password1:0') && e('您的密码强度小于系统设定。'); //密码小于设定强度的情况
system("./ztest init");
system("./ztest init");