Skip to content

Commit 800522a

Browse files
authored
Merge pull request #475 from jimmy4o4/issue-participants
Implemented Issues::showParticipants.
2 parents 289e42c + 14eae2b commit 800522a

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

lib/Gitlab/Api/Issues.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,16 @@ public function closedByMergeRequests($project_id, $issue_iid)
310310
return $this->get($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_iid)).'/closed_by');
311311
}
312312

313+
/**
314+
* @param int $project_id
315+
* @param int $issue_iid
316+
* @return mixed
317+
*/
318+
public function showParticipants($project_id, $issue_iid)
319+
{
320+
return $this->get($this->getProjectPath($project_id, 'issues/' .$this->encodePath($issue_iid)).'/participants');
321+
}
322+
313323
/**
314324
* {@inheritDoc}
315325
*/

test/Gitlab/Tests/Api/IssuesTest.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,40 @@ public function shouldGetProjectIssuesByAssignee()
514514
$this->assertEquals($expectedArray, $api->all(1, array('assignee_id' => 1)));
515515
}
516516

517+
/**
518+
* @test
519+
*/
520+
public function shouldGetIssueParticipants()
521+
{
522+
$expectedArray = array(
523+
array(
524+
"id" => 1,
525+
"name" => "John Doe1",
526+
"username" => "user1",
527+
"state" => "active",
528+
"avatar_url" => "http://www.gravatar.com/avatar/c922747a93b40d1ea88262bf1aebee62?s=80&d=identicon",
529+
"web_url" => "http://localhost/user1",
530+
),
531+
array(
532+
"id" => 5,
533+
"name" => "John Doe5",
534+
"username" => "user5",
535+
"state" => "active",
536+
"avatar_url" => "http://www.gravatar.com/avatar/4aea8cf834ed91844a2da4ff7ae6b491?s=80&d=identicon",
537+
"web_url" => "http://localhost/user5",
538+
)
539+
);
540+
541+
$api = $this->getApiMock();
542+
$api->expects($this->once())
543+
->method('get')
544+
->with('projects/1/issues/2/participants')
545+
->will($this->returnValue($expectedArray))
546+
;
547+
548+
$this->assertEquals($expectedArray, $api->showParticipants(1, 2));
549+
}
550+
517551
protected function getApiClass()
518552
{
519553
return 'Gitlab\Api\Issues';

0 commit comments

Comments
 (0)