diff --git a/module/user/test/lib/user.unittest.class.php b/module/user/test/lib/model.class.php old mode 100755 new mode 100644 similarity index 72% rename from module/user/test/lib/user.unittest.class.php rename to module/user/test/lib/model.class.php index 764bf21e50..a8e730ebf0 --- a/module/user/test/lib/user.unittest.class.php +++ b/module/user/test/lib/model.class.php @@ -1,13 +1,12 @@ objectModel = $tester->loadModel('user'); - $this->objectTao = $tester->loadTao('user'); - } + protected $moduleName = 'user'; + protected $className = 'model'; /** * Test get user list. @@ -18,16 +17,13 @@ class userTest */ public function getListTest($params = 'nodeleted', $count = false) { - $objects = $this->objectModel->getList($params); + $objects = $this->instance->getList($params); if(dao::isError()) { $error = dao::getError(); return $error[0]; } - else - { - return $count ? count($objects) : $objects; - } + return $count ? count($objects) : $objects; } /** @@ -40,11 +36,13 @@ class userTest */ public function getListByAccountsTest($accounts = array(), $keyField = 'id') { - $objects = $this->objectModel->getListByAccounts($accounts, $keyField); - if(!dao::isError()) return $objects; - - $error = dao::getError(); - return $error[0]; + $objects = $this->instance->getListByAccounts($accounts, $keyField); + if(dao::isError()) + { + $error = dao::getError(); + return $error[0]; + } + return $objects; } /** @@ -56,13 +54,12 @@ class userTest public function suTest() { global $app; - $originalUser = $app->user; - $result = $this->objectModel->su(); + $result = $this->instance->su(); if(dao::isError()) return dao::getError(); $responseData = new stdClass(); - $responseData->result = $result; + $responseData->result = $result; $responseData->currentUser = $app->user; return $responseData; @@ -80,16 +77,13 @@ class userTest */ public function getPairsTest($params = '', $usersToAppended = '', $maxCount = 0, $accounts = array()) { - $objects = $this->objectModel->getPairs($params, $usersToAppended, $maxCount, $accounts); + $objects = $this->instance->getPairs($params, $usersToAppended, $maxCount, $accounts); if(dao::isError()) { $error = dao::getError(); return $error[0]; } - else - { - return $objects; - } + return $objects; } /** @@ -105,7 +99,7 @@ class userTest */ public function getProjectsTest(string $account, string $status = 'all', string $orderBy = 'id_desc', ?object $pager = null): array { - return $this->objectModel->getProjects($account, $status, $orderBy, $pager); + return $this->instance->getProjects($account, $status, $orderBy, $pager); } /** @@ -121,79 +115,7 @@ class userTest */ public function getExecutionsTest(string $account, string $status = 'all', string $orderBy = 'id_desc', ?object $pager = null): array { - return $this->objectModel->getExecutions($account, $status, $orderBy, $pager); - } - - /** - * 测试根据用户和状态获取项目列表。 - * Test fetch projects by user and status. - * - * @param string $account - * @param string $status - * @param string $orderBy - * @param object $pager - * @access public - * @return array - */ - public function fetchProjectsTest(string $account, string $status = 'all', string $orderBy = 'id', ?object $pager = null): array - { - return $this->objectTao->fetchProjects($account, $status, $orderBy, $pager); - } - - /** - * 测试获取某个用户参与的项目和项目包含的执行数键值对。 - * Test fetch project execution count. - * - * @param array $projectidList - * @access public - * @return array - */ - public function fetchProjectExecutionCountTest(array $projectIdList): array - { - return $this->objectTao->fetchProjectExecutionCount($projectIdList); - } - - /** - * 测试获取某个用户参与的项目和项目包含的需求规模数和需求数。 - * Test fetch project story estimate and count. - * - * @param array $projectIdList - * @access public - * @return array - */ - public function fetchProjectStoryCountAndEstimateTest(array $projectIdList): array - { - return $this->objectTao->fetchProjectStoryCountAndEstimate($projectIdList); - } - - /** - * 测试根据用户和状态获取执行列表。 - * Test fetch executions by user and status. - * - * @param string $account - * @param string $status - * @param string $orderBy - * @param object $pager - * @access public - * @return array - */ - public function fetchExecutionsTest(string $account, string $status = 'all', string $orderBy = 'id_desc', ?object $pager = null): array - { - return $this->objectTao->fetchExecutions($account, $status, $orderBy, $pager); - } - - /** - * 测试获取某个用户参与的执行和执行中指派给他的任务数的键值对。 - * Get the executions that the user joined and the task count of the execution. - * - * @param string $account - * @param array $executionIdList - * @access public - * @return - */ - public function fetchExecutionTaskCountTest(string $account, array $executionIdList): array - { - return $this->objectTao->fetchExecutionTaskCount($account, $executionIdList); + return $this->instance->getExecutions($account, $status, $orderBy, $pager); } /** @@ -208,7 +130,7 @@ class userTest */ public function fetchExtraUsersTest(string|array $usersToAppended, string $fields, string $keyField): array { - return $this->objectModel->fetchExtraUsers($usersToAppended, $fields, $keyField); + return $this->instance->fetchExtraUsers($usersToAppended, $fields, $keyField); } /** @@ -222,8 +144,7 @@ class userTest */ public function processDisplayValueTest(array $users, string $params): array { - return $this->objectModel->processDisplayValue($users, $params); - + return $this->instance->processDisplayValue($users, $params); } /** @@ -235,16 +156,13 @@ class userTest */ public function getAvatarPairsTest($param = 'nodeleted') { - $objects = $this->objectModel->getAvatarPairs($param); + $objects = $this->instance->getAvatarPairs($param); if(dao::isError()) { $error = dao::getError(); return $error[0]; } - else - { - return $objects; - } + return $objects; } /** @@ -255,16 +173,13 @@ class userTest */ public function getCommitersTest() { - $objects = $this->objectModel->getCommiters(); + $objects = $this->instance->getCommiters(); if(dao::isError()) { $error = dao::getError(); return $error[0]; } - else - { - return $objects; - } + return $objects; } /** @@ -276,16 +191,13 @@ class userTest */ public function getRealNameAndEmailsTest($accounts) { - $objects = $this->objectModel->getRealNameAndEmails($accounts); + $objects = $this->instance->getRealNameAndEmails($accounts); if(dao::isError()) { $error = dao::getError(); return $error[0]; } - else - { - return $objects; - } + return $objects; } /** @@ -298,16 +210,13 @@ class userTest */ public function getUserRolesTest($accounts, $needRole = false) { - $objects = $this->objectModel->getUserRoles($accounts, $needRole); + $objects = $this->instance->getUserRoles($accounts, $needRole); if(dao::isError()) { $error = dao::getError(); return $error[0]; } - else - { - return $objects; - } + return $objects; } /** @@ -320,16 +229,13 @@ class userTest */ public function getByIdTest($userID, $field = 'account') { - $objects = $this->objectModel->getById($userID, $field); + $objects = $this->instance->getById($userID, $field); if(dao::isError()) { - $error = dao::getError(); + $error = dao::getError(); return $error[0]; } - else - { - return $objects; - } + return $objects; } /** @@ -344,16 +250,13 @@ class userTest */ public function getByQueryTest($browseType = 'inside', $query = '', $pager = null, $orderBy = 'id') { - $objects = $this->objectModel->getByQuery($browseType, $query, $pager, $orderBy); + $objects = $this->instance->getByQuery($browseType, $query, $pager, $orderBy); if(dao::isError()) { $error = dao::getError(); return $error[0]; } - else - { - return $objects; - } + return $objects; } /** @@ -366,7 +269,7 @@ class userTest */ public function createTest(object $user): array { - $result = $this->objectModel->create($user); + $result = $this->instance->create($user); $errors = dao::getError(); foreach($errors as $key => $error) @@ -387,7 +290,7 @@ class userTest */ public function createCompanyTest(string $companyName): array { - $result = $this->objectModel->createCompany($companyName); + $result = $this->instance->createCompany($companyName); $errors = dao::getError(); foreach($errors as $key => $error) @@ -409,7 +312,7 @@ class userTest */ public function createUserGroupTest(array $groups, string $account): array { - $result = $this->objectModel->createUserGroup($groups, $account); + $result = $this->instance->createUserGroup($groups, $account); $errors = dao::getError(); foreach($errors as $key => $error) @@ -436,7 +339,7 @@ class userTest foreach(array_keys($users) as $index) $_POST['company'][$index] = 'ditto'; $_POST['company']['0'] = $verifyPassword; - $result = $this->objectModel->batchCreate($users, $verifyPassword); + $result = $this->instance->batchCreate($users, $verifyPassword); $errors = dao::getError(); unset($_POST); @@ -458,7 +361,7 @@ class userTest */ public function updateTest(object $user): array { - $result = $this->objectModel->update($user); + $result = $this->instance->update($user); $errors = dao::getError(); foreach($errors as $key => $error) @@ -480,7 +383,7 @@ class userTest */ public function checkAccountChangeTest(string $oldAccount, string $newAccount): array { - $result = $this->objectModel->checkAccountChange($oldAccount, $newAccount); + $result = $this->instance->checkAccountChange($oldAccount, $newAccount); $errors = dao::getError(); foreach($errors as $key => $error) @@ -501,7 +404,7 @@ class userTest */ public function checkGroupChangeTest(object $user): array { - $result = $this->objectModel->checkGroupChange($user); + $result = $this->instance->checkGroupChange($user); $errors = dao::getError(); foreach($errors as $key => $error) @@ -523,7 +426,7 @@ class userTest */ public function batchUpdateTest(array $users, string $verifyPassword): array { - $result = $this->objectModel->batchUpdate($users, $verifyPassword); + $result = $this->instance->batchUpdate($users, $verifyPassword); $errors = dao::getError(); foreach($errors as $key => $error) @@ -544,7 +447,7 @@ class userTest */ public function updatePasswordTest(object $user): array { - $result = $this->objectModel->updatePassword($user); + $result = $this->instance->updatePassword($user); $errors = dao::getError(); foreach($errors as $key => $error) @@ -565,7 +468,7 @@ class userTest */ public function resetPasswordTest(object $user): array { - $result = $this->objectModel->resetPassword($user); + $result = $this->instance->resetPassword($user); $errors = dao::getError(); foreach($errors as $key => $error) @@ -587,7 +490,7 @@ class userTest */ public function checkBeforeCreateOrEditTest(object $user, bool $canNoPassword = false): array { - $result = $this->objectModel->checkBeforeCreateOrEdit($user, $canNoPassword); + $result = $this->instance->checkBeforeCreateOrEdit($user, $canNoPassword); $errors = dao::getError(); foreach($errors as $key => $error) @@ -609,7 +512,7 @@ class userTest */ public function checkBeforeBatchCreateTest(array $users, string $verifyPassword): array { - $result = $this->objectModel->checkBeforeBatchCreate($users, $verifyPassword); + $result = $this->instance->checkBeforeBatchCreate($users, $verifyPassword); $errors = dao::getError(); foreach($errors as $key => $error) @@ -631,7 +534,7 @@ class userTest */ public function checkBeforeBatchUpdateTest(array $users, string $verifyPassword): array { - $result = $this->objectModel->checkBeforeBatchUpdate($users, $verifyPassword); + $result = $this->instance->checkBeforeBatchUpdate($users, $verifyPassword); $errors = dao::getError(); foreach($errors as $key => $error) @@ -653,7 +556,7 @@ class userTest */ public function checkPasswordTest(object $user, bool $canNoPassword = false): array { - $result = $this->objectModel->checkPassword($user, $canNoPassword); + $result = $this->instance->checkPassword($user, $canNoPassword); $errors = dao::getError(); foreach($errors as $key => $error) @@ -674,7 +577,7 @@ class userTest */ public function checkVerifyPasswordTest(string $verifyPassword): array { - $result = $this->objectModel->checkVerifyPassword($verifyPassword); + $result = $this->instance->checkVerifyPassword($verifyPassword); $errors = dao::getError(); foreach($errors as $key => $error) @@ -697,7 +600,7 @@ class userTest */ public function identifyTest(string $account, string $password, int $passwordStrength = 0): object|bool { - return $this->objectModel->identify($account, $password, $passwordStrength); + return $this->instance->identify($account, $password, $passwordStrength); } /** @@ -711,7 +614,7 @@ class userTest */ public function identifyUserTest(string $account, string $password): object|bool { - return $this->objectModel->identifyUser($account, $password); + return $this->instance->identifyUser($account, $password); } /** @@ -725,7 +628,7 @@ class userTest */ public function checkNeedModifyPasswordTest(object $user, int $passwordStrength): object { - return $this->objectModel->checkNeedModifyPassword($user, $passwordStrength); + return $this->instance->checkNeedModifyPassword($user, $passwordStrength); } /** @@ -737,9 +640,7 @@ class userTest */ public function authorizeTest($account) { - $user = $this->objectModel->authorize($account); - - return $user; + return $this->instance->authorize($account); } /** @@ -754,7 +655,7 @@ class userTest */ public function loginTest(object $user, bool $addAction = true, bool $keepLogin = false): bool|object { - return $this->objectModel->login($user, $addAction, $keepLogin); + return $this->instance->login($user, $addAction, $keepLogin); } /** @@ -767,7 +668,7 @@ class userTest */ public function getGroupsTest(string $account): array { - return $this->objectModel->getGroups($account); + return $this->instance->getGroups($account); } /** @@ -780,7 +681,7 @@ class userTest */ public function getGroupsByVisionsTest(string|array $visions): array { - return $this->objectModel->getGroupsByVisions($visions); + return $this->instance->getGroupsByVisions($visions); } /** @@ -793,7 +694,7 @@ class userTest */ public function cleanLockedTest(string $account): array { - $result = $this->objectModel->cleanLocked($account); + $result = $this->instance->cleanLocked($account); $errors = dao::getError(); foreach($errors as $key => $error) @@ -813,16 +714,11 @@ class userTest */ public function unbindTest($account) { - global $tester; - - $this->objectModel->unbind($account); - + $this->instance->unbind($account); if(dao::isError()) return dao::getError(); - $ranzhi = $tester->dao->select('ranzhi')->from(TABLE_USER)->where('account')->eq($account)->fetch('ranzhi'); - + $ranzhi = $this->instance->dao->select('ranzhi')->from(TABLE_USER)->where('account')->eq($account)->fetch('ranzhi'); $result = empty($ranzhi) ? 'success' : 'fail'; - return $result; } @@ -836,10 +732,8 @@ class userTest */ public function getContactListsTest($account = '', $params = '') { - $contacts = $this->objectModel->getContactLists($account, $params); - + $contacts = $this->instance->getContactLists($account, $params); if(dao::isError()) return dao::getError(); - return $contacts ? $contacts : 0; } @@ -852,7 +746,7 @@ class userTest */ public function getParentStageAuthedUsersTest($stageID) { - return $this->objectModel->getParentStageAuthedUsers($stageID); + return $this->instance->getParentStageAuthedUsers($stageID); } /** @@ -864,7 +758,7 @@ class userTest */ public function getContactListByIDTest($listID) { - return $this->objectModel->getContactListByID($listID); + return $this->instance->getContactListByID($listID); } /** @@ -877,7 +771,7 @@ class userTest */ public function createContactListTest(object $userContact): array { - $result = $this->objectModel->createContactList($userContact); + $result = $this->instance->createContactList($userContact); $errors = dao::getError(); foreach($errors as $key => $error) @@ -898,7 +792,7 @@ class userTest */ public function updateContactListTest(object $userContact): array { - $result = $this->objectModel->updateContactList($userContact); + $result = $this->instance->updateContactList($userContact); $errors = dao::getError(); foreach($errors as $key => $error) @@ -919,7 +813,7 @@ class userTest */ public function deleteContactListTest(int $listID): array { - $result = $this->objectModel->deleteContactList($listID); + $result = $this->instance->deleteContactList($listID); $errors = dao::getError(); foreach($errors as $key => $error) @@ -939,7 +833,7 @@ class userTest */ public function getWeakUsersTest(): array { - return $this->objectModel->getWeakUsers(); + return $this->instance->getWeakUsers(); } /** @@ -952,7 +846,7 @@ class userTest */ public function computePasswordStrengthTest(string $password): int { - return $this->objectModel->computePasswordStrength($password); + return $this->instance->computePasswordStrength($password); } /** @@ -965,8 +859,7 @@ class userTest */ public function computeUserViewTest($account, $force = true) { - $userview = $this->objectModel->computeUserView($account, $force); - + $userview = $this->instance->computeUserView($account, $force); if(dao::isError()) return dao::getError(); return $userview; } @@ -981,8 +874,7 @@ class userTest */ public function getProductMembersTest($allProducts) { - $members = $this->objectModel->getProductMembers($allProducts); - + $members = $this->instance->getProductMembers($allProducts); if(dao::isError()) return dao::getError(); return $members; } @@ -997,8 +889,7 @@ class userTest */ public function grantUserViewTest($account = '', $acls = array(), $projects = '') { - $userView = $this->objectModel->grantUserView($account, $acls, $projects); - + $userView = $this->instance->grantUserView($account, $acls, $projects); if(dao::isError()) return dao::getError(); return $userView; } @@ -1013,10 +904,9 @@ class userTest */ public function updateProgramViewTest($programIdList = array(), $users = array()) { - $this->objectModel->updateProgramView($programIdList, $users); - + $this->instance->updateProgramView($programIdList, $users); if(dao::isError()) return dao::getError(); - return $this->objectModel->grantUserView(current($users)); + return $this->instance->grantUserView(current($users)); } /** @@ -1031,9 +921,8 @@ class userTest */ public function getProductViewListUsersTest($productID, $teams, $stakeholders, $whiteList, $admins) { - global $tester; - $product = $tester->loadModel('product')->getByID($productID); - return $this->objectModel->getProductViewListUsers($product, $teams, $stakeholders, $whiteList, $admins); + $product = $this->instance->loadModel('product')->getByID($productID); + return $this->instance->getProductViewListUsers($product, $teams, $stakeholders, $whiteList, $admins); } /** @@ -1048,7 +937,7 @@ class userTest */ public function getTeamMemberPairsTest(string|array|int $objectIds, string $type = 'project', string $params = '', string|array $usersToAppended = '') { - return $this->objectModel->getTeamMemberPairs($objectIds, $type, $params, $usersToAppended); + return $this->instance->getTeamMemberPairs($objectIds, $type, $params, $usersToAppended); } /** @@ -1061,7 +950,7 @@ class userTest */ public function saveUserTemplateTest(object $template): array { - $result = $this->objectModel->saveUserTemplate($template); + $result = $this->instance->saveUserTemplate($template); $errors = dao::getError(); foreach($errors as $key => $error) @@ -1082,7 +971,7 @@ class userTest */ public function getUserTemplatesTest(string $type): array { - return $this->objectModel->getUserTemplates($type); + return $this->instance->getUserTemplates($type); } /** @@ -1094,7 +983,7 @@ class userTest */ public function getListForGitLabAPITest(array $accountList): array { - return $this->objectModel->getListForGitLabAPI($accountList); + return $this->instance->getListForGitLabAPI($accountList); } /** @@ -1105,7 +994,7 @@ class userTest */ public function getCanCreateStoryUsersTest() { - return $this->objectModel->getCanCreateStoryUsers(); + return $this->instance->getCanCreateStoryUsers(); } /** @@ -1117,7 +1006,7 @@ class userTest */ public function isLogonTest(): bool { - return $this->objectModel->isLogon(); + return $this->instance->isLogon(); } /** @@ -1129,9 +1018,8 @@ class userTest */ public function failPlusTest($account) { - $result = $this->objectModel->failPlus($account); + $result = $this->instance->failPlus($account); if(dao::isError()) return dao::getError(); - return $result; } @@ -1145,7 +1033,7 @@ class userTest */ public function checkLockedTest(string $account): bool { - return $this->objectModel->checkLocked($account); + return $this->instance->checkLocked($account); } /** @@ -1157,7 +1045,7 @@ class userTest */ public function identifyByPhpAuthTest(): bool { - return $this->objectModel->identifyByPhpAuth(); + return $this->instance->identifyByPhpAuth(); } /** @@ -1169,7 +1057,7 @@ class userTest */ public function identifyByCookieTest(): bool { - return $this->objectModel->identifyByCookie(); + return $this->instance->identifyByCookie(); } /** @@ -1183,7 +1071,7 @@ class userTest */ public function isClickableTest(object $user, string $action): bool { - return $this->objectModel->isClickable($user, $action); + return $this->instance->isClickable($user, $action); } /** @@ -1195,13 +1083,8 @@ class userTest */ public function getUserAclsTest(string $account) { - $reflection = new ReflectionClass($this->objectModel); - $method = $reflection->getMethod('getUserAcls'); - $method->setAccessible(true); - - $result = $method->invoke($this->objectModel, $account); + $result = $this->invokeArgs('getUserAcls', [$account]); if(dao::isError()) return dao::getError(); - return $result; } @@ -1213,9 +1096,8 @@ class userTest */ public function uploadAvatarTest(): array { - $result = $this->objectModel->uploadAvatar(); + $result = $this->instance->uploadAvatar(); if(dao::isError()) return dao::getError(); - return $result; } @@ -1228,13 +1110,8 @@ class userTest */ public function initViewObjectsTest(bool $force = false) { - $reflection = new ReflectionClass($this->objectModel); - $method = $reflection->getMethod('initViewObjects'); - $method->setAccessible(true); - - $result = $method->invoke($this->objectModel, $force); + $result = $this->invokeArgs('initViewObjects', [$force]); if(dao::isError()) return dao::getError(); - return $result; } @@ -1252,13 +1129,8 @@ class userTest */ public function getProgramViewTest(string $account = '', array $allPrograms = array(), array $manageObjects = array(), array $stakeholders = array(), array $whiteList = array(), array $programStakeholderGroup = array()) { - $reflection = new ReflectionClass($this->objectModel); - $method = $reflection->getMethod('getProgramView'); - $method->setAccessible(true); - - $result = $method->invoke($this->objectModel, $account, $allPrograms, $manageObjects, $stakeholders, $whiteList, $programStakeholderGroup); + $result = $this->invokeArgs('getProgramView', [$account, $allPrograms, $manageObjects, $stakeholders, $whiteList, $programStakeholderGroup]); if(dao::isError()) return dao::getError(); - return $result; } @@ -1274,13 +1146,8 @@ class userTest */ public function getProductViewTest(string $account = '', array $allProducts = array(), array $manageObjects = array(), array $whiteList = array()) { - $reflection = new ReflectionClass($this->objectModel); - $method = $reflection->getMethod('getProductView'); - $method->setAccessible(true); - - $result = $method->invoke($this->objectModel, $account, $allProducts, $manageObjects, $whiteList); + $result = $this->invokeArgs('getProductView', [$account, $allProducts, $manageObjects, $whiteList]); if(dao::isError()) return dao::getError(); - return $result; } @@ -1299,13 +1166,8 @@ class userTest */ public function getProjectViewTest(string $account = '', array $allProjects = array(), array $manageObjects = array(), array $teams = array(), array $stakeholders = array(), array $whiteList = array(), array $projectStakeholderGroup = array()) { - $reflection = new ReflectionClass($this->objectModel); - $method = $reflection->getMethod('getProjectView'); - $method->setAccessible(true); - - $result = $method->invoke($this->objectModel, $account, $allProjects, $manageObjects, $teams, $stakeholders, $whiteList, $projectStakeholderGroup); + $result = $this->invokeArgs('getProjectView', [$account, $allProjects, $manageObjects, $teams, $stakeholders, $whiteList, $projectStakeholderGroup]); if(dao::isError()) return dao::getError(); - return $result; } @@ -1318,13 +1180,8 @@ class userTest */ public function getManageListGroupByTypeTest(string $account = '') { - $reflection = new ReflectionClass($this->objectModel); - $method = $reflection->getMethod('getManageListGroupByType'); - $method->setAccessible(true); - - $result = $method->invoke($this->objectModel, $account); + $result = $this->invokeArgs('getManageListGroupByType', [$account]); if(dao::isError()) return dao::getError(); - return $result; } @@ -1337,13 +1194,8 @@ class userTest */ public function getProgramStakeholderTest($programProduct = null) { - $reflection = new ReflectionClass($this->objectModel); - $method = $reflection->getMethod('getProgramStakeholder'); - $method->setAccessible(true); - - $result = $method->invoke($this->objectModel, $programProduct); + $result = $this->invokeArgs('getProgramStakeholder', [$programProduct]); if(dao::isError()) return dao::getError(); - return $result; } @@ -1359,13 +1211,8 @@ class userTest */ public function mergeAclsToUserViewTest(string $account, object $userView, array $acls, string $projects) { - $reflection = new ReflectionClass($this->objectModel); - $method = $reflection->getMethod('mergeAclsToUserView'); - $method->setAccessible(true); - - $result = $method->invoke($this->objectModel, $account, $userView, $acls, $projects); + $result = $this->invokeArgs(['mergeAclsToUserView', [$account, $userView, $acls, $projects]); if(dao::isError()) return dao::getError(); - return $result; } @@ -1385,13 +1232,8 @@ class userTest */ public function getObjectsAuthedUsersTest(array $objects, string $objectType, array $stakeholderGroup = array(), array $teamsGroup = array(), array $whiteListGroup = array(), array $adminsGroup = array(), array $parentStakeholderGroup = array(), array $parentPMGroup = array()): array { - $reflection = new ReflectionClass($this->objectModel); - $method = $reflection->getMethod('getObjectsAuthedUsers'); - $method->setAccessible(true); - - $result = $method->invokeArgs($this->objectModel, array($objects, $objectType, $stakeholderGroup, $teamsGroup, $whiteListGroup, $adminsGroup, $parentStakeholderGroup, $parentPMGroup)); + $result = $this->invokeArgs('getObjectsAuthedUsers', [$objects, $objectType, $stakeholderGroup, $teamsGroup, $whiteListGroup, $adminsGroup, $parentStakeholderGroup, $parentPMGroup]); if(dao::isError()) return dao::getError(); - return $result; } @@ -1413,13 +1255,8 @@ class userTest */ public function getLatestUserViewTest(string $account, string $view, object $object, string $objectType, array $stakeholderGroup = array(), array $teamsGroup = array(), array $whiteListGroup = array(), array $adminsGroup = array(), array $parentStakeholderGroup = array(), array $parentPMGroup = array()): string { - $reflection = new ReflectionClass($this->objectModel); - $method = $reflection->getMethod('getLatestUserView'); - $method->setAccessible(true); - - $result = $method->invokeArgs($this->objectModel, array($account, $view, $object, $objectType, $stakeholderGroup, $teamsGroup, $whiteListGroup, $adminsGroup, $parentStakeholderGroup, $parentPMGroup)); + $result = $this->invokeArgs('getLatestUserView', [$account, $view, $object, $objectType, $stakeholderGroup, $teamsGroup, $whiteListGroup, $adminsGroup, $parentStakeholderGroup, $parentPMGroup]); if(dao::isError()) return dao::getError(); - return $result; } @@ -1436,13 +1273,8 @@ class userTest */ public function checkProgramPrivTest(object $program, string $account, array $stakeholders = array(), array $whiteList = array(), array $admins = array()): bool { - $reflection = new ReflectionClass($this->objectModel); - $method = $reflection->getMethod('checkProgramPriv'); - $method->setAccessible(true); - - $result = $method->invokeArgs($this->objectModel, array($program, $account, $stakeholders, $whiteList, $admins)); + $result = $this->invokeArgs('checkProgramPriv', [$program, $account, $stakeholders, $whiteList, $admins]); if(dao::isError()) return dao::getError(); - return $result; } @@ -1460,13 +1292,8 @@ class userTest */ public function checkProjectPrivTest(object $project, string $account, array $stakeholders = array(), array $teams = array(), array $whiteList = array(), array $admins = array()): bool { - $reflection = new ReflectionClass($this->objectModel); - $method = $reflection->getMethod('checkProjectPriv'); - $method->setAccessible(true); - - $result = $method->invokeArgs($this->objectModel, array($project, $account, $stakeholders, $teams, $whiteList, $admins)); + $result = $this->invokeArgs('checkProjectPriv', [$project, $account, $stakeholders, $teams, $whiteList, $admins]); if(dao::isError()) return dao::getError(); - return $result; } @@ -1484,13 +1311,8 @@ class userTest */ public function checkProductPrivTest(object $product, string $account, array $teams = array(), array $stakeholders = array(), array $whiteList = array(), array $admins = array()): bool { - $reflection = new ReflectionClass($this->objectModel); - $method = $reflection->getMethod('checkProductPriv'); - $method->setAccessible(true); - - $result = $method->invokeArgs($this->objectModel, array($product, $account, $teams, $stakeholders, $whiteList, $admins)); + $result = $this->invokeArgs('checkProductPriv', [$product, $account, $teams, $stakeholders, $whiteList, $admins]); if(dao::isError()) return dao::getError(); - return $result; } @@ -1506,13 +1328,8 @@ class userTest */ public function getProgramAuthedUsersTest(object $program, array $stakeholders = array(), array $whiteList = array(), array $admins = array()): array { - $reflection = new ReflectionClass($this->objectModel); - $method = $reflection->getMethod('getProgramAuthedUsers'); - $method->setAccessible(true); - - $result = $method->invokeArgs($this->objectModel, array($program, $stakeholders, $whiteList, $admins)); + $result = $this->invokeArgs('getProgramAuthedUsers', [$program, $stakeholders, $whiteList, $admins]); if(dao::isError()) return dao::getError(); - return $result; } @@ -1529,13 +1346,8 @@ class userTest */ public function getProjectAuthedUsersTest(object $project, array $stakeholders = array(), array $teams = array(), array $whiteList = array(), array $admins = array()): array { - $reflection = new ReflectionClass($this->objectModel); - $method = $reflection->getMethod('getProjectAuthedUsers'); - $method->setAccessible(true); - - $result = $method->invokeArgs($this->objectModel, array($project, $stakeholders, $teams, $whiteList, $admins)); + $result = $this->invokeArgs('getProjectAuthedUsers', [$project, $stakeholders, $teams, $whiteList, $admins]); if(dao::isError()) return dao::getError(); - return $result; } @@ -1549,7 +1361,7 @@ class userTest */ public function saveOldUserTemplateTest(string $type): array { - $this->objectModel->saveOldUserTemplate($type); + $this->instance->saveOldUserTemplate($type); $errors = dao::getError(); foreach($errors as $key => $error) diff --git a/module/user/test/lib/tao.class.php b/module/user/test/lib/tao.class.php new file mode 100644 index 0000000000..83d9c1a7ce --- /dev/null +++ b/module/user/test/lib/tao.class.php @@ -0,0 +1,82 @@ +instance->fetchProjects($account, $status, $orderBy, $pager); + } + + /** + * 测试获取某个用户参与的项目和项目包含的执行数键值对。 + * Test fetch project execution count. + * + * @param array $projectidList + * @access public + * @return array + */ + public function fetchProjectExecutionCountTest(array $projectIdList): array + { + return $this->instance->fetchProjectExecutionCount($projectIdList); + } + + /** + * 测试获取某个用户参与的项目和项目包含的需求规模数和需求数。 + * Test fetch project story estimate and count. + * + * @param array $projectIdList + * @access public + * @return array + */ + public function fetchProjectStoryCountAndEstimateTest(array $projectIdList): array + { + return $this->instance->fetchProjectStoryCountAndEstimate($projectIdList); + } + + /** + * 测试根据用户和状态获取执行列表。 + * Test fetch executions by user and status. + * + * @param string $account + * @param string $status + * @param string $orderBy + * @param object $pager + * @access public + * @return array + */ + public function fetchExecutionsTest(string $account, string $status = 'all', string $orderBy = 'id_desc', ?object $pager = null): array + { + return $this->instance->fetchExecutions($account, $status, $orderBy, $pager); + } + + /** + * 测试获取某个用户参与的执行和执行中指派给他的任务数的键值对。 + * Get the executions that the user joined and the task count of the execution. + * + * @param string $account + * @param array $executionIdList + * @access public + * @return + */ + public function fetchExecutionTaskCountTest(string $account, array $executionIdList): array + { + return $this->instance->fetchExecutionTaskCount($account, $executionIdList); + } +} diff --git a/module/user/test/model/authorize.php b/module/user/test/model/authorize.php index a66ebf6e63..55d192e8e7 100755 --- a/module/user/test/model/authorize.php +++ b/module/user/test/model/authorize.php @@ -21,7 +21,7 @@ cid=19578 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; su('admin'); @@ -30,7 +30,7 @@ zenData('group')->loadYaml('group')->gen(100); zenData('usergroup')->loadYaml('usergroup')->gen(100); zenData('grouppriv')->loadYaml('grouppriv')->gen(100); -$user = new userTest(); +$user = new userModelTest(); r($user->authorizeTest('user2')) && p('rights[index]:index;rights[module3]:method3') && e('1,1'); // 获取user2用户的访问权限。 r($user->authorizeTest('user2')) && p('acls[programs]:0,1') && e('1,6'); // 获取user2用户的可访问项目集、项目、产品。 diff --git a/module/user/test/model/batchcreate.php b/module/user/test/model/batchcreate.php index 9b0e36603f..1225f3bca2 100755 --- a/module/user/test/model/batchcreate.php +++ b/module/user/test/model/batchcreate.php @@ -35,7 +35,7 @@ cid=19579 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; zenData('user')->gen(1); zenData('company')->gen(1); @@ -46,7 +46,7 @@ su('admin'); global $app; -$userTest = new userTest(); +$userTest = new userModelTest(); $random = updateSessionRandom(); $verify = md5($app->user->password . $random); diff --git a/module/user/test/model/batchupdate.php b/module/user/test/model/batchupdate.php index 636a4c473d..121890d53c 100755 --- a/module/user/test/model/batchupdate.php +++ b/module/user/test/model/batchupdate.php @@ -40,7 +40,7 @@ cid=19580 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; zenData('user')->gen(2); zenData('action')->gen(0); @@ -50,7 +50,7 @@ su('admin'); global $app; -$userTest = new userTest(); +$userTest = new userModelTest(); $random = updateSessionRandom(); $verify = md5($app->user->password . $random); diff --git a/module/user/test/model/checkaccountchange.php b/module/user/test/model/checkaccountchange.php index 9cd9f6f6d0..8ff7da0425 100755 --- a/module/user/test/model/checkaccountchange.php +++ b/module/user/test/model/checkaccountchange.php @@ -37,7 +37,7 @@ cid=19581 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; zenData('user')->gen(1); zenData('company')->gen(1); @@ -57,7 +57,7 @@ global $app; $app->company->admins = ',admin,'; -$userTest = new userTest(); +$userTest = new userModelTest(); r($userTest->checkAccountChangeTest('admin', 'admin')) && p('result') && e(0); // 新用户忙和旧用户名相同,返回 false。 diff --git a/module/user/test/model/checkbeforebatchcreate.php b/module/user/test/model/checkbeforebatchcreate.php index 04933d3831..6625bbc6fc 100644 --- a/module/user/test/model/checkbeforebatchcreate.php +++ b/module/user/test/model/checkbeforebatchcreate.php @@ -62,7 +62,7 @@ cid=19582 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; zenData('user')->loadYaml('user')->gen(1); zenData('config')->gen(0); // config 表置空,防止安全设置影响测试结果。 @@ -105,7 +105,7 @@ $users4 = array $random = updateSessionRandom(); $verifyPassword = md5(md5('123456') . $random); -$userTest = new userTest(); +$userTest = new userModelTest(); $config->safe = new stdclass(); $config->safe->mode = 0; diff --git a/module/user/test/model/checkbeforebatchupdate.php b/module/user/test/model/checkbeforebatchupdate.php index 051fb8eec2..788fb894a7 100644 --- a/module/user/test/model/checkbeforebatchupdate.php +++ b/module/user/test/model/checkbeforebatchupdate.php @@ -30,7 +30,7 @@ cid=19583 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; zenData('user')->loadYaml('user')->gen(1); @@ -59,7 +59,7 @@ $users3 = array $random = updateSessionRandom(); $verifyPassword = md5(md5('123456') . $random); -$userTest = new userTest(); +$userTest = new userModelTest(); /* 必填项为空的用户。*/ $result = $userTest->checkBeforeBatchUpdateTest($users1, ''); diff --git a/module/user/test/model/checkgroupchange.php b/module/user/test/model/checkgroupchange.php index 18d175c7a1..f144c8a5fb 100644 --- a/module/user/test/model/checkgroupchange.php +++ b/module/user/test/model/checkgroupchange.php @@ -25,7 +25,7 @@ cid=19585 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; zenData('user')->gen(2); zenData('group')->gen(3); @@ -37,7 +37,7 @@ $groupTable->gen(2); su('admin'); -$userTest = new userTest(); +$userTest = new userModelTest(); $user = $userTest->getByIdTest('user1'); $user->group = array(1, 2); diff --git a/module/user/test/model/checklocked.php b/module/user/test/model/checklocked.php index 02edaa419a..58df440956 100755 --- a/module/user/test/model/checklocked.php +++ b/module/user/test/model/checklocked.php @@ -14,7 +14,7 @@ cid=19586 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; global $config; if(empty($config->user)) $config->user = new stdclass(); @@ -30,7 +30,7 @@ $table->account->range('admin,user1,user2'); $table->locked->range("`{$locked}`,`{$now}`,`{$locked}`"); $table->gen(3); -$userTest = new userTest(); +$userTest = new userModelTest(); r($userTest->checkLockedTest('admin')) && p() && e(1); // admin 用户被锁定,返回 true。 r($userTest->checkLockedTest('user1')) && p() && e(1); // user1 用户锁定时间未超过锁定时长限制,返回 true。 diff --git a/module/user/test/model/checkneedmodifypassword.php b/module/user/test/model/checkneedmodifypassword.php index 99f3a68080..5554577de1 100644 --- a/module/user/test/model/checkneedmodifypassword.php +++ b/module/user/test/model/checkneedmodifypassword.php @@ -40,9 +40,9 @@ cid=19587 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; -$userTest = new userTest(); +$userTest = new userModelTest(); global $app, $config; $config->safe = new stdclass(); diff --git a/module/user/test/model/checkpassword.php b/module/user/test/model/checkpassword.php index 26bd1c8f88..be87745e18 100755 --- a/module/user/test/model/checkpassword.php +++ b/module/user/test/model/checkpassword.php @@ -47,7 +47,7 @@ cid=19588 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; zenData('user')->gen(1); zenData('config')->gen(0); // config 表置空,防止安全设置影响测试结果。 @@ -56,7 +56,7 @@ su('admin'); global $config; -$userTest = new userTest(); +$userTest = new userModelTest(); $user1 = (object)array('password1' => ''); $user2 = (object)array('password1' => '123456', 'password2' => '12345', 'passwordStrength' => 0, 'passwordLength' => 6); diff --git a/module/user/test/model/checkproductpriv.php b/module/user/test/model/checkproductpriv.php index 708fb5a948..2d9257b72a 100755 --- a/module/user/test/model/checkproductpriv.php +++ b/module/user/test/model/checkproductpriv.php @@ -27,7 +27,7 @@ cid=19589 // 1. 导入依赖(路径固定,不可修改) include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; // 2. zendata数据准备 $table = zenData('product'); @@ -53,7 +53,7 @@ $companyTable->gen(1); su('admin'); // 4. 创建测试实例 -$userTest = new userTest(); +$userTest = new userModelTest(); // 5. 执行测试(必须包含至少5个测试步骤) // 创建测试数据对象 diff --git a/module/user/test/model/checkprogrampriv.php b/module/user/test/model/checkprogrampriv.php index ea0ff17fa5..2ed4ec7489 100755 --- a/module/user/test/model/checkprogrampriv.php +++ b/module/user/test/model/checkprogrampriv.php @@ -21,7 +21,7 @@ cid=19590 // 1. 导入依赖 include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; // 2. zendata数据准备 $projectTable = zenData('project'); @@ -34,7 +34,7 @@ $userTable->loadYaml('user_checkprogrampriv', false, 2)->gen(10); su('admin'); // 4. 创建测试实例 -$userTest = new userTest(); +$userTest = new userModelTest(); // 5. 准备测试数据 global $tester; diff --git a/module/user/test/model/checkprojectpriv.php b/module/user/test/model/checkprojectpriv.php index 12ff996b7a..b1c0b3a96a 100755 --- a/module/user/test/model/checkprojectpriv.php +++ b/module/user/test/model/checkprojectpriv.php @@ -21,7 +21,7 @@ cid=19591 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; $project = zenData('project'); $project->id->range('1-10'); @@ -58,7 +58,7 @@ global $tester; $tester->app->company = new stdClass(); $tester->app->company->admins = ',admin,'; -$userTest = new userTest(); +$userTest = new userModelTest(); r($userTest->checkProjectPrivTest((object)array('id' => 1, 'acl' => 'private', 'PO' => '', 'PM' => '', 'QD' => '', 'RD' => '', 'type' => 'project', 'parent' => 0, 'path' => ',1,'), 'admin', array(), array(), array(), array())) && p() && e('1'); r($userTest->checkProjectPrivTest((object)array('id' => 1, 'acl' => 'private', 'PO' => '', 'PM' => 'pm1', 'QD' => '', 'RD' => '', 'type' => 'project', 'parent' => 0, 'path' => ',1,'), 'pm1', array(), array(), array(), array())) && p() && e('1'); diff --git a/module/user/test/model/checkverifypassword.php b/module/user/test/model/checkverifypassword.php index 7f33ecd23e..9b4fd62a93 100644 --- a/module/user/test/model/checkverifypassword.php +++ b/module/user/test/model/checkverifypassword.php @@ -25,7 +25,7 @@ cid=19592 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; zenData('user')->loadYaml('user')->gen(1); @@ -33,7 +33,7 @@ su('admin'); $random = updateSessionRandom(); -$userTest = new userTest(); +$userTest = new userModelTest(); $result1 = $userTest->checkVerifyPasswordTest(''); r($result1) && p('result') && e(0); // 验证密码传空字符串返回 false。 diff --git a/module/user/test/model/cleanlocked.php b/module/user/test/model/cleanlocked.php index 5660dfb5b1..dee8dca983 100755 --- a/module/user/test/model/cleanlocked.php +++ b/module/user/test/model/cleanlocked.php @@ -28,14 +28,14 @@ cid=19593 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; $user = zenData('user'); $user->fails->range('5'); $user->locked->range('`2023-01-10 14:34:12`'); $user->gen(2); -$userTest = new userTest(); +$userTest = new userModelTest(); $_SESSION['loginFails'] = 5; $_SESSION['admin.loginLocked'] = '2023-01-10 14:34:12'; diff --git a/module/user/test/model/computepasswordstrength.php b/module/user/test/model/computepasswordstrength.php index dc4a8f562c..fa792b3c8e 100755 --- a/module/user/test/model/computepasswordstrength.php +++ b/module/user/test/model/computepasswordstrength.php @@ -37,9 +37,9 @@ cid=19594 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; -$userTest = new userTest(); +$userTest = new userModelTest(); r($userTest->computePasswordStrengthTest('')) && p() && e(0); // 密码为空,强度为弱。 diff --git a/module/user/test/model/computeuserview.php b/module/user/test/model/computeuserview.php index 87ffe8c0c9..55b03dbe8d 100755 --- a/module/user/test/model/computeuserview.php +++ b/module/user/test/model/computeuserview.php @@ -26,7 +26,7 @@ cid=19595 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; zenData('user')->gen(10); zenData('userview')->loadYaml('userview')->gen(10); @@ -46,7 +46,7 @@ global $config; $config->userview->updateTime = $time + 1; $config->userview->relatedTablesUpdateTime = $time; -$user = new userTest(); +$user = new userModelTest(); r($user->computeUserViewTest('test1', false)) && p('programs', '-') && e(',3'); // 不强制更新,获取test1账户的可查看项目集列表。 r($user->computeUserViewTest('test1', false)) && p('products', '-') && e(',3'); // 不强制更新,获取test1账户的可查看产品列表。 r($user->computeUserViewTest('test1', false)) && p('projects', '-') && e(',13'); // 不强制更新,获取test1账户的可查看项目列表。 diff --git a/module/user/test/model/create.php b/module/user/test/model/create.php index bfa72adf6d..f0328f2f5f 100755 --- a/module/user/test/model/create.php +++ b/module/user/test/model/create.php @@ -58,7 +58,7 @@ cid=19596 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; zenData('user')->gen(1); zenData('company')->gen(1); @@ -98,7 +98,7 @@ $template->verifyPassword = $verify; $template->passwordLength = 6; $template->passwordStrength = 0; -$userTest = new userTest(); +$userTest = new userModelTest(); /* 检测系统预留用户名。*/ $user1 = clone $template; diff --git a/module/user/test/model/createcompany.php b/module/user/test/model/createcompany.php index bbdbac7d70..6275f5a5ca 100644 --- a/module/user/test/model/createcompany.php +++ b/module/user/test/model/createcompany.php @@ -15,14 +15,14 @@ cid=19597 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; zenData('user')->gen(1); zenData('company')->gen(1); su('admin'); -$userTest = new userTest(); +$userTest = new userModelTest(); $result = $userTest->createCompanyTest(''); r($result) && p('result') && e(0); // 公司名称为空,返回 0。 diff --git a/module/user/test/model/createcontactlist.php b/module/user/test/model/createcontactlist.php index c66417dc08..28ce7af02f 100755 --- a/module/user/test/model/createcontactlist.php +++ b/module/user/test/model/createcontactlist.php @@ -29,11 +29,11 @@ cid=19598 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; zenData('usercontact')->gen(1); -$userTest = new userTest(); +$userTest = new userModelTest(); $contact1 = (object)array('account' => 'user1', 'listName' => '', 'userList' => '', 'public' => 0); $contact2 = (object)array('account' => 'user1', 'listName' => '联系人列表1', 'userList' => 'user1,user2', 'public' => 0); diff --git a/module/user/test/model/createusergroup.php b/module/user/test/model/createusergroup.php index 31e1c31cf1..345190931b 100644 --- a/module/user/test/model/createusergroup.php +++ b/module/user/test/model/createusergroup.php @@ -19,7 +19,7 @@ cid=19599 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; zenData('user')->gen(1); zenData('company')->gen(1); @@ -27,7 +27,7 @@ zenData('usergroup')->gen(0); su('admin'); -$userTest = new userTest(); +$userTest = new userModelTest(); r($userTest->createUserGroupTest(array(), 'admin')) && p('result') && e(0); // 权限组为空,返回 false。 r($userTest->createUserGroupTest(array('1'), '')) && p('result') && e(0); // 用户名为空,返回 false。 diff --git a/module/user/test/model/deletecontactlist.php b/module/user/test/model/deletecontactlist.php index 9a0eadbb17..88ce1cd85e 100755 --- a/module/user/test/model/deletecontactlist.php +++ b/module/user/test/model/deletecontactlist.php @@ -18,13 +18,13 @@ cid=19600 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; $table = zenData('usercontact'); $table->account->range('user1'); $table->gen(3); -$userTest = new userTest(); +$userTest = new userModelTest(); $lists = $userTest->getContactListsTest('user1'); r(count($lists)) && p() && e(3); //联系人列表数量为 3。 diff --git a/module/user/test/model/failplus.php b/module/user/test/model/failplus.php index 462535773f..b76e330523 100755 --- a/module/user/test/model/failplus.php +++ b/module/user/test/model/failplus.php @@ -16,7 +16,7 @@ cid=19601 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; $user = zenData('user'); $user->account->range('testuser'); @@ -33,7 +33,7 @@ su('admin'); global $config, $tester; $config->user->failTimes = 3; -$userTest = new userTest(); +$userTest = new userModelTest(); // 清理session状态 unset($_SESSION['loginFails']); diff --git a/module/user/test/model/fetchextrausers.php b/module/user/test/model/fetchextrausers.php index 359c964b48..414727feea 100644 --- a/module/user/test/model/fetchextrausers.php +++ b/module/user/test/model/fetchextrausers.php @@ -28,11 +28,11 @@ cid=19602 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; zenData('user')->gen(2); -$userTest = new userTest(); +$userTest = new userModelTest(); r($userTest->fetchExtraUsersTest('', '*', '')) && p() && e(0); // usersToAppended 参数为空字符串,返回空数组。 r($userTest->fetchExtraUsersTest(array(), '*', '')) && p() && e(0); // usersToAppended 参数为空数组,返回空数组。 diff --git a/module/user/test/model/getavatarpairs.php b/module/user/test/model/getavatarpairs.php index 1ed881b46c..bc8be22d4d 100755 --- a/module/user/test/model/getavatarpairs.php +++ b/module/user/test/model/getavatarpairs.php @@ -16,7 +16,7 @@ cid=19603 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; su('admin'); $user = zenData('user'); @@ -28,7 +28,7 @@ $user->avatar->range('1-5')->prefix('/home/z/user/'); $user->deleted->range('0{4}, 1{1}'); $user->gen(5); -$user = new userTest(); +$user = new userModelTest(); r(count($user->getAvatarPairsTest())) && p() && e('4'); // 未删除的用户头像的数量 r(count($user->getAvatarPairsTest('all'))) && p() && e('5'); // 所有用户头像的数量 diff --git a/module/user/test/model/getbyid.php b/module/user/test/model/getbyid.php index 710015ba6e..5f234da711 100755 --- a/module/user/test/model/getbyid.php +++ b/module/user/test/model/getbyid.php @@ -21,7 +21,7 @@ cid=19604 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; $table = zenData('user'); $table->last->prefix('2025-01-01 10:00:00'); @@ -29,7 +29,7 @@ $table->gen(1); su('admin'); -$userTest = new userTest(); +$userTest = new userModelTest(); r($userTest->getByIDTest(0)) && p('account') && e(0); // $userID 参数为 0 ,通过默认字段获取,用户不存在。 r($userTest->getByIDTest(1)) && p('account') && e(0); // $userID 参数为 1 ,通过默认字段获取,用户不存在。 diff --git a/module/user/test/model/getbyquery.php b/module/user/test/model/getbyquery.php index d82bac58f2..bd5c4f4ca0 100755 --- a/module/user/test/model/getbyquery.php +++ b/module/user/test/model/getbyquery.php @@ -41,7 +41,7 @@ cid=19605 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; $table = zenData('user'); $table->type->range('outside{2},inside{8}'); @@ -57,7 +57,7 @@ $app->rawModule = 'user'; $app->rawMethod = 'browse'; $pager = new pager(0, 5, 1); -$userTest = new userTest(); +$userTest = new userModelTest(); $users = $userTest->getByQueryTest(); r(count($users)) && p() && e(8); // 使用默认参数,有 8 个用户。 diff --git a/module/user/test/model/getcancreatestoryusers.php b/module/user/test/model/getcancreatestoryusers.php index 64b5ca4f0a..3760178d8d 100755 --- a/module/user/test/model/getcancreatestoryusers.php +++ b/module/user/test/model/getcancreatestoryusers.php @@ -20,7 +20,7 @@ cid=19606 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; zenData('company')->gen(1); @@ -41,7 +41,7 @@ $privTable->module->range('story{6},task{6},bug{6},story{6},story{6}'); $privTable->method->range('create,batchCreate,edit,batchEdit,delete,batchDelete'); $privTable->gen(30); -$userTest = new userTest(); +$userTest = new userModelTest(); $users = $userTest->getCanCreateStoryUsersTest(); r(count($users)) && p() && e(4); // 有创建需求权限的用户数为 4。 diff --git a/module/user/test/model/getcommiters.php b/module/user/test/model/getcommiters.php index 03a7525123..44f54c30cc 100755 --- a/module/user/test/model/getcommiters.php +++ b/module/user/test/model/getcommiters.php @@ -15,12 +15,12 @@ cid=19607 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; su('admin'); zenData('user')->gen(30); -$user = new userTest(); +$user = new userModelTest(); $commiters = $user->getCommitersTest(); r($commiters) && p('user1') && e('用户1'); //获取源代码账号为user1的用户真实姓名 diff --git a/module/user/test/model/getcontactlistbyid.php b/module/user/test/model/getcontactlistbyid.php index 4abf35176f..6aa2014a53 100755 --- a/module/user/test/model/getcontactlistbyid.php +++ b/module/user/test/model/getcontactlistbyid.php @@ -19,11 +19,11 @@ cid=19608 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; zenData('usercontact')->gen(2); -$userTest = new userTest(); +$userTest = new userModelTest(); r($userTest->getContactListByIDTest(0)) && p() && e(0); //获取 id 为 0 的联系人列表,返回空。 r($userTest->getContactListByIDTest(3)) && p() && e(0); //获取 id 为 4 的联系人列表,返回空。 diff --git a/module/user/test/model/getcontactlists.php b/module/user/test/model/getcontactlists.php index 02288600ed..de51bb1479 100755 --- a/module/user/test/model/getcontactlists.php +++ b/module/user/test/model/getcontactlists.php @@ -14,13 +14,13 @@ cid=19609 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; su('admin'); $userContactList = zenData('usercontact'); $userContactList->gen(100); -$user = new userTest(); +$user = new userModelTest(); $user1ContactList = $user->getContactListsTest('user1', 'withempty|withnote'); $dev2ContactList = $user->getContactListsTest('dev2', 'withempty'); $test3ContactList = $user->getContactListsTest('test3'); diff --git a/module/user/test/model/getexecutions.php b/module/user/test/model/getexecutions.php index c8adcc4731..be29a81bb2 100755 --- a/module/user/test/model/getexecutions.php +++ b/module/user/test/model/getexecutions.php @@ -39,7 +39,7 @@ cid=19610 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; zenData('user')->gen(3); zenData('company')->gen(1); @@ -78,7 +78,7 @@ $app->rawMethod = 'project'; $app->loadClass('pager'); $pager = new pager(0, 5, 1); -$userTest = new userTest(); +$userTest = new userModelTest(); r($userTest->getExecutionsTest('')) && p() && e(0); // 用户名为空,返回空数组。 r($userTest->getExecutionsTest('user2')) && p() && e(0); // 用户 user2 未参与任何执行,返回空数组。 diff --git a/module/user/test/model/getgroups.php b/module/user/test/model/getgroups.php index e90a5876bb..5841fe5a97 100755 --- a/module/user/test/model/getgroups.php +++ b/module/user/test/model/getgroups.php @@ -21,14 +21,14 @@ cid=19611 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; $table = zenData('usergroup'); $table->account->range('user1{3},user2{2},user3{2}'); $table->group->range('1-3,2,3,3,4'); $table->gen(7); -$userTest = new userTest(); +$userTest = new userModelTest(); r($userTest->getGroupsTest('')) && p() && e(0); // 参数为空字符串,返回空数组。 r($userTest->getGroupsTest('admin')) && p() && e(0); // 参数为不存在的用户名,返回空数组。 diff --git a/module/user/test/model/getgroupsbyvisions.php b/module/user/test/model/getgroupsbyvisions.php index 78938266d3..5e07c537f8 100755 --- a/module/user/test/model/getgroupsbyvisions.php +++ b/module/user/test/model/getgroupsbyvisions.php @@ -73,7 +73,7 @@ cid=19612 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; $table = zenData('group'); $table->vision->range('rnd{3},lite{3},or{3}'); @@ -87,7 +87,7 @@ $config->edition = 'open'; $app::$loadedLangs = array(); $app->loadLang('common'); -$userTest = new userTest(); +$userTest = new userModelTest(); r($userTest->getGroupsByVisionsTest('')) && p() && e(0); // 传空字符串,返回空数组。 r($userTest->getGroupsByVisionsTest(',,')) && p() && e(0); // 传只包含逗号的字符串,返回空数组。 diff --git a/module/user/test/model/getlatestuserview.php b/module/user/test/model/getlatestuserview.php index eb5310800e..e8a65d7651 100755 --- a/module/user/test/model/getlatestuserview.php +++ b/module/user/test/model/getlatestuserview.php @@ -29,7 +29,7 @@ cid=19614 // 1. 导入依赖(路径固定,不可修改) include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; // 2. zendata数据准备(根据需要配置) $user = zenData('user'); @@ -89,7 +89,7 @@ $program->gen(5); su('admin'); // 4. 创建测试实例(变量名与模块名一致) -$userTest = new userTest(); +$userTest = new userModelTest(); // 5. 🔴 强制要求:必须包含至少5个测试步骤 diff --git a/module/user/test/model/getlist.php b/module/user/test/model/getlist.php index 761a238775..dfd158b8e0 100755 --- a/module/user/test/model/getlist.php +++ b/module/user/test/model/getlist.php @@ -18,7 +18,7 @@ cid=19615 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; su('admin'); $user = zenData('user'); @@ -29,7 +29,7 @@ $user->type->range('inside{3},outside{2}'); $user->deleted->range('0-1'); $user->gen(5); -$user = new userTest(); +$user = new userModelTest(); r($user->getListTest()) && p('0:realname') && e('用户名1'); // 查找系统中第一个未删除的、内部用户真实姓名,根据account正序排 r($user->getListTest()) && p('1:realname') && e('用户名3'); // 查找系统中第二个未删除的、内部用户真实姓名,根据account正序排 diff --git a/module/user/test/model/getlistbyaccounts.php b/module/user/test/model/getlistbyaccounts.php index 2813f7dd90..b2f007342c 100755 --- a/module/user/test/model/getlistbyaccounts.php +++ b/module/user/test/model/getlistbyaccounts.php @@ -35,7 +35,7 @@ cid=19616 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; $user = zenData('user'); $user->id->range('1001-1005'); @@ -46,7 +46,7 @@ $user->type->range('inside{3},outside{2}'); $user->deleted->range('0-1'); $user->gen(5); -$userTest = new userTest(); +$userTest = new userModelTest(); $accounts = array('user1', 'user2', 'user3', 'user4', 'user5'); $users = $userTest->getListByAccountsTest(array()); diff --git a/module/user/test/model/getlistforgitlabapi.php b/module/user/test/model/getlistforgitlabapi.php index befab33721..d5072d092a 100755 --- a/module/user/test/model/getlistforgitlabapi.php +++ b/module/user/test/model/getlistforgitlabapi.php @@ -14,14 +14,14 @@ cid=19618 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; $user = zenData('user'); $user->account->range('1-2')->prefix('user'); $user->avatar->range('`avatar`,``'); $user->gen(2); -$userTest = new userTest(); +$userTest = new userModelTest(); $accounts = array('user1', 'user2'); $users = $userTest->getListForGitLabAPITest(array()); diff --git a/module/user/test/model/getmanagelistgroupbytype.php b/module/user/test/model/getmanagelistgroupbytype.php index b949e339a6..04f42136c3 100755 --- a/module/user/test/model/getmanagelistgroupbytype.php +++ b/module/user/test/model/getmanagelistgroupbytype.php @@ -19,13 +19,13 @@ cid=19619 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; zendata('projectadmin')->loadYaml('projectadmin_getmanagelistgroupbytype', false, 2)->gen(4); su('admin'); -$userTest = new userTest(); +$userTest = new userModelTest(); r($userTest->getManageListGroupByTypeTest('admin')) && p('programs:isAdmin') && e('1'); // 测试用户admin的programs权限为all,isAdmin为1 r($userTest->getManageListGroupByTypeTest('admin')) && p('projects:isAdmin') && e('1'); // 测试用户admin的projects权限为all,isAdmin为1 diff --git a/module/user/test/model/getobjectsauthedusers.php b/module/user/test/model/getobjectsauthedusers.php index b96307b5f9..36304027a2 100755 --- a/module/user/test/model/getobjectsauthedusers.php +++ b/module/user/test/model/getobjectsauthedusers.php @@ -21,7 +21,7 @@ cid=19620 // 1. 导入依赖 include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; // 2. zendata数据准备 $user = zenData('user'); @@ -65,7 +65,7 @@ $acl->gen(12); su('admin'); // 4. 创建测试实例 -$userTest = new userTest(); +$userTest = new userModelTest(); // 5. 测试步骤 // 创建项目对象 diff --git a/module/user/test/model/getpairs.php b/module/user/test/model/getpairs.php index 7ba7caa997..ec2c2ac363 100755 --- a/module/user/test/model/getpairs.php +++ b/module/user/test/model/getpairs.php @@ -18,7 +18,7 @@ cid=19621 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; $user = zenData('user'); $user->id->range('1001-1006'); @@ -32,7 +32,7 @@ $user->gen(5); $usersToAppended = array('account5', 'account1'); -$user = new userTest(); +$user = new userModelTest(); $outsideUsersWithClosed = $user->getPairsTest('outside'); $outsideUsersWithLetter = $user->getPairsTest('outside|noclosed'); $outsideUsersNoLetter = $user->getPairsTest('outside|noclosed|noletter'); diff --git a/module/user/test/model/getparentstageauthedusers.php b/module/user/test/model/getparentstageauthedusers.php index 8f16e6e020..6ca03de447 100755 --- a/module/user/test/model/getparentstageauthedusers.php +++ b/module/user/test/model/getparentstageauthedusers.php @@ -15,14 +15,14 @@ cid=19622 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; zenData('user')->gen(10); su('admin'); $userView = zenData('userview'); $userView->gen(400); -$user = new userTest(); +$user = new userModelTest(); r($user->getParentStageAuthedUsersTest(0)) && p() && e('0'); //传入阶段ID为0获取有权限的用户 r($user->getParentStageAuthedUsersTest(1)) && p() && e('0'); //传入一个阶段ID为1获取有权限的用户 diff --git a/module/user/test/model/getproductmembers.php b/module/user/test/model/getproductmembers.php index 2f28f7c035..317cb070d6 100644 --- a/module/user/test/model/getproductmembers.php +++ b/module/user/test/model/getproductmembers.php @@ -16,7 +16,7 @@ cid=19623 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; zenData('user')->gen(4); zenData('product')->gen(3); @@ -39,7 +39,7 @@ $stakeholder->objectType->range('project'); $stakeholder->user->range('user2,user4'); $stakeholder->gen(2); -$userTest = new userTest(); +$userTest = new userModelTest(); $emptyProducts = $userTest->getProductMembersTest(array()); r(count($emptyProducts[0])) && p() && e(0); // 产品列表为空,返回空数组。 diff --git a/module/user/test/model/getproductview.php b/module/user/test/model/getproductview.php index 809068ecb8..eff2e2eee6 100755 --- a/module/user/test/model/getproductview.php +++ b/module/user/test/model/getproductview.php @@ -21,7 +21,7 @@ cid=19624 // 1. 导入依赖(路径固定,不可修改) include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; // 2. zendata数据准备(根据需要配置) $userTable = zenData('user'); @@ -37,7 +37,7 @@ $aclTable->loadYaml('acl_getproductview', false, 2)->gen(20); su('admin'); // 4. 创建测试实例(变量名与模块名一致) -$userTest = new userTest(); +$userTest = new userModelTest(); // 5. 🔴 强制要求:必须包含至少5个测试步骤 // 准备测试数据 diff --git a/module/user/test/model/getprogramauthedusers.php b/module/user/test/model/getprogramauthedusers.php index 15f5d58020..cf98c0e2f5 100755 --- a/module/user/test/model/getprogramauthedusers.php +++ b/module/user/test/model/getprogramauthedusers.php @@ -17,7 +17,7 @@ cid=19626 // 1. 导入依赖(路径固定,不可修改) include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; // 2. zendata数据准备(根据需要配置) $project = zenData('project'); @@ -40,7 +40,7 @@ $company->gen(1); su('admin'); // 4. 创建测试实例(变量名与模块名一致) -$userTest = new userTest(); +$userTest = new userModelTest(); // 5. 🔴 强制要求:必须包含至少5个测试步骤 r(count($userTest->getProgramAuthedUsersTest((object)array('id' => 1, 'openedBy' => 'admin', 'PM' => 'pm1', 'parent' => 0, 'acl' => 'open', 'path' => ',1,')))) && p() && e('2'); // 步骤1:正常情况 diff --git a/module/user/test/model/getprogramstakeholder.php b/module/user/test/model/getprogramstakeholder.php index f7aa2d5c4e..e36a5d707b 100755 --- a/module/user/test/model/getprogramstakeholder.php +++ b/module/user/test/model/getprogramstakeholder.php @@ -19,7 +19,7 @@ cid=19627 // 1. 导入依赖(路径固定,不可修改) include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; // 2. zendata数据准备 $stakeholderTable = zenData('stakeholder'); @@ -38,7 +38,7 @@ $projectTable->gen(6); su('admin'); // 4. 创建测试实例 -$userTest = new userTest(); +$userTest = new userModelTest(); // 5. 测试步骤(必须包含至少5个) r($userTest->getProgramStakeholderTest(array(1 => array(1, 2), 2 => array(3)))) && p('1:admin') && e('admin'); // 步骤1:正常情况,检查产品1有admin diff --git a/module/user/test/model/getprogramview.php b/module/user/test/model/getprogramview.php index 09a2bda3d4..952fb1db24 100755 --- a/module/user/test/model/getprogramview.php +++ b/module/user/test/model/getprogramview.php @@ -21,7 +21,7 @@ cid=19628 // 1. 导入依赖(路径固定,不可修改) include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; // 2. zendata数据准备(根据需要配置) $table = zenData('project'); @@ -37,7 +37,7 @@ $app->company->admins = ',admin,'; su('admin'); // 4. 创建测试实例(变量名与模块名一致) -$userTest = new userTest(); +$userTest = new userModelTest(); // 5. 🔴 强制要求:必须包含至少5个测试步骤 diff --git a/module/user/test/model/getprojectauthedusers.php b/module/user/test/model/getprojectauthedusers.php index c9934cc96f..3a204dfea9 100755 --- a/module/user/test/model/getprojectauthedusers.php +++ b/module/user/test/model/getprojectauthedusers.php @@ -17,7 +17,7 @@ cid=19629 // 1. 导入依赖(路径固定,不可修改) include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; // 2. zendata数据准备 $table = zenData('project'); @@ -40,7 +40,7 @@ $table->gen(10); su('admin'); // 4. 创建测试实例(变量名与模块名一致) -$userTest = new userTest(); +$userTest = new userModelTest(); // 创建测试项目对象 $basicProject = new stdClass(); diff --git a/module/user/test/model/getprojects.php b/module/user/test/model/getprojects.php index 3a686c7dcc..1d0b4ab762 100755 --- a/module/user/test/model/getprojects.php +++ b/module/user/test/model/getprojects.php @@ -18,7 +18,7 @@ cid=19630 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; global $tester; $tester->dao->delete()->from(TABLE_PROJECT)->exec(); @@ -51,7 +51,7 @@ for($i = 1; $i <= 5; $i++) su('admin'); -$userTest = new userTest(); +$userTest = new userModelTest(); r(count($userTest->getProjectsTest(''))) && p() && e('0'); r(count($userTest->getProjectsTest('nonexistuser'))) && p() && e('0'); diff --git a/module/user/test/model/getprojectview.php b/module/user/test/model/getprojectview.php index be6f16e494..8207c9795e 100755 --- a/module/user/test/model/getprojectview.php +++ b/module/user/test/model/getprojectview.php @@ -19,7 +19,7 @@ cid=19631 // 1. 导入依赖(路径固定,不可修改) include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; // 2. zendata数据准备(根据需要配置) // 由于测试私有方法不需要数据库数据,此处不需要zendata生成数据 @@ -28,7 +28,7 @@ include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; su('admin'); // 4. 创建测试实例(变量名与模块名一致) -$userTest = new userTest(); +$userTest = new userModelTest(); // 5. 🔴 强制要求:必须包含至少5个测试步骤 r($userTest->getProjectViewTest('admin', array(1 => (object)array('id' => 1, 'acl' => 'open', 'PO' => '', 'QD' => '', 'RD' => '', 'PM' => '', 'type' => 'project', 'parent' => 0, 'path' => ',1,'), 2 => (object)array('id' => 2, 'acl' => 'open', 'PO' => '', 'QD' => '', 'RD' => '', 'PM' => '', 'type' => 'project', 'parent' => 0, 'path' => ',2,'), 3 => (object)array('id' => 3, 'acl' => 'private', 'PO' => '', 'QD' => '', 'RD' => '', 'PM' => '', 'type' => 'project', 'parent' => 0, 'path' => ',3,')), array('projects' => array('isAdmin' => 1)), array(), array(), array(), array())) && p() && e('1,2,3'); // 步骤1:管理员用户可访问所有项目 diff --git a/module/user/test/model/getrealnameandemails.php b/module/user/test/model/getrealnameandemails.php index 1ceb847806..b44053b079 100755 --- a/module/user/test/model/getrealnameandemails.php +++ b/module/user/test/model/getrealnameandemails.php @@ -19,7 +19,7 @@ cid=19632 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; $user = zenData('user'); $user->id->range('1001-1005'); @@ -29,7 +29,7 @@ $user->email->range('account1!qq.com,account2!qq.com,account3!qq.com,account4!qq $user->deleted->range('0{5}'); $user->gen(5); -$userTest = new userTest(); +$userTest = new userModelTest(); $result = $userTest->getRealNameAndEmailsTest(array()); r(count($result)) && p() && e(0); // 参数为空数组,返回空数组。 diff --git a/module/user/test/model/getsprintview.php b/module/user/test/model/getsprintview.php index 4d897d1f65..36fb6055ec 100755 --- a/module/user/test/model/getsprintview.php +++ b/module/user/test/model/getsprintview.php @@ -21,7 +21,7 @@ cid=19633 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; su('admin'); diff --git a/module/user/test/model/getteammemberpairs.php b/module/user/test/model/getteammemberpairs.php index 4d81322cff..f408c0f4d1 100755 --- a/module/user/test/model/getteammemberpairs.php +++ b/module/user/test/model/getteammemberpairs.php @@ -17,13 +17,13 @@ cid=19634 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; zenData('project')->gen(20); zenData('team')->gen(20); zenData('user')->gen(20); su('admin'); -$user = new userTest(); +$user = new userModelTest(); r(count($user->getTeamMemberPairsTest(11, 'project'))) && p() && e('1'); //获取ID为11的项目的团队成员数量 r(count($user->getTeamMemberPairsTest(11, 'project', '', array('user1')))) && p() && e('2'); //获取ID为11的项目的团队成员数量,追加用户user1 r(count($user->getTeamMemberPairsTest(12, 'project'))) && p() && e('1'); //获取ID为12的项目的团队成员数量 diff --git a/module/user/test/model/getuseracls.php b/module/user/test/model/getuseracls.php index ff4695c112..903172fb7a 100755 --- a/module/user/test/model/getuseracls.php +++ b/module/user/test/model/getuseracls.php @@ -16,14 +16,14 @@ cid=19635 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; zendata('group')->loadYaml('group_getuseracls', false, 2)->gen(10); zendata('usergroup')->loadYaml('usergroup_getuseracls', false, 2)->gen(10); su('admin'); -$userTest = new userTest(); +$userTest = new userModelTest(); r(is_array($userTest->getUserAclsTest('guest'))) && p() && e('1'); // 步骤1:测试guest用户权限获取 r(is_array($userTest->getUserAclsTest('admin'))) && p() && e('1'); // 步骤2:测试admin用户权限获取 diff --git a/module/user/test/model/getuserroles.php b/module/user/test/model/getuserroles.php index 8ec09c7641..b8d96bcf38 100755 --- a/module/user/test/model/getuserroles.php +++ b/module/user/test/model/getuserroles.php @@ -39,7 +39,7 @@ cid=19636 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; $user = zenData('user'); $user->role->range('dev,qa,pm,po,td,pd,qd,top,others,role'); @@ -47,7 +47,7 @@ $user->gen(10); su('admin'); -$userTest = new userTest(); +$userTest = new userModelTest(); r(count($userTest->getUserRolesTest(''))) && p() && e(0); // 参数为空字符串返回空数组。 r(count($userTest->getUserRolesTest(array()))) && p() && e(0); // 参数为空数组返回空数组。 diff --git a/module/user/test/model/getusertemplates.php b/module/user/test/model/getusertemplates.php index e557a2c7be..783f3b7f19 100755 --- a/module/user/test/model/getusertemplates.php +++ b/module/user/test/model/getusertemplates.php @@ -62,7 +62,7 @@ cid=19637 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; zenData('user')->gen(2); @@ -72,7 +72,7 @@ $table->gen(10); su('admin'); // 当前用户切换为 admin。 -$userTest = new userTest(); +$userTest = new userModelTest(); $templates = $userTest->getUserTemplatesTest('exporttask'); r(count($templates)) && p() && e(2); // admin 用户可以查看导出任务的模板有 2 个。 diff --git a/module/user/test/model/getweakusers.php b/module/user/test/model/getweakusers.php index 04131a4533..47b2130dfc 100755 --- a/module/user/test/model/getweakusers.php +++ b/module/user/test/model/getweakusers.php @@ -42,7 +42,7 @@ cid=19638 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; $table = zenData('user'); $table->account->range('1-12')->prefix('user'); @@ -59,7 +59,7 @@ global $app; unset($config->safe->weak); // 防止数据库中的配置影响测试结果。 $app->loadConfig('admin'); // 加载系统内置的弱密码配置。 -$userTest = new userTest(); +$userTest = new userModelTest(); $users = $userTest->getWeakUsersTest(); r(count($users)) && p() && e(10); // 检测出 10 个弱密码用户。 diff --git a/module/user/test/model/grantuserview.php b/module/user/test/model/grantuserview.php index e757de0c8b..e9341fa239 100755 --- a/module/user/test/model/grantuserview.php +++ b/module/user/test/model/grantuserview.php @@ -26,7 +26,7 @@ cid=19639 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; zenData('user')->gen(10); zenData('projectproduct')->gen(0); @@ -47,7 +47,7 @@ global $config; $config->userview->updateTime = $time + 1; $config->userview->relatedTablesUpdateTime = $time; -$user = new userTest(); +$user = new userModelTest(); r($user->grantUserViewTest('admin')) && p('programs', '-') && e('1,1,4,7,10'); // 用户视图最后更新时间大于相关表最后更新时间,获取admin账户最终可见的项目集列表 r($user->grantUserViewTest('admin')) && p('products', '-') && e('1,1,2,3,4,5,6,7,8,9,10'); // 用户视图最后更新时间大于相关表最后更新时间,获取admin账户最终可见的产品列表 r($user->grantUserViewTest('admin')) && p('projects', '-') && e('11,13,16,19'); // 用户视图最后更新时间大于相关表最后更新时间,获取admin账户最终可见的项目列表 diff --git a/module/user/test/model/identify.php b/module/user/test/model/identify.php index c766dff43d..1706f8f248 100755 --- a/module/user/test/model/identify.php +++ b/module/user/test/model/identify.php @@ -33,7 +33,7 @@ cid=19640 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; $table = zenData('user'); $table->password->range(md5(123456)); @@ -46,7 +46,7 @@ su('admin'); global $app, $config; $config->webRoot = '/'; -$userTest = new userTest(); +$userTest = new userModelTest(); $random = updateSessionRandom(); $admin = $userTest->getByIdTest('admin'); diff --git a/module/user/test/model/identifybycookie.php b/module/user/test/model/identifybycookie.php index a34eb54784..b215d893df 100755 --- a/module/user/test/model/identifybycookie.php +++ b/module/user/test/model/identifybycookie.php @@ -54,7 +54,7 @@ cid=19641 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; zenData('user')->gen(2); zenData('company')->gen(1); @@ -73,7 +73,7 @@ $groupPrivTable->gen(9); global $app; -$userTest = new userTest(); +$userTest = new userModelTest(); $password = sha1(123456); $admin = $userTest->getByIdTest('admin'); $user1 = $userTest->getByIdTest('user1'); diff --git a/module/user/test/model/identifybyphpauth.php b/module/user/test/model/identifybyphpauth.php index 278e514602..83246877b6 100755 --- a/module/user/test/model/identifybyphpauth.php +++ b/module/user/test/model/identifybyphpauth.php @@ -54,7 +54,7 @@ cid=19642 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; zenData('user')->gen(2); zenData('company')->gen(1); @@ -75,7 +75,7 @@ su('admin'); global $app; -$userTest = new userTest(); +$userTest = new userModelTest(); $random = updateSessionRandom(); $password = md5(md5(123456) . $random); $admin = $userTest->getByIdTest('admin'); diff --git a/module/user/test/model/identifyuser.php b/module/user/test/model/identifyuser.php index 0c5d131f5d..1590840aca 100644 --- a/module/user/test/model/identifyuser.php +++ b/module/user/test/model/identifyuser.php @@ -19,7 +19,7 @@ cid=19643 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; $table = zenData('user'); $table->password->range(md5(123456)); @@ -28,7 +28,7 @@ $table->gen(2); su('admin'); -$userTest = new userTest(); +$userTest = new userModelTest(); $random = updateSessionRandom(); $admin = $userTest->getByIdTest('admin'); diff --git a/module/user/test/model/initviewobjects.php b/module/user/test/model/initviewobjects.php index 72e29e2973..28eb7c264d 100755 --- a/module/user/test/model/initviewobjects.php +++ b/module/user/test/model/initviewobjects.php @@ -17,7 +17,7 @@ cid=19644 // 1. 导入依赖(路径固定,不可修改) include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; // 2. zendata数据准备(根据需要配置) $product = zenData('product'); @@ -54,7 +54,7 @@ $stakeholder->gen(12); su('admin'); // 4. 创建测试实例(变量名与模块名一致) -$userTest = new userTest(); +$userTest = new userModelTest(); // 5. 🔴 强制要求:必须包含至少5个测试步骤 r(count($userTest->initViewObjectsTest(false))) && p() && e('7'); // 步骤1:正常初始化,返回7个元素的数组 diff --git a/module/user/test/model/isclickable.php b/module/user/test/model/isclickable.php index be536da236..cd0dd50636 100755 --- a/module/user/test/model/isclickable.php +++ b/module/user/test/model/isclickable.php @@ -17,7 +17,7 @@ cid=19645 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; su('admin'); @@ -25,7 +25,7 @@ global $config; $config->user->lockMinutes = 10; -$userTest = new userTest(); +$userTest = new userModelTest(); $user1 = (object)array('account' => 'user1', 'ranzhi' => ''); $user2 = (object)array('account' => 'user2', 'ranzhi' => 'user2'); diff --git a/module/user/test/model/islogon.php b/module/user/test/model/islogon.php index ab6ac39670..d5809f1772 100755 --- a/module/user/test/model/islogon.php +++ b/module/user/test/model/islogon.php @@ -17,11 +17,11 @@ cid=19646 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; zenData('user')->gen(2); -$userTest = new userTest(); +$userTest = new userModelTest(); $_SESSION['user'] = $userTest->getbyIdTest('admin'); r($userTest->isLogonTest()) && p() && e(1); // 步骤1:正常登录用户admin的状态检查 diff --git a/module/user/test/model/login.php b/module/user/test/model/login.php index 6f9e39c424..114257dd66 100755 --- a/module/user/test/model/login.php +++ b/module/user/test/model/login.php @@ -81,7 +81,7 @@ cid=19648 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; zenData('user')->gen(2); zenData('company')->gen(1); @@ -100,7 +100,7 @@ $groupPrivTable->gen(9); su('admin'); -$userTest = new userTest(); +$userTest = new userModelTest(); /* session 中记录登录失败次数和用户锁定时间以供检测清除用户锁定状态功能使用。*/ $tester->session->set('loginFails', 5); diff --git a/module/user/test/model/mergeaclstouserview.php b/module/user/test/model/mergeaclstouserview.php index fe7c6d83d6..446a5080e0 100755 --- a/module/user/test/model/mergeaclstouserview.php +++ b/module/user/test/model/mergeaclstouserview.php @@ -20,7 +20,7 @@ cid=19649 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; zenData('user')->gen(10); zenData('userview')->gen(5); @@ -33,7 +33,7 @@ $app->company->admins = ',admin,'; su('admin'); -$userTest = new userTest(); +$userTest = new userModelTest(); // 准备测试数据:userView对象 $userView1 = new stdclass(); diff --git a/module/user/test/model/processdisplayvalue.php b/module/user/test/model/processdisplayvalue.php index 03d7d5883e..0fe92bd97f 100644 --- a/module/user/test/model/processdisplayvalue.php +++ b/module/user/test/model/processdisplayvalue.php @@ -41,7 +41,7 @@ cid=19650 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; $users = array ( @@ -50,7 +50,7 @@ $users = array 'user3' => (object)array('id' => 3, 'account' => 'user3', 'realname' => '用户3', 'deleted' => '1') ); -$userTest = new userTest(); +$userTest = new userModelTest(); r($userTest->processDisplayValueTest($users, '')) && p('user1,user2,user3') && e('U:用户1,U:user2,U:user3'); // 参数为空,用户 1 显示首字母 + 姓名,用户 2 显示首字母 + 用户名,用户 3 显示首字母 + 用户名。 r($userTest->processDisplayValueTest($users, 'showid')) && p('user1,user2,user3') && e('1,2,3'); // 参数为 showid,用户 1 显示用户 ID,用户 2 显示用户 ID,用户 3 显示用户 ID。 diff --git a/module/user/test/model/resetpassword.php b/module/user/test/model/resetpassword.php index be2cf45777..0c88a473cb 100755 --- a/module/user/test/model/resetpassword.php +++ b/module/user/test/model/resetpassword.php @@ -21,13 +21,13 @@ cid=19652 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; zenData('user')->gen(2); su('admin'); -$userTest = new userTest(); +$userTest = new userModelTest(); /* 安全配置相关功能在 checkPassword 单元测试用例中有详细测试,此处重置为默认值以减少对当前用例的影响。*/ unset($config->safe->mode); diff --git a/module/user/test/model/saveoldusertemplate.php b/module/user/test/model/saveoldusertemplate.php index 560c021d61..f661338e98 100755 --- a/module/user/test/model/saveoldusertemplate.php +++ b/module/user/test/model/saveoldusertemplate.php @@ -17,7 +17,7 @@ cid=19653 // 1. 导入依赖(路径固定,不可修改) include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; // 2. zendata数据准备(根据需要配置) $table = zenData('usertpl'); @@ -27,7 +27,7 @@ $table->loadYaml('usertpl_saveoldusertemplate', false, 2)->gen(10); su('admin'); // 4. 创建测试实例(变量名与模块名一致) -$userTest = new userTest(); +$userTest = new userModelTest(); // 5. 🔴 强制要求:必须包含至少5个测试步骤 $_POST = array('title' => '新建Bug模板', 'content' => '这是一个新的Bug模板内容', 'public' => '0'); diff --git a/module/user/test/model/saveusertemplate.php b/module/user/test/model/saveusertemplate.php index 4e1d3740e8..7d9a78287a 100755 --- a/module/user/test/model/saveusertemplate.php +++ b/module/user/test/model/saveusertemplate.php @@ -33,13 +33,13 @@ cid=19654 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; $table = zenData('usertpl'); $table->type->range('story'); $table->gen(1); -$userTest = new userTest(); +$userTest = new userModelTest(); $template1 = (object)array('account' => 'admin', 'type' => 'story', 'title' => '', 'content' => '', 'public' => 0); $template2 = (object)array('account' => 'admin', 'type' => 'story', 'title' => '模板名称1', 'content' => '模板内容1', 'public' => 0); diff --git a/module/user/test/model/su.php b/module/user/test/model/su.php index 2a9f6eb01b..0010da1721 100755 --- a/module/user/test/model/su.php +++ b/module/user/test/model/su.php @@ -16,7 +16,7 @@ cid=19656 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; $userTable = zenData('user'); $userTable->id->range('1-5'); @@ -34,7 +34,7 @@ $companyTable->gen(1); su('user1'); -$userTest = new userTest(); +$userTest = new userModelTest(); r($userTest->suTest()) && p('result') && e('1'); diff --git a/module/user/test/model/unbind.php b/module/user/test/model/unbind.php index 57914af98b..d17d0795b1 100755 --- a/module/user/test/model/unbind.php +++ b/module/user/test/model/unbind.php @@ -17,7 +17,7 @@ cid=19657 // 1. 导入依赖(路径固定,不可修改) include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; // 2. zendata数据准备(根据需要配置) $table = zenData('user'); @@ -32,7 +32,7 @@ $table->gen(10); su('admin'); // 4. 创建测试实例(变量名与模块名一致) -$userTest = new userTest(); +$userTest = new userModelTest(); // 5. 强制要求:必须包含至少5个测试步骤 r($userTest->unbindTest('user1')) && p('') && e('success'); // 步骤1:解绑已有然之账号的正常用户 diff --git a/module/user/test/model/update.php b/module/user/test/model/update.php index 0cc93eaf6d..9dcb6d7ef9 100755 --- a/module/user/test/model/update.php +++ b/module/user/test/model/update.php @@ -102,7 +102,7 @@ cid=19658 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; zenData('user')->gen(3); $companyTable = zenData('company'); @@ -163,7 +163,7 @@ $template->verifyPassword = $verify; $template->passwordLength = 6; $template->passwordStrength = 0; -$userTest = new userTest(); +$userTest = new userModelTest(); /** * 检测系统预留用户名。 diff --git a/module/user/test/model/updatecontactlist.php b/module/user/test/model/updatecontactlist.php index 9746ee789e..fdb3d5f619 100755 --- a/module/user/test/model/updatecontactlist.php +++ b/module/user/test/model/updatecontactlist.php @@ -29,13 +29,13 @@ cid=19659 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; $table = zenData('usercontact'); $table->account->range('user1'); $table->gen(2); -$userTest = new userTest(); +$userTest = new userModelTest(); $contact1 = (object)array('id' => 1, 'account' => 'user1', 'listName' => '', 'userList' => '', 'public' => 0); $contact2 = (object)array('id' => 1, 'account' => 'user1', 'listName' => '联系人列表2', 'userList' => 'user1,user2', 'public' => 0); diff --git a/module/user/test/model/updatepassword.php b/module/user/test/model/updatepassword.php index de320dcddb..58a60a12f0 100755 --- a/module/user/test/model/updatepassword.php +++ b/module/user/test/model/updatepassword.php @@ -25,7 +25,7 @@ cid=19660 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; zenData('user')->gen(1); @@ -33,7 +33,7 @@ su('admin'); global $app; -$userTest = new userTest(); +$userTest = new userModelTest(); /* 安全配置相关功能在 checkPassword 单元测试用例中有详细测试,此处重置为默认值以减少对当前用例的影响。*/ unset($config->safe->mode); diff --git a/module/user/test/model/uploadavatar.php b/module/user/test/model/uploadavatar.php index e7d9a2fcc9..7fd2b21269 100755 --- a/module/user/test/model/uploadavatar.php +++ b/module/user/test/model/uploadavatar.php @@ -17,7 +17,7 @@ cid=19666 // 1. 导入依赖(路径固定,不可修改) include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/model.class.php'; // 2. zendata数据准备(根据需要配置) // uploadAvatar方法主要调用file模块功能,不需要预生成大量数据 @@ -26,7 +26,7 @@ include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; su('admin'); // 4. 创建测试实例(变量名与模块名一致) -$userTest = new userTest(); +$userTest = new userModelTest(); // 5. 🔴 强制要求:必须包含至少5个测试步骤 r($userTest->uploadAvatarTest()) && p('result') && e('fail'); // 步骤1:正常情况下无文件上传 diff --git a/module/user/test/tao/fetchexecutions.php b/module/user/test/tao/fetchexecutions.php index e4d293c454..5b14d447a9 100644 --- a/module/user/test/tao/fetchexecutions.php +++ b/module/user/test/tao/fetchexecutions.php @@ -27,7 +27,7 @@ cid=19667 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/tao.class.php'; zenData('user')->gen(3); zenData('company')->gen(1); @@ -61,7 +61,7 @@ $app->rawMethod = 'project'; $app->loadClass('pager'); $pager = new pager(0, 5, 1); -$userTest = new userTest(); +$userTest = new userTaoTest(); r($userTest->fetchExecutionsTest('')) && p() && e(0); // 用户名为空,返回空数组。 r($userTest->fetchExecutionsTest('user2')) && p() && e(0); // 用户 user2 未参与任何执行,返回空数组。 diff --git a/module/user/test/tao/fetchexecutiontaskcount.php b/module/user/test/tao/fetchexecutiontaskcount.php index 28412782e1..16eea41248 100644 --- a/module/user/test/tao/fetchexecutiontaskcount.php +++ b/module/user/test/tao/fetchexecutiontaskcount.php @@ -26,7 +26,7 @@ cid=19668 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/tao.class.php'; $table = zenData('task'); $table->execution->range('1-5{10}'); @@ -37,7 +37,7 @@ $table->gen(50); global $config; -$userTest = new userTest(); +$userTest = new userTaoTest(); $executionIdList = array(1, 2, 3, 4, 5); diff --git a/module/user/test/tao/fetchprojectexecutioncount.php b/module/user/test/tao/fetchprojectexecutioncount.php index 9c23f659c9..c572488b8f 100644 --- a/module/user/test/tao/fetchprojectexecutioncount.php +++ b/module/user/test/tao/fetchprojectexecutioncount.php @@ -6,7 +6,7 @@ cid=19669 pid=1 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/tao.class.php'; $projectTable = zenData('project'); $projectTable->project->range('1-4{6}'); @@ -18,7 +18,7 @@ $projectTable->gen(20); global $config; -$userTest = new userTest(); +$userTest = new userTaoTest(); $projectIdList = array(1, 2, 3, 4); diff --git a/module/user/test/tao/fetchprojects.php b/module/user/test/tao/fetchprojects.php index 8db09107b0..14e83562dd 100644 --- a/module/user/test/tao/fetchprojects.php +++ b/module/user/test/tao/fetchprojects.php @@ -27,7 +27,7 @@ cid=19670 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/tao.class.php'; zenData('user')->gen(3); zenData('company')->gen(1); @@ -57,7 +57,7 @@ $app->rawMethod = 'project'; $app->loadClass('pager'); $pager = new pager(0, 5, 1); -$userTest = new userTest(); +$userTest = new userTaoTest(); r($userTest->fetchProjectsTest('')) && p() && e(0); // 用户名为空,返回空数组。 r($userTest->fetchProjectsTest('user2')) && p() && e(0); // 用户 user2 未参与任何项目,返回空数组。 diff --git a/module/user/test/tao/fetchprojectstorycountandestimate.php b/module/user/test/tao/fetchprojectstorycountandestimate.php index 480f6b91bc..a28e957a9c 100644 --- a/module/user/test/tao/fetchprojectstorycountandestimate.php +++ b/module/user/test/tao/fetchprojectstorycountandestimate.php @@ -6,7 +6,7 @@ cid=19671 pid=1 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; -include dirname(__FILE__, 2) . '/lib/user.unittest.class.php'; +include dirname(__FILE__, 2) . '/lib/tao.class.php'; $projectTable = zenData('project'); $projectTable->type->range('project'); @@ -26,7 +26,7 @@ $storyTable->gen(100); global $config; -$userTest = new userTest(); +$userTest = new userTaoTest(); $projectIdList = array(1, 2, 3, 4); diff --git a/module/user/test/zen/getfeaturebarmenus.php b/module/user/test/zen/getfeaturebarmenus.php old mode 100644 new mode 100755 index 7addf15096..b234ef1634 --- a/module/user/test/zen/getfeaturebarmenus.php +++ b/module/user/test/zen/getfeaturebarmenus.php @@ -1,5 +1,6 @@ #!/usr/bin/env php responseForLockedTest('')) && p('result') && e('fail'); r($userTest->responseForLockedTest('json')) && p('status') && e('failed'); r($userTest->responseForLockedTest('web')) && p('result') && e('fail'); r($userTest->responseForLockedTest('invalid')) && p('result') && e('fail'); -r($userTest->responseForLockedTest(' ')) && p('result,message') && e('fail,密码尝试次数太多,请联系管理员解锁,或10分钟后重试。'); \ No newline at end of file +r($userTest->responseForLockedTest(' ')) && p('result,message') && e('fail,密码尝试次数太多,请联系管理员解锁,或10分钟后重试。');