From 9b39f0ac7576de88bf7954e1de1f5dd52ea8c179 Mon Sep 17 00:00:00 2001 From: Fabien Bourigault Date: Tue, 25 Jul 2017 13:31:34 +0200 Subject: [PATCH] replace visibility_level by visibility --- UPGRADE.md | 4 ++++ lib/Gitlab/Api/Groups.php | 5 +++-- test/Gitlab/Tests/Api/GroupsTest.php | 8 ++++---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/UPGRADE.md b/UPGRADE.md index 3ac17720e..c88215b6f 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -13,6 +13,10 @@ See [documentation](doc/customize.md) to know how to customize the client timeou * The `setHttpClient` method have been removed. Use a `Gitlab\HttpClient\Builder` instead. * The `getHttpClient` method return type is changed to `Http\Client\Common\HttpMethodsClient`. +## `Gitlab\Api\Groups` changes + +* The `visibility_level` parameter have been removed from `create` method. Use `visibility` instead. + ## `Gitlab\Api\Projects` changes * The `keys`, `key`, `addKey`, `removeKey`, `disableKey` and `enableKey` methods have been removed. diff --git a/lib/Gitlab/Api/Groups.php b/lib/Gitlab/Api/Groups.php index 4ec574d64..ef98265e7 100644 --- a/lib/Gitlab/Api/Groups.php +++ b/lib/Gitlab/Api/Groups.php @@ -42,15 +42,16 @@ public function show($id) * @param string $name * @param string $path * @param string $description + * @param string $visibility * @return mixed */ - public function create($name, $path, $description = null, $visibility_level = 0) + public function create($name, $path, $description = null, $visibility = 'private') { return $this->post('groups', array( 'name' => $name, 'path' => $path, 'description' => $description, - 'visibility_level' => $visibility_level + 'visibility' => $visibility, )); } diff --git a/test/Gitlab/Tests/Api/GroupsTest.php b/test/Gitlab/Tests/Api/GroupsTest.php index a5fb478d2..00afe60eb 100644 --- a/test/Gitlab/Tests/Api/GroupsTest.php +++ b/test/Gitlab/Tests/Api/GroupsTest.php @@ -111,7 +111,7 @@ public function shouldCreateGroup() $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with('groups', array('name' => 'A new group', 'path' => 'a-new-group', 'description' => null, 'visibility_level' => 0)) + ->with('groups', array('name' => 'A new group', 'path' => 'a-new-group', 'description' => null, 'visibility' => 'private')) ->will($this->returnValue($expectedArray)) ; @@ -121,18 +121,18 @@ public function shouldCreateGroup() /** * @test */ - public function shouldCreateGroupWithDescriptionAndVisLevel() + public function shouldCreateGroupWithDescriptionAndVisibility() { $expectedArray = array('id' => 1, 'name' => 'A new group', 'visibility_level' => 2); $api = $this->getApiMock(); $api->expects($this->once()) ->method('post') - ->with('groups', array('name' => 'A new group', 'path' => 'a-new-group', 'description' => 'Description', 'visibility_level' => 2)) + ->with('groups', array('name' => 'A new group', 'path' => 'a-new-group', 'description' => 'Description', 'visibility' => 'public')) ->will($this->returnValue($expectedArray)) ; - $this->assertEquals($expectedArray, $api->create('A new group', 'a-new-group', 'Description', 2)); + $this->assertEquals($expectedArray, $api->create('A new group', 'a-new-group', 'Description', 'public')); } /**