File tree 2 files changed +35
-0
lines changed 2 files changed +35
-0
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,18 @@ public function show($username)
51
51
return $ this ->get ('users/ ' .rawurlencode ($ username ));
52
52
}
53
53
54
+ /**
55
+ * Get extended information about a user by its username
56
+ * @link https://developer.github.com/v3/orgs/
57
+ *
58
+ * @param string $username the username to show
59
+ * @return array information about organizations that user belongs to
60
+ */
61
+ public function organizations ($ username )
62
+ {
63
+ return $ this ->get ('users/ ' .rawurlencode ($ username ).'/orgs ' );
64
+ }
65
+
54
66
/**
55
67
* Request the users that a specific user is following
56
68
* @link http://developer.github.com/v3/users/followers/
Original file line number Diff line number Diff line change @@ -20,6 +20,29 @@ public function shouldShowUser()
20
20
$ this ->assertEquals ($ expectedArray , $ api ->show ('l3l0 ' ));
21
21
}
22
22
23
+ /**
24
+ * @test
25
+ */
26
+ public function shouldGetUserOrganizations ()
27
+ {
28
+ $ expectedArray = array (array (
29
+ 'id ' => 202732 ,
30
+ 'url ' => 'https://api.github.com/orgs/KnpLabs ' ,
31
+ 'repos_url ' => 'https://api.github.com/orgs/KnpLabs/repos ' ,
32
+ 'events_url ' => 'https://api.github.com/orgs/KnpLabs/events ' ,
33
+ 'members_url ' => 'https://api.github.com/orgs/KnpLabs/members{/member} ' ,
34
+ 'public_members_url ' => 'https://api.github.com/orgs/KnpLabs/public_members{/member} '
35
+ ));
36
+
37
+ $ api = $ this ->getApiMock ();
38
+ $ api ->expects ($ this ->once ())
39
+ ->method ('get ' )
40
+ ->with ('users/l3l0/orgs ' )
41
+ ->will ($ this ->returnValue ($ expectedArray ));
42
+
43
+ $ this ->assertEquals ($ expectedArray , $ api ->organizations ('l3l0 ' ));
44
+ }
45
+
23
46
/**
24
47
* @test
25
48
*/
You can’t perform that action at this time.
0 commit comments