File tree Expand file tree Collapse file tree 4 files changed +158
-3
lines changed Expand file tree Collapse file tree 4 files changed +158
-3
lines changed Original file line number Diff line number Diff line change @@ -71,4 +71,14 @@ public function delete(array $data)
71
71
$ this ->core ->request ('DeleteIssue ' , $ data );
72
72
return true ;
73
73
}
74
+
75
+ public function get (array $ data )
76
+ {
77
+ $ this ->validate ($ data , [
78
+ 'ProjectName ' => 'string|required ' ,
79
+ 'IssueCode ' => 'integer|required ' ,
80
+ ]);
81
+ $ response = $ this ->core ->request ('DescribeIssue ' , $ data );
82
+ return $ response ['Issue ' ];
83
+ }
74
84
}
Original file line number Diff line number Diff line change @@ -20,11 +20,12 @@ public function testCreateAndDelete()
20
20
$ result = $ issue ->create ($ data );
21
21
$ this ->assertTrue (is_numeric ($ result ['Code ' ]));
22
22
23
- // delete
24
- $ data = [
23
+ $ params = [
25
24
'ProjectName ' => $ this ->projectName ,
26
25
'IssueCode ' => $ result ['Code ' ],
27
26
];
28
- $ this ->assertTrue ($ issue ->delete ($ data ));
27
+ $ result = $ issue ->get ($ params );
28
+ $ this ->assertEquals ($ data ['Name ' ], $ result ['Name ' ]);
29
+ $ this ->assertTrue ($ issue ->delete ($ params ));
29
30
}
30
31
}
Original file line number Diff line number Diff line change @@ -109,4 +109,24 @@ public function testDelete()
109
109
$ issue = new Issue ($ this ->token , $ this ->coreMock );
110
110
$ this ->assertTrue ($ issue ->delete ($ data ));
111
111
}
112
+
113
+ public function testGet ()
114
+ {
115
+ $ response = json_decode (
116
+ file_get_contents ($ this ->dataPath ('DescribeIssueResponse.json ' )),
117
+ true
118
+ )['Response ' ];
119
+ $ data = [
120
+ 'ProjectName ' => $ this ->projectName ,
121
+ 'IssueCode ' => $ this ->faker ->randomNumber (),
122
+ ];
123
+ $ this ->coreMock ->shouldReceive ('request ' )->times (1 )->withArgs ([
124
+ 'DescribeIssue ' ,
125
+ $ data
126
+ ])->andReturn ($ response );
127
+
128
+ $ issue = new Issue ($ this ->token , $ this ->coreMock );
129
+ $ result = $ issue ->get ($ data );
130
+ $ this ->assertEquals ($ response ['Issue ' ], $ result );
131
+ }
112
132
}
Original file line number Diff line number Diff line change
1
+ {
2
+ "Response" : {
3
+ "RequestId" : " 8a6a4856-5de0-7270-6257-270e9b19d645" ,
4
+ "Issue" : {
5
+ "Epic" : {
6
+ "Code" : 0 ,
7
+ "Type" : " " ,
8
+ "Name" : " " ,
9
+ "IssueStatusId" : 0 ,
10
+ "IssueStatusName" : " " ,
11
+ "Priority" : " " ,
12
+ "Assignee" : {
13
+ "Id" : 0 ,
14
+ "Status" : 0 ,
15
+ "Avatar" : " " ,
16
+ "Name" : " " ,
17
+ "Email" : " " ,
18
+ "TeamId" : 0 ,
19
+ "Phone" : " " ,
20
+ "GlobalKey" : " " ,
21
+ "TeamGlobalKey" : " "
22
+ }
23
+ },
24
+ "ParentType" : " MISSION" ,
25
+ "Code" : 1 ,
26
+ "Type" : " MISSION" ,
27
+ "Name" : " Molestiae vel soluta et at aliquam nam unde." ,
28
+ "Description" : " " ,
29
+ "IterationId" : 0 ,
30
+ "IssueStatusId" : 1227034 ,
31
+ "IssueStatusName" : " 未开始" ,
32
+ "IssueStatusType" : " TODO" ,
33
+ "Priority" : " 1" ,
34
+ "Assignee" : {
35
+ "Id" : 183478 ,
36
+ "Status" : 1 ,
37
+ "Avatar" : " https://coding-net-production-static-ci.codehub.cn/2cb665a3-bebc-4b09-aa00-2b6df3e33edc.jpg?imageMogr2/auto-orient/format/jpeg/cut/400x400x0x0" ,
38
+ "Name" : " sinkcup" ,
39
+ "Email" : " " ,
40
+ "TeamId" : 0 ,
41
+ "Phone" : " " ,
42
+ "GlobalKey" : " " ,
43
+ "TeamGlobalKey" : " "
44
+ },
45
+ "StartDate" : 0 ,
46
+ "DueDate" : 0 ,
47
+ "WorkingHours" : 0.0 ,
48
+ "Creator" : {
49
+ "Id" : 183478 ,
50
+ "Status" : 1 ,
51
+ "Avatar" : " https://coding-net-production-static-ci.codehub.cn/2cb665a3-bebc-4b09-aa00-2b6df3e33edc.jpg?imageMogr2/auto-orient/format/jpeg/cut/400x400x0x0" ,
52
+ "Name" : " sinkcup" ,
53
+ "Email" : " " ,
54
+ "TeamId" : 0 ,
55
+ "Phone" : " " ,
56
+ "GlobalKey" : " " ,
57
+ "TeamGlobalKey" : " "
58
+ },
59
+ "StoryPoint" : " " ,
60
+ "CreatedAt" : 1639820653000 ,
61
+ "UpdatedAt" : 1640598932000 ,
62
+ "CompletedAt" : 0 ,
63
+ "ProjectModule" : {
64
+ "Id" : 0 ,
65
+ "Name" : " "
66
+ },
67
+ "Watchers" : [],
68
+ "Labels" : [],
69
+ "Files" : [],
70
+ "RequirementType" : {
71
+ "Id" : 0 ,
72
+ "Name" : " "
73
+ },
74
+ "DefectType" : {
75
+ "Id" : 0 ,
76
+ "Name" : " " ,
77
+ "IconUrl" : " "
78
+ },
79
+ "CustomFields" : [],
80
+ "ThirdLinks" : [],
81
+ "SubTasks" : [],
82
+ "Parent" : {
83
+ "Code" : 0 ,
84
+ "Type" : " " ,
85
+ "Name" : " " ,
86
+ "IssueStatusId" : 0 ,
87
+ "IssueStatusName" : " " ,
88
+ "Priority" : " " ,
89
+ "Assignee" : {
90
+ "Id" : 0 ,
91
+ "Status" : 0 ,
92
+ "Avatar" : " " ,
93
+ "Name" : " " ,
94
+ "Email" : " " ,
95
+ "TeamId" : 0 ,
96
+ "Phone" : " " ,
97
+ "GlobalKey" : " " ,
98
+ "TeamGlobalKey" : " "
99
+ },
100
+ "IssueStatusType" : " " ,
101
+ "IssueTypeDetail" : {
102
+ "Id" : 0 ,
103
+ "Name" : " " ,
104
+ "IssueType" : " " ,
105
+ "Description" : " " ,
106
+ "IsSystem" : false
107
+ }
108
+ },
109
+ "Iteration" : {
110
+ "Code" : 0 ,
111
+ "Name" : " " ,
112
+ "Status" : " "
113
+ },
114
+ "IssueTypeDetail" : {
115
+ "Id" : 213220 ,
116
+ "Name" : " 任务" ,
117
+ "IssueType" : " MISSION" ,
118
+ "Description" : " 任务是指为实现某个目标或需求所进行的具体活动。" ,
119
+ "IsSystem" : true
120
+ },
121
+ "IssueTypeId" : 213220
122
+ }
123
+ }
124
+ }
You can’t perform that action at this time.
0 commit comments