Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions lib/Gitlab/Api/Projects.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
14 changes: 14 additions & 0 deletions lib/Gitlab/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -267,6 +275,9 @@ public function api($name)
case 'deploy_keys':
return $this->deployKeys();

case 'environments':
return $this->environments();

case 'groups':
return $this->groups();

Expand Down Expand Up @@ -298,6 +309,9 @@ public function api($name)
case 'repositories':
return $this->repositories();

case 'repositoryFiles':
return $this->repositoryFiles();

case 'snippets':
return $this->snippets();

Expand Down
15 changes: 15 additions & 0 deletions test/Gitlab/Tests/Api/ProjectsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down