99use Redmine \Api \IssueCategory ;
1010use Redmine \Api \IssueStatus ;
1111use Redmine \Api \Project ;
12+ use Redmine \Api \Tracker ;
1213use Redmine \Client \Client ;
1314use Redmine \Http \HttpClient ;
1415use Redmine \Http \Response ;
@@ -150,16 +151,12 @@ public function testCreateWithClientCleansParameters()
150151 'project ' => 'Project 1 Name ' ,
151152 'category ' => 'Category 5 Name ' ,
152153 'status ' => 'Status 6 Name ' ,
153- 'tracker ' => 'Tracker Name ' ,
154+ 'tracker ' => 'Tracker 2 Name ' ,
154155 'assigned_to ' => 'Assigned to User Name ' ,
155156 'author ' => 'Author Name ' ,
156157 ];
157158
158159 // Create the used mock objects
159- $ getIdByNameApi = $ this ->createMock ('Redmine\Api\Tracker ' );
160- $ getIdByNameApi ->expects ($ this ->exactly (1 ))
161- ->method ('getIdByName ' )
162- ->willReturn ('cleanedValue ' );
163160 $ getIdByUsernameApi = $ this ->createMock ('Redmine\Api\User ' );
164161 $ getIdByUsernameApi ->expects ($ this ->exactly (2 ))
165162 ->method ('getIdByUsername ' )
@@ -194,6 +191,15 @@ public function testCreateWithClientCleansParameters()
194191 'application/json ' ,
195192 '{"issue_statuses":[{"id":6,"name":"Status 6 Name"}]} ' ,
196193 ],
194+ [
195+ 'GET ' ,
196+ '/trackers.json ' ,
197+ 'application/json ' ,
198+ '' ,
199+ 200 ,
200+ 'application/json ' ,
201+ '{"trackers":[{"id":2,"name":"Tracker 2 Name"}]} ' ,
202+ ],
197203 );
198204
199205 $ client = $ this ->createMock (Client::class);
@@ -204,7 +210,7 @@ public function testCreateWithClientCleansParameters()
204210 ['project ' , new Project ($ httpClient )],
205211 ['issue_category ' , new IssueCategory ($ httpClient )],
206212 ['issue_status ' , new IssueStatus ($ httpClient )],
207- ['tracker ' , $ getIdByNameApi ],
213+ ['tracker ' , new Tracker ( $ httpClient ) ],
208214 ['user ' , $ getIdByUsernameApi ],
209215 ],
210216 )
@@ -216,7 +222,7 @@ public function testCreateWithClientCleansParameters()
216222 '/issues.xml ' ,
217223 <<< XML
218224 <?xml version="1.0"?>
219- <issue><project_id>1</project_id><category_id>5</category_id><status_id>6</status_id><tracker_id>cleanedValue </tracker_id><assigned_to_id>cleanedValue</assigned_to_id><author_id>cleanedValue</author_id></issue>
225+ <issue><project_id>1</project_id><category_id>5</category_id><status_id>6</status_id><tracker_id>2 </tracker_id><assigned_to_id>cleanedValue</assigned_to_id><author_id>cleanedValue</author_id></issue>
220226
221227 XML ,
222228 )
0 commit comments