diff --git a/test/class/user.class.php b/test/class/user.class.php index 5faf0b9749..74d15feb0c 100755 --- a/test/class/user.class.php +++ b/test/class/user.class.php @@ -530,6 +530,13 @@ class userTest return $myObjects; } + /** + * Test clean user locked time. + * + * @param string $account + * @access public + * @return string + */ public function cleanLockedTest($account) { global $tester; @@ -545,6 +552,28 @@ class userTest return $result; } + /** + * Test unbind Ranzhi. + * + * @param string $account + * @access public + * @return string + */ + public function unbindTest($account) + { + global $tester; + + $this->objectModel->unbind($account); + + if(dao::isError()) return dao::getError(); + + $ranzhi = $tester->dao->select('ranzhi')->from(TABLE_USER)->where('account')->eq($account)->fetch('ranzhi'); + + $result = empty($ranzhi) ? 'success' : 'fail'; + + return $result; + } + /** * Test get contact list. * diff --git a/test/model/user/cleanlocked.php b/test/model/user/cleanlocked.php index ac45875632..91ebb63a00 100755 --- a/test/model/user/cleanlocked.php +++ b/test/model/user/cleanlocked.php @@ -4,14 +4,12 @@ include dirname(dirname(dirname(__FILE__))) . '/lib/init.php'; include dirname(dirname(dirname(__FILE__))) . '/class/user.class.php'; su('admin'); -$now = date('Y-m-d H:i:s'); - $user = zdTable('user'); $user->id->range('1-10'); $user->account->range('admin,user1,user2,user3,user4,user5,user6,user7,user8,user9'); $user->password->range('a0933c1218a4e745bacdcf572b10eba7'); $user->realname->range('1-10')->prefix('用户'); -$user->locked->range("[0000-00-00 00:00:00]{5},$now{5}"); +$user->locked->range("20230110 143412")->type('timestamp')->format('YY/MM/DD hh:mm:ss'); $user->gen(10); /** diff --git a/test/model/user/unbind.php b/test/model/user/unbind.php new file mode 100755 index 0000000000..8128acf1b8 --- /dev/null +++ b/test/model/user/unbind.php @@ -0,0 +1,33 @@ +#!/usr/bin/env php +id->range('1-10'); +$user->account->range('admin,user1,user2,user3,user4,user5,user6,user7,user8,user9'); +$user->password->range('a0933c1218a4e745bacdcf572b10eba7'); +$user->realname->range('1-10')->prefix('用户'); +$user->ranzhi->range('admin,user1,user2,user3,user4,user5,user6,user7,user8,user9'); +$user->gen(10); + +/** + +title=测试 userModel->unbind(); +cid=1 +pid=1 + +获取user7对应的然之用户,重置为空 >> success +获取不存在的用户的对应的然之用户,返回空 >> success + +*/ + +$user = new userTest(); +$userLocked = $user->unbindTest('user7'); +$notExistUser = $user->unbindTest('test999'); + +r($userLocked) && p('') && e('success'); //获取user7对应的然之用户,重置为空 +r($notExistUser) && p('') && e('success'); //获取不存在的用户的对应的然之用户,返回空