* Modify user test.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/user.class.php';
|
||||
zdTable('user')->gen(10);
|
||||
su('admin');
|
||||
|
||||
$user = zdTable('user');
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/user.class.php';
|
||||
zdTable('user')->gen(10);
|
||||
su('admin');
|
||||
|
||||
$now = date('Y-m-d H:i:s');
|
||||
|
||||
@@ -41,5 +41,5 @@ $specialUser['account'] = '!@#Asdsd中文';
|
||||
|
||||
r($user->updateUserTest(3, $normalUser)) && p('account') && e('newtestuser4'); //编辑用户,返回新的用户名
|
||||
r($user->updateUserTest(3, $existUser)) && p('account:0') && e('『用户名』已经有『admin』这条记录了。如果您确定该记录已删除,请到后台-系统-数据-回收站还原。');//编辑用户,有重名用户的情况
|
||||
r($user->updateUserTest(3, $differentPassword)) && p('password1:0') && e('两次密码应该相同。<br/>'); //两次密码不相同的情况
|
||||
r($user->updateUserTest(3, $differentPassword)) && p('password1:0') && e('两次密码应该相同。'); //两次密码不相同的情况
|
||||
r($user->updateUserTest(3, $specialUser)) && p('account:0') && e('『用户名』只能是字母、数字或下划线的组合三位以上。'); //用户名包含特殊字符的情况
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/user.class.php';
|
||||
zdTable('user')->gen(10);
|
||||
su('admin');
|
||||
|
||||
$usercontact = zdTable('usercontact');
|
||||
@@ -22,5 +23,5 @@ $userTester = new userTest();
|
||||
$userList = array('admin,test2,user29,assfjg');
|
||||
|
||||
r($userTester->updateContactListTest(1, '新的列表名称1', $userList)) && p('listName') && e('新的列表名称1'); //更新ID为1的联系人列表,获取更新的联系人列表名称
|
||||
r($userTester->updateContactListTest(2, '新的列表名称2', $userList)) && p('userList') && e('新的列表名称2'); //更新ID为2的联系人列表,获取更新的联系人列表名称
|
||||
r($userTester->updateContactListTest(2, '新的列表名称2', $userList)) && p('userList', '-') && e('admin,test2,user29,assfjg'); //更新ID为2的联系人列表,获取更新的联系人列表名称
|
||||
r($userTester->updateContactListTest(1, '', array())) && p('message[listName]:0') && e('『列表名称』不能为空。'); //列表名称为空时 // 列表名称为空时
|
||||
|
||||
@@ -32,5 +32,5 @@ $differentPassword = $normalUser;
|
||||
$differentPassword['password2'] = 'asdasfasf!@#!@#asfasf';
|
||||
|
||||
r($user->updatePasswordTest(10, $normalUser)) && p('password') && e('dcf859ce8dd8f998bdfe4ae6c22c329e'); //编辑用户密码,返回编辑后的密码
|
||||
r($user->updatePasswordTest(10, $differentPassword)) && p('password1:0') && e('两次密码应该相同。<br/>'); //两次密码不相同的情况
|
||||
r($user->updatePasswordTest(10, $weakPassword)) && p('password1:0') && e('密码必须6位及以上,且包含大小写字母、数字。<br/>'); //密码小于设定强度的情况
|
||||
r($user->updatePasswordTest(10, $differentPassword)) && p('password1:0') && e('两次密码应该相同。'); //两次密码不相同的情况
|
||||
r($user->updatePasswordTest(10, $weakPassword)) && p('password1:0') && e('密码必须6位及以上,且包含大小写字母、数字。'); //密码小于设定强度的情况
|
||||
|
||||
@@ -667,7 +667,10 @@ class userTest
|
||||
*/
|
||||
public function updateContactListTest($listID = 0, $listName = '', $userList = array())
|
||||
{
|
||||
$this->objectModel->updateContactList($listID, $listName, $userList);
|
||||
$_POST = array();
|
||||
$_POST['listName'] = $listName;
|
||||
$_POST['userList'] = $userList;
|
||||
$this->objectModel->updateContactList($listID);
|
||||
|
||||
if(dao::isError()) return array('message' => dao::getError());
|
||||
return $this->objectModel->getContactListByID($listID);
|
||||
@@ -1039,8 +1042,8 @@ class userTest
|
||||
*/
|
||||
public function setUserListTest($users, $account)
|
||||
{
|
||||
$string = $this->objectModel->setUserList($users, $account);
|
||||
return strpos($string, "<option value='$account' selected='selected'") !== false ? 1 : 0;
|
||||
$accounts = $this->objectModel->setUserList($users, $account);
|
||||
return isset($accounts[$account]) ? 1 : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user