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');
12
12
13
13
Returns an array of found users.
14
14
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
+
15
31
### Get information about a user
16
32
17
33
``` php
Original file line number Diff line number Diff line change @@ -24,6 +24,21 @@ public function find($keyword)
24
24
return $ this ->get ('legacy/user/search/ ' .rawurlencode ($ keyword ));
25
25
}
26
26
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
+
27
42
/**
28
43
* Get extended information about a user by its username
29
44
* @link http://developer.github.com/v3/users/
Original file line number Diff line number Diff line change @@ -20,6 +20,25 @@ public function shouldShowUser()
20
20
$ this ->assertEquals ($ expectedArray , $ api ->show ('l3l0 ' ));
21
21
}
22
22
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
+
23
42
/**
24
43
* @test
25
44
*/
You can’t perform that action at this time.
0 commit comments