From 03d913eb7813fb214a77e408c3ca7adea0f31f14 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Thu, 5 Jan 2023 14:38:07 +0800 Subject: [PATCH] * Modify unit test of user. --- test/class/user.class.php | 30 ++++++++++++++----- test/model/user/getavatarpairs.php | 27 ++++++++++++++--- test/model/user/getcommiters.php | 12 ++++++-- test/model/user/getlist.php | 34 ++++++++++++++++----- test/model/user/getlistbyaccounts.php | 33 +++++++++++++++----- test/model/user/getpairs.php | 38 +++++++++++++++--------- test/model/user/getrealnameandemails.php | 26 ++++++++++++---- test/model/user/setuserlist.php | 34 +++++++++++++++++++++ 8 files changed, 187 insertions(+), 47 deletions(-) create mode 100755 test/model/user/setuserlist.php diff --git a/test/class/user.class.php b/test/class/user.class.php index dcf7725a2f..7f78827947 100755 --- a/test/class/user.class.php +++ b/test/class/user.class.php @@ -14,9 +14,9 @@ class userTest * @access public * @return void */ - public function getListTest($count = false) + public function getListTest($params = 'nodeleted', $count = false) { - $objects = $this->objectModel->getList(); + $objects = $this->objectModel->getList($params); if(dao::isError()) { $error = dao::getError(); @@ -32,13 +32,14 @@ class userTest * Test get user information by accounts. * * @param array $accounts + * @param string $keyField * @param bool $count * @access public * @return void */ - public function getListByAccountsTest($accounts = array(), $count = false) + public function getListByAccountsTest($accounts = array(), $keyField = 'id', $count = false) { - $objects = $this->objectModel->getListByAccounts($accounts); + $objects = $this->objectModel->getListByAccounts($accounts, $keyField); if(dao::isError()) { $error = dao::getError(); @@ -77,12 +78,13 @@ class userTest /** * Test get avatar pairs. * + * @param string $params * @access public - * @return void + * @return array */ - public function getAvatarPairsTest() + public function getAvatarPairsTest($param = 'nodeleted') { - $objects = $this->objectModel->getAvatarPairs(); + $objects = $this->objectModel->getAvatarPairs($param); if(dao::isError()) { $error = dao::getError(); @@ -955,4 +957,18 @@ class userTest { return $this->objectModel->processAccountSort($users); } + + /** + * Set users list. + * + * @param array $users + * @param string $account + * @access public + * @return string + */ + public function setUserListTest($users, $account) + { + $string = $this->objectModel->setUserList($users, $account); + return strpos($string, "