Repository navigation
Expand file tree
/
Copy pathRepoTest.php
More file actions
82 lines (71 loc) · 2.71 KB
/
Copy pathRepoTest.php
File metadata and controls
82 lines (71 loc) · 2.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
namespace Github\Tests\Functional;
use Github\Client;
class RepoTest extends \PHPUnit_Framework_TestCase
{
/**
* @test
*/
public function shouldRetrieveContributorsList()
{
$username = 'KnpLabs';
$repo = 'php-github-api';
$github = new Client();
$contributors = $github->getRepoApi()->getRepoContributors($username, $repo);
$contributor = array_pop($contributors);
$this->assertArrayHasKey('url', $contributor);
$this->assertArrayHasKey('gravatar_id', $contributor);
$this->assertArrayHasKey('contributions', $contributor);
$this->assertArrayHasKey('avatar_url', $contributor);
$this->assertArrayHasKey('login', $contributor);
$this->assertArrayHasKey('id', $contributor);
}
/**
* @test
*/
public function shouldGetUserRepositories()
{
$username = 'KnpLabs';
$github = new Client();
$repos = $github->getRepoApi()->getUserRepos($username);
$repo = array_pop($repos);
$this->assertArrayHasKey('id', $repo);
$this->assertArrayHasKey('name', $repo);
$this->assertArrayHasKey('description', $repo);
$this->assertArrayHasKey('url', $repo);
$this->assertArrayHasKey('has_wiki', $repo);
$this->assertArrayHasKey('has_issues', $repo);
$this->assertArrayHasKey('forks', $repo);
$this->assertArrayHasKey('updated_at', $repo);
$this->assertArrayHasKey('created_at', $repo);
$this->assertArrayHasKey('pushed_at', $repo);
$this->assertArrayHasKey('open_issues', $repo);
$this->assertArrayHasKey('ssh_url', $repo);
$this->assertArrayHasKey('git_url', $repo);
$this->assertArrayHasKey('svn_url', $repo);
}
/**
* @test
*/
public function shouldShowRepo()
{
$username = 'KnpLabs';
$repo = 'php-github-api';
$github = new Client();
$repo = $github->getRepoApi()->show($username, $repo);
$this->assertArrayHasKey('id', $repo);
$this->assertArrayHasKey('name', $repo);
$this->assertArrayHasKey('description', $repo);
$this->assertArrayHasKey('url', $repo);
$this->assertArrayHasKey('has_wiki', $repo);
$this->assertArrayHasKey('has_issues', $repo);
$this->assertArrayHasKey('forks', $repo);
$this->assertArrayHasKey('updated_at', $repo);
$this->assertArrayHasKey('created_at', $repo);
$this->assertArrayHasKey('pushed_at', $repo);
$this->assertArrayHasKey('open_issues', $repo);
$this->assertArrayHasKey('ssh_url', $repo);
$this->assertArrayHasKey('git_url', $repo);
$this->assertArrayHasKey('svn_url', $repo);
}
}