Skip to content

Commit 01ee70f

Browse files
committed
Use OptionsResolver in Projects::deployments
1 parent a7d94b6 commit 01ee70f

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

UPGRADE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ Use the `deployKeys`, `deployKey`, `addDeployKey`, `deleteDeployKey`, `removeDep
5858
* The `builds` method have been removed. Use `Gitlab\Api\Jobs::all` instead.
5959
* The `build` method have been removed. Use `Gitlab\Api\Jobs::show` instead.
6060
* The `events` method second and subsequent arguments have been replaced by a single associative array of query string parameters.
61+
* The `deployments` method second and subsequent arguments have been replaced by a single associative array of query string parameters.
6162

6263
## `Gitlab\Api\ProjectNamespaces` changes
6364

lib/Gitlab/Api/Projects.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -609,16 +609,15 @@ public function uploadFile($project_id, $file)
609609

610610
/**
611611
* @param int $project_id
612-
* @param int $page
613-
* @param int $per_page
612+
* @param array $parameters
613+
*
614614
* @return mixed
615615
*/
616-
public function deployments($project_id, $page = 1, $per_page = self::PER_PAGE)
616+
public function deployments($project_id, array $parameters = [])
617617
{
618-
return $this->get($this->getProjectPath($project_id, 'deployments'), array(
619-
'page' => $page,
620-
'per_page' => $per_page
621-
));
618+
$resolver = $this->createOptionsResolver();
619+
620+
return $this->get($this->getProjectPath($project_id, 'deployments'), $resolver->resolve($parameters));
622621
}
623622

624623
/**

test/Gitlab/Tests/Api/ProjectsTest.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -930,10 +930,7 @@ public function shouldGetDeployments()
930930
$api = $this->getApiMock();
931931
$api->expects($this->once())
932932
->method('get')
933-
->with('projects/1/deployments', array(
934-
'page' => 1,
935-
'per_page' => AbstractApi::PER_PAGE
936-
))
933+
->with('projects/1/deployments', array())
937934
->will($this->returnValue($expectedArray))
938935
;
939936

@@ -960,7 +957,7 @@ public function shouldGetDeploymentsWithPagination()
960957
->will($this->returnValue($expectedArray))
961958
;
962959

963-
$this->assertEquals($expectedArray, $api->deployments(1, 2, 15));
960+
$this->assertEquals($expectedArray, $api->deployments(1, ['page' => 2, 'per_page' => 15]));
964961
}
965962

966963
protected function getMultipleProjectsData()

0 commit comments

Comments
 (0)