@@ -257,6 +257,147 @@ public function testGetPriorities()
257
257
$ this ->assertEquals ($ expected , $ this ->api ->getPriorities (), 'Calling twice did not yield the same results ' );
258
258
}
259
259
260
+ public function testGetIssue ()
261
+ {
262
+ $ response = file_get_contents (__DIR__ . '/resources/api_get_issue.json ' );
263
+
264
+ $ issue_key = 'POR-1 ' ;
265
+
266
+ $ this ->expectClientCall (
267
+ Api::REQUEST_GET ,
268
+ '/rest/api/2/issue/ ' . $ issue_key ,
269
+ array ('expand ' => '' ),
270
+ $ response
271
+ );
272
+
273
+ $ actual = $ this ->api ->getIssue ($ issue_key );
274
+
275
+ $ expected = json_decode ($ response , true );
276
+ $ this ->assertEquals ($ expected , $ actual );
277
+ }
278
+
279
+ public function testEditIssue ()
280
+ {
281
+ $ issue_key = 'POR-1 ' ;
282
+ $ params = array ('update ' => (object ) array ('summary ' => array ( (object ) array ("set " => "Bug in business logic " ))));
283
+ $ this ->expectClientCall (
284
+ Api::REQUEST_PUT ,
285
+ '/rest/api/2/issue/ ' . $ issue_key ,
286
+ $ params ,
287
+ false // False is returned because there is no content (204).
288
+ );
289
+
290
+ $ actual = $ this ->api ->editIssue ($ issue_key , $ params );
291
+ $ this ->assertEquals (false , $ actual );
292
+ }
293
+
294
+ public function testGetAttachmentsMetaInformation ()
295
+ {
296
+ $ response = file_get_contents (__DIR__ . '/resources/api_get_attachments_meta.json ' );
297
+
298
+ $ this ->expectClientCall (
299
+ Api::REQUEST_GET ,
300
+ '/rest/api/2/attachment/meta ' ,
301
+ array (),
302
+ $ response
303
+ );
304
+
305
+ $ actual = $ this ->api ->getAttachmentsMetaInformation ();
306
+
307
+ $ expected = json_decode ($ response , true );
308
+ $ this ->assertEquals ($ expected , $ actual );
309
+ }
310
+
311
+ public function testGetAttachment ()
312
+ {
313
+ $ response = file_get_contents (__DIR__ . '/resources/api_get_attachment.json ' );
314
+ $ attachment_id = '18700 ' ;
315
+
316
+ $ this ->expectClientCall (
317
+ Api::REQUEST_GET ,
318
+ '/rest/api/2/attachment/ ' . $ attachment_id ,
319
+ array (),
320
+ $ response
321
+ );
322
+
323
+ $ actual = $ this ->api ->getAttachment ($ attachment_id );
324
+
325
+ $ expected = json_decode ($ response , true );
326
+ $ this ->assertEquals ($ expected , $ actual );
327
+ }
328
+
329
+ public function testGetProjects ()
330
+ {
331
+ $ response = file_get_contents (__DIR__ . '/resources/api_get_projects.json ' );
332
+
333
+ $ this ->expectClientCall (
334
+ Api::REQUEST_GET ,
335
+ '/rest/api/2/project ' ,
336
+ array (),
337
+ $ response
338
+ );
339
+
340
+ $ actual = $ this ->api ->getProjects ();
341
+
342
+ $ expected = json_decode ($ response , true );
343
+ $ this ->assertEquals ($ expected , $ actual );
344
+ }
345
+
346
+ public function testGetProject ()
347
+ {
348
+ $ response = file_get_contents (__DIR__ . '/resources/api_get_project.json ' );
349
+ $ project_id = '10500 ' ;
350
+
351
+ $ this ->expectClientCall (
352
+ Api::REQUEST_GET ,
353
+ '/rest/api/2/project/ ' . $ project_id ,
354
+ array (),
355
+ $ response
356
+ );
357
+
358
+ $ actual = $ this ->api ->getProject ($ project_id );
359
+
360
+ $ expected = json_decode ($ response , true );
361
+ $ this ->assertEquals ($ expected , $ actual );
362
+ }
363
+
364
+ public function testGetRoles ()
365
+ {
366
+ $ response = file_get_contents (__DIR__ . '/resources/api_get_roles_of_project.json ' );
367
+ $ project_id = '10500 ' ;
368
+
369
+ $ this ->expectClientCall (
370
+ Api::REQUEST_GET ,
371
+ '/rest/api/2/project/ ' . $ project_id . '/role ' ,
372
+ array (),
373
+ $ response
374
+ );
375
+
376
+ $ actual = $ this ->api ->getRoles ($ project_id );
377
+
378
+ $ expected = json_decode ($ response , true );
379
+ $ this ->assertEquals ($ expected , $ actual );
380
+ }
381
+
382
+ public function testGetRoleDetails ()
383
+ {
384
+ $ response = file_get_contents (__DIR__ . '/resources/api_get_roles_of_project_by_id.json ' );
385
+ $ project_id = '10500 ' ;
386
+ $ role_id = '10200 ' ;
387
+
388
+ $ this ->expectClientCall (
389
+ Api::REQUEST_GET ,
390
+ '/rest/api/2/project/ ' . $ project_id . '/role/ ' . $ role_id ,
391
+ array (),
392
+ $ response
393
+ );
394
+
395
+ $ actual = $ this ->api ->getRoleDetails ($ project_id , $ role_id );
396
+
397
+ $ expected = json_decode ($ response , true );
398
+ $ this ->assertEquals ($ expected , $ actual );
399
+ }
400
+
260
401
/**
261
402
* Expects a particular client call.
262
403
*
0 commit comments