diff --git a/test/class/user.class.php b/test/class/user.class.php index a86f5a6d78..5faf0b9749 100755 --- a/test/class/user.class.php +++ b/test/class/user.class.php @@ -530,6 +530,21 @@ class userTest return $myObjects; } + public function cleanLockedTest($account) + { + global $tester; + + $this->objectModel->cleanLocked($account); + + if(dao::isError()) return dao::getError(); + + $locked = $tester->dao->select('locked')->from(TABLE_USER)->where('account')->eq($account)->fetch('locked'); + + $result = $locked === '0000-00-00 00:00:00' ? 'success' : 'fail'; + + return $result; + } + /** * Test get contact list. * diff --git a/test/model/user/cleanlocked.php b/test/model/user/cleanlocked.php new file mode 100755 index 0000000000..ac45875632 --- /dev/null +++ b/test/model/user/cleanlocked.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->locked->range("[0000-00-00 00:00:00]{5},$now{5}"); +$user->gen(10); + +/** + +title=测试 userModel->cleanLocked(); +cid=1 +pid=1 + +获取user8的锁定时间,重置为空 >> success +获取不存在的用户的锁定时间,返回空 >> fail + +*/ + +$user = new userTest(); +$userLocked = $user->cleanLockedTest('user8'); +$notExistUser = $user->cleanLockedTest('test999'); + +r($userLocked) && p('') && e('success'); //获取user8的锁定时间,重置为空 +r($notExistUser) && p('') && e('fail'); //获取不存在的用户的锁定时间,返回空