Skip to content

Commit c54f4df

Browse files
[9.19] Add issue reorder method (#564)
Co-authored-by: Graham Campbell <GrahamCampbell@users.noreply.github.com>
1 parent 6487227 commit c54f4df

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

lib/Gitlab/Api/Issues.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,18 @@ public function update($project_id, $issue_iid, array $params)
8888
return $this->put($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_iid)), $params);
8989
}
9090

91+
/**
92+
* @param int|string $project_id
93+
* @param int $issue_iid
94+
* @param array $params
95+
*
96+
* @return mixed
97+
*/
98+
public function reorder($project_id, $issue_iid, array $params)
99+
{
100+
return $this->put($this->getProjectPath($project_id, 'issues/'.$this->encodePath($issue_iid)).'/reorder', $params);
101+
}
102+
91103
/**
92104
* @param int|string $project_id
93105
* @param int $issue_iid

test/Gitlab/Tests/Api/IssuesTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,21 @@ public function shouldUpdateIssue()
177177
$this->assertEquals($expectedArray, $api->update(1, 2, ['title' => 'A renamed issue', 'labels' => 'foo']));
178178
}
179179

180+
/**
181+
* @test
182+
*/
183+
public function shouldReorderIssue()
184+
{
185+
$expectedArray = ['id' => 2, 'title' => 'A reordered issue'];
186+
$api = $this->getApiMock();
187+
$api->expects($this->once())
188+
->method('put')
189+
->with('projects/1/issues/2/reorder', ['move_after_id' => 3, 'move_before_id' => 4])
190+
->will($this->returnValue($expectedArray))
191+
;
192+
$this->assertEquals($expectedArray, $api->reorder(1, 2, ['move_after_id' => 3, 'move_before_id' => 4]));
193+
}
194+
180195
/**
181196
* @test
182197
*/

0 commit comments

Comments
 (0)