Skip to content

Commit 84fbf5d

Browse files
authored
Merge pull request #240 from fbourigault/deprecate-comments
Deprecate merge request comment related methods
2 parents af99282 + 6ae9c05 commit 84fbf5d

File tree

2 files changed

+6
-41
lines changed

2 files changed

+6
-41
lines changed

lib/Gitlab/Api/MergeRequests.php

+6-4
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,9 @@ public function addNote($project_id, $mr_id, $note)
162162
*/
163163
public function showComments($project_id, $mr_id)
164164
{
165-
return $this->get($this->getProjectPath($project_id, 'merge_requests/'.$this->encodePath($mr_id).'/comments'));
165+
@trigger_error(sprintf('The %s() method is deprecated since version 9.1 and will be removed in 10.0. Use the showNotes() method instead.', __METHOD__), E_USER_DEPRECATED);
166+
167+
return $this->showNotes($project_id, $mr_id);
166168
}
167169

168170
/**
@@ -173,9 +175,9 @@ public function showComments($project_id, $mr_id)
173175
*/
174176
public function addComment($project_id, $mr_id, $note)
175177
{
176-
return $this->post($this->getProjectPath($project_id, 'merge_requests/'.$this->encodePath($mr_id).'/comments'), array(
177-
'note' => $note
178-
));
178+
@trigger_error(sprintf('The %s() method is deprecated since version 9.1 and will be removed in 10.0. Use the addNote() method instead.', __METHOD__), E_USER_DEPRECATED);
179+
180+
return $this->addNote($project_id, $mr_id, $note);
179181
}
180182

181183
/**

test/Gitlab/Tests/Api/MergeRequestsTest.php

-37
Original file line numberDiff line numberDiff line change
@@ -163,43 +163,6 @@ public function shouldGetMergeRequestNotes()
163163
$this->assertEquals($expectedArray, $api->showNotes(1, 2));
164164
}
165165

166-
/**
167-
* @test
168-
*/
169-
public function shouldGetMergeRequestComments()
170-
{
171-
$expectedArray = array(
172-
array('id' => 1, 'note' => 'A comment'),
173-
array('id' => 2, 'note' => 'Another comment')
174-
);
175-
176-
$api = $this->getApiMock();
177-
$api->expects($this->once())
178-
->method('get')
179-
->with('projects/1/merge_requests/2/comments')
180-
->will($this->returnValue($expectedArray))
181-
;
182-
183-
$this->assertEquals($expectedArray, $api->showComments(1, 2));
184-
}
185-
186-
/**
187-
* @test
188-
*/
189-
public function shouldAddMergeRequestComment()
190-
{
191-
$expectedArray = array('id' => 2, 'title' => 'A comment');
192-
193-
$api = $this->getApiMock();
194-
$api->expects($this->once())
195-
->method('post')
196-
->with('projects/1/merge_requests/2/comments', array('note' => 'A comment'))
197-
->will($this->returnValue($expectedArray))
198-
;
199-
200-
$this->assertEquals($expectedArray, $api->addComment(1, 2, 'A comment'));
201-
}
202-
203166
/**
204167
* @test
205168
*/

0 commit comments

Comments
 (0)