Repository navigation
Expand file tree
/
Copy pathCurrentUserTest.php
More file actions
151 lines (122 loc) · 3.6 KB
/
Copy pathCurrentUserTest.php
File metadata and controls
151 lines (122 loc) · 3.6 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<?php
namespace Github\Tests\Api;
class CurrentUserTest extends TestCase
{
/**
* @test
*/
public function shouldShowCurrentUser()
{
$expectedArray = array('id' => 1, 'username' => 'l3l0');
$api = $this->getApiMock();
$api->expects($this->once())
->method('get')
->with('user')
->will($this->returnValue($expectedArray));
$this->assertEquals($expectedArray, $api->show());
}
/**
* @test
*/
public function shouldUpdateCurrentUserData()
{
$expectedArray = array('id' => 1, 'username' => 'l3l0');
$api = $this->getApiMock();
$api->expects($this->once())
->method('patch')
->with('user', array('value' => 'toChange'))
->will($this->returnValue($expectedArray));
$this->assertEquals($expectedArray, $api->update(array('value' => 'toChange')));
}
/**
* @test
*/
public function shouldGetUserFollowers()
{
$expectedArray = array(array('id' => 1, 'username' => 'l3l0test'));
$api = $this->getApiMock();
$api->expects($this->once())
->method('get')
->with('user/followers', array('page' => 1))
->will($this->returnValue($expectedArray));
$this->assertEquals($expectedArray, $api->followers(1));
}
/**
* @test
*/
public function shouldGetIssuesAssignedToUser()
{
$expectedArray = array(array('id' => 1, 'title' => 'issues'));
$api = $this->getApiMock();
$api->expects($this->once())
->method('get')
->with('issues', array('page' => 1, 'some' => 'param'))
->will($this->returnValue($expectedArray));
$this->assertEquals($expectedArray, $api->issues(array('some' => 'param')));
}
/**
* @test
*/
public function shouldGetWatchedRepositories()
{
$expectedArray = array(array('id' => 1, 'name' => 'l3l0repo'));
$api = $this->getApiMock();
$api->expects($this->once())
->method('get')
->with('user/watched', array('page' => 1))
->will($this->returnValue($expectedArray));
$this->assertEquals($expectedArray, $api->watched(1));
}
/**
* @test
*/
public function shouldGetDeployKeysApiObject()
{
$api = $this->getApiMock();
$this->assertInstanceOf('Github\Api\CurrentUser\DeployKeys', $api->keys());
}
/**
* @test
*/
public function shouldGetEmailsApiObject()
{
$api = $this->getApiMock();
$this->assertInstanceOf('Github\Api\CurrentUser\Emails', $api->emails());
}
/**
* @test
*/
public function shouldGetFollowersApiObject()
{
$api = $this->getApiMock();
$this->assertInstanceOf('Github\Api\CurrentUser\Followers', $api->follow());
}
/**
* @test
*/
public function shouldGetNotificationsApiObject()
{
$api = $this->getApiMock();
$this->assertInstanceOf('Github\Api\CurrentUser\Notifications', $api->notifications());
}
/**
* @test
*/
public function shouldGetWatchersApiObject()
{
$api = $this->getApiMock();
$this->assertInstanceOf('Github\Api\CurrentUser\Watchers', $api->watchers());
}
/**
* @test
*/
public function shouldGetStarredApiObject()
{
$api = $this->getApiMock();
$this->assertInstanceOf('Github\Api\CurrentUser\Starring', $api->starring());
}
protected function getApiClass()
{
return 'Github\Api\CurrentUser';
}
}