Skip to content

Commit 155bc01

Browse files
bdelbassoNyholm
authored andcommitted
Add the ability to fetch user installations (#577)
* Add the ability to fetch user installations * fix style * tests and support for pagination * style fix
1 parent 4729cec commit 155bc01

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

lib/Github/Api/CurrentUser.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,4 +168,14 @@ public function subscriptions()
168168
{
169169
return $this->get('/user/subscriptions');
170170
}
171+
172+
/**
173+
* @link https://developer.github.com/v3/integrations/#list-installations-for-user
174+
*
175+
* @param array $params
176+
*/
177+
public function installations(array $params = array())
178+
{
179+
return $this->get('/user/installations', array_merge(array('page' => 1), $params));
180+
}
171181
}

test/Github/Tests/Api/CurrentUserTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,22 @@ public function shouldGetWatchedRepositories()
8484
$this->assertEquals($expectedArray, $api->watched(1));
8585
}
8686

87+
/**
88+
* @test
89+
*/
90+
public function shouldGetInstallationsForUser()
91+
{
92+
$result = ['installation1', 'installation2'];
93+
94+
$api = $this->getApiMock();
95+
$api->expects($this->once())
96+
->method('get')
97+
->with('/user/installations')
98+
->willReturn($result);
99+
100+
$this->assertEquals($result, $api->installations());
101+
}
102+
87103
/**
88104
* @test
89105
*/

0 commit comments

Comments
 (0)