Skip to content

Commit 74fbb0c

Browse files
drummm1guelpf
authored andcommitted
Add test, code style
1 parent 8e441b5 commit 74fbb0c

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

lib/Gitlab/Api/Repositories.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,9 @@ public function commit($project_id, $sha)
181181
* @param $sha
182182
* @return mixed
183183
*/
184-
public function commitrefs($project_id, $sha)
184+
public function commitRefs($project_id, $sha)
185185
{
186-
return $this->get($this->getProjectPath($project_id, 'repository/commits/'.$this->encodePath($sha) . '/refs'));
186+
return $this->get($this->getProjectPath($project_id, 'repository/commits/'.$this->encodePath($sha).'/refs'));
187187
}
188188

189189
/**

test/Gitlab/Tests/Api/RepositoriesTest.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,26 @@ public function shouldGetCommit()
302302
$this->assertEquals($expectedArray, $api->commit(1, 'abcd1234'));
303303
}
304304

305+
/**
306+
* @test
307+
*/
308+
public function shouldGetCommitRefs()
309+
{
310+
$expectedArray = [
311+
['type' => 'branch', 'name' => 'master'],
312+
['type' => 'tag', 'name' => 'v1.1.0'],
313+
];
314+
315+
$api = $this->getApiMock();
316+
$api->expects($this->once())
317+
->method('get')
318+
->with('projects/1/repository/commits/abcd1234/refs')
319+
->will($this->returnValue($expectedArray))
320+
;
321+
322+
$this->assertEquals($expectedArray, $api->commitRefs(1, 'abcd1234'));
323+
}
324+
305325
/**
306326
* @test
307327
*/

0 commit comments

Comments
 (0)