Skip to content

Commit f6f441d

Browse files
authored
Merge pull request #151 from dariuskt/master
adding update method for Groups
2 parents cd16d48 + fa13974 commit f6f441d

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

lib/Gitlab/Api/Groups.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,16 @@ public function create($name, $path, $description = null, $visibility_level = 0)
5454
));
5555
}
5656

57+
/**
58+
* @param int $id
59+
* @param array $params
60+
* @return mixed
61+
*/
62+
public function update($id, array $params)
63+
{
64+
return $this->put('groups/'.$this->encodePath($id), $params);
65+
}
66+
5767
/**
5868
* @param int $group_id
5969
* @return mixed

test/Gitlab/Tests/Api/GroupsTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,23 @@ public function shouldCreateGroupWithDescriptionAndVisLevel()
135135
$this->assertEquals($expectedArray, $api->create('A new group', 'a-new-group', 'Description', 2));
136136
}
137137

138+
/**
139+
* @test
140+
*/
141+
public function shouldUpdateGroup()
142+
{
143+
$expectedArray = array('id' => 3, 'name' => 'Group name', 'path' => 'group-path');
144+
145+
$api = $this->getApiMock();
146+
$api->expects($this->once())
147+
->method('put')
148+
->with('groups/3', array('name' => 'Group name', 'path' => 'group-path'))
149+
->will($this->returnValue($expectedArray))
150+
;
151+
152+
$this->assertEquals($expectedArray, $api->update(3, array('name' => 'Group name', 'path' => 'group-path')));
153+
}
154+
138155
/**
139156
* @test
140157
*/

0 commit comments

Comments
 (0)