Skip to content

Commit 4fc60dc

Browse files
authored
Merge pull request GitLabPHP#321 from labzone/master
Add languages API request
2 parents c52c250 + c1ce05c commit 4fc60dc

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

lib/Gitlab/Api/Projects.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,17 @@ public function removeLabel($project_id, $name)
515515
));
516516
}
517517

518+
/**
519+
* Get languages used in a project with percentage value.
520+
*
521+
* @param int $project_id
522+
* @return mixed
523+
*/
524+
public function languages($project_id)
525+
{
526+
return $this->get($this->getProjectPath($project_id, 'languages'));
527+
}
528+
518529
/**
519530
* @param int $project_id
520531
* @param array $params (

test/Gitlab/Tests/Api/ProjectsTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -858,6 +858,21 @@ public function shouldRemoveLabel()
858858
$this->assertEquals($expectedBool, $api->removeLabel(1, 'bug'));
859859
}
860860

861+
/**
862+
* @test
863+
*/
864+
public function shouldGetLanguages()
865+
{
866+
$expectedArray = ['php' => 100];
867+
$api = $this->getApiMock();
868+
$api->expects($this->once())
869+
->method('get')
870+
->will($this->returnValue($expectedArray))
871+
;
872+
873+
$this->assertEquals($expectedArray, $api->languages(1));
874+
}
875+
861876
/**
862877
* @test
863878
*/

0 commit comments

Comments
 (0)