Skip to content

Commit 485e48e

Browse files
committed
add Apps endpoint get /org/:org:/installation
1 parent ad6aa93 commit 485e48e

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

lib/Github/Api/Apps.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,19 @@ public function getInstallation($installation_id)
6666
return $this->get('/app/installations/'.rawurldecode($installation_id));
6767
}
6868

69+
/**
70+
* Get an installation of the application for an organization
71+
*
72+
* @link https://developer.github.com/v3/apps/#get-an-organization-installation
73+
*
74+
* @param $org An organization
75+
* @return array
76+
*/
77+
public function getInstallationForOrganization($org)
78+
{
79+
return $this->get('/org/'.rawurldecode($org).'/installation');
80+
}
81+
6982
/**
7083
* Delete an installation of the application
7184
*

test/Github/Tests/Api/AppTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,22 @@ public function shouldGetInstallationForApplication()
5656
$this->assertEquals($result, $api->getInstallation('1234'));
5757
}
5858

59+
/**
60+
* @test
61+
*/
62+
public function shouldGetInstallationForOrganization()
63+
{
64+
$result = ['installation1'];
65+
66+
$api = $this->getApiMock();
67+
$api->expects($this->once())
68+
->method('get')
69+
->with('/org/1234/installation')
70+
->willReturn($result);
71+
72+
$this->assertEquals($result, $api->getInstallationForOrganization('1234'));
73+
}
74+
5975
/**
6076
* @test
6177
*/

0 commit comments

Comments
 (0)