File tree Expand file tree Collapse file tree 2 files changed +54
-0
lines changed Expand file tree Collapse file tree 2 files changed +54
-0
lines changed Original file line number Diff line number Diff line change @@ -386,6 +386,24 @@ public function hook($project_id, $hook_id)
386
386
return $ this ->get ($ this ->getProjectPath ($ project_id , 'hooks/ ' .$ this ->encodePath ($ hook_id )));
387
387
}
388
388
389
+ /**
390
+ * Get project users.
391
+ *
392
+ * See https://docs.gitlab.com/ee/api/projects.html#get-project-users for more info.
393
+ *
394
+ * @param int $project_id
395
+ * Project id.
396
+ * @param array $parameters
397
+ * Url parameters.
398
+ *
399
+ * @return array
400
+ * List of project users.
401
+ */
402
+ public function users ($ project_id , array $ parameters = [])
403
+ {
404
+ return $ this ->get ($ this ->getProjectPath ($ project_id , 'users ' ), $ parameters );
405
+ }
406
+
389
407
/**
390
408
* Get project issues.
391
409
*
Original file line number Diff line number Diff line change @@ -287,6 +287,24 @@ public function shouldGetProjectIssues()
287
287
$ this ->assertEquals ($ expectedArray , $ api ->issues (1 ));
288
288
}
289
289
290
+ /**
291
+ * Check we can request project issues.
292
+ *
293
+ * @test
294
+ */
295
+ public function shouldGetProjectUsers ()
296
+ {
297
+ $ expectedArray = $ this ->getProjectUsersExpectedArray ();
298
+
299
+ $ api = $ this ->getApiMock ();
300
+ $ api ->expects ($ this ->once ())
301
+ ->method ('get ' )
302
+ ->with ('projects/1/users ' )
303
+ ->will ($ this ->returnValue ($ expectedArray ));
304
+
305
+ $ this ->assertEquals ($ expectedArray , $ api ->users (1 ));
306
+ }
307
+
290
308
/**
291
309
* Check we can request project issues with query parameters.
292
310
*
@@ -379,6 +397,24 @@ public function getProjectIssuesExpectedArray()
379
397
];
380
398
}
381
399
400
+ /**
401
+ * Get expected array for tests which check project users method.
402
+ *
403
+ * @return array
404
+ */
405
+ public function getProjectUsersExpectedArray () {
406
+ return [
407
+ [
408
+ 'id ' => 1 ,
409
+ 'name ' => 'John Doe ' ,
410
+ 'username ' => 'john.doe ' ,
411
+ 'state ' => 'active ' ,
412
+ 'avatar_url ' => 'https://example.com ' ,
413
+ 'web_url ' => 'gitlab.com/john.doe ' ,
414
+ ],
415
+ ];
416
+ }
417
+
382
418
/**
383
419
* @test
384
420
*/
You can’t perform that action at this time.
0 commit comments