1 | <?php |
||
19 | class GitHubTest extends \PHPUnit_Framework_TestCase |
||
20 | { |
||
21 | const PROFILE_RESPONSE = |
||
22 | '{ |
||
23 | "login": "octocat", |
||
24 | "id": 123, |
||
25 | "avatar_url": "https://github.com/images/error/octocat_happy.gif", |
||
26 | "gravatar_id": "somehexcode", |
||
27 | "url": "https://api.github.com/users/octocat", |
||
28 | "html_url": "https://github.com/octocat", |
||
29 | "followers_url": "https://api.github.com/users/octocat/followers", |
||
30 | "following_url": "https://api.github.com/users/octocat/following{/other_user}", |
||
31 | "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}", |
||
32 | "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}", |
||
33 | "subscriptions_url": "https://api.github.com/users/octocat/subscriptions", |
||
34 | "organizations_url": "https://api.github.com/users/octocat/orgs", |
||
35 | "repos_url": "https://api.github.com/users/octocat/repos", |
||
36 | "events_url": "https://api.github.com/users/octocat/events{/privacy}", |
||
37 | "received_events_url": "https://api.github.com/users/octocat/received_events", |
||
38 | "type": "User", |
||
39 | "site_admin": false, |
||
40 | "name": "monalisa octocat", |
||
41 | "company": "GitHub", |
||
42 | "blog": "https://github.com/blog", |
||
43 | "location": "San Francisco", |
||
44 | "email": "[email protected]", |
||
45 | "hireable": false, |
||
46 | "bio": "There once was...", |
||
47 | "public_repos": 2, |
||
48 | "public_gists": 1, |
||
49 | "followers": 20, |
||
50 | "following": 0, |
||
51 | "created_at": "2008-01-14T04:33:35Z", |
||
52 | "updated_at": "2008-01-14T04:33:35Z", |
||
53 | "total_private_repos": 100, |
||
54 | "owned_private_repos": 100, |
||
55 | "private_gists": 81, |
||
56 | "disk_usage": 10000, |
||
57 | "collaborators": 8, |
||
58 | "plan": { |
||
59 | "name": "Medium", |
||
60 | "space": 400, |
||
61 | "collaborators": 10, |
||
62 | "private_repos": 20 |
||
63 | } |
||
64 | }'; |
||
65 | |||
66 | const EMAIL_RESPONSE_PRIMARY_AND_VERIFIED = |
||
67 | '[ |
||
68 | { |
||
69 | "email": "[email protected]", |
||
70 | "verified": false, |
||
71 | "primary": false |
||
72 | }, |
||
73 | { |
||
74 | "email": "[email protected]", |
||
75 | "verified": true, |
||
76 | "primary": false |
||
77 | }, |
||
78 | { |
||
79 | "email": "[email protected]", |
||
80 | "verified": true, |
||
81 | "primary": true |
||
82 | } |
||
83 | ]'; |
||
84 | |||
85 | const EMAIL_RESPONSE_PRIMARY_BUT_NOT_VERIFIED = |
||
86 | '[ |
||
87 | { |
||
88 | "email": "[email protected]", |
||
89 | "verified": false, |
||
90 | "primary": false |
||
91 | } |
||
92 | ]'; |
||
93 | |||
94 | /** |
||
95 | * @var GitHub |
||
96 | */ |
||
97 | protected $extractor; |
||
98 | |||
99 | /** |
||
100 | * Sets up the fixture, for example, opens a network connection. |
||
101 | * This method is called before a test is executed. |
||
102 | */ |
||
103 | protected function setUp() |
||
119 | |||
120 | /** |
||
121 | * Tears down the fixture, for example, closes a network connection. |
||
122 | * This method is called after a test is executed. |
||
123 | */ |
||
124 | protected function tearDown() |
||
127 | |||
128 | public function testDoesNotSupportWebsites() |
||
133 | |||
134 | public function testGetUniqueId() |
||
138 | |||
139 | public function testGetUsername() |
||
143 | |||
144 | public function testGetFistName() |
||
148 | |||
149 | public function testGetLastName() |
||
153 | |||
154 | public function testGetFullName() |
||
158 | |||
159 | public function testGetEmailWithPrimaryAndVerifiedAvailable() |
||
165 | |||
166 | public function testGetEmailWithPrimaryButNotVerifiedAvailable() |
||
172 | |||
173 | public function testGetLocation() |
||
177 | |||
178 | public function testGetDescription() |
||
182 | |||
183 | public function testGetImageUrl() |
||
187 | |||
188 | public function testGetProfileUrl() |
||
192 | |||
193 | public function testIsEmailVerifiedIfVerified() |
||
199 | |||
200 | public function testIsEmailVerifiedIfNotVerified() |
||
206 | |||
207 | public function testGetExtra() |
||
223 | |||
224 | /** |
||
225 | * @return \OAuth\Common\Service\ServiceInterface |
||
226 | */ |
||
227 | private function getEmailTestMock($returnValue) |
||
239 | } |
||
240 |