Skip to content

Commit 8a16137

Browse files
author
Артур Комаров
committed
add method Gitlab\Api\MergeRequests::getByIid
1 parent 39ef1e0 commit 8a16137

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

lib/Gitlab/Api/MergeRequests.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,4 +174,14 @@ public function changes($project_id, $mr_id)
174174
{
175175
return $this->get($this->getProjectPath($project_id, 'merge_request/'.$this->encodePath($mr_id).'/changes'));
176176
}
177+
178+
/**
179+
* @param $project_id
180+
* @param $mr_iid
181+
* @return mixed
182+
*/
183+
public function getByIid($project_id, $mr_iid)
184+
{
185+
return $this->get($this->getProjectPath($project_id, 'merge_requests'), array('iid' => $mr_iid));
186+
}
177187
}

test/Gitlab/Tests/Api/MergeRequestsTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,23 @@ public function shouldGetMergeRequestChanges()
316316
$this->assertEquals($expectedArray, $api->changes(1, 2));
317317
}
318318

319+
/**
320+
* @test
321+
*/
322+
public function shouldGetMergeRequestByIid()
323+
{
324+
$expectedArray = array('id' => 1, 'title' => 'A merge request');
325+
326+
$api = $this->getApiMock();
327+
$api->expects($this->once())
328+
->method('get')
329+
->with('projects/1/merge_requests', array('iid' => 2))
330+
->will($this->returnValue($expectedArray))
331+
;
332+
333+
$this->assertEquals($expectedArray, $api->getByIid(1, 2));
334+
}
335+
319336
protected function getMultipleMergeRequestsData()
320337
{
321338
return array(

0 commit comments

Comments
 (0)