diff --git a/lib/Gitlab/Api/Projects.php b/lib/Gitlab/Api/Projects.php index a4973b6dd..01eea1ed9 100644 --- a/lib/Gitlab/Api/Projects.php +++ b/lib/Gitlab/Api/Projects.php @@ -496,6 +496,17 @@ public function removeLabel($project_id, $name) )); } + /** + * Get languages used in a project with percentage value. + * + * @param int $project_id + * @return mixed + */ + public function languages($project_id) + { + return $this->get($this->getProjectPath($project_id, 'languages')); + } + /** * @param int $project_id * @param array $params ( diff --git a/lib/Gitlab/Client.php b/lib/Gitlab/Client.php index a8d593571..376e461f4 100644 --- a/lib/Gitlab/Client.php +++ b/lib/Gitlab/Client.php @@ -126,6 +126,14 @@ public function deployKeys() return new Api\DeployKeys($this); } + /** + * @return Api\Environments + */ + public function environments() + { + return new Api\Environments($this); + } + /** * @return Api\Groups */ @@ -267,6 +275,9 @@ public function api($name) case 'deploy_keys': return $this->deployKeys(); + case 'environments': + return $this->environments(); + case 'groups': return $this->groups(); @@ -298,6 +309,9 @@ public function api($name) case 'repositories': return $this->repositories(); + case 'repositoryFiles': + return $this->repositoryFiles(); + case 'snippets': return $this->snippets(); diff --git a/test/Gitlab/Tests/Api/ProjectsTest.php b/test/Gitlab/Tests/Api/ProjectsTest.php index 0d9f07397..d068a1fc4 100644 --- a/test/Gitlab/Tests/Api/ProjectsTest.php +++ b/test/Gitlab/Tests/Api/ProjectsTest.php @@ -815,6 +815,21 @@ public function shouldRemoveLabel() $this->assertEquals($expectedBool, $api->removeLabel(1, 'bug')); } + /** + * @test + */ + public function shouldGetLanguages() + { + $expectedArray = ['php' => 100]; + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('get') + ->will($this->returnValue($expectedArray)) + ; + + $this->assertEquals($expectedArray, $api->languages(1)); + } + /** * @test */