Skip to content

Commit 3664fd8

Browse files
committed
Merge pull request #355 from corbosman/master
list all organizations
2 parents fe74a4e + 6e896d4 commit 3664fd8

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

lib/Github/Api/Organization.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,16 @@
1515
*/
1616
class Organization extends AbstractApi
1717
{
18+
/**
19+
* @link https://developer.github.com/v3/orgs/#list-all-organizations
20+
*
21+
* @return array the organizations
22+
*/
23+
public function all($since = '')
24+
{
25+
return $this->get('organizations?since='.rawurlencode($since));
26+
}
27+
1828
/**
1929
* Get extended information about an organization by its name.
2030
*

test/Github/Tests/Api/OrganizationTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,22 @@
44

55
class OrganizationTest extends TestCase
66
{
7+
/**
8+
* @test
9+
*/
10+
public function shouldGetAllOrganizations()
11+
{
12+
$expectedValue = array(array('login' => 'KnpLabs'));
13+
14+
$api = $this->getApiMock();
15+
$api->expects($this->once())
16+
->method('get')
17+
->with('organizations?since=1')
18+
->will($this->returnValue($expectedValue));
19+
20+
$this->assertEquals($expectedValue, $api->all(1));
21+
}
22+
723
/**
824
* @test
925
*/

0 commit comments

Comments
 (0)