+ [misc] Add unit tests for projectModel::getInvolvedListByCurrentUser() method
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -53,4 +53,19 @@ class Project
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test getInvolvedListByCurrentUser method.
|
||||
*
|
||||
* @param string $fields
|
||||
* @access public
|
||||
* @return mixed
|
||||
*/
|
||||
public function getInvolvedListByCurrentUserTest($fields = 't1.*')
|
||||
{
|
||||
$result = $this->objectModel->getInvolvedListByCurrentUser($fields);
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
/**
|
||||
|
||||
title=测试 projectModel::getInvolvedListByCurrentUser();
|
||||
timeout=0
|
||||
cid=0
|
||||
|
||||
- 执行projectTest模块的getInvolvedListByCurrentUserTest方法,参数是't1.*' @5
|
||||
- 执行projectTest模块的getInvolvedListByCurrentUserTest方法,参数是't1.id, t1.name'
|
||||
- 第1条的id属性 @1
|
||||
- 第1条的1:name属性 @项目1
|
||||
- 第2条的id属性 @2
|
||||
- 第2条的2:name属性 @项目2
|
||||
- 执行projectTest模块的getInvolvedListByCurrentUserTest方法
|
||||
- 第1条的name属性 @项目1
|
||||
- 第1条的2:name属性 @项目2
|
||||
- 执行projectTest模块的getInvolvedListByCurrentUserTest方法 @3
|
||||
- 执行projectTest模块的getInvolvedListByCurrentUserTest方法 @2
|
||||
|
||||
*/
|
||||
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/lib/project.unittest.class.php';
|
||||
|
||||
zenData('project')->loadYaml('project_getinvolvedlistbycurrentuser', false, 2)->gen(10);
|
||||
zenData('team')->loadYaml('team_getinvolvedlistbycurrentuser', false, 2)->gen(15);
|
||||
zenData('stakeholder')->loadYaml('stakeholder_getinvolvedlistbycurrentuser', false, 2)->gen(10);
|
||||
|
||||
su('admin');
|
||||
|
||||
$projectTest = new Project();
|
||||
|
||||
r($projectTest->getInvolvedListByCurrentUserTest('t1.*')) && p() && e('5');
|
||||
r($projectTest->getInvolvedListByCurrentUserTest('t1.id,t1.name')) && p('1:id,1:name;2:id,2:name') && e('1,项目1;2,项目2');
|
||||
r($projectTest->getInvolvedListByCurrentUserTest()) && p('1:name,2:name') && e('项目1,项目2');
|
||||
su('user1');
|
||||
r($projectTest->getInvolvedListByCurrentUserTest()) && p() && e('3');
|
||||
su('testuser');
|
||||
r($projectTest->getInvolvedListByCurrentUserTest()) && p() && e('2');
|
||||
@@ -0,0 +1,30 @@
|
||||
---
|
||||
title: 项目数据
|
||||
desc: 用于测试 getInvolvedListByCurrentUser 方法的项目数据
|
||||
author: claude
|
||||
|
||||
fields:
|
||||
- field: id
|
||||
range: 1-10
|
||||
- field: name
|
||||
range: '项目1,项目2,项目3,项目4,项目5,项目6,项目7,项目8,项目9,项目10'
|
||||
- field: type
|
||||
range: 'project{10}'
|
||||
- field: openedBy
|
||||
range: 'admin{2},user1{2},user2{2},user3{2},testuser{2}'
|
||||
- field: PM
|
||||
range: 'admin{2},user1{2},user2{2},user3{2},testuser{2}'
|
||||
- field: deleted
|
||||
range: '0{10}'
|
||||
- field: status
|
||||
range: 'wait{3},doing{3},done{2},suspended{1},closed{1}'
|
||||
- field: vision
|
||||
range: 'rnd{10}'
|
||||
- field: acl
|
||||
range: 'open{7},private{3}'
|
||||
- field: whitelist
|
||||
range: 'admin{2},user1{2},user2{2},user3{2},testuser{2}'
|
||||
- field: begin
|
||||
range: '2024-01-01{3},2024-02-01{3},2024-03-01{4}'
|
||||
- field: end
|
||||
range: '2024-12-31{3},2024-11-30{3},2024-10-31{4}'
|
||||
@@ -0,0 +1,26 @@
|
||||
---
|
||||
title: 干系人数据
|
||||
desc: 用于测试 getInvolvedListByCurrentUser 方法的项目干系人数据
|
||||
author: claude
|
||||
|
||||
fields:
|
||||
- field: id
|
||||
range: 1-10
|
||||
- field: objectID
|
||||
range: 1-10
|
||||
- field: objectType
|
||||
range: 'project{10}'
|
||||
- field: user
|
||||
range: 'admin{2},user1{2},user2{2},user3{2},testuser{2}'
|
||||
- field: type
|
||||
range: 'inside{5},outside{5}'
|
||||
- field: key
|
||||
range: '0{7},1{3}'
|
||||
- field: from
|
||||
range: 'manual{5},sync{5}'
|
||||
- field: deleted
|
||||
range: '0{10}'
|
||||
- field: createdBy
|
||||
range: 'admin{5},system{5}'
|
||||
- field: createdDate
|
||||
range: '2024-01-01{5},2024-02-01{5}'
|
||||
@@ -0,0 +1,18 @@
|
||||
---
|
||||
title: 团队数据
|
||||
desc: 用于测试 getInvolvedListByCurrentUser 方法的团队成员数据
|
||||
author: claude
|
||||
|
||||
fields:
|
||||
- field: id
|
||||
range: 1-15
|
||||
- field: root
|
||||
range: '1{3},2{3},3{3},4{3},5{3}'
|
||||
- field: type
|
||||
range: 'project{15}'
|
||||
- field: account
|
||||
range: 'admin{3},user1{3},user2{3},user3{3},testuser{3}'
|
||||
- field: role
|
||||
range: 'QA{5},dev{5},pm{5}'
|
||||
- field: join
|
||||
range: '2024-01-01{5},2024-02-01{5},2024-03-01{5}'
|
||||
Reference in New Issue
Block a user