Skip to content

Commit d23c5f8

Browse files
authored
Merge pull request #125 from phpcodecrafting/master
Adding the newer merge request notes API endpoint.
2 parents c01826e + ea2a11d commit d23c5f8

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

lib/Gitlab/Api/MergeRequests.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,16 @@ public function merge($project_id, $mr_id, $message = null)
142142
return $this->put($this->getProjectPath($project_id, 'merge_request/'.$this->encodePath($mr_id).'/merge'), $params);
143143
}
144144

145+
/**
146+
* @param int $project_id
147+
* @param int $mr_id
148+
* @return mixed
149+
*/
150+
public function showNotes($project_id, $mr_id)
151+
{
152+
return $this->get($this->getProjectPath($project_id, 'merge_requests/'.$this->encodePath($mr_id).'/notes'));
153+
}
154+
145155
/**
146156
* @param int $project_id
147157
* @param int $mr_id

test/Gitlab/Tests/Api/MergeRequestsTest.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,26 @@ public function shouldMergeMergeRequest()
262262
$this->assertEquals($expectedArray, $api->merge(1, 2, array('merge_commit_message' => 'Accepted')));
263263
}
264264

265+
/**
266+
* @test
267+
*/
268+
public function shouldGetMergeRequestNotes()
269+
{
270+
$expectedArray = array(
271+
array('id' => 1, 'body' => 'A comment'),
272+
array('id' => 2, 'body' => 'Another comment')
273+
);
274+
275+
$api = $this->getApiMock();
276+
$api->expects($this->once())
277+
->method('get')
278+
->with('projects/1/merge_requests/2/notes')
279+
->will($this->returnValue($expectedArray))
280+
;
281+
282+
$this->assertEquals($expectedArray, $api->showNotes(1, 2));
283+
}
284+
265285
/**
266286
* @test
267287
*/

0 commit comments

Comments
 (0)