Skip to content

Commit a603126

Browse files
author
guillermo-fisher
committed
Back-filled other Enterprise tests.
1 parent 944ef80 commit a603126

File tree

2 files changed

+91
-0
lines changed

2 files changed

+91
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
/**
3+
* This file is part of the php-github-api package.
4+
*
5+
* For the full copyright and license information, please view the LICENSE
6+
* file that was distributed with this source code.
7+
*/
8+
9+
namespace Github\Tests\Api\Enterprise;
10+
11+
use Github\Tests\Api\TestCase;
12+
13+
class LicenseTest extends TestCase
14+
{
15+
/**
16+
* @test
17+
*/
18+
public function shouldShowLicenseInformation()
19+
{
20+
$expectedArray = array(
21+
'seats' => 1400,
22+
'seats_used' => 1316,
23+
'seats_available' => 84,
24+
'kind' => 'standard',
25+
'days_until_expiration' => 365,
26+
'expire_at' => '2016/02/06 12:41:52 -0600'
27+
);
28+
29+
$api = $this->getApiMock();
30+
$api->expects($this->once())
31+
->method('get')
32+
->with('enterprise/settings/license')
33+
->will($this->returnValue($expectedArray));
34+
35+
$this->assertEquals($expectedArray, $api->show());
36+
}
37+
38+
protected function getApiClass()
39+
{
40+
return 'Github\Api\Enterprise\License';
41+
}
42+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
/**
3+
* This file is part of the php-github-api package.
4+
*
5+
* For the full copyright and license information, please view the LICENSE
6+
* file that was distributed with this source code.
7+
*/
8+
9+
namespace Github\Tests\Api\Enterprise;
10+
11+
use Github\Tests\Api\TestCase;
12+
13+
class StatsTest extends TestCase
14+
{
15+
/**
16+
* @test
17+
*/
18+
public function shouldShowStats()
19+
{
20+
$expectedJson = $this->getJson();
21+
$expectedArray = json_encode($expectedJson);
22+
23+
$api = $this->getApiMock();
24+
$api->expects($this->once())
25+
->method('get')
26+
->with('enterprise/stats/all')
27+
->will($this->returnValue($expectedArray));
28+
29+
$this->assertEquals($expectedArray, $api->show('all'));
30+
}
31+
32+
protected function getJson()
33+
{
34+
return '{"repos":{"total_repos": 212, "root_repos": 194, "fork_repos": 18, "org_repos": 51,
35+
"total_pushes": 3082, "total_wikis": 15 }, "hooks": { "total_hooks": 27, "active_hooks": 23,
36+
"inactive_hooks": 4 }, "pages": { "total_pages": 36 }, "orgs": { "total_orgs": 33, "disabled_orgs": 0,
37+
"total_teams": 60, "total_team_members": 314 }, "users": { "total_users": 254, "admin_users": 45,
38+
"suspended_users": 21 }, "pulls": { "total_pulls": 86, "merged_pulls": 60, "mergeable_pulls": 21,
39+
"unmergeable_pulls": 3 }, "issues": { "total_issues": 179, "open_issues": 83, "closed_issues": 96 },
40+
"milestones": { "total_milestones": 7, "open_milestones": 6, "closed_milestones": 1 }, "gists":
41+
{ "total_gists": 178, "private_gists": 151, "public_gists": 25 }, "comments": { "total_commit_comments": 6,
42+
"total_gist_comments": 28, "total_issue_comments": 366, "total_pull_request_comments": 30 } }';
43+
}
44+
45+
protected function getApiClass()
46+
{
47+
return 'Github\Api\Enterprise\Stats';
48+
}
49+
}

0 commit comments

Comments
 (0)