From 6154f78ec7e935a4b5ab92637c47db1e4adc420c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=B9=BF=E6=98=8E?= Date: Fri, 11 Mar 2022 14:17:32 +0800 Subject: [PATCH 01/15] * Add user auto test. --- test/class/user.class.php | 66 +++++++++++++++++++++++++++ test/model/user/getbyid.php | 21 ++++----- test/model/user/getlist.php | 24 ++++++++++ test/model/user/getlistbyaccounts.php | 24 ++++++++++ test/model/user/getpairs.php | 47 +++++++++++++++++++ test/ztest | 3 ++ 6 files changed, 173 insertions(+), 12 deletions(-) create mode 100644 test/class/user.class.php create mode 100644 test/model/user/getlist.php create mode 100644 test/model/user/getlistbyaccounts.php create mode 100644 test/model/user/getpairs.php diff --git a/test/class/user.class.php b/test/class/user.class.php new file mode 100644 index 0000000000..42d7d8a553 --- /dev/null +++ b/test/class/user.class.php @@ -0,0 +1,66 @@ +objectModel = $tester->loadModel('user'); + } + + /** + * Test get user list. + * + * @param bool $count + * @access public + * @return void + */ + public function getListTest($count = false) + { + $objects = $this->objectModel->getList(); + if(dao::isError()) + { + $error = dao::getError(); + return $error[0]; + } + else + { + return $count ? count($objects) : $objects; + } + } + + /** + * Test get user information by accounts. + * + * @param array $accounts + * @param bool $count + * @access public + * @return void + */ + public function getListByAccountsTest($accounts = array(), $count = false) + { + $objects = $this->objectModel->getListByAccounts($accounts); + if(dao::isError()) + { + $error = dao::getError(); + return $error[0]; + } + else + { + return $count ? count($objects) : $objects; + } + } + + public function getPairsTest($params = '', $usersToAppended = '', $maxCount = 0, $accounts = array()) + { + $objects = $this->objectModel->getPairs($params, $usersToAppended, $maxCount, $accounts); + if(dao::isError()) + { + $error = dao::getError(); + return $error[0]; + } + else + { + return $objects; + } + } +} diff --git a/test/model/user/getbyid.php b/test/model/user/getbyid.php index 17f22ba69b..864f536a35 100755 --- a/test/model/user/getbyid.php +++ b/test/model/user/getbyid.php @@ -10,19 +10,16 @@ title=测试 userModel::getById(); cid=1 pid=1 -通过id获取存在的用户 >> account1 -使用account字段获取存在的用户 >> account1 -通过默认字段获取存在的用户 >> account1 +通过id获取存在的用户 >> admin +使用account字段获取存在的用户 >> admin +通过默认字段获取存在的用户 >> admin */ $user = $tester->loadModel('user'); -r($user->getById(1, 'id')) && p('account') && e('admin'); // 通过id获取存在的用户 -r($user->getByID('admin', 'account')) && p('account') && e('admin'); // 使用account字段获取存在的用户 -r($user->getByID('admin')) && p('account') && e('admin'); // 通过默认字段获取存在的用户 - -/* -r($user->getByID(1)) && p('account') && e(''); // 通过默认字段获取不存在的用户 -r($user->getByID(100000, 'id')) && p('account') && e(''); // 通过id字段获取不存在的用户 -r($user->getByID('error', 'account')) && p('account') && e(''); // 通过默认字段获取不存在的用户 - */ +r($user->getById(1, 'id')) && p('account') && e('admin'); // 通过id获取存在的用户 +r($user->getByID('admin', 'account')) && p('account') && e('admin'); // 使用account字段获取存在的用户 +r($user->getByID('admin')) && p('account') && e('admin'); // 通过默认字段获取存在的用户 +r($user->getByID(1)) && p('account') && e(''); // 通过默认字段获取不存在的用户 +r($user->getByID(100000, 'id')) && p('account') && e(''); // 通过id字段获取不存在的用户 +r($user->getByID('error', 'account')) && p('account') && e(''); // 通过默认字段获取不存在的用户 \ No newline at end of file diff --git a/test/model/user/getlist.php b/test/model/user/getlist.php new file mode 100644 index 0000000000..1580882cdd --- /dev/null +++ b/test/model/user/getlist.php @@ -0,0 +1,24 @@ +#!/usr/bin/env php +getList(); +cid=1 +pid=1 + +查找系统中第二个未删除的、内部用户真实姓名,根据account正序排 >> 开发1 +查找系统中第三个未删除的、内部用户电话号,根据account正序排 >> 18556488236 +查找系统中所有未删除的、内部用户的数量 >> 999 +查找系统中不存在的用户,输出错误提示 >> Error: Cannot get index 1000 + +*/ + +$user = new userTest(); +r($user->getListTest()) && p('1:realname') && e('开发1'); //查找系统中第二个未删除的、内部用户真实姓名,根据account正序排 +r($user->getListTest()) && p('2:phone') && e('18556488236'); //查找系统中第三个未删除的、内部用户电话号,根据account正序排 +r($user->getListTest(true)) && p() && e('999'); //查找系统中所有未删除的、内部用户的数量 +r($user->getListTest()) && p('1000:realname') && e('Error: Cannot get index 1000'); //查找系统中不存在的用户,输出错误提示 \ No newline at end of file diff --git a/test/model/user/getlistbyaccounts.php b/test/model/user/getlistbyaccounts.php new file mode 100644 index 0000000000..48c8f37d3f --- /dev/null +++ b/test/model/user/getlistbyaccounts.php @@ -0,0 +1,24 @@ +#!/usr/bin/env php +getListByAccountsTest(); +cid=1 +pid=1 + +按照给定的用户名列表查询用户信息,获取用户ID为1的用户真实姓名和角色 >> admin,qa +按照给定的用户名列表查询用户信息,获取查询出的用户列表数量 >> 3 +按照给定的用户名列表查询用户信息,获取用户ID为0的用户信息 >> Error: Cannot get index 0. + +*/ +$accounts = array('admin', 'program1whitelist', 'user10', 'ccsdqq@!'); +$count = array(0 => false, 1 => true); + +$user = new userTest(); +r($user->getListByAccountsTest($accounts, $count[0])) && p('1:realname,role') && e('admin,qa'); //按照给定的用户名列表查询用户信息,获取用户ID为1的用户真实姓名和角色 +r($user->getListByAccountsTest($accounts, $count[1])) && p() && e('3'); //按照给定的用户名列表查询用户信息,获取查询出的用户列表数量 +r($user->getListByAccountsTest($accounts, $count[0])) && p('0:realname') && e('Error: Cannot get index 0.'); //按照给定的用户名列表查询用户信息,获取用户ID为0的用户信息 diff --git a/test/model/user/getpairs.php b/test/model/user/getpairs.php new file mode 100644 index 0000000000..2d6e4fd5f4 --- /dev/null +++ b/test/model/user/getpairs.php @@ -0,0 +1,47 @@ +#!/usr/bin/env php +getPairs(); +cid=1 +pid=1 + +查找带有Closed用户的外部用户键值对 >> Closed +查找带有首字母的外部用户键值对 >> O:用户1 +查找不带首字母的外部用户键值对 >> 用户1 +按照给定的用户名查找用户键值对,返回值中不带有Closed用户 >> 1 +按照给定的用户名查找用户键值对,返回值中带有Closed用户 >> 2 +使用limit参数来限制最多获取2个用户键值对 >> 2 +使用limit参数来限制最多获取50个用户键值对 >> 50 +使用pofirst参数来将系统中的产品经理用户放到返回值前列 >> P:测试主管58 +使用pmfirst参数来将系统中的项目经理用户放到返回值前列 >> O:其他100 + +*/ + +$user = new userTest(); +$accounts = array('tesrasd1asd#@!#$', 'ASD123中文', 'user10', 'ccsdqq@!'); +$outsideUsersWithClosed = $user->getPairsTest('outside'); +$outsideUsersWithLetter = $user->getPairsTest('outside|noclosed'); +$outsideUsersNoLetter = $user->getPairsTest('outside|noclosed|noletter'); +$usersInAccountsNoclosed = $user->getPairsTest('noempty|noclosed', '', 0, $accounts); +$usersInAccountsWithclosed = $user->getPairsTest('noempty', '', 0, $accounts); +$limit2Users = $user->getPairsTest('noempty|noclosed', '', 2); +$limit50Users = $user->getPairsTest('noempty|noclosed', '', 50); +$POFirstUsers = $user->getPairsTest('noempty|noclosed|pofirst'); +$PMFirstUsers = $user->getPairsTest('noempty|noclosed|pmfirst'); +$firstPO = array_slice($POFirstUsers, 0, 1); +$firstPM = array_slice($PMFirstUsers, 0, 1); + +r($outsideUsersWithClosed) && p('closed') && e('Closed'); //查找带有Closed用户的外部用户键值对 +r($outsideUsersWithLetter) && p('outside1') && e('O:用户1'); //查找带有首字母的外部用户键值对 +r($outsideUsersNoLetter) && p('outside1') && e('用户1'); //查找不带首字母的外部用户键值对 +r(count($usersInAccountsNoclosed)) && p() && e('1'); //按照给定的用户名查找用户键值对,返回值中不带有Closed用户 +r(count($usersInAccountsWithclosed)) && p() && e('2'); //按照给定的用户名查找用户键值对,返回值中带有Closed用户 +r(count($limit2Users)) && p() && e('2'); //使用limit参数来限制最多获取2个用户键值对 +r(count($limit50Users)) && p() && e('50'); //使用limit参数来限制最多获取50个用户键值对 +r($firstPO) && p('pd58') && e('P:测试主管58'); //使用pofirst参数来将系统中的产品经理用户放到返回值前列 +r($firstPM) && p('outside100') && e('O:其他100'); //使用pmfirst参数来将系统中的项目经理用户放到返回值前列 \ No newline at end of file diff --git a/test/ztest b/test/ztest index 09ae67a348..37efdb4b6a 100755 --- a/test/ztest +++ b/test/ztest @@ -28,6 +28,9 @@ switch($argv[1]) case 'execution': ztfRun('model/execution'); break; + case 'user': + ztfRun('model/user'); + break; case 'model': ztfRun('model'); break; From 88c870f3e171976efa47fca098d0f6e22ffaf146 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=B9=BF=E6=98=8E?= Date: Mon, 14 Mar 2022 11:02:00 +0800 Subject: [PATCH 02/15] * Add auto test. --- test/class/user.class.php | 116 +++++++++++++++++++++++ test/data/user.yaml | 14 ++- test/model/user/getavatarpairs.php | 27 ++++++ test/model/user/getcommiters.php | 29 ++++++ test/model/user/getpairs.php | 2 +- test/model/user/getrealnameandemails.php | 30 ++++++ test/model/user/getuserdisplayinfos.php | 31 ++++++ test/model/user/getuserroles.php | 31 ++++++ 8 files changed, 276 insertions(+), 4 deletions(-) create mode 100644 test/model/user/getavatarpairs.php create mode 100644 test/model/user/getcommiters.php create mode 100644 test/model/user/getrealnameandemails.php create mode 100644 test/model/user/getuserdisplayinfos.php create mode 100644 test/model/user/getuserroles.php diff --git a/test/class/user.class.php b/test/class/user.class.php index 42d7d8a553..87fdce99ce 100644 --- a/test/class/user.class.php +++ b/test/class/user.class.php @@ -50,6 +50,16 @@ class userTest } } + /** + * Test user get pairs. + * + * @param string $params + * @param string $usersToAppended + * @param int $maxCount + * @param array $accounts + * @access public + * @return void + */ public function getPairsTest($params = '', $usersToAppended = '', $maxCount = 0, $accounts = array()) { $objects = $this->objectModel->getPairs($params, $usersToAppended, $maxCount, $accounts); @@ -63,4 +73,110 @@ class userTest return $objects; } } + + /** + * Test get avatar pairs. + * + * @access public + * @return void + */ + public function getAvatarPairsTest() + { + $objects = $this->objectModel->getAvatarPairs(); + if(dao::isError()) + { + $error = dao::getError(); + return $error[0]; + } + else + { + return $objects; + } + } + + /** + * Test get user commiters. + * + * @access public + * @return void + */ + public function getCommitersTest() + { + $objects = $this->objectModel->getCommiters(); + if(dao::isError()) + { + $error = dao::getError(); + return $error[0]; + } + else + { + return $objects; + } + } + + /** + * Test get user realname and emails. + * + * @param array $accounts + * @access public + * @return void + */ + public function getRealNameAndEmailsTest($accounts) + { + $objects = $this->objectModel->getRealNameAndEmails($accounts); + if(dao::isError()) + { + $error = dao::getError(); + return $error[0]; + } + else + { + return $objects; + } + } + + /** + * Test get user roles. + * + * @param array $accounts + * @param bool $needRole + * @access public + * @return void + */ + public function getUserRolesTest($accounts, $needRole = false) + { + $objects = $this->objectModel->getUserRoles($accounts, $needRole); + if(dao::isError()) + { + $error = dao::getError(); + return $error[0]; + } + else + { + return $objects; + } + } + + /** + * Test get user display infos. + * + * @param int $accounts + * @param int $deptID + * @param string $type + * @access public + * @return void + */ + public function getUserDisplayInfosTest($accounts, $deptID = 0, $type = 'inside') + { + $objects = $this->objectModel->getUserDisplayInfos($accounts, $deptID, $type); + if(dao::isError()) + { + $error = dao::getError(); + return $error[0]; + } + else + { + return $objects; + } + } } diff --git a/test/data/user.yaml b/test/data/user.yaml index ea3b28fe51..0c5d4ae06a 100644 --- a/test/data/user.yaml +++ b/test/data/user.yaml @@ -50,12 +50,20 @@ fields: note: "昵称" - field: commiter note: "源代码帐号" + fields: + - field: commiter1 + range: admin,user{99},test{100},dev{100},pm{100},po{100},td{100},pd{100},qd{100},top{100},outside{100},others{100},a,bb,ccc,qwuiadsd?!2as@#%$aasd~aj1!@#1 + - field: commiter2 + range: [],1-99,1-100,1-100,1-100,1-100,1-100,1-100,1-100,1-100,1-100,1-100,[]{4} - field: avatar note: "" - range: 0 + fields: + - field: avatar1 + range: /home/z/tmp/,/home/z/user/ + - field: avatar2 + range: 1-10,10-20 prefix: "" - postfix: "" - loop: 0 + postfix: ".png" format: "" - field: birthday note: "生日" diff --git a/test/model/user/getavatarpairs.php b/test/model/user/getavatarpairs.php new file mode 100644 index 0000000000..2ba8389fa0 --- /dev/null +++ b/test/model/user/getavatarpairs.php @@ -0,0 +1,27 @@ +#!/usr/bin/env php +getPairs(); +cid=1 +pid=1 + +查找带有Closed用户的外部用户键值对 >> Closed +查找带有首字母的外部用户键值对 >> O:用户1 +查找不带首字母的外部用户键值对 >> 用户1 +按照给定的用户名查找用户键值对,返回值中不带有Closed用户 >> 1 +按照给定的用户名查找用户键值对,返回值中带有Closed用户 >> 2 +使用limit参数来限制最多获取2个用户键值对 >> 2 +使用limit参数来限制最多获取50个用户键值对 >> 50 +使用pofirst参数来将系统中的产品经理用户放到返回值前列 >> P:测试主管58 +使用pmfirst参数来将系统中的项目经理用户放到返回值前列 >> O:其他100 + +*/ +$user = new userTest(); + +r(count($user->getAvatarPairsTest())) && p() && e('999'); //所有用户头像的数量 +r($user->getAvatarPairsTest()) && p('user99') && e('/home/z/user/15.png'); //查找account为"user99"的用户的头像路径 diff --git a/test/model/user/getcommiters.php b/test/model/user/getcommiters.php new file mode 100644 index 0000000000..a12a9e426c --- /dev/null +++ b/test/model/user/getcommiters.php @@ -0,0 +1,29 @@ +#!/usr/bin/env php +getPairs(); +cid=1 +pid=1 + +查找带有Closed用户的外部用户键值对 >> Closed +查找带有首字母的外部用户键值对 >> O:用户1 +查找不带首字母的外部用户键值对 >> 用户1 +按照给定的用户名查找用户键值对,返回值中不带有Closed用户 >> 1 +按照给定的用户名查找用户键值对,返回值中带有Closed用户 >> 2 +使用limit参数来限制最多获取2个用户键值对 >> 2 +使用limit参数来限制最多获取50个用户键值对 >> 50 +使用pofirst参数来将系统中的产品经理用户放到返回值前列 >> P:测试主管58 +使用pmfirst参数来将系统中的项目经理用户放到返回值前列 >> O:其他100 + +*/ + +$user = new userTest(); +$commiters = $user->getCommitersTest(); + +r($commiters) && p('qd100') && e('高层管理100'); //获取源代码账号为qd100的用户真实姓名 +r(count($commiters)) && p() && e('1000'); //获取系统中源代码账号不为空的用户数量 diff --git a/test/model/user/getpairs.php b/test/model/user/getpairs.php index 2d6e4fd5f4..b111b224c6 100644 --- a/test/model/user/getpairs.php +++ b/test/model/user/getpairs.php @@ -44,4 +44,4 @@ r(count($usersInAccountsWithclosed)) && p() && e('2'); // r(count($limit2Users)) && p() && e('2'); //使用limit参数来限制最多获取2个用户键值对 r(count($limit50Users)) && p() && e('50'); //使用limit参数来限制最多获取50个用户键值对 r($firstPO) && p('pd58') && e('P:测试主管58'); //使用pofirst参数来将系统中的产品经理用户放到返回值前列 -r($firstPM) && p('outside100') && e('O:其他100'); //使用pmfirst参数来将系统中的项目经理用户放到返回值前列 \ No newline at end of file +r($firstPM) && p('outside100') && e('O:其他100'); //使用pmfirst参数来将系统中的项目经理用户放到返回值前列 diff --git a/test/model/user/getrealnameandemails.php b/test/model/user/getrealnameandemails.php new file mode 100644 index 0000000000..966d8bc0ef --- /dev/null +++ b/test/model/user/getrealnameandemails.php @@ -0,0 +1,30 @@ +#!/usr/bin/env php +getPairs(); +cid=1 +pid=1 + +查找带有Closed用户的外部用户键值对 >> Closed +查找带有首字母的外部用户键值对 >> O:用户1 +查找不带首字母的外部用户键值对 >> 用户1 +按照给定的用户名查找用户键值对,返回值中不带有Closed用户 >> 1 +按照给定的用户名查找用户键值对,返回值中带有Closed用户 >> 2 +使用limit参数来限制最多获取2个用户键值对 >> 2 +使用limit参数来限制最多获取50个用户键值对 >> 50 +使用pofirst参数来将系统中的产品经理用户放到返回值前列 >> P:测试主管58 +使用pmfirst参数来将系统中的项目经理用户放到返回值前列 >> O:其他100 + +*/ + +$accounts = array('tesrasd1asd#@!#$', 'ASD123中文', 'user10', 'ccsdqq@!', 'admin'); +$user = new userTest(); +$emails = $user->getRealNameAndEmailsTest($accounts); + +r($emails['admin']) && p('email') && e('631479@qq.com'); //获取admin的邮箱 +r(count($emails)) && p() && e('2'); //从accounts中获取到的用户邮箱数量 diff --git a/test/model/user/getuserdisplayinfos.php b/test/model/user/getuserdisplayinfos.php new file mode 100644 index 0000000000..45d14e8325 --- /dev/null +++ b/test/model/user/getuserdisplayinfos.php @@ -0,0 +1,31 @@ +#!/usr/bin/env php +getPairs(); +cid=1 +pid=1 + +查找带有Closed用户的外部用户键值对 >> Closed +查找带有首字母的外部用户键值对 >> O:用户1 +查找不带首字母的外部用户键值对 >> 用户1 +按照给定的用户名查找用户键值对,返回值中不带有Closed用户 >> 1 +按照给定的用户名查找用户键值对,返回值中带有Closed用户 >> 2 +使用limit参数来限制最多获取2个用户键值对 >> 2 +使用limit参数来限制最多获取50个用户键值对 >> 50 +使用pofirst参数来将系统中的产品经理用户放到返回值前列 >> P:测试主管58 +使用pmfirst参数来将系统中的项目经理用户放到返回值前列 >> O:其他100 + +*/ + +$accounts = array('!asd12d', '中文用户名', 'user10', 'dev33', 'cccfff'); +$user = new userTest(); + +r($user->getUserRolesTest($accounts, true)) && p('dev33') && e('dev'); //获取用户名和职位Key的键值对 +r($user->getUserRolesTest($accounts, false)) && p('dev33') && e('研发'); //获取用户名和职位Value的键值对 +r(count($user->getUserRolesTest($accounts, true))) && p() && e(2); //从指定accounts中获取到的键值对数量 +r(count($user->getUserRolesTest($accounts, false))) && p() && e(2); //从指定accounts中获取到的键值对数量 diff --git a/test/model/user/getuserroles.php b/test/model/user/getuserroles.php new file mode 100644 index 0000000000..45d14e8325 --- /dev/null +++ b/test/model/user/getuserroles.php @@ -0,0 +1,31 @@ +#!/usr/bin/env php +getPairs(); +cid=1 +pid=1 + +查找带有Closed用户的外部用户键值对 >> Closed +查找带有首字母的外部用户键值对 >> O:用户1 +查找不带首字母的外部用户键值对 >> 用户1 +按照给定的用户名查找用户键值对,返回值中不带有Closed用户 >> 1 +按照给定的用户名查找用户键值对,返回值中带有Closed用户 >> 2 +使用limit参数来限制最多获取2个用户键值对 >> 2 +使用limit参数来限制最多获取50个用户键值对 >> 50 +使用pofirst参数来将系统中的产品经理用户放到返回值前列 >> P:测试主管58 +使用pmfirst参数来将系统中的项目经理用户放到返回值前列 >> O:其他100 + +*/ + +$accounts = array('!asd12d', '中文用户名', 'user10', 'dev33', 'cccfff'); +$user = new userTest(); + +r($user->getUserRolesTest($accounts, true)) && p('dev33') && e('dev'); //获取用户名和职位Key的键值对 +r($user->getUserRolesTest($accounts, false)) && p('dev33') && e('研发'); //获取用户名和职位Value的键值对 +r(count($user->getUserRolesTest($accounts, true))) && p() && e(2); //从指定accounts中获取到的键值对数量 +r(count($user->getUserRolesTest($accounts, false))) && p() && e(2); //从指定accounts中获取到的键值对数量 From 66db8b02492b10d7fe74a3243f3853d3540b4c97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=B9=BF=E6=98=8E?= Date: Mon, 14 Mar 2022 15:40:17 +0800 Subject: [PATCH 03/15] * Add auto test. --- test/class/user.class.php | 22 ++++++++++++++++++++++ test/model/user/getbyid.php | 2 +- test/model/user/getuserdisplayinfos.php | 10 +++++----- 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/test/class/user.class.php b/test/class/user.class.php index 87fdce99ce..eb3de2d874 100644 --- a/test/class/user.class.php +++ b/test/class/user.class.php @@ -179,4 +179,26 @@ class userTest return $objects; } } + + /** + * Test get user by id. + * + * @param int|string $userID + * @param string $field + * @access public + * @return void + */ + public function getByIdTest($userID, $field = 'account') + { + $objects = $this->objectModel->getById($userID, $field); + if(dao::isError()) + { + $error = dao::getError(); + return $error[0]; + } + else + { + return $objects; + } + } } diff --git a/test/model/user/getbyid.php b/test/model/user/getbyid.php index 864f536a35..ffd1c89fe6 100755 --- a/test/model/user/getbyid.php +++ b/test/model/user/getbyid.php @@ -22,4 +22,4 @@ r($user->getByID('admin', 'account')) && p('account') && e('admin'); // 使 r($user->getByID('admin')) && p('account') && e('admin'); // 通过默认字段获取存在的用户 r($user->getByID(1)) && p('account') && e(''); // 通过默认字段获取不存在的用户 r($user->getByID(100000, 'id')) && p('account') && e(''); // 通过id字段获取不存在的用户 -r($user->getByID('error', 'account')) && p('account') && e(''); // 通过默认字段获取不存在的用户 \ No newline at end of file +r($user->getByID('error', 'account')) && p('account') && e(''); // 通过默认字段获取不存在的用户 diff --git a/test/model/user/getuserdisplayinfos.php b/test/model/user/getuserdisplayinfos.php index 45d14e8325..69b9816426 100644 --- a/test/model/user/getuserdisplayinfos.php +++ b/test/model/user/getuserdisplayinfos.php @@ -22,10 +22,10 @@ pid=1 */ -$accounts = array('!asd12d', '中文用户名', 'user10', 'dev33', 'cccfff'); +$accounts = array('!asd12d', '中文用户名', 'user10', 'dev33', 'cccfff', 'outside1'); $user = new userTest(); -r($user->getUserRolesTest($accounts, true)) && p('dev33') && e('dev'); //获取用户名和职位Key的键值对 -r($user->getUserRolesTest($accounts, false)) && p('dev33') && e('研发'); //获取用户名和职位Value的键值对 -r(count($user->getUserRolesTest($accounts, true))) && p() && e(2); //从指定accounts中获取到的键值对数量 -r(count($user->getUserRolesTest($accounts, false))) && p() && e(2); //从指定accounts中获取到的键值对数量 +r($user->getUserDisplayInfosTest($accounts)) && p('dev33:realname') && e('项目经理33'); //查找获取到的用户名为dev33的真实姓名 +r($user->getUserDisplayInfosTest($accounts)) && p('user10:avatar') && e('/home/z/tmp/10.png'); //查找获取到的用户名为user10的头像 +r($user->getUserDisplayInfosTest($accounts, 0, 'outside')) && p('outside1:avatar') && e('/home/z/tmp/18.png'); //查找获取到的用户名为outside1的外部用户的头像信息 +r($user->getUserDisplayInfosTest($accounts)) && p('cccfff:realname') && e('Error: Cannot get index cccfff.'); //查找获取到的用户名为cccfff的真实姓名 From 78f64fdb322a893b4e13fc8fff65a839da409e3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=B9=BF=E6=98=8E?= Date: Tue, 15 Mar 2022 13:33:38 +0800 Subject: [PATCH 04/15] * Add batch create user unit test. --- test/class/user.class.php | 74 ++++++++++++++++++++++++ test/model/user/batchcreate.php | 37 ++++++++++++ test/model/user/create.php | 60 +++++++++++++++++++ test/model/user/getavatarpairs.php | 13 +---- test/model/user/getbyid.php | 16 ++--- test/model/user/getbyquery.php | 24 ++++++++ test/model/user/getcommiters.php | 13 +---- test/model/user/getlist.php | 5 +- test/model/user/getlistbyaccounts.php | 2 +- test/model/user/getpairs.php | 2 +- test/model/user/getrealnameandemails.php | 15 ++--- test/model/user/getuserdisplayinfos.php | 15 ++--- test/model/user/getuserroles.php | 13 +---- 13 files changed, 226 insertions(+), 63 deletions(-) create mode 100644 test/model/user/batchcreate.php create mode 100644 test/model/user/create.php create mode 100644 test/model/user/getbyquery.php diff --git a/test/class/user.class.php b/test/class/user.class.php index eb3de2d874..2b6b4248b6 100644 --- a/test/class/user.class.php +++ b/test/class/user.class.php @@ -201,4 +201,78 @@ class userTest return $objects; } } + + /** + * Test get user by query. + * + * @param string $browseType + * @param string $query + * @param string $orderBy + * @access public + * @return void + */ + public function getByQueryTest($browseType = 'inside', $query = '', $orderBy = 'id') + { + $objects = $this->objectModel->getByQuery($browseType, $query, null, $orderBy); + if(dao::isError()) + { + $error = dao::getError(); + return $error[0]; + } + else + { + return $objects; + } + } + + /** + * Test create a user. + * + * @param array $params + * @access public + * @return void + */ + public function createUserTest($params = array()) + { + $_POST = $params; + $_POST['verifyPassword'] = 'e79f8fb9726857b212401e42e5b7e18b'; + + $userID = $this->objectModel->create(); + unset($_POST); + + if(dao::isError()) + { + return dao::getError(); + } + else + { + return $this->objectModel->getByID($userID, 'id'); + } + } + + /** + * Test batch create users. + * + * @access public + * @return void + */ + public function batchCreateUserTest($params = array()) + { + $_POST = $params; + $_POST['verifyPassword'] = 'e79f8fb9726857b212401e42e5b7e18b'; + + $userIDList = $this->objectModel->batchCreate(); + unset($_POST); + + if(dao::isError()) + { + return dao::getError(); + } + else + { + a($userIDList);die; + $query = "id in $userIDList"; + return $this->objectModel->getByQuery('', $query); + } + } } diff --git a/test/model/user/batchcreate.php b/test/model/user/batchcreate.php new file mode 100644 index 0000000000..c9e471140c --- /dev/null +++ b/test/model/user/batchcreate.php @@ -0,0 +1,37 @@ +#!/usr/bin/env php +batchCreateTest(); +cid=1 +pid=1 + +密码较弱的情况 >> 您的密码强度小于系统设定。 +Visions为空的情况 >> 『版本类型』不能为空。 +用户名为空的情况 >> 『用户名』不能为空。 +用户名特殊的情况 >> 『用户名』只能是字母、数字或下划线的组合三位以上。 +两次密码不相同的情况 >> 两次密码应该相同。 +插入重复的用户名,返回报错信息 >> 『用户名』已经有『admin』这条记录了。如果您确定该记录已删除,请到后台-系统-数据-回收站还原。 +正常插入用户,返回新插入的ID、真实姓名 >> 1001,新的测试用户 +正常插入用户,返回新插入的真实姓名 >> 新的测试用户 + +*/ + +$user = new userTest(); +$normalUser = array(); +$normalUser['account'] = array('newtestuser1', 'newtestuser2', 'newtestuser3'); +$normalUser['realname'] = array('新测试用户1', '新测试用户2', '新测试用户3'); +$normalUser['visions'] = array('rnd', 'rnd,lite', 'lite'); +$normalUser['role'] = array('qa', 'dev', 'pm'); +$normalUser['email'] = array('testasd@163.com', '', '11773@qq.com'); +$normalUser['password'] = array('e10adc3949ba59abbe56e057f20f883e', 'e10adc3949ba59abbe56e057f20f883e', 'e10adc3949ba59abbe56e057f20f883e'); + +a($user->batchCreateUserTest($normalUser));die; + +r($user->batchCreateUserTest($normalUser)) && p('password1:0') && e('您的密码强度小于系统设定。'); //密码较弱的情况 + +system("./ztest init"); diff --git a/test/model/user/create.php b/test/model/user/create.php new file mode 100644 index 0000000000..6457995041 --- /dev/null +++ b/test/model/user/create.php @@ -0,0 +1,60 @@ +#!/usr/bin/env php +createTest(); +cid=1 +pid=1 + +密码较弱的情况 >> 您的密码强度小于系统设定。 +Visions为空的情况 >> 『版本类型』不能为空。 +用户名为空的情况 >> 『用户名』不能为空。 +用户名特殊的情况 >> 『用户名』只能是字母、数字或下划线的组合三位以上。 +两次密码不相同的情况 >> 两次密码应该相同。 +插入重复的用户名,返回报错信息 >> 『用户名』已经有『admin』这条记录了。如果您确定该记录已删除,请到后台-系统-数据-回收站还原。 +正常插入用户,返回新插入的ID、真实姓名 >> 1001,新的测试用户 +正常插入用户,返回新插入的真实姓名 >> 新的测试用户 + +*/ + +$user = new userTest(); +$normalUser = array(); +$normalUser['account'] = 'newtestuser'; +$normalUser['realname'] = '新的测试用户'; +$normalUser['password1'] = 'e10adc3949ba59abbe56e057f20f883e'; +$normalUser['password2'] = 'e10adc3949ba59abbe56e057f20f883e'; +$normalUser['type'] = 'inside'; +$normalUser['passwordStrength'] = 1; +$normalUser['visions'] = 'rnd'; + +$weakPassword = $normalUser; +$weakPassword['passwordStrength'] = 0; + +$emptyVisions = $normalUser; +unset($emptyVisions['visions']); + +$emptyAccount = $normalUser; +unset($emptyAccount['account']); + +$specialAccount = $normalUser; +$specialAccount['account'] = 'sa!@#asdf'; + +$differentPassword = $normalUser; +$differentPassword['password2'] = 'asfjhjkahf9012asd123'; + +$existUser = $normalUser; +$existUser['account'] = 'admin'; + +r($user->createUserTest($weakPassword)) && p('password1:0') && e('您的密码强度小于系统设定。'); //密码较弱的情况 +r($user->createUserTest($emptyVisions)) && p('visions:0') && e('『版本类型』不能为空。'); //Visions为空的情况 +r($user->createUserTest($emptyAccount)) && p('account:0') && e('『用户名』不能为空。'); //用户名为空的情况 +r($user->createUserTest($specialAccount)) && p('account:0') && e('『用户名』只能是字母、数字或下划线的组合三位以上。'); //用户名特殊的情况 +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"); diff --git a/test/model/user/getavatarpairs.php b/test/model/user/getavatarpairs.php index 2ba8389fa0..37c6e80893 100644 --- a/test/model/user/getavatarpairs.php +++ b/test/model/user/getavatarpairs.php @@ -10,18 +10,11 @@ title=userModel->getPairs(); cid=1 pid=1 -查找带有Closed用户的外部用户键值对 >> Closed -查找带有首字母的外部用户键值对 >> O:用户1 -查找不带首字母的外部用户键值对 >> 用户1 -按照给定的用户名查找用户键值对,返回值中不带有Closed用户 >> 1 -按照给定的用户名查找用户键值对,返回值中带有Closed用户 >> 2 -使用limit参数来限制最多获取2个用户键值对 >> 2 -使用limit参数来限制最多获取50个用户键值对 >> 50 -使用pofirst参数来将系统中的产品经理用户放到返回值前列 >> P:测试主管58 -使用pmfirst参数来将系统中的项目经理用户放到返回值前列 >> O:其他100 +所有用户头像的数量 >> 999 +查找account为"user99"的用户的头像路径 >> /home/z/user/15.png */ $user = new userTest(); r(count($user->getAvatarPairsTest())) && p() && e('999'); //所有用户头像的数量 -r($user->getAvatarPairsTest()) && p('user99') && e('/home/z/user/15.png'); //查找account为"user99"的用户的头像路径 +r($user->getAvatarPairsTest()) && p('user99') && e('/home/z/user/15.png'); //查找account为"user99"的用户的头像路径 \ No newline at end of file diff --git a/test/model/user/getbyid.php b/test/model/user/getbyid.php index ffd1c89fe6..533b877ebe 100755 --- a/test/model/user/getbyid.php +++ b/test/model/user/getbyid.php @@ -1,7 +1,7 @@ #!/usr/bin/env php > admin */ -$user = $tester->loadModel('user'); +$user = new userTest(); -r($user->getById(1, 'id')) && p('account') && e('admin'); // 通过id获取存在的用户 -r($user->getByID('admin', 'account')) && p('account') && e('admin'); // 使用account字段获取存在的用户 -r($user->getByID('admin')) && p('account') && e('admin'); // 通过默认字段获取存在的用户 -r($user->getByID(1)) && p('account') && e(''); // 通过默认字段获取不存在的用户 -r($user->getByID(100000, 'id')) && p('account') && e(''); // 通过id字段获取不存在的用户 -r($user->getByID('error', 'account')) && p('account') && e(''); // 通过默认字段获取不存在的用户 +r($user->getByIDTest(1, 'id')) && p('account') && e('admin'); // 通过id获取存在的用户 +r($user->getByIDTest('admin', 'account')) && p('account') && e('admin'); // 使用account字段获取存在的用户 +r($user->getByIDTest('admin')) && p('account') && e('admin'); // 通过默认字段获取存在的用户 +r($user->getByIDTest(1)) && p('account') && e(''); // 通过默认字段获取不存在的用户 +r($user->getByIDTest(100000, 'id')) && p('account') && e(''); // 通过id字段获取不存在的用户 +r($user->getByIDTest('error', 'account')) && p('account') && e(''); // 通过默认字段获取不存在的用户 \ No newline at end of file diff --git a/test/model/user/getbyquery.php b/test/model/user/getbyquery.php new file mode 100644 index 0000000000..c3cd097b94 --- /dev/null +++ b/test/model/user/getbyquery.php @@ -0,0 +1,24 @@ +#!/usr/bin/env php +> 303 +按ID倒序查询内部用户,获取最后一个用户的account >> admin +获取第一个外部用户的真实姓名 >> 用户1 + +*/ +$user = new userTest(); +$insideQAUsers = $user->getByQueryTest('inside', "`role` = 'qa'", 'id desc'); +$outsideUsers = $user->getByQueryTest('outside'); + +r(count($insideQAUsers)) && p() && e('303'); //对比获取到的内部用户的数量 +r($insideQAUsers) && p('302:account') && e('admin'); //按ID倒序查询内部用户,获取最后一个用户的account +r($outsideUsers) && p('0:realname') && e('用户1'); //获取第一个外部用户的真实姓名 \ No newline at end of file diff --git a/test/model/user/getcommiters.php b/test/model/user/getcommiters.php index a12a9e426c..d6466aafbc 100644 --- a/test/model/user/getcommiters.php +++ b/test/model/user/getcommiters.php @@ -10,15 +10,8 @@ title=userModel->getPairs(); cid=1 pid=1 -查找带有Closed用户的外部用户键值对 >> Closed -查找带有首字母的外部用户键值对 >> O:用户1 -查找不带首字母的外部用户键值对 >> 用户1 -按照给定的用户名查找用户键值对,返回值中不带有Closed用户 >> 1 -按照给定的用户名查找用户键值对,返回值中带有Closed用户 >> 2 -使用limit参数来限制最多获取2个用户键值对 >> 2 -使用limit参数来限制最多获取50个用户键值对 >> 50 -使用pofirst参数来将系统中的产品经理用户放到返回值前列 >> P:测试主管58 -使用pmfirst参数来将系统中的项目经理用户放到返回值前列 >> O:其他100 +获取源代码账号为qd100的用户真实姓名 >> 高层管理100 +获取系统中源代码账号不为空的用户数量 >> 1000 */ @@ -26,4 +19,4 @@ $user = new userTest(); $commiters = $user->getCommitersTest(); r($commiters) && p('qd100') && e('高层管理100'); //获取源代码账号为qd100的用户真实姓名 -r(count($commiters)) && p() && e('1000'); //获取系统中源代码账号不为空的用户数量 +r(count($commiters)) && p() && e('1000'); //获取系统中源代码账号不为空的用户数量 \ No newline at end of file diff --git a/test/model/user/getlist.php b/test/model/user/getlist.php index 1580882cdd..4cc11069ae 100644 --- a/test/model/user/getlist.php +++ b/test/model/user/getlist.php @@ -11,14 +11,15 @@ cid=1 pid=1 查找系统中第二个未删除的、内部用户真实姓名,根据account正序排 >> 开发1 -查找系统中第三个未删除的、内部用户电话号,根据account正序排 >> 18556488236 +查找系统中未删除的、根据account正序排的最后一个用户的姓名 >> 测试99 查找系统中所有未删除的、内部用户的数量 >> 999 查找系统中不存在的用户,输出错误提示 >> Error: Cannot get index 1000 */ $user = new userTest(); +a($user->getListTest());die; r($user->getListTest()) && p('1:realname') && e('开发1'); //查找系统中第二个未删除的、内部用户真实姓名,根据account正序排 -r($user->getListTest()) && p('2:phone') && e('18556488236'); //查找系统中第三个未删除的、内部用户电话号,根据account正序排 +r($user->getListTest()) && p('998:realname') && e('测试99'); //查找系统中未删除的、根据account正序排的最后一个用户的姓名 r($user->getListTest(true)) && p() && e('999'); //查找系统中所有未删除的、内部用户的数量 r($user->getListTest()) && p('1000:realname') && e('Error: Cannot get index 1000'); //查找系统中不存在的用户,输出错误提示 \ No newline at end of file diff --git a/test/model/user/getlistbyaccounts.php b/test/model/user/getlistbyaccounts.php index 48c8f37d3f..3e25f2c71d 100644 --- a/test/model/user/getlistbyaccounts.php +++ b/test/model/user/getlistbyaccounts.php @@ -21,4 +21,4 @@ $count = array(0 => false, 1 => true); $user = new userTest(); r($user->getListByAccountsTest($accounts, $count[0])) && p('1:realname,role') && e('admin,qa'); //按照给定的用户名列表查询用户信息,获取用户ID为1的用户真实姓名和角色 r($user->getListByAccountsTest($accounts, $count[1])) && p() && e('3'); //按照给定的用户名列表查询用户信息,获取查询出的用户列表数量 -r($user->getListByAccountsTest($accounts, $count[0])) && p('0:realname') && e('Error: Cannot get index 0.'); //按照给定的用户名列表查询用户信息,获取用户ID为0的用户信息 +r($user->getListByAccountsTest($accounts, $count[0])) && p('0:realname') && e('Error: Cannot get index 0.'); //按照给定的用户名列表查询用户信息,获取用户ID为0的用户信息 \ No newline at end of file diff --git a/test/model/user/getpairs.php b/test/model/user/getpairs.php index b111b224c6..2d6e4fd5f4 100644 --- a/test/model/user/getpairs.php +++ b/test/model/user/getpairs.php @@ -44,4 +44,4 @@ r(count($usersInAccountsWithclosed)) && p() && e('2'); // r(count($limit2Users)) && p() && e('2'); //使用limit参数来限制最多获取2个用户键值对 r(count($limit50Users)) && p() && e('50'); //使用limit参数来限制最多获取50个用户键值对 r($firstPO) && p('pd58') && e('P:测试主管58'); //使用pofirst参数来将系统中的产品经理用户放到返回值前列 -r($firstPM) && p('outside100') && e('O:其他100'); //使用pmfirst参数来将系统中的项目经理用户放到返回值前列 +r($firstPM) && p('outside100') && e('O:其他100'); //使用pmfirst参数来将系统中的项目经理用户放到返回值前列 \ No newline at end of file diff --git a/test/model/user/getrealnameandemails.php b/test/model/user/getrealnameandemails.php index 966d8bc0ef..5dda0f0dc9 100644 --- a/test/model/user/getrealnameandemails.php +++ b/test/model/user/getrealnameandemails.php @@ -10,15 +10,8 @@ title=userModel->getPairs(); cid=1 pid=1 -查找带有Closed用户的外部用户键值对 >> Closed -查找带有首字母的外部用户键值对 >> O:用户1 -查找不带首字母的外部用户键值对 >> 用户1 -按照给定的用户名查找用户键值对,返回值中不带有Closed用户 >> 1 -按照给定的用户名查找用户键值对,返回值中带有Closed用户 >> 2 -使用limit参数来限制最多获取2个用户键值对 >> 2 -使用limit参数来限制最多获取50个用户键值对 >> 50 -使用pofirst参数来将系统中的产品经理用户放到返回值前列 >> P:测试主管58 -使用pmfirst参数来将系统中的项目经理用户放到返回值前列 >> O:其他100 +获取admin的邮箱 >> 833482@qq.com +从accounts中获取到的用户邮箱数量 >> 2 */ @@ -26,5 +19,5 @@ $accounts = array('tesrasd1asd#@!#$', 'ASD123中文', 'user10', 'ccsdqq@!', 'adm $user = new userTest(); $emails = $user->getRealNameAndEmailsTest($accounts); -r($emails['admin']) && p('email') && e('631479@qq.com'); //获取admin的邮箱 -r(count($emails)) && p() && e('2'); //从accounts中获取到的用户邮箱数量 +r($emails['admin']) && p('email') && e('833482@qq.com'); //获取admin的邮箱 +r(count($emails)) && p() && e('2'); //从accounts中获取到的用户邮箱数量 \ No newline at end of file diff --git a/test/model/user/getuserdisplayinfos.php b/test/model/user/getuserdisplayinfos.php index 69b9816426..8366fa54f2 100644 --- a/test/model/user/getuserdisplayinfos.php +++ b/test/model/user/getuserdisplayinfos.php @@ -10,15 +10,10 @@ title=userModel->getPairs(); cid=1 pid=1 -查找带有Closed用户的外部用户键值对 >> Closed -查找带有首字母的外部用户键值对 >> O:用户1 -查找不带首字母的外部用户键值对 >> 用户1 -按照给定的用户名查找用户键值对,返回值中不带有Closed用户 >> 1 -按照给定的用户名查找用户键值对,返回值中带有Closed用户 >> 2 -使用limit参数来限制最多获取2个用户键值对 >> 2 -使用limit参数来限制最多获取50个用户键值对 >> 50 -使用pofirst参数来将系统中的产品经理用户放到返回值前列 >> P:测试主管58 -使用pmfirst参数来将系统中的项目经理用户放到返回值前列 >> O:其他100 +查找获取到的用户名为dev33的真实姓名 >> 项目经理33 +查找获取到的用户名为user10的头像 >> /home/z/tmp/10.png +查找获取到的用户名为outside1的外部用户的头像信息 >> /home/z/tmp/18.png +查找获取到的用户名为cccfff的真实姓名 >> Error: Cannot get index cccfff. */ @@ -28,4 +23,4 @@ $user = new userTest(); r($user->getUserDisplayInfosTest($accounts)) && p('dev33:realname') && e('项目经理33'); //查找获取到的用户名为dev33的真实姓名 r($user->getUserDisplayInfosTest($accounts)) && p('user10:avatar') && e('/home/z/tmp/10.png'); //查找获取到的用户名为user10的头像 r($user->getUserDisplayInfosTest($accounts, 0, 'outside')) && p('outside1:avatar') && e('/home/z/tmp/18.png'); //查找获取到的用户名为outside1的外部用户的头像信息 -r($user->getUserDisplayInfosTest($accounts)) && p('cccfff:realname') && e('Error: Cannot get index cccfff.'); //查找获取到的用户名为cccfff的真实姓名 +r($user->getUserDisplayInfosTest($accounts)) && p('cccfff:realname') && e('Error: Cannot get index cccfff.'); //查找获取到的用户名为cccfff的真实姓名 \ No newline at end of file diff --git a/test/model/user/getuserroles.php b/test/model/user/getuserroles.php index 45d14e8325..8f2efdde53 100644 --- a/test/model/user/getuserroles.php +++ b/test/model/user/getuserroles.php @@ -10,15 +10,8 @@ title=userModel->getPairs(); cid=1 pid=1 -查找带有Closed用户的外部用户键值对 >> Closed -查找带有首字母的外部用户键值对 >> O:用户1 -查找不带首字母的外部用户键值对 >> 用户1 -按照给定的用户名查找用户键值对,返回值中不带有Closed用户 >> 1 -按照给定的用户名查找用户键值对,返回值中带有Closed用户 >> 2 -使用limit参数来限制最多获取2个用户键值对 >> 2 -使用limit参数来限制最多获取50个用户键值对 >> 50 -使用pofirst参数来将系统中的产品经理用户放到返回值前列 >> P:测试主管58 -使用pmfirst参数来将系统中的项目经理用户放到返回值前列 >> O:其他100 +获取用户名和职位Key的键值对 >> dev +获取用户名和职位Value的键值对 >> 研发 */ @@ -28,4 +21,4 @@ $user = new userTest(); r($user->getUserRolesTest($accounts, true)) && p('dev33') && e('dev'); //获取用户名和职位Key的键值对 r($user->getUserRolesTest($accounts, false)) && p('dev33') && e('研发'); //获取用户名和职位Value的键值对 r(count($user->getUserRolesTest($accounts, true))) && p() && e(2); //从指定accounts中获取到的键值对数量 -r(count($user->getUserRolesTest($accounts, false))) && p() && e(2); //从指定accounts中获取到的键值对数量 +r(count($user->getUserRolesTest($accounts, false))) && p() && e(2); //从指定accounts中获取到的键值对数量 \ No newline at end of file From 2b9fcb67f5d2c5868b00aba1e5fbbae976157107 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=B9=BF=E6=98=8E?= Date: Tue, 15 Mar 2022 13:36:29 +0800 Subject: [PATCH 05/15] * Code for batch create. --- test/class/user.class.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/test/class/user.class.php b/test/class/user.class.php index 2b6b4248b6..50156218ae 100644 --- a/test/class/user.class.php +++ b/test/class/user.class.php @@ -270,9 +270,13 @@ class userTest } else { - a($userIDList);die; - $query = "id in $userIDList"; - return $this->objectModel->getByQuery('', $query); + $users = array(); + foreach($userIDList as $userID) + { + $users[] = $this->objectModel->getByID($userID, 'id'); + } + + return $users; } } } From 3a090c60347dd9f5d13ccdf1c8856a7564f6ddf8 Mon Sep 17 00:00:00 2001 From: Zongjun Lan Date: Tue, 15 Mar 2022 13:55:46 +0800 Subject: [PATCH 06/15] * fix bug #20760,#20761,#20762,#20763 --- extension/lite/leave/ext/view/create.oa.html.hook.php | 6 ++++++ extension/lite/leave/ext/view/edit.oa.html.hook.php | 6 ++++++ extension/lite/lieu/ext/view/create.oa.html.hook.php | 7 +++++++ extension/lite/lieu/ext/view/edit.oa.html.hook.php | 7 +++++++ extension/lite/makeup/ext/view/create.oa.html.hook.php | 6 ++++++ extension/lite/makeup/ext/view/edit.oa.html.hook.php | 6 ++++++ extension/lite/overtime/ext/view/create.oa.html.hook.php | 6 ++++++ extension/lite/overtime/ext/view/edit.oa.html.hook.php | 6 ++++++ 8 files changed, 50 insertions(+) create mode 100644 extension/lite/leave/ext/view/create.oa.html.hook.php create mode 100644 extension/lite/leave/ext/view/edit.oa.html.hook.php create mode 100644 extension/lite/lieu/ext/view/create.oa.html.hook.php create mode 100644 extension/lite/lieu/ext/view/edit.oa.html.hook.php create mode 100644 extension/lite/makeup/ext/view/create.oa.html.hook.php create mode 100644 extension/lite/makeup/ext/view/edit.oa.html.hook.php create mode 100644 extension/lite/overtime/ext/view/create.oa.html.hook.php create mode 100644 extension/lite/overtime/ext/view/edit.oa.html.hook.php diff --git a/extension/lite/leave/ext/view/create.oa.html.hook.php b/extension/lite/leave/ext/view/create.oa.html.hook.php new file mode 100644 index 0000000000..f0df39d0c4 --- /dev/null +++ b/extension/lite/leave/ext/view/create.oa.html.hook.php @@ -0,0 +1,6 @@ + \ No newline at end of file diff --git a/extension/lite/leave/ext/view/edit.oa.html.hook.php b/extension/lite/leave/ext/view/edit.oa.html.hook.php new file mode 100644 index 0000000000..f0df39d0c4 --- /dev/null +++ b/extension/lite/leave/ext/view/edit.oa.html.hook.php @@ -0,0 +1,6 @@ + \ No newline at end of file diff --git a/extension/lite/lieu/ext/view/create.oa.html.hook.php b/extension/lite/lieu/ext/view/create.oa.html.hook.php new file mode 100644 index 0000000000..d1ea319c49 --- /dev/null +++ b/extension/lite/lieu/ext/view/create.oa.html.hook.php @@ -0,0 +1,7 @@ + \ No newline at end of file diff --git a/extension/lite/lieu/ext/view/edit.oa.html.hook.php b/extension/lite/lieu/ext/view/edit.oa.html.hook.php new file mode 100644 index 0000000000..d1ea319c49 --- /dev/null +++ b/extension/lite/lieu/ext/view/edit.oa.html.hook.php @@ -0,0 +1,7 @@ + \ No newline at end of file diff --git a/extension/lite/makeup/ext/view/create.oa.html.hook.php b/extension/lite/makeup/ext/view/create.oa.html.hook.php new file mode 100644 index 0000000000..c6777f621d --- /dev/null +++ b/extension/lite/makeup/ext/view/create.oa.html.hook.php @@ -0,0 +1,6 @@ + \ No newline at end of file diff --git a/extension/lite/makeup/ext/view/edit.oa.html.hook.php b/extension/lite/makeup/ext/view/edit.oa.html.hook.php new file mode 100644 index 0000000000..92e1734fea --- /dev/null +++ b/extension/lite/makeup/ext/view/edit.oa.html.hook.php @@ -0,0 +1,6 @@ + diff --git a/extension/lite/overtime/ext/view/create.oa.html.hook.php b/extension/lite/overtime/ext/view/create.oa.html.hook.php new file mode 100644 index 0000000000..f0df39d0c4 --- /dev/null +++ b/extension/lite/overtime/ext/view/create.oa.html.hook.php @@ -0,0 +1,6 @@ + \ No newline at end of file diff --git a/extension/lite/overtime/ext/view/edit.oa.html.hook.php b/extension/lite/overtime/ext/view/edit.oa.html.hook.php new file mode 100644 index 0000000000..f0df39d0c4 --- /dev/null +++ b/extension/lite/overtime/ext/view/edit.oa.html.hook.php @@ -0,0 +1,6 @@ + \ No newline at end of file From 0ead3997b79c92becf952832dc4a29a23f98ca46 Mon Sep 17 00:00:00 2001 From: hufangzhou Date: Tue, 15 Mar 2022 14:31:43 +0800 Subject: [PATCH 07/15] * Fix bug #20735. --- extension/lite/common/ext/lang/en/lite.php | 2 +- extension/lite/common/ext/lang/zh-cn/lite.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/extension/lite/common/ext/lang/en/lite.php b/extension/lite/common/ext/lang/en/lite.php index 661d9e63bd..1bceb9a274 100644 --- a/extension/lite/common/ext/lang/en/lite.php +++ b/extension/lite/common/ext/lang/en/lite.php @@ -161,7 +161,7 @@ $lang->admin->menuOrder[30] = 'dev'; $lang->admin->menuOrder[35] = 'system'; $lang->admin->menu->message['subMenu'] = new stdclass(); -$lang->admin->menu->message['subMenu']->message = new stdclass(); +$lang->admin->menu->message['subMenu']->message = array(); $lang->admin->menu->message['subMenu']->mail = array('link' => "{$lang->mail->common}|mail|index", 'subModule' => 'mail'); $lang->admin->menu->message['subMenu']->webhook = array('link' => "Webhook|webhook|browse", 'subModule' => 'webhook'); diff --git a/extension/lite/common/ext/lang/zh-cn/lite.php b/extension/lite/common/ext/lang/zh-cn/lite.php index f6b37feac0..337aa5b160 100644 --- a/extension/lite/common/ext/lang/zh-cn/lite.php +++ b/extension/lite/common/ext/lang/zh-cn/lite.php @@ -161,7 +161,7 @@ $lang->admin->menuOrder[30] = 'dev'; $lang->admin->menuOrder[35] = 'system'; $lang->admin->menu->message['subMenu'] = new stdclass(); -$lang->admin->menu->message['subMenu']->message = new stdclass(); +$lang->admin->menu->message['subMenu']->message = array(); $lang->admin->menu->message['subMenu']->mail = array('link' => "{$lang->mail->common}|mail|index", 'subModule' => 'mail'); $lang->admin->menu->message['subMenu']->webhook = array('link' => "Webhook|webhook|browse", 'subModule' => 'webhook'); From 33ef68d31bc57ec40331f3231686238069ac1b7a Mon Sep 17 00:00:00 2001 From: liumengyi Date: Tue, 15 Mar 2022 14:58:35 +0800 Subject: [PATCH 08/15] * Change file name to lowercase. --- test/model/task/{batchChangeModule.php => batchchangemodule.php} | 0 test/model/task/{batchCreate.php => batchcreate.php} | 0 test/model/task/{batchUpdate.php => batchupdate.php} | 0 .../model/task/{computeBeginAndEnd.php => computebeginandend.php} | 0 .../task/{computeHours4Multiple.php => computehours4multiple.php} | 0 .../task/{computeWorkingHours.php => computeworkinghours.php} | 0 ...reateTaskFromGitlabIssue.php => createtaskfromgitlabissue.php} | 0 test/model/task/{deleteEstimate.php => deleteestimate.php} | 0 test/model/task/{getById.php => getbyid.php} | 0 test/model/task/{getByList.php => getbylist.php} | 0 test/model/task/{getEstimateById.php => getestimatebyid.php} | 0 .../task/{getExecutionTaskPairs.php => getexecutiontaskpairs.php} | 0 test/model/task/{getExecutionTasks.php => getexecutiontasks.php} | 0 .../model/task/{getParentTaskPairs.php => getparenttaskpairs.php} | 0 test/model/task/{getProjectID.php => getprojectid.php} | 0 test/model/task/{getStoryComments.php => getstorycomments.php} | 0 .../model/task/{getStoryTaskCounts.php => getstorytaskcounts.php} | 0 test/model/task/{getStoryTasks.php => getstorytasks.php} | 0 test/model/task/{getTaskEstimate.php => gettaskestimate.php} | 0 test/model/task/{getTasksByModule.php => gettasksbymodule.php} | 0 .../task/{getUserSuspendedTasks.php => getusersuspendedtasks.php} | 0 test/model/task/{getUserTaskPairs.php => getusertaskpairs.php} | 0 test/model/task/{getUserTasks.php => getusertasks.php} | 0 test/model/task/{recordEstimate.php => recordestimate.php} | 0 test/model/task/{updateEstimate.php => updateestimate.php} | 0 25 files changed, 0 insertions(+), 0 deletions(-) rename test/model/task/{batchChangeModule.php => batchchangemodule.php} (100%) rename test/model/task/{batchCreate.php => batchcreate.php} (100%) rename test/model/task/{batchUpdate.php => batchupdate.php} (100%) rename test/model/task/{computeBeginAndEnd.php => computebeginandend.php} (100%) rename test/model/task/{computeHours4Multiple.php => computehours4multiple.php} (100%) rename test/model/task/{computeWorkingHours.php => computeworkinghours.php} (100%) rename test/model/task/{createTaskFromGitlabIssue.php => createtaskfromgitlabissue.php} (100%) rename test/model/task/{deleteEstimate.php => deleteestimate.php} (100%) rename test/model/task/{getById.php => getbyid.php} (100%) rename test/model/task/{getByList.php => getbylist.php} (100%) rename test/model/task/{getEstimateById.php => getestimatebyid.php} (100%) rename test/model/task/{getExecutionTaskPairs.php => getexecutiontaskpairs.php} (100%) rename test/model/task/{getExecutionTasks.php => getexecutiontasks.php} (100%) rename test/model/task/{getParentTaskPairs.php => getparenttaskpairs.php} (100%) rename test/model/task/{getProjectID.php => getprojectid.php} (100%) rename test/model/task/{getStoryComments.php => getstorycomments.php} (100%) rename test/model/task/{getStoryTaskCounts.php => getstorytaskcounts.php} (100%) rename test/model/task/{getStoryTasks.php => getstorytasks.php} (100%) rename test/model/task/{getTaskEstimate.php => gettaskestimate.php} (100%) rename test/model/task/{getTasksByModule.php => gettasksbymodule.php} (100%) rename test/model/task/{getUserSuspendedTasks.php => getusersuspendedtasks.php} (100%) rename test/model/task/{getUserTaskPairs.php => getusertaskpairs.php} (100%) rename test/model/task/{getUserTasks.php => getusertasks.php} (100%) rename test/model/task/{recordEstimate.php => recordestimate.php} (100%) rename test/model/task/{updateEstimate.php => updateestimate.php} (100%) diff --git a/test/model/task/batchChangeModule.php b/test/model/task/batchchangemodule.php similarity index 100% rename from test/model/task/batchChangeModule.php rename to test/model/task/batchchangemodule.php diff --git a/test/model/task/batchCreate.php b/test/model/task/batchcreate.php similarity index 100% rename from test/model/task/batchCreate.php rename to test/model/task/batchcreate.php diff --git a/test/model/task/batchUpdate.php b/test/model/task/batchupdate.php similarity index 100% rename from test/model/task/batchUpdate.php rename to test/model/task/batchupdate.php diff --git a/test/model/task/computeBeginAndEnd.php b/test/model/task/computebeginandend.php similarity index 100% rename from test/model/task/computeBeginAndEnd.php rename to test/model/task/computebeginandend.php diff --git a/test/model/task/computeHours4Multiple.php b/test/model/task/computehours4multiple.php similarity index 100% rename from test/model/task/computeHours4Multiple.php rename to test/model/task/computehours4multiple.php diff --git a/test/model/task/computeWorkingHours.php b/test/model/task/computeworkinghours.php similarity index 100% rename from test/model/task/computeWorkingHours.php rename to test/model/task/computeworkinghours.php diff --git a/test/model/task/createTaskFromGitlabIssue.php b/test/model/task/createtaskfromgitlabissue.php similarity index 100% rename from test/model/task/createTaskFromGitlabIssue.php rename to test/model/task/createtaskfromgitlabissue.php diff --git a/test/model/task/deleteEstimate.php b/test/model/task/deleteestimate.php similarity index 100% rename from test/model/task/deleteEstimate.php rename to test/model/task/deleteestimate.php diff --git a/test/model/task/getById.php b/test/model/task/getbyid.php similarity index 100% rename from test/model/task/getById.php rename to test/model/task/getbyid.php diff --git a/test/model/task/getByList.php b/test/model/task/getbylist.php similarity index 100% rename from test/model/task/getByList.php rename to test/model/task/getbylist.php diff --git a/test/model/task/getEstimateById.php b/test/model/task/getestimatebyid.php similarity index 100% rename from test/model/task/getEstimateById.php rename to test/model/task/getestimatebyid.php diff --git a/test/model/task/getExecutionTaskPairs.php b/test/model/task/getexecutiontaskpairs.php similarity index 100% rename from test/model/task/getExecutionTaskPairs.php rename to test/model/task/getexecutiontaskpairs.php diff --git a/test/model/task/getExecutionTasks.php b/test/model/task/getexecutiontasks.php similarity index 100% rename from test/model/task/getExecutionTasks.php rename to test/model/task/getexecutiontasks.php diff --git a/test/model/task/getParentTaskPairs.php b/test/model/task/getparenttaskpairs.php similarity index 100% rename from test/model/task/getParentTaskPairs.php rename to test/model/task/getparenttaskpairs.php diff --git a/test/model/task/getProjectID.php b/test/model/task/getprojectid.php similarity index 100% rename from test/model/task/getProjectID.php rename to test/model/task/getprojectid.php diff --git a/test/model/task/getStoryComments.php b/test/model/task/getstorycomments.php similarity index 100% rename from test/model/task/getStoryComments.php rename to test/model/task/getstorycomments.php diff --git a/test/model/task/getStoryTaskCounts.php b/test/model/task/getstorytaskcounts.php similarity index 100% rename from test/model/task/getStoryTaskCounts.php rename to test/model/task/getstorytaskcounts.php diff --git a/test/model/task/getStoryTasks.php b/test/model/task/getstorytasks.php similarity index 100% rename from test/model/task/getStoryTasks.php rename to test/model/task/getstorytasks.php diff --git a/test/model/task/getTaskEstimate.php b/test/model/task/gettaskestimate.php similarity index 100% rename from test/model/task/getTaskEstimate.php rename to test/model/task/gettaskestimate.php diff --git a/test/model/task/getTasksByModule.php b/test/model/task/gettasksbymodule.php similarity index 100% rename from test/model/task/getTasksByModule.php rename to test/model/task/gettasksbymodule.php diff --git a/test/model/task/getUserSuspendedTasks.php b/test/model/task/getusersuspendedtasks.php similarity index 100% rename from test/model/task/getUserSuspendedTasks.php rename to test/model/task/getusersuspendedtasks.php diff --git a/test/model/task/getUserTaskPairs.php b/test/model/task/getusertaskpairs.php similarity index 100% rename from test/model/task/getUserTaskPairs.php rename to test/model/task/getusertaskpairs.php diff --git a/test/model/task/getUserTasks.php b/test/model/task/getusertasks.php similarity index 100% rename from test/model/task/getUserTasks.php rename to test/model/task/getusertasks.php diff --git a/test/model/task/recordEstimate.php b/test/model/task/recordestimate.php similarity index 100% rename from test/model/task/recordEstimate.php rename to test/model/task/recordestimate.php diff --git a/test/model/task/updateEstimate.php b/test/model/task/updateestimate.php similarity index 100% rename from test/model/task/updateEstimate.php rename to test/model/task/updateestimate.php From 114416d345efd9f627d7e6615538a47c006a8689 Mon Sep 17 00:00:00 2001 From: Zongjun Lan Date: Tue, 15 Mar 2022 15:36:07 +0800 Subject: [PATCH 09/15] * fix bug #20692 --- extension/lite/custom/ext/lang/zh-cn/lite.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extension/lite/custom/ext/lang/zh-cn/lite.php b/extension/lite/custom/ext/lang/zh-cn/lite.php index 9d1feed8cd..a1b67f9dae 100644 --- a/extension/lite/custom/ext/lang/zh-cn/lite.php +++ b/extension/lite/custom/ext/lang/zh-cn/lite.php @@ -15,7 +15,8 @@ $lang->custom->object['user'] = '用户'; $lang->custom->object['block'] = '区块'; $lang->custom->task = new stdClass(); -$lang->custom->task->fields['priList'] = '优先级'; +$lang->custom->task->fields['priList'] = '优先级'; +$lang->custom->task->fields['typeList'] = '类型'; $lang->custom->story = new stdClass(); $lang->custom->story->fields['priList'] = '优先级'; From 69fc328a1e1aa841ecb43d60ce03d284f686ba97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=B9=BF=E6=98=8E?= Date: Tue, 15 Mar 2022 15:41:39 +0800 Subject: [PATCH 10/15] * Code for auto test. --- test/class/user.class.php | 152 ++++++++++++++++++++++++++++- test/model/user/batchcreate.php | 17 ++-- test/model/user/batchedit.php | 36 +++++++ test/model/user/checkpassword.php | 44 +++++++++ test/model/user/create.php | 2 +- test/model/user/identify.php | 18 ++++ test/model/user/resetpassword.php | 45 +++++++++ test/model/user/update.php | 47 +++++++++ test/model/user/updatepassword.php | 41 ++++++++ 9 files changed, 390 insertions(+), 12 deletions(-) create mode 100644 test/model/user/batchedit.php create mode 100644 test/model/user/checkpassword.php create mode 100644 test/model/user/identify.php create mode 100644 test/model/user/resetpassword.php create mode 100644 test/model/user/update.php create mode 100644 test/model/user/updatepassword.php diff --git a/test/class/user.class.php b/test/class/user.class.php index 50156218ae..854110c622 100644 --- a/test/class/user.class.php +++ b/test/class/user.class.php @@ -271,12 +271,160 @@ class userTest else { $users = array(); - foreach($userIDList as $userID) + foreach($userIDList as $userID) $users[] = $this->objectModel->getByID($userID, 'id'); + + return $users; + } + } + + /** + * Test edit a user. + * + * @param int $userID + * @param array $params + * @access public + * @return void + */ + public function updateUserTest($userID, $params = array()) + { + $_POST = $params; + $_POST['verifyPassword'] = 'e79f8fb9726857b212401e42e5b7e18b'; + + $this->objectModel->update($userID); + unset($_POST); + + if(dao::isError()) + { + return dao::getError(); + } + else + { + return $this->objectModel->getByID($userID, 'id'); + } + } + + /** + * Test batch edit users. + * + * @param array $params + * @access public + * @return void + */ + public function batchEditUserTest($params = array()) + { + $_POST = $params; + $_POST['verifyPassword'] = 'e79f8fb9726857b212401e42e5b7e18b'; + + $this->objectModel->batchEdit($params); + unset($_POST); + + if(dao::isError()) + { + return dao::getError(); + } + else + { + $users = array(); + $userIDList = array_keys($params['account']); + foreach($userIDList as $userID) { - $users[] = $this->objectModel->getByID($userID, 'id'); + $user = $this->objectModel->getByID($userID, 'id'); + $users[$user->id] = $user; } return $users; } } + + /** + * Test edit a user password. + * + * @param int $userID + * @param array $params + * @access public + * @return void + */ + public function updatePasswordTest($userID, $params = array()) + { + $_POST = $params; + + $this->objectModel->updatePassword($userID); + unset($_POST); + + if(dao::isError()) + { + return dao::getError(); + } + else + { + return $this->objectModel->getByID($userID, 'id'); + } + } + + /** + * Reset user password. + * + * @param array $params + * @access public + * @return void + */ + public function resetPasswordTest($params = array()) + { + $_POST = $params; + + $this->objectModel->resetPassword(); + unset($_POST); + + if(dao::isError()) + { + return dao::getError(); + } + else + { + $account = $params['account']; + return $this->objectModel->getByID($account, 'account'); + } + } + + /** + * Check user password. + * + * @param array $params + * @access public + * @return void + */ + public function checkPasswordTest($params = array()) + { + $_POST = $params; + + $this->objectModel->checkPassword(); + unset($_POST); + + if(dao::isError()) + { + return dao::getError(); + } + else + { + return '无报错'; + } + } + + /** + * Identify user. + * + * @param string $account + * @param string $password + * @access public + * @return void + */ + public function identifyTest($account, $password) + { + $_POST = $params; + + $user = $this->objectModel->identify($account, $password); + unset($_POST); + + return $user; + } } diff --git a/test/model/user/batchcreate.php b/test/model/user/batchcreate.php index c9e471140c..6a11f8e31d 100644 --- a/test/model/user/batchcreate.php +++ b/test/model/user/batchcreate.php @@ -23,15 +23,14 @@ Visions为空的情况 >> 『版本类型』不能为空。 $user = new userTest(); $normalUser = array(); -$normalUser['account'] = array('newtestuser1', 'newtestuser2', 'newtestuser3'); -$normalUser['realname'] = array('新测试用户1', '新测试用户2', '新测试用户3'); -$normalUser['visions'] = array('rnd', 'rnd,lite', 'lite'); -$normalUser['role'] = array('qa', 'dev', 'pm'); -$normalUser['email'] = array('testasd@163.com', '', '11773@qq.com'); -$normalUser['password'] = array('e10adc3949ba59abbe56e057f20f883e', 'e10adc3949ba59abbe56e057f20f883e', 'e10adc3949ba59abbe56e057f20f883e'); +$normalUser['account'] = array(1 => 'newtestuser1', 2 => 'newtestuser2', 3 => 'newtestuser3'); +$normalUser['realname'] = array(1 => '新测试用户1', 2 => '新测试用户2', 3 => '新测试用户3'); +$normalUser['visions'] = array(1 => 'rnd', 2 => 'rnd,lite', 3 => 'lite'); +$normalUser['role'] = array(1 => 'qa', 2 => 'dev', 3 => 'pm'); +$normalUser['email'] = array(1 => 'testasd@163.com', 2 => '', 3 => '11773@qq.com'); +$normalUser['password'] = array(1 => 'e10adc3949ba59abbe56e057f20f883e', 2 => 'e10adc3949ba59abbe56e057f20f883e', 3 => 'e10adc3949ba59abbe56e057f20f883e'); -a($user->batchCreateUserTest($normalUser));die; - -r($user->batchCreateUserTest($normalUser)) && p('password1:0') && e('您的密码强度小于系统设定。'); //密码较弱的情况 +r($user->batchCreateUserTest($normalUser)) && p('0:account') && e('newtestuser1'); //获取插入的第一个用户的account +r($user->batchCreateUserTest($normalUser)) && p('2:realname') && e('新测试用户3'); //获取插入的最后一个用户的realname system("./ztest init"); diff --git a/test/model/user/batchedit.php b/test/model/user/batchedit.php new file mode 100644 index 0000000000..dc509eaf48 --- /dev/null +++ b/test/model/user/batchedit.php @@ -0,0 +1,36 @@ +#!/usr/bin/env php +batchEditTest(); +cid=1 +pid=1 + +密码较弱的情况 >> 您的密码强度小于系统设定。 +Visions为空的情况 >> 『版本类型』不能为空。 +用户名为空的情况 >> 『用户名』不能为空。 +用户名特殊的情况 >> 『用户名』只能是字母、数字或下划线的组合三位以上。 +两次密码不相同的情况 >> 两次密码应该相同。 +插入重复的用户名,返回报错信息 >> 『用户名』已经有『admin』这条记录了。如果您确定该记录已删除,请到后台-系统-数据-回收站还原。 +正常插入用户,返回新插入的ID、真实姓名 >> 1001,新的测试用户 +正常插入用户,返回新插入的真实姓名 >> 新的测试用户 + +*/ + +$user = new userTest(); +$normalUser = array(); +$normalUser['account'] = array(998 => 'newtestuser1', 999 => 'newtestuser2', 1000 => 'newtestuser3'); +$normalUser['realname'] = array(998 => '新测试用户1', 999 => '新测试用户2', 1000 => '新测试用户3'); +$normalUser['visions'] = array(998 => 'rnd', 999 => 'rnd,lite', 1000 => 'lite'); +$normalUser['role'] = array(998 => 'qa', 999 => 'dev', 1000 => 'pm'); +$normalUser['email'] = array(998 => 'testasd@163.com', 999 => '', 1000 => '11773@qq.com'); +$normalUser['password'] = array(998 => 'e10adc3949ba59abbe56e057f20f883e', 999 => 'e10adc3949ba59abbe56e057f20f883e', 1000 => 'e10adc3949ba59abbe56e057f20f883e'); + +r($user->batchEditUserTest($normalUser)) && p('998:account') && e('newtestuser1'); //获取编辑后的第一个用户的account +r($user->batchEditUserTest($normalUser)) && p('1000:realname') && e('新测试用户3'); //获取编辑的最后一个用户的真实姓名 + +system("./ztest init"); diff --git a/test/model/user/checkpassword.php b/test/model/user/checkpassword.php new file mode 100644 index 0000000000..63ae484b00 --- /dev/null +++ b/test/model/user/checkpassword.php @@ -0,0 +1,44 @@ +#!/usr/bin/env php +checkPasswordTest(); +cid=1 +pid=1 + +密码较弱的情况 >> 您的密码强度小于系统设定。 +Visions为空的情况 >> 『版本类型』不能为空。 +用户名为空的情况 >> 『用户名』不能为空。 +用户名特殊的情况 >> 『用户名』只能是字母、数字或下划线的组合三位以上。 +两次密码不相同的情况 >> 两次密码应该相同。 +插入重复的用户名,返回报错信息 >> 『用户名』已经有『admin』这条记录了。如果您确定该记录已删除,请到后台-系统-数据-回收站还原。 +正常插入用户,返回新插入的ID、真实姓名 >> 1001,新的测试用户 +正常插入用户,返回新插入的真实姓名 >> 新的测试用户 + +*/ + +$user = new userTest(); +$normalUser = array(); +$normalUser['password1'] = 'Adsd@#!%qaz'; +$normalUser['password2'] = 'Adsd@#!%qaz'; +$normalUser['passwordStrength'] = 1; + +$weakPassword = $normalUser; +$weakPassword['passwordStrength'] = '0'; + +$differentPassword = $normalUser; +$differentPassword['password2'] = '!@#!@#asfasf'; + +$simplePassword = $normalUser; +$simplePassword['password1'] = '123456'; +$simplePassword['password2'] = '123456'; + +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"); diff --git a/test/model/user/create.php b/test/model/user/create.php index 6457995041..1a8c0d5779 100644 --- a/test/model/user/create.php +++ b/test/model/user/create.php @@ -6,7 +6,7 @@ su('admin'); /** -title=userModel->createTest(); +title=userModel->createUserTest(); cid=1 pid=1 diff --git a/test/model/user/identify.php b/test/model/user/identify.php new file mode 100644 index 0000000000..22a47519e2 --- /dev/null +++ b/test/model/user/identify.php @@ -0,0 +1,18 @@ +#!/usr/bin/env php +identifyTest(); +cid=1 +pid=1 + +*/ + +$user = new userTest(); +$user->identifyTest('admin', '78302615c8b79cac8df6d2607f8a83ee'); + +system("./ztest init"); diff --git a/test/model/user/resetpassword.php b/test/model/user/resetpassword.php new file mode 100644 index 0000000000..ab0ec41dd5 --- /dev/null +++ b/test/model/user/resetpassword.php @@ -0,0 +1,45 @@ +#!/usr/bin/env php +resetPasswordTest(); +cid=1 +pid=1 + +密码较弱的情况 >> 您的密码强度小于系统设定。 +Visions为空的情况 >> 『版本类型』不能为空。 +用户名为空的情况 >> 『用户名』不能为空。 +用户名特殊的情况 >> 『用户名』只能是字母、数字或下划线的组合三位以上。 +两次密码不相同的情况 >> 两次密码应该相同。 +插入重复的用户名,返回报错信息 >> 『用户名』已经有『admin』这条记录了。如果您确定该记录已删除,请到后台-系统-数据-回收站还原。 +正常插入用户,返回新插入的ID、真实姓名 >> 1001,新的测试用户 +正常插入用户,返回新插入的真实姓名 >> 新的测试用户 + +*/ + +$user = new userTest(); +$normalUser = array(); +$normalUser['account'] = 'admin'; +$normalUser['password1'] = 'Adsd@#!%qaz'; +$normalUser['password2'] = 'Adsd@#!%qaz'; +$normalUser['passwordStrength'] = 1; + +$weakPassword = $normalUser; +$weakPassword['passwordStrength'] = 0; + +$differentPassword = $normalUser; +$differentPassword['password2'] = '!@#!@#asfasf'; + +$simplePassword = $normalUser; +$simplePassword['password1'] = '123456'; +$simplePassword['password2'] = '123456'; + +r($user->resetPasswordTest($normalUser)) && p('password') && e('367ef140036b0feb2f90d70d33255eea'); //重设用户密码,返回重设后的加密后的密码 +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"); diff --git a/test/model/user/update.php b/test/model/user/update.php new file mode 100644 index 0000000000..204a6d2718 --- /dev/null +++ b/test/model/user/update.php @@ -0,0 +1,47 @@ +#!/usr/bin/env php +updateUserTest(); +cid=1 +pid=1 + +密码较弱的情况 >> 您的密码强度小于系统设定。 +Visions为空的情况 >> 『版本类型』不能为空。 +用户名为空的情况 >> 『用户名』不能为空。 +用户名特殊的情况 >> 『用户名』只能是字母、数字或下划线的组合三位以上。 +两次密码不相同的情况 >> 两次密码应该相同。 +插入重复的用户名,返回报错信息 >> 『用户名』已经有『admin』这条记录了。如果您确定该记录已删除,请到后台-系统-数据-回收站还原。 +正常插入用户,返回新插入的ID、真实姓名 >> 1001,新的测试用户 +正常插入用户,返回新插入的真实姓名 >> 新的测试用户 + +*/ + +$user = new userTest(); +$normalUser = array(); +$normalUser['account'] = 'newtestuser4'; +$normalUser['realname'] = '新的测试用户'; +$normalUser['password1'] = 'e10adc3949ba59abbe56e057f20f883e'; +$normalUser['password2'] = 'e10adc3949ba59abbe56e057f20f883e'; +$normalUser['type'] = 'inside'; +$normalUser['passwordStrength'] = 1; +$normalUser['visions'] = 'rnd'; + +$existUser = $normalUser; +$existUser['account'] = 'adminasdasd'; + +$differentPassword = $normalUser; +$differentPassword['password2'] = 'asfjsdklj1234jkljsdklfj19'; + +$specialUser = $normalUser; +$specialUser['account'] = '!@#Asdsd中文'; + +r($user->updateUserTest(1000, $normalUser)) && p('account') && e('newtestuser4'); //编辑用户,返回新的用户名 +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"); diff --git a/test/model/user/updatepassword.php b/test/model/user/updatepassword.php new file mode 100644 index 0000000000..9e60a05a12 --- /dev/null +++ b/test/model/user/updatepassword.php @@ -0,0 +1,41 @@ +#!/usr/bin/env php +updatePasswordTest(); +cid=1 +pid=1 + +密码较弱的情况 >> 您的密码强度小于系统设定。 +Visions为空的情况 >> 『版本类型』不能为空。 +用户名为空的情况 >> 『用户名』不能为空。 +用户名特殊的情况 >> 『用户名』只能是字母、数字或下划线的组合三位以上。 +两次密码不相同的情况 >> 两次密码应该相同。 +插入重复的用户名,返回报错信息 >> 『用户名』已经有『admin』这条记录了。如果您确定该记录已删除,请到后台-系统-数据-回收站还原。 +正常插入用户,返回新插入的ID、真实姓名 >> 1001,新的测试用户 +正常插入用户,返回新插入的真实姓名 >> 新的测试用户 + +*/ + +$user = new userTest(); +$normalUser = array(); +$normalUser['originalPassword'] = 'e79f8fb9726857b212401e42e5b7e18b'; +$normalUser['password1'] = 'dcf859ce8dd8f998bdfe4ae6c22c329e'; +$normalUser['password2'] = 'dcf859ce8dd8f998bdfe4ae6c22c329e'; +$normalUser['passwordStrength'] = 1; + +$weakPassword = $normalUser; +$weakPassword['passwordStrength'] = 0; + +$differentPassword = $normalUser; +$differentPassword['password2'] = 'asdasfasf!@#!@#asfasf'; + +r($user->updatePasswordTest(1000, $normalUser)) && p('password') && e('dcf859ce8dd8f998bdfe4ae6c22c329e'); //编辑用户密码,返回编辑后的密码 +r($user->updatePasswordTest(1000, $differentPassword)) && p('password:0') && e('两次密码应该相同。'); //两次密码不相同的情况 +r($user->updatePasswordTest(1000, $weakPassword)) && p('password1:0') && e('您的密码强度小于系统设定。'); //密码小于设定强度的情况 + +system("./ztest init"); From 2550fd101ceb025c0e7ad87d3d2a335ad17347d5 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Tue, 15 Mar 2022 15:45:02 +0800 Subject: [PATCH 11/15] * Add auto test of task. --- test/class/task.class.php | 14 +++++++++++ test/data/zentao/processor.php | 2 +- test/model/task/needupdatebugstatus.php | 31 +++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 1 deletion(-) create mode 100755 test/model/task/needupdatebugstatus.php diff --git a/test/class/task.class.php b/test/class/task.class.php index aeb9ab0b64..4142395227 100644 --- a/test/class/task.class.php +++ b/test/class/task.class.php @@ -1029,4 +1029,18 @@ class taskTest return $object; } } + + public function needUpdateBugStatusTest($task) + { + $object = $this->objectModel->needUpdateBugStatus($task); + + if(dao::isError()) + { + return dao::getError(); + } + else + { + return $object ? 1 : 2; + } + } } diff --git a/test/data/zentao/processor.php b/test/data/zentao/processor.php index b6117543f9..26f11f7eb8 100644 --- a/test/data/zentao/processor.php +++ b/test/data/zentao/processor.php @@ -154,7 +154,7 @@ class Processor $parentID = implode(',', $parentIDList); $this->dao->update(TABLE_TASK)->set('parent')->eq(-1)->where('id')->in($parentID)->andWhere('deleted')->eq(0)->exec(); - $this->dao->update(TABLE_TASK)->set('assignedTo')->eq('po82')->set('mailto')->eq('user1,user2,user3')->where('id')->eq(1)->andWhere('deleted')->eq(0)->exec(); + $this->dao->update(TABLE_TASK)->set('assignedTo')->eq('po82')->set('mailto')->eq('user1,user2,user3')->set('frombug')->eq('1')->where('id')->eq(1)->andWhere('deleted')->eq(0)->exec(); } /** diff --git a/test/model/task/needupdatebugstatus.php b/test/model/task/needupdatebugstatus.php new file mode 100755 index 0000000000..a338ee30f7 --- /dev/null +++ b/test/model/task/needupdatebugstatus.php @@ -0,0 +1,31 @@ +#!/usr/bin/env php +needUpdateBugStatus(); +cid=1 +pid=1 + +计算不来源于bug的任务是否需要更新bug状态 >> 2 +计算来源于bug的任务是否需要更新bug状态 bug状态active >> 1 +计算来源于bug的任务是否需要更新bug状态 bug状态resolved >> 2 + +*/ + +$task1 = new stdclass(); +$task1->fromBug = 0; + +$task2 = new stdclass(); +$task2->fromBug = 1; + +$task3 = new stdclass(); +$task3->fromBug = 51; + +$task = new taskTest(); +r($task->needUpdateBugStatusTest($task1)) && p() && e('2'); //计算不来源于bug的任务是否需要更新bug状态 +r($task->needUpdateBugStatusTest($task2)) && p() && e('1'); //计算来源于bug的任务是否需要更新bug状态 bug状态active +r($task->needUpdateBugStatusTest($task3)) && p() && e('2'); //计算来源于bug的任务是否需要更新bug状态 bug状态resolved From 88230cd949ec07937a9350baa838829aa262feeb Mon Sep 17 00:00:00 2001 From: tanghucheng Date: Tue, 15 Mar 2022 15:49:25 +0800 Subject: [PATCH 12/15] * Fix bug #20779,20782,20783. --- extension/lite/execution/ext/model/lite.php | 2 +- extension/lite/user/ext/view/execution.html.php | 3 --- module/doc/lang/en.php | 1 + module/doc/lang/zh-cn.php | 1 + module/doc/model.php | 2 +- 5 files changed, 4 insertions(+), 5 deletions(-) diff --git a/extension/lite/execution/ext/model/lite.php b/extension/lite/execution/ext/model/lite.php index 3773fe3daa..c3d5f927f4 100644 --- a/extension/lite/execution/ext/model/lite.php +++ b/extension/lite/execution/ext/model/lite.php @@ -25,7 +25,7 @@ public function setMenu($executionID, $buildID = 0, $extra = '') $modulePageNav .= ""; diff --git a/extension/lite/user/ext/view/execution.html.php b/extension/lite/user/ext/view/execution.html.php index 6b6c8d08f8..fca1be387c 100644 --- a/extension/lite/user/ext/view/execution.html.php +++ b/extension/lite/user/ext/view/execution.html.php @@ -36,9 +36,6 @@ id);?> - maxVersion)):?> - user->executionTypeList, $execution->type);?> - name);?> delay)):?> diff --git a/module/doc/lang/en.php b/module/doc/lang/en.php index 9af7f23758..1f5c138078 100644 --- a/module/doc/lang/en.php +++ b/module/doc/lang/en.php @@ -89,6 +89,7 @@ $lang->doc->diffAction = 'Diff Document'; $lang->doc->sort = 'Rank Document'; $lang->doc->manageType = 'Manage Category'; $lang->doc->editType = 'Edit'; +$lang->doc->editChildType = 'Edit'; $lang->doc->deleteType = 'Delete'; $lang->doc->addType = 'Add'; $lang->doc->childType = 'Directory'; diff --git a/module/doc/lang/zh-cn.php b/module/doc/lang/zh-cn.php index 255a1f793f..f929a40d98 100644 --- a/module/doc/lang/zh-cn.php +++ b/module/doc/lang/zh-cn.php @@ -89,6 +89,7 @@ $lang->doc->diffAction = '对比文档'; $lang->doc->sort = '文档排序'; $lang->doc->manageType = '维护目录'; $lang->doc->editType = '编辑目录'; +$lang->doc->editChildType = '编辑子目录'; $lang->doc->deleteType = '删除目录'; $lang->doc->addType = '增加目录'; $lang->doc->childType = '子目录'; diff --git a/module/doc/model.php b/module/doc/model.php index c6befca2f6..4bd060690e 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -2475,7 +2475,7 @@ EOT; { $li .= "
"; if(common::hasPriv('tree', 'edit')) $li .= html::a(helper::createLink('tree', 'edit', "module=$module->id&type=doc"), "", '', "data-toggle='modal' title={$this->lang->doc->editType}"); - if(common::hasPriv('tree', 'browse')) $li .= html::a(helper::createLink('tree', 'browse', "rootID=$libID&type=doc&module=$module->id", '', 1), "", '', "class='iframe' title={$this->lang->doc->editType}"); + if(common::hasPriv('tree', 'browse')) $li .= html::a(helper::createLink('tree', 'browse', "rootID=$libID&type=doc&module=$module->id", '', 1), "", '', "class='iframe' title={$this->lang->doc->editChildType}"); $li .= '
'; } $li .= ''; From 72095bf38ae81ede74ccff7cf086b4e20edabad8 Mon Sep 17 00:00:00 2001 From: tanghucheng Date: Tue, 15 Mar 2022 16:31:27 +0800 Subject: [PATCH 13/15] * Fix bug #20803. --- module/user/view/story.html.php | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/module/user/view/story.html.php b/module/user/view/story.html.php index c19414a157..e1827571b2 100644 --- a/module/user/view/story.html.php +++ b/module/user/view/story.html.php @@ -41,21 +41,23 @@ id}&storyType=$storyType&type=$type&orderBy=%s&recTotal={$pager->recTotal}&recPerPage={$pager->recPerPage}&pageID={$pager->pageID}"; ?> - idAB);?> - priAB);?> + idAB);?> + priAB);?> config->vision == 'lite'):?> - story->project);?> + story->project);?> - story->product);?> + story->product);?> story->title);?> config->vision != 'lite'):?> - story->plan);?> + story->plan);?> + + openedByAB);?> + story->estimateAB);?> + statusAB);?> + config->vision != 'lite'):?> + story->stageAB);?> - openedByAB);?> - story->estimateAB);?> - statusAB);?> - story->stageAB);?> @@ -72,7 +74,9 @@ openedBy);?> estimate . $config->hourUnit;?> processStatus('story', $story);?> + config->vision != 'lite'):?> story->stageList[$story->stage];?> + From d8f9da553f58106eb5def16594acbf8b66a929a8 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Tue, 15 Mar 2022 16:54:32 +0800 Subject: [PATCH 14/15] * Add function annotations. --- test/class/task.class.php | 401 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 401 insertions(+) diff --git a/test/class/task.class.php b/test/class/task.class.php index 4142395227..7a0e7ed53b 100644 --- a/test/class/task.class.php +++ b/test/class/task.class.php @@ -8,6 +8,14 @@ class taskTest $this->objectModel = $tester->loadModel('task'); } + /** + * Test create a task. + * + * @param array $param + * @param int $executionID + * @access public + * @return object + */ public function createObject($param = array(), $executionID = '') { $assignedTo = array(''); @@ -39,6 +47,14 @@ class taskTest } } + /** + * Test update a task. + * + * @param int $objectID + * @param array $param + * @access public + * @return array|string + */ public function updateObject($objectID, $param = array()) { global $tester; @@ -70,6 +86,14 @@ class taskTest } } + /** + * Test batch create tasks. + * + * @param array $param + * @param int $executionID + * @access public + * @return object + */ public function batchCreateObject($param = array(), $executionID = '') { $modul = array('','',''); @@ -110,6 +134,14 @@ class taskTest } } + /** + * Test batch update tasks. + * + * @param array $param + * @param int $taskID + * @access public + * @return array + */ public function batchUpdateObject($param = array(), $taskID = '') { $taskIDList = array($taskID => $taskID); @@ -149,6 +181,14 @@ class taskTest } } + /** + * Test batch change module. + * + * @param array $taskIDList + * @param int $moduleID + * @access public + * @return array + */ public function batchChangeModuleTest($taskIDList, $moduleID) { $object = $this->objectModel->batchChangeModule($taskIDList, $moduleID); @@ -180,6 +220,14 @@ class taskTest } } + /** + * Test record estimate and left of task. + * + * @param int $taskID + * @param array $param + * @access public + * @return array + */ public function recordEstimateTest($taskID, $param = array()) { $todate = date("Y-m-d"); @@ -203,6 +251,14 @@ class taskTest } } + /** + * Test activate a task. + * + * @param int $taskID + * @param array $param + * @access public + * @return array + */ public function activateTest($taskID, $param = array()) { $createFields = array('status' => 'doing', 'comment' => '单元测试','assignedTo' => '', 'left' => '3'); @@ -221,6 +277,14 @@ class taskTest } } + /** + * Test assign a task to a user again. + * + * @param int $taskID + * @param array $param + * @access public + * @return array + */ public function assignTest($taskID, $param = array()) { $createFields = array('assignedTo' => '', 'status' => '', 'comment' => ''); @@ -238,6 +302,14 @@ class taskTest } } + /** + * Test cancel a task. + * + * @param int $taskID + * @param array $param + * @access public + * @return array + */ public function cancelTest($taskID, $param = array()) { $createFields = array('status' => 'cancel', 'comment' => '单元测试'); @@ -256,6 +328,14 @@ class taskTest } } + /** + * Test close a task. + * + * @param int $taskID + * @param array $param + * @access public + * @return array + */ public function closeTest($taskID, $param = array()) { $createFields = array('status' => 'closed', 'comment' => '单元测试'); @@ -274,6 +354,14 @@ class taskTest } } + /** + * Test finish a task. + * + * @param int $taskID + * @param array $param + * @access public + * @return array + */ public function finishTest($taskID, $param = array()) { $todate = date("Y-m-d h:i:s"); @@ -295,6 +383,13 @@ class taskTest } } + /** + * Test get task info by Id. + * + * @param int $taskID + * @access public + * @return object + */ public function getByIdTest($taskID) { $object = $this->objectModel->getById($taskID); @@ -309,6 +404,13 @@ class taskTest } } + /** + * Test get task info by Id List. + * + * @param int|array|string $taskID + * @access public + * @return array + */ public function getByListTest($taskID) { $object = $this->objectModel->getByList($taskID); @@ -323,6 +425,13 @@ class taskTest } } + /** + * Test get execution tasks pairs.. + * + * @param int $executionID + * @access public + * @return array + */ public function getExecutionTaskPairsTest($executionID) { $object = $this->objectModel->getExecutionTaskPairs($executionID); @@ -337,6 +446,13 @@ class taskTest } } + /** + * Test get tasks of a execution. + * + * @param int $executionID + * @access public + * @return array + */ public function getExecutionTasksTest($executionID,$count) { $object = $this->objectModel->getExecutionTasks($executionID); @@ -355,6 +471,15 @@ class taskTest } } + /** + * Test get tasks list of a execution. + * + * @param int $executionID + * @param array $moduleIdList + * @param int $count + * @access public + * @return array + */ public function getTasksByModuleTest($executionID, $moduleIdList, $count) { $object = $this->objectModel->getTasksByModule($executionID, $moduleIdList); @@ -373,6 +498,14 @@ class taskTest } } + /** + * Test get tasks of a user. + * + * @param int $taskID + * @param string $assignedTo + * @access public + * @return array + */ public function getUserTasksTest($taskID, $assignedTo) { $createFields = array('assignedTo' => $assignedTo, 'status' => 'doing', 'comment' => ''); @@ -390,6 +523,14 @@ class taskTest } } + /** + * Test pause a task. + * + * @param int $taskID + * @param array $param + * @access public + * @return array + */ public function pauseTest($taskID, $param = array()) { $createFields = array('status' => 'pause', 'comment' => '单元测试'); @@ -408,6 +549,14 @@ class taskTest } } + /** + * Test get tasks pairs of a user. + * + * @param int $taskID + * @param string $assignedTo + * @access public + * @return array + */ public function getUserTaskPairsTest($taskID, $assignedTo) { $createFields = array('assignedTo' => $assignedTo, 'status' => 'doing', 'comment' => ''); @@ -425,6 +574,14 @@ class taskTest } } + /** + * Test get suspended tasks of a user. + * + * @param int $taskID + * @param string $assignedTo + * @access public + * @return array + */ public function getUserSuspendedTasksTest($taskID, $assignedTo) { $createFields = array('assignedTo' => $assignedTo, 'status' => 'doing', 'comment' => ''); @@ -442,6 +599,14 @@ class taskTest } } + /** + * Test get task pairs of a story. + * + * @param int $storyID + * @param int $count + * @access public + * @return array + */ public function getStoryTasksTest($storyID, $count) { $object = $this->objectModel->getStoryTasks($storyID); @@ -460,6 +625,13 @@ class taskTest } } + /** + * Test get counts of some stories' tasks. + * + * @param array $storyIDList + * @access public + * @return int + */ public function getStoryTaskCountsTest($storyIDList) { $object = $this->objectModel->getStoryTaskCounts($storyIDList); @@ -474,6 +646,13 @@ class taskTest } } + /** + * Test get task estimate. + * + * @param int $taskID + * @access public + * @return object + */ public function getTaskEstimateTest($taskID) { $object = $this->objectModel->getTaskEstimate($taskID); @@ -488,6 +667,13 @@ class taskTest } } + /** + * Test get estimate by id. + * + * @param int $estimateID + * @access public + * @return object + */ public function getEstimateByIdTest($estimateID) { $object = $this->objectModel->getEstimateById($estimateID); @@ -502,6 +688,14 @@ class taskTest } } + /** + * Test update estimate. + * + * @param int $estimateID + * @param array $param + * @access public + * @return array + */ public function updateEstimateTest($estimateID, $param = array()) { $createFields = array('date' => '0000-00-00', 'consumed' => '1', 'left' => '1', 'work' => '这里是工作内容1'); @@ -519,6 +713,13 @@ class taskTest } } + /** + * Test delete estimate. + * + * @param int $estimateID + * @access public + * @return array + */ public function deleteEstimateTest($estimateID) { $object = $this->objectModel->deleteEstimate($estimateID); @@ -533,6 +734,14 @@ class taskTest } } + /** + * Test create task from gitlab issue. + * + * @param array $task + * @param int $executionID + * @access public + * @return int + */ public function createTaskFromGitlabIssueTest($task, $executionID) { $objectID = $this->objectModel->createTaskFromGitlabIssue($task, $executionID); @@ -548,6 +757,13 @@ class taskTest } } + /** + * Test get project id by execution id. + * + * @param int $executionID + * @access public + * @return array + */ public function getProjectIDTest($executionID) { $object = $this->objectModel->getProjectID($executionID); @@ -562,6 +778,13 @@ class taskTest } } + /** + * Test get story comments. + * + * @param int $storyID + * @access public + * @return array + */ public function getStoryCommentsTest($storyID) { $object = $this->objectModel->getStoryComments($storyID); @@ -576,6 +799,13 @@ class taskTest } } + /** + * Test compute parent task working hours. + * + * @param int $taskID + * @access public + * @return object + */ public function computeWorkingHoursTest($taskID) { $result = $this->objectModel->computeWorkingHours($taskID); @@ -592,6 +822,13 @@ class taskTest } } + /** + * Test compute begin and end for parent task. + * + * @param int $taskID + * @access public + * @return array + */ public function computeBeginAndEndTest($taskID) { $result = $this->objectModel->computeBeginAndEnd($taskID); @@ -615,6 +852,16 @@ class taskTest } } + /** + * Test compute hours for multiple task. + * + * @param object $oldTask + * @param object $task + * @param array $team + * @param bool $autoStatus + * @access public + * @return array + */ public function computeHours4MultipleTest($oldTask, $task = null, $team = array(), $autoStatus = true) { $result = $this->objectModel->computeHours4Multiple($oldTask, $task, $team, $autoStatus); @@ -645,6 +892,13 @@ class taskTest } } + /** + * Test process a task, judge it's status. + * + * @param object $task + * @access public + * @return object + */ public function processTaskTest($task) { $task->deadline = $task->deadline == '-1day' ? date('Y-m-d',strtotime('-1 day')) : date('Y-m-d',strtotime('+1 day')); @@ -660,6 +914,13 @@ class taskTest } } + /** + * Test batch process tasks. + * + * @param int $executionID + * @access public + * @return array + */ public function processTasksTest($executionID) { global $tester; @@ -699,6 +960,14 @@ class taskTest } } + /** + * Test process data for report. + * + * @param bool $children + * @param array $field + * @access public + * @return array + */ public function processData4ReportTest($children, $field) { global $tester; @@ -747,6 +1016,12 @@ class taskTest } } + /** + * Test get report data of tasks per execution. + * + * @access public + * @return array + */ public function getDataOfTasksPerExecutionTest() { $object = $this->objectModel->getDataOfTasksPerExecution(); @@ -761,6 +1036,12 @@ class taskTest } } + /** + * Test get report data of tasks per module. + * + * @access public + * @return array + */ public function getDataOfTasksPerModuleTest() { $object = $this->objectModel->getDataOfTasksPerModule(); @@ -775,6 +1056,12 @@ class taskTest } } + /** + * Test get report data of tasks per assignedto. + * + * @access public + * @return array + */ public function getDataOfTasksPerAssignedToTest() { $object = $this->objectModel->getDataOfTasksPerAssignedTo(); @@ -789,6 +1076,12 @@ class taskTest } } + /** + * Test get report data of tasks per type. + * + * @access public + * @return array + */ public function getDataOfTasksPerTypeTest() { $object = $this->objectModel->getDataOfTasksPerType(); @@ -803,6 +1096,12 @@ class taskTest } } + /** + * Test get report data of tasks per priority. + * + * @access public + * @return array + */ public function getDataOfTasksPerPriTest() { $object = $this->objectModel->getDataOfTasksPerPri(); @@ -817,6 +1116,12 @@ class taskTest } } + /** + * Test get report data of tasks per deadline. + * + * @access public + * @return array + */ public function getDataOfTasksPerDeadlineTest($dateID) { $dateList = array(date('Y-m-d',strtotime('+1 day')), date('Y-m-d',strtotime('+2 day')), date('Y-m-d',strtotime('+3 day')), date('Y-m-d',strtotime('+4 day')), date('Y-m-d',strtotime('-1 day')), date('Y-m-d',strtotime('-2 day')), date('Y-m-d',strtotime('-3 day')), date('Y-m-d',strtotime('-4 day'))); @@ -832,6 +1137,12 @@ class taskTest } } + /** + * Test get report data of tasks per estimate. + * + * @access public + * @return array + */ public function getDataOfTasksPerEstimateTest() { $object = $this->objectModel->getDataOfTasksPerEstimate(); @@ -846,6 +1157,12 @@ class taskTest } } + /** + * Test get report data of tasks per left. + * + * @access public + * @return array + */ public function getDataOfTasksPerLeftTest() { $object = $this->objectModel->getDataOfTasksPerLeft(); @@ -860,6 +1177,12 @@ class taskTest } } + /** + * Test get report data of tasks per consumed. + * + * @access public + * @return array + */ public function getDataOfTasksPerConsumedTest() { $object = $this->objectModel->getDataOfTasksPerConsumed(); @@ -874,6 +1197,12 @@ class taskTest } } + /** + * Test get report data of tasks per finishedBy. + * + * @access public + * @return array + */ public function getDataOfTasksPerFinishedByTest() { $object = $this->objectModel->getDataOfTasksPerFinishedBy(); @@ -888,6 +1217,12 @@ class taskTest } } + /** + * Test get report data of tasks per closed reason. + * + * @access public + * @return array + */ public function getDataOfTasksPerClosedReasonTest() { $object = $this->objectModel->getDataOfTasksPerClosedReason(); @@ -902,6 +1237,12 @@ class taskTest } } + /** + * Test get report data of finished tasks per day. + * + * @access public + * @return array + */ public function getDataOffinishedTasksPerDayTest() { $object = $this->objectModel->getDataOffinishedTasksPerDay(); @@ -916,6 +1257,12 @@ class taskTest } } + /** + * Test get report data of tasks per status. + * + * @access public + * @return array + */ public function getDataOfTasksPerStatusTest() { $object = $this->objectModel->getDataOfTasksPerStatus(); @@ -930,6 +1277,15 @@ class taskTest } } + /** + * Test update parent status by taskID. + * + * @param int $taskID + * @param int $parentID + * @param bool $createAction + * @access public + * @return object + */ public function updateParentStatusTest($taskID, $parentID = 0, $createAction = true) { $object = $this->objectModel->updateParentStatus($taskID, $parentID, $createAction); @@ -945,6 +1301,14 @@ class taskTest } } + /** + * Test judge an action is clickable or not. + * + * @param object $task + * @param string $action + * @access public + * @return int + */ public function isClickableTest($task, $action) { $object = $this->objectModel->isClickable($task, $action); @@ -959,6 +1323,13 @@ class taskTest } } + /** + * Test add task estimate. + * + * @param object $data + * @access public + * @return object + */ public function addTaskEstimateTest($data) { $data->date = date("Y-m-d"); @@ -978,6 +1349,14 @@ class taskTest } } + /** + * Test get toList and ccList. + * + * @param int $taskID + * @param bool $skipMailto + * @access public + * @return array + */ public function getToAndCcListTest($taskID, $skipMailto = false) { $task = $this->objectModel->getByID($taskID); @@ -998,6 +1377,14 @@ class taskTest } } + /** + * Test get next user. + * + * @param array $users + * @param string $current + * @access public + * @return string + */ public function getNextUserTest($users, $current) { $object = $this->objectModel->getNextUser($users, $current); @@ -1012,6 +1399,13 @@ class taskTest } } + /** + * Test get task's team member pairs. + * + * @param int $taskID + * @access public + * @return array + */ public function getMemberPairsTest($taskID) { $task = $this->objectModel->getByID($taskID); @@ -1030,6 +1424,13 @@ class taskTest } } + /** + * Test check whether need update status of bug. + * + * @param object $task + * @access public + * @return int + */ public function needUpdateBugStatusTest($task) { $object = $this->objectModel->needUpdateBugStatus($task); From 0fecbc4834a2c7c3209942646336d7220f88e116 Mon Sep 17 00:00:00 2001 From: liyang <“liyang@easycorp.ltd”> Date: Tue, 15 Mar 2022 17:13:16 +0800 Subject: [PATCH 15/15] add execution test --- test/class/execution.class.php | 233 ++++++++++++++++++- test/model/execution/fixFirst.php | 2 +- test/model/execution/fixOrder.php | 23 ++ test/model/execution/getDateList.php | 32 +++ test/model/execution/getKanbanColorList.php | 26 +++ test/model/execution/getKanbanColumns.php | 26 +++ test/model/execution/getKanbanGroupData.php | 32 +++ test/model/execution/getKanbanSetting.php | 26 +++ test/model/execution/getKanbanStatusList.php | 26 +++ test/model/execution/getKanbanStatusMap.php | 27 +++ test/model/execution/getKanbanTasks.php | 31 +++ test/model/execution/getTotalEstimate.php | 28 +++ test/model/execution/isClickable.php | 58 +++++ test/model/execution/processBurnData.php | 32 +++ test/model/execution/summary.php | 27 +++ 15 files changed, 623 insertions(+), 6 deletions(-) create mode 100755 test/model/execution/fixOrder.php create mode 100755 test/model/execution/getDateList.php create mode 100755 test/model/execution/getKanbanColorList.php create mode 100755 test/model/execution/getKanbanColumns.php create mode 100755 test/model/execution/getKanbanGroupData.php create mode 100755 test/model/execution/getKanbanSetting.php create mode 100755 test/model/execution/getKanbanStatusList.php create mode 100755 test/model/execution/getKanbanStatusMap.php create mode 100755 test/model/execution/getKanbanTasks.php create mode 100755 test/model/execution/getTotalEstimate.php create mode 100755 test/model/execution/isClickable.php create mode 100755 test/model/execution/processBurnData.php create mode 100755 test/model/execution/summary.php diff --git a/test/class/execution.class.php b/test/class/execution.class.php index 0bb079d5ac..5dfe58cbeb 100644 --- a/test/class/execution.class.php +++ b/test/class/execution.class.php @@ -1012,7 +1012,7 @@ class executionTest } } - public function fixFirstTest($executionID, $count, $param = array()) + public function fixFirstTest($executionID, $param = array()) { global $tester; $date = date('Y-m-d'); @@ -1028,10 +1028,6 @@ class executionTest $error = dao::getError(); return $error; } - elseif($count == "1") - { - return count($object); - } else { if(empty($object)) @@ -1062,4 +1058,231 @@ class executionTest return $object; } } + + public function processBurnDataTest($executionID, $itemCounts, $begin, $end, $count) + { + global $tester; + $sets = $tester->dao->select('execution, `date` as name, `left` as value')->from(TABLE_BURN)->where('execution')->eq($executionID)->fetchAll('name'); + $object = $this->objectModel->processBurnData($sets, $itemCounts, $begin, $end); + if(dao::isError()) + { + $error = dao::getError(); + return $error; + } + elseif($count == "1") + { + return count($object); + } + else + { + return $object; + } + } + + public function summaryTest($executionID) + { + global $tester; + $execution = $tester->dbh->query("select * from zt_project where id = $executionID")->fetch(); + $executions = array($executionID => $execution->name); + $page = 'NULL'; + $tasks = $this->objectModel->getTasks('0', $executionID, $executions,'all', '0', '0', 'status,id_desc', $page); + $object = $this->objectModel->summary($tasks); + if(dao::isError()) + { + $error = dao::getError(); + return $error[0]; + } + else + { + return $object; + } + } + + public function isClickableTest($execution, $action) + { + $object = $this->objectModel->isClickable($execution, $action); + if(dao::isError()) + { + $error = dao::getError(); + return $error[0]; + } + else + { + if($object == true) + { + return "检查通过"; + } + else + { + return "检查不通过"; + } + } + } + + public function getDateListTest($begin, $end, $type, $count, $interval = 0) + { + $object = $this->objectModel->getDateList($begin, $end, $type, $interval); + if(dao::isError()) + { + $error = dao::getError(); + return $error[0]; + } + elseif($count == "1") + { + return count($object[0]); + } + else + { + if(empty($object[0])) + { + return '无数据'; + } + else + { + return $object; + } + } + } + + public function getTotalEstimateTest($executionID) + { + $object = $this->objectModel->getTotalEstimate($executionID); + if(dao::isError()) + { + $error = dao::getError(); + return $error[0]; + } + else + { + return $object; + } + } + + public function fixOrderTest() + { + global $tester; + $this->objectModel->fixOrder(); + $object = $tester->dao->select('id,`order`')->from(TABLE_EXECUTION)->fetchAll('id'); + if(dao::isError()) + { + $error = dao::getError(); + return $error; + } + else + { + return $object; + } + } + + public function getKanbanTasksTest($executionID, $count) + { + $object = $this->objectModel->getKanbanTasks($executionID); + if(dao::isError()) + { + $error = dao::getError(); + return $error; + } + elseif($count == 1) + { + return count($object); + } + else + { + return $object; + } + } + + public function getKanbanSettingTest($count) + { + $object = $this->objectModel->getKanbanSetting(); + if(dao::isError()) + { + $error = dao::getError(); + return $error; + } + elseif($count == 1) + { + return count($object->colorList); + } + else + { + return $object; + } + } + + public function getKanbanColumnsTest($count) + { + $kanbanSetting = $this->objectModel->getKanbanSetting(); + $object = $this->objectModel->getKanbanColumns($kanbanSetting); + if(dao::isError()) + { + $error = dao::getError(); + return $error; + } + elseif($count == 1) + { + return count($object); + } + else + { + return $object; + } + } + + public function getKanbanStatusMapTest($count) + { + $kanbanSetting = $this->objectModel->getKanbanSetting(); + $object = $this->objectModel->getKanbanStatusMap($kanbanSetting); + if(dao::isError()) + { + $error = dao::getError(); + return $error; + } + elseif($count == 1) + { + return count($object); + } + else + { + return $object; + } + } + + public function getKanbanStatusListTest($count) + { + $kanbanSetting = $this->objectModel->getKanbanSetting(); + $object = $this->objectModel->getKanbanStatusList($kanbanSetting); + if(dao::isError()) + { + $error = dao::getError(); + return $error; + } + elseif($count == 1) + { + return count($object); + } + else + { + return $object; + } + } + + public function getKanbanColorListTest($count) + { + $kanbanSetting = $this->objectModel->getKanbanSetting(); + $object = $this->objectModel->getKanbanColorList($kanbanSetting); + if(dao::isError()) + { + $error = dao::getError(); + return $error; + } + elseif($count == 1) + { + return count($object); + } + else + { + return $object; + } + } } diff --git a/test/model/execution/fixFirst.php b/test/model/execution/fixFirst.php index 9f83aab0e9..a05e4fb500 100755 --- a/test/model/execution/fixFirst.php +++ b/test/model/execution/fixFirst.php @@ -26,6 +26,6 @@ $withLeft = array('estimate' => '21', 'withLeft' => '1'); $waterfallEstimate = array('estimate' => '17', 'withLeft' => '1'); $execution = new executionTest(); -r($execution->fixFirstTest($executionIDList[0], $scrumEstimate)) && p('0:estimate') && e('26'); // 敏捷执行更新首日工时 +r($execution->fixFirstTest($executionIDList[0], $scrumEstimate)) && p('0:estimate') && e('26'); // 不传入withLeft r($execution->fixFirstTest($executionIDList[0], $withLeft)) && p('0:estimate') && e('26'); // 敏捷执行更新首日剩余工时 r($execution->fixFirstTest($executionIDList[1], $waterfallEstimate)) && p('0:left') && e('17'); // 瀑布执行更新首日剩余工时 diff --git a/test/model/execution/fixOrder.php b/test/model/execution/fixOrder.php new file mode 100755 index 0000000000..1f9faa817e --- /dev/null +++ b/test/model/execution/fixOrder.php @@ -0,0 +1,23 @@ +#!/usr/bin/env php +fixOrderTest(); +cid=1 +pid=1 + +敏捷执行关联用例 >> 101,1,1 +瀑布执行关联用例 >> 131,43,169 +看板执行关联用例 >> 161,68,269 +敏捷执行关联用例统计 >> 4 +瀑布执行关联用例统计 >> 4 +看板执行关联用例统计 >> 4 + +*/ + +$execution = new executionTest(); +r($execution->fixOrderTest()) && p('101:order') && e('15'); // 重置order diff --git a/test/model/execution/getDateList.php b/test/model/execution/getDateList.php new file mode 100755 index 0000000000..e688970eb3 --- /dev/null +++ b/test/model/execution/getDateList.php @@ -0,0 +1,32 @@ +#!/usr/bin/env php +getDateListTest(); +cid=1 +pid=1 + +敏捷执行关联用例 >> 101,1,1 +瀑布执行关联用例 >> 131,43,169 +看板执行关联用例 >> 161,68,269 +敏捷执行关联用例统计 >> 4 +瀑布执行关联用例统计 >> 4 +看板执行关联用例统计 >> 4 + +*/ + +$start = array('2022-01-01', '2025-01-01'); +$end = array('2022-01-07', '2025-01-07'); +$count = array('0', '1'); +$type = array('noweekend', 'week'); + +$execution = new executionTest(); +r($execution->getDateListTest($start[0], $end[0], $type[0] ,$count[0])) && p('0:0') && e('01/03/2022'); // 去除工作日日期列表 +r($execution->getDateListTest($start[0], $end[0], $type[0] ,$count[1])) && p() && e('5'); // 去除工作日日期列表统计 +r($execution->getDateListTest($start[0], $end[0], $type[1] ,$count[0])) && p('0:0') && e('01/01/2022'); // 未去除工作日日期列表 +r($execution->getDateListTest($start[0], $end[0], $type[1] ,$count[1])) && p() && e('7'); // 未去除工作日日期列表统计 +r($execution->getDateListTest($start[1], $end[0], $type[1] ,$count[0])) && p() && e('无数据'); // 日期输入错误查询 diff --git a/test/model/execution/getKanbanColorList.php b/test/model/execution/getKanbanColorList.php new file mode 100755 index 0000000000..77762eb997 --- /dev/null +++ b/test/model/execution/getKanbanColorList.php @@ -0,0 +1,26 @@ +#!/usr/bin/env php +getKanbanColorListTest(); +cid=1 +pid=1 + +敏捷执行关联用例 >> 101,1,1 +瀑布执行关联用例 >> 131,43,169 +看板执行关联用例 >> 161,68,269 +敏捷执行关联用例统计 >> 4 +瀑布执行关联用例统计 >> 4 +看板执行关联用例统计 >> 4 + +*/ + +$count = array('0', '1'); + +$execution = new executionTest(); +r($execution->getKanbanColorListTest($count[0])) && p('wait') && e('#7EC5FF'); // 看板状态颜色查询 +r($execution->getKanbanColorListTest($count[1])) && p() && e('6'); // 看板状态颜色数量统计 diff --git a/test/model/execution/getKanbanColumns.php b/test/model/execution/getKanbanColumns.php new file mode 100755 index 0000000000..1867f63bf1 --- /dev/null +++ b/test/model/execution/getKanbanColumns.php @@ -0,0 +1,26 @@ +#!/usr/bin/env php +getKanbanColumnsTest(); +cid=1 +pid=1 + +敏捷执行关联用例 >> 101,1,1 +瀑布执行关联用例 >> 131,43,169 +看板执行关联用例 >> 161,68,269 +敏捷执行关联用例统计 >> 4 +瀑布执行关联用例统计 >> 4 +看板执行关联用例统计 >> 4 + +*/ + +$count = array('0', '1'); + +$execution = new executionTest(); +r($execution->getKanbanColumnsTest($count[0])[0]) && p() && e('wait'); // 看板列查询 +r($execution->getKanbanColumnsTest($count[1])) && p() && e('6'); // 看板列查询统计 diff --git a/test/model/execution/getKanbanGroupData.php b/test/model/execution/getKanbanGroupData.php new file mode 100755 index 0000000000..be6944fd1f --- /dev/null +++ b/test/model/execution/getKanbanGroupData.php @@ -0,0 +1,32 @@ +#!/usr/bin/env php +getKanbanGroupDataTest(); +cid=1 +pid=1 + +敏捷执行关联用例 >> 101,1,1 +瀑布执行关联用例 >> 131,43,169 +看板执行关联用例 >> 161,68,269 +敏捷执行关联用例统计 >> 4 +瀑布执行关联用例统计 >> 4 +看板执行关联用例统计 >> 4 + +*/ + +$executionIDList = array('101', '131', '161'); +$count = array('0', '1'); + +$execution = new executionTest(); +var_dump($execution->getKanbanGroupDataTest($executionIDList[0], $count[0]));die; +r($execution->getKanbanGroupDataTest($executionIDList[0], $count[0])) && p('906:name,execution') && e('子任务6,101'); // 敏捷执行查询 +r($execution->getKanbanGroupDataTest($executionIDList[1], $count[0])) && p('693:name,execution') && e('更多任务93,131'); // 瀑布执行查询 +r($execution->getKanbanGroupDataTest($executionIDList[2], $count[0])) && p('61:name,execution') && e('开发任务71,161'); // 看板执行查询 +r($execution->getKanbanGroupDataTest($executionIDList[0], $count[1])) && p() && e('11'); // 敏捷执行查询统计 +r($execution->getKanbanGroupDataTest($executionIDList[1], $count[1])) && p() && e('4'); // 瀑布执行查询统计 +r($execution->getKanbanGroupDataTest($executionIDList[2], $count[1])) && p() && e('4'); // 看板执行查询统计 diff --git a/test/model/execution/getKanbanSetting.php b/test/model/execution/getKanbanSetting.php new file mode 100755 index 0000000000..39b11ee23a --- /dev/null +++ b/test/model/execution/getKanbanSetting.php @@ -0,0 +1,26 @@ +#!/usr/bin/env php +getKanbanSettingTest(); +cid=1 +pid=1 + +敏捷执行关联用例 >> 101,1,1 +瀑布执行关联用例 >> 131,43,169 +看板执行关联用例 >> 161,68,269 +敏捷执行关联用例统计 >> 4 +瀑布执行关联用例统计 >> 4 +看板执行关联用例统计 >> 4 + +*/ + +$count = array('0', '1'); + +$execution = new executionTest(); +r($execution->getKanbanSettingTest($count[0])) && p('colorList:wait') && e('#7EC5FF'); // 看板设置查询 +r($execution->getKanbanSettingTest($count[1])) && p() && e('6'); // 看板设置查询统计 diff --git a/test/model/execution/getKanbanStatusList.php b/test/model/execution/getKanbanStatusList.php new file mode 100755 index 0000000000..228ac14a0a --- /dev/null +++ b/test/model/execution/getKanbanStatusList.php @@ -0,0 +1,26 @@ +#!/usr/bin/env php +getKanbanStatusListTest(); +cid=1 +pid=1 + +敏捷执行关联用例 >> 101,1,1 +瀑布执行关联用例 >> 131,43,169 +看板执行关联用例 >> 161,68,269 +敏捷执行关联用例统计 >> 4 +瀑布执行关联用例统计 >> 4 +看板执行关联用例统计 >> 4 + +*/ + +$count = array('0', '1'); + +$execution = new executionTest(); +r($execution->getKanbanStatusListTest($count[0])) && p('wait') && e('未开始');// 看板状态列表查询 +r($execution->getKanbanStatusListTest($count[1])) && p() && e('7'); // 看板状态列表数量统计 diff --git a/test/model/execution/getKanbanStatusMap.php b/test/model/execution/getKanbanStatusMap.php new file mode 100755 index 0000000000..25758d862e --- /dev/null +++ b/test/model/execution/getKanbanStatusMap.php @@ -0,0 +1,27 @@ +#!/usr/bin/env php +getKanbanStatusMapTest(); +cid=1 +pid=1 + +敏捷执行关联用例 >> 101,1,1 +瀑布执行关联用例 >> 131,43,169 +看板执行关联用例 >> 161,68,269 +敏捷执行关联用例统计 >> 4 +瀑布执行关联用例统计 >> 4 +看板执行关联用例统计 >> 4 + +*/ + +$count = array('0', '1'); + +$execution = new executionTest(); +r($execution->getKanbanStatusMapTest($count[0])["task"]) && p('wait:doing') && e('start'); // 看板tesk查询 +r($execution->getKanbanStatusMapTest($count[0])["bug"]) && p('wait:done') && e('resolve'); // 看板bug查询 +r($execution->getKanbanStatusMapTest($count[1])) && p() && e('2'); // 看板统计 diff --git a/test/model/execution/getKanbanTasks.php b/test/model/execution/getKanbanTasks.php new file mode 100755 index 0000000000..6708a867c6 --- /dev/null +++ b/test/model/execution/getKanbanTasks.php @@ -0,0 +1,31 @@ +#!/usr/bin/env php +getKanbanTasksTest(); +cid=1 +pid=1 + +敏捷执行关联用例 >> 101,1,1 +瀑布执行关联用例 >> 131,43,169 +看板执行关联用例 >> 161,68,269 +敏捷执行关联用例统计 >> 4 +瀑布执行关联用例统计 >> 4 +看板执行关联用例统计 >> 4 + +*/ + +$executionIDList = array('101', '131', '161'); +$count = array('0', '1'); + +$execution = new executionTest(); +r($execution->getKanbanTasksTest($executionIDList[0], $count[0])) && p('906:name,execution') && e('子任务6,101'); // 敏捷执行查询 +r($execution->getKanbanTasksTest($executionIDList[1], $count[0])) && p('693:name,execution') && e('更多任务93,131'); // 瀑布执行查询 +r($execution->getKanbanTasksTest($executionIDList[2], $count[0])) && p('61:name,execution') && e('开发任务71,161'); // 看板执行查询 +r($execution->getKanbanTasksTest($executionIDList[0], $count[1])) && p() && e('11'); // 敏捷执行查询统计 +r($execution->getKanbanTasksTest($executionIDList[1], $count[1])) && p() && e('4'); // 瀑布执行查询统计 +r($execution->getKanbanTasksTest($executionIDList[2], $count[1])) && p() && e('4'); // 看板执行查询统计 diff --git a/test/model/execution/getTotalEstimate.php b/test/model/execution/getTotalEstimate.php new file mode 100755 index 0000000000..c2c239188b --- /dev/null +++ b/test/model/execution/getTotalEstimate.php @@ -0,0 +1,28 @@ +#!/usr/bin/env php +getTotalEstimateTest(); +cid=1 +pid=1 + +敏捷执行关联用例 >> 101,1,1 +瀑布执行关联用例 >> 131,43,169 +看板执行关联用例 >> 161,68,269 +敏捷执行关联用例统计 >> 4 +瀑布执行关联用例统计 >> 4 +看板执行关联用例统计 >> 4 + +*/ + +$executionIDList = array('101', '131', '161'); + +$execution = new executionTest(); +r($execution->getTotalEstimateTest($executionIDList[0])) && p() && e('48'); // 敏捷执行预计工时统计 +r($execution->getTotalEstimateTest($executionIDList[1])) && p() && e('17'); // 瀑布执行预计工时统计 +r($execution->getTotalEstimateTest($executionIDList[2])) && p() && e('20'); // 看板执行预计工时统计 +r($execution->getTotalEstimateTest('')) && p() && e('0'); // 无执行预计工时统计 diff --git a/test/model/execution/isClickable.php b/test/model/execution/isClickable.php new file mode 100755 index 0000000000..769246fd7b --- /dev/null +++ b/test/model/execution/isClickable.php @@ -0,0 +1,58 @@ +#!/usr/bin/env php +isClickableTest(); +cid=1 +pid=1 + +敏捷执行关联用例 >> 101,1,1 +瀑布执行关联用例 >> 131,43,169 +看板执行关联用例 >> 161,68,269 +敏捷执行关联用例统计 >> 4 +瀑布执行关联用例统计 >> 4 +看板执行关联用例统计 >> 4 + +*/ + +$waitExecution = new stdclass(); +$doingExecution = new stdclass(); +$suspendedExecution = new stdclass(); +$closedExecution = new stdclass(); + +$waitExecution->status = 'wait'; +$doingExecution->status = 'doing'; +$suspendedExecution->status = 'suspended'; +$closedExecution->status = 'closed'; + +$actionList = array('start', 'close', 'suspend', 'putoff', 'activate', 'delete'); + +$execution = new executionTest(); +r($execution->isClickableTest($waitExecution, $actionList[0])) && p() && e('检查通过'); // wait状态执行start按钮检查 +r($execution->isClickableTest($waitExecution, $actionList[1])) && p() && e('检查通过'); // wait状态执行close按钮检查 +r($execution->isClickableTest($waitExecution, $actionList[2])) && p() && e('检查通过'); // wait状态执行suspend按钮检查 +r($execution->isClickableTest($waitExecution, $actionList[3])) && p() && e('检查通过'); // wait状态执行putoff按钮检查 +r($execution->isClickableTest($waitExecution, $actionList[4])) && p() && e('检查不通过'); // wait状态执行activate按钮检查 +r($execution->isClickableTest($waitExecution, $actionList[5])) && p() && e('检查通过'); // wait状态执行delete按钮检查 +r($execution->isClickableTest($doingExecution, $actionList[0])) && p() && e('检查不通过'); // doing状态执行start按钮检查 +r($execution->isClickableTest($doingExecution, $actionList[1])) && p() && e('检查通过'); // doing状态执行close按钮检查 +r($execution->isClickableTest($doingExecution, $actionList[2])) && p() && e('检查通过'); // doing状态执行suspend按钮检查 +r($execution->isClickableTest($doingExecution, $actionList[3])) && p() && e('检查通过'); // doing状态执行putoff按钮检查 +r($execution->isClickableTest($doingExecution, $actionList[4])) && p() && e('检查不通过'); // doing状态执行activate按钮检查 +r($execution->isClickableTest($doingExecution, $actionList[5])) && p() && e('检查通过'); // doing状态执行delete按钮检查 +r($execution->isClickableTest($suspendedExecution, $actionList[0])) && p() && e('检查不通过'); // suspended状态执行start按钮检查 +r($execution->isClickableTest($suspendedExecution, $actionList[1])) && p() && e('检查通过'); // suspended状态执行close按钮检查 +r($execution->isClickableTest($suspendedExecution, $actionList[2])) && p() && e('检查不通过'); // suspended状态执行suspend按钮检查 +r($execution->isClickableTest($suspendedExecution, $actionList[3])) && p() && e('检查不通过'); // suspended状态执行putoff按钮检查 +r($execution->isClickableTest($suspendedExecution, $actionList[4])) && p() && e('检查通过'); // suspended状态执行activate按钮检查 +r($execution->isClickableTest($suspendedExecution, $actionList[5])) && p() && e('检查不通过'); // suspended状态执行delete按钮检查 +r($execution->isClickableTest($closedExecution, $actionList[0])) && p() && e('检查不通过'); // closed状态执行start按钮检查 +r($execution->isClickableTest($closedExecution, $actionList[1])) && p() && e('检查不通过'); // closed状态执行close按钮检查 +r($execution->isClickableTest($closedExecution, $actionList[2])) && p() && e('检查不通过'); // closed状态执行suspend按钮检查 +r($execution->isClickableTest($closedExecution, $actionList[3])) && p() && e('检查不通过'); // closed状态执行putoff按钮检查 +r($execution->isClickableTest($closedExecution, $actionList[4])) && p() && e('检查通过'); // closed状态执行activate按钮检查 +r($execution->isClickableTest($closedExecution, $actionList[5])) && p() && e('检查不通过'); // closed状态执行delete按钮检查 diff --git a/test/model/execution/processBurnData.php b/test/model/execution/processBurnData.php new file mode 100755 index 0000000000..ff57e7f538 --- /dev/null +++ b/test/model/execution/processBurnData.php @@ -0,0 +1,32 @@ +#!/usr/bin/env php +processBurnDataTest(); +cid=1 +pid=1 + +敏捷执行关联用例 >> 101,1,1 +瀑布执行关联用例 >> 131,43,169 +看板执行关联用例 >> 161,68,269 +敏捷执行关联用例统计 >> 4 +瀑布执行关联用例统计 >> 4 +看板执行关联用例统计 >> 4 + +*/ + +$executionIDList = array('101', '131', '161'); +$itemCounts = array('30', '60', '100'); +$begin = array('2022-01-15','2022-03-22'); +$end = array('2022-03-22','2022-01-15'); +$count = array('0','1'); + +$execution = new executionTest(); +r($execution->processBurnDataTest($executionIDList[0], $itemCounts[0], $begin[0], $end[0], $count[1])) && p() && e('29'); // 敏捷执行查询统计 +r($execution->processBurnDataTest($executionIDList[1], $itemCounts[1], $begin[0], $end[0], $count[1])) && p() && e('60'); // 瀑布执行查询统计 +r($execution->processBurnDataTest($executionIDList[2], $itemCounts[2], $begin[0], $end[0], $count[1])) && p() && e('60'); // 看板执行查询统计 +r($execution->processBurnDataTest($executionIDList[2], $itemCounts[2], $begin[1], $end[1], $count[1])) && p() && e('0'); // 错误时间查询统计 diff --git a/test/model/execution/summary.php b/test/model/execution/summary.php new file mode 100755 index 0000000000..d07aa18617 --- /dev/null +++ b/test/model/execution/summary.php @@ -0,0 +1,27 @@ +#!/usr/bin/env php +summaryTest(); +cid=1 +pid=1 + +敏捷执行关联用例 >> 101,1,1 +瀑布执行关联用例 >> 131,43,169 +看板执行关联用例 >> 161,68,269 +敏捷执行关联用例统计 >> 4 +瀑布执行关联用例统计 >> 4 +看板执行关联用例统计 >> 4 + +*/ + +$executionIDList = array('101', '131', '161'); + +$execution = new executionTest(); +r($execution->summaryTest($executionIDList[0])) && p() && e('本页共 14 个任务,未开始 4,进行中 3,总预计 3 工时,已消耗 15 工时,剩余 3 工时。'); // 敏捷执行任务统计 +r($execution->summaryTest($executionIDList[1])) && p() && e('本页共 4 个任务,未开始 2,进行中 1,总预计 17 工时,已消耗 15 工时,剩余 17 工时。'); // 瀑布执行任务统计 +r($execution->summaryTest($executionIDList[2])) && p() && e('本页共 4 个任务,未开始 2,进行中 1,总预计 20 工时,已消耗 15 工时,剩余 20 工时。'); // 看板执行任务统计