File tree Expand file tree Collapse file tree 3 files changed +50
-0
lines changed Expand file tree Collapse file tree 3 files changed +50
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,22 @@ $users = $client->api('user')->find('KnpLabs');
1212
1313Returns an array of found users.
1414
15+ ### Lists all users, in the order they signed up, since the last user you've seen
16+
17+ ``` php
18+ $users = $client->api('user')->all(135);
19+ ```
20+
21+ Returns an array of all users that registered after the user whose ID is 135.
22+
23+ ### Lists all users, in the order they signed up
24+
25+ ``` php
26+ $users = $client->api('user')->all();
27+ ```
28+
29+ Returns an array of all users.
30+
1531### Get information about a user
1632
1733``` php
Original file line number Diff line number Diff line change @@ -24,6 +24,21 @@ public function find($keyword)
2424 return $ this ->get ('legacy/user/search/ ' .rawurlencode ($ keyword ));
2525 }
2626
27+ /**
28+ * Request all users:
29+ * @link https://developer.github.com/v3/users/#get-all-users
30+ *
31+ * @param integer|null $id ID of the last user that you've seen
32+ * @return array list of users found
33+ */
34+ public function all ($ id = null )
35+ {
36+ if (!is_integer ($ id )) {
37+ return $ this ->get ('users ' );
38+ }
39+ return $ this ->get ('users?since= ' . rawurldecode ($ id ));
40+ }
41+
2742 /**
2843 * Get extended information about a user by its username
2944 * @link http://developer.github.com/v3/users/
Original file line number Diff line number Diff line change @@ -20,6 +20,25 @@ public function shouldShowUser()
2020 $ this ->assertEquals ($ expectedArray , $ api ->show ('l3l0 ' ));
2121 }
2222
23+ /**
24+ * @test
25+ */
26+ public function shouldGetAllUsers ()
27+ {
28+ $ expectedArray = array (
29+ array ('id ' => 1 , 'username ' => 'l3l0 ' ),
30+ array ('id ' => 2 , 'username ' => 'l3l0test ' )
31+ );
32+
33+ $ api = $ this ->getApiMock ();
34+ $ api ->expects ($ this ->once ())
35+ ->method ('get ' )
36+ ->with ('users ' )
37+ ->will ($ this ->returnValue ($ expectedArray ));
38+
39+ $ this ->assertEquals ($ expectedArray , $ api ->all ());
40+ }
41+
2342 /**
2443 * @test
2544 */
You can’t perform that action at this time.
0 commit comments