Skip to content

Commit 47bab96

Browse files
committed
Implemented Issues::showParticipants.
1 parent 8693991 commit 47bab96

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
@@ -328,4 +328,14 @@ public function closedByMergeRequests($project_id, $issue_iid)
328328
{
329329
return $this->get($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_iid)).'/closed_by');
330330
}
331+
332+
/**
333+
* @param int $project_id
334+
* @param int $issue_iid
335+
* @return mixed
336+
*/
337+
public function showParticipants($project_id, $issue_iid)
338+
{
339+
return $this->get($this->getProjectPath($project_id, 'issues/' .$this->encodePath($issue_iid)).'/participants');
340+
}
331341
}

test/Gitlab/Tests/Api/IssuesTest.php

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

457+
/**
458+
* @test
459+
*/
460+
public function shouldGetIssueParticipants()
461+
{
462+
$expectedArray = array(
463+
array(
464+
"id" => 1,
465+
"name" => "John Doe1",
466+
"username" => "user1",
467+
"state" => "active",
468+
"avatar_url" => "http://www.gravatar.com/avatar/c922747a93b40d1ea88262bf1aebee62?s=80&d=identicon",
469+
"web_url" => "http://localhost/user1",
470+
),
471+
array(
472+
"id" => 5,
473+
"name" => "John Doe5",
474+
"username" => "user5",
475+
"state" => "active",
476+
"avatar_url" => "http://www.gravatar.com/avatar/4aea8cf834ed91844a2da4ff7ae6b491?s=80&d=identicon",
477+
"web_url" => "http://localhost/user5",
478+
)
479+
);
480+
481+
$api = $this->getApiMock();
482+
$api->expects($this->once())
483+
->method('get')
484+
->with('projects/1/issues/2/participants')
485+
->will($this->returnValue($expectedArray))
486+
;
487+
488+
$this->assertEquals($expectedArray, $api->showParticipants(1, 2));
489+
}
490+
457491
protected function getApiClass()
458492
{
459493
return 'Gitlab\Api\Issues';

0 commit comments

Comments
 (0)