Skip to content

Commit adeb763

Browse files
committed
add Apps endpoint /apps/installations/:installation_id:
1 parent 2665eb8 commit adeb763

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

lib/Github/Api/Apps.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,19 @@ public function findInstallations()
5353
return $this->get('/app/installations');
5454
}
5555

56+
/**
57+
* Get an installation of the application
58+
*
59+
* @link https://developer.github.com/v3/apps/#get-an-installation
60+
*
61+
* @param $installation_id An integration installation id
62+
* @return array
63+
*/
64+
public function getInstallation($installation_id)
65+
{
66+
return $this->get('/app/installations/'.rawurldecode($installation_id));
67+
}
68+
5669
/**
5770
* List repositories that are accessible to the authenticated installation.
5871
*

test/Github/Tests/Api/AppTest.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function shouldCreateInstallationTokenForInstallation()
2727
/**
2828
* @test
2929
*/
30-
public function shouldFindRepositoriesForApplication()
30+
public function shouldFindInstallationsForApplication()
3131
{
3232
$result = ['installation1', 'installation2'];
3333

@@ -40,6 +40,22 @@ public function shouldFindRepositoriesForApplication()
4040
$this->assertEquals($result, $api->findInstallations());
4141
}
4242

43+
/**
44+
* @test
45+
*/
46+
public function shouldGetInstallationForApplication()
47+
{
48+
$result = ['installation1'];
49+
50+
$api = $this->getApiMock();
51+
$api->expects($this->once())
52+
->method('get')
53+
->with('/app/installations/1234')
54+
->willReturn($result);
55+
56+
$this->assertEquals($result, $api->getInstallation('1234'));
57+
}
58+
4359
/**
4460
* @test
4561
*/

0 commit comments

Comments
 (0)