Skip to content

Commit 34f06de

Browse files
authored
[11.11] Add support for MergeRequests::showParticipants (#755)
1 parent 3d0f14e commit 34f06de

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

src/Api/MergeRequests.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,17 @@ public function removeDiscussionNote($project_id, int $mr_iid, string $discussio
382382
return $this->delete($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid).'/discussions/'.self::encodePath($discussion_id).'/notes/'.self::encodePath($note_id)));
383383
}
384384

385+
/**
386+
* @param int|string $project_id
387+
* @param int $mr_iid
388+
*
389+
* @return mixed
390+
*/
391+
public function showParticipants($project_id, int $mr_iid)
392+
{
393+
return $this->get($this->getProjectPath($project_id, 'merge_requests/'.self::encodePath($mr_iid)).'/participants');
394+
}
395+
385396
/**
386397
* @param int|string $project_id
387398
* @param int $mr_iid

tests/Api/MergeRequestsTest.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,40 @@ public function shouldRemoveNote(): void
350350
$this->assertEquals($expectedBool, $api->removeNote(1, 2, 3));
351351
}
352352

353+
/**
354+
* @test
355+
*/
356+
public function shouldGetMergeRequestParticipants(): void
357+
{
358+
$expectedArray = [
359+
[
360+
'id' => 1,
361+
'name' => 'John Doe1',
362+
'username' => 'user1',
363+
'state' => 'active',
364+
'avatar_url' => 'http://www.gravatar.com/avatar/c922747a93b40d1ea88262bf1aebee62?s=80&d=identicon',
365+
'web_url' => 'http://localhost/user1',
366+
],
367+
[
368+
'id' => 5,
369+
'name' => 'John Doe5',
370+
'username' => 'user5',
371+
'state' => 'active',
372+
'avatar_url' => 'http://www.gravatar.com/avatar/4aea8cf834ed91844a2da4ff7ae6b491?s=80&d=identicon',
373+
'web_url' => 'http://localhost/user5',
374+
],
375+
];
376+
377+
$api = $this->getApiMock();
378+
$api->expects($this->once())
379+
->method('get')
380+
->with('projects/1/merge_requests/2/participants')
381+
->will($this->returnValue($expectedArray))
382+
;
383+
384+
$this->assertEquals($expectedArray, $api->showParticipants(1, 2));
385+
}
386+
353387
/**
354388
* @test
355389
*/

0 commit comments

Comments
 (0)