File tree Expand file tree Collapse file tree 2 files changed +35
-0
lines changed Expand file tree Collapse file tree 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)
5151 return $ this ->get ('users/ ' .rawurlencode ($ username ));
5252 }
5353
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+
5466 /**
5567 * Request the users that a specific user is following
5668 * @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()
2020 $ this ->assertEquals ($ expectedArray , $ api ->show ('l3l0 ' ));
2121 }
2222
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+
2346 /**
2447 * @test
2548 */
You can’t perform that action at this time.
0 commit comments