Repository navigation
Expand file tree
/
Copy pathUserTest.php
More file actions
113 lines (97 loc) · 3.2 KB
/
Copy pathUserTest.php
File metadata and controls
113 lines (97 loc) · 3.2 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<?php
namespace Github\Tests\Functional;
/**
* @group functional
*/
class UserTest extends TestCase
{
/**
* @test
*/
public function shouldShowUserData()
{
$username = 'KnpLabs';
$user = $this->client->api('user')->show($username);
$this->assertArrayHasKey('id', $user);
$this->assertEquals('KnpLabs', $user['login']);
$this->assertEquals('Organization', $user['type']);
$this->assertArrayHasKey('email', $user);
$this->assertArrayHasKey('avatar_url', $user);
$this->assertArrayHasKey('company', $user);
$this->assertArrayHasKey('blog', $user);
$this->assertArrayHasKey('public_repos', $user);
$this->assertArrayHasKey('public_gists', $user);
$this->assertArrayHasKey('followers', $user);
$this->assertArrayHasKey('following', $user);
$this->assertArrayHasKey('html_url', $user);
}
/**
* @test
* @expectedException \Github\Exception\RuntimeException
*/
public function shouldNotUpdateUserWithoutAuthorization()
{
$this->client->api('current_user')->update(array('email' => 'leszek.prabucki@gmail.com'));
}
/**
* @test
*/
public function shouldGetUsersWhoUserIsFollowing()
{
$username = 'l3l0';
$users = $this->client->api('user')->following($username);
$user = array_pop($users);
$this->assertArrayHasKey('id', $user);
$this->assertArrayHasKey('login', $user);
}
/**
* @test
*/
public function shouldGetFollowersUsers()
{
$username = 'cursedcoder';
$users = $this->client->api('user')->followers($username);
$user = array_pop($users);
$this->assertArrayHasKey('id', $user);
$this->assertArrayHasKey('login', $user);
}
/**
* @test
* @expectedException \Github\Exception\RuntimeException
*/
public function shouldNotFollowUserWithoutAuthorization()
{
$this->client->api('current_user')->follow()->follow('KnpLabs');
}
/**
* @test
* @expectedException \Github\Exception\RuntimeException
*/
public function shouldNotUnfollowUserWithoutAuthorization()
{
$this->client->api('current_user')->follow()->unfollow('KnpLabs');
}
/**
* @test
*/
public function shouldGetReposBeingWatched()
{
$username = 'l3l0';
$repos = $this->client->api('user')->watched($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);
}
}