From af0bd7f60d9bec3f2e7f3e6b1830b02b0fb27b32 Mon Sep 17 00:00:00 2001 From: Jeroen Thora Date: Sat, 25 Mar 2017 21:17:03 +0100 Subject: [PATCH] Use parameters array instead of inline query param --- lib/Github/Api/User.php | 2 +- test/Github/Tests/Api/UserTest.php | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/lib/Github/Api/User.php b/lib/Github/Api/User.php index c11716040d8..d4dc6bccbf6 100644 --- a/lib/Github/Api/User.php +++ b/lib/Github/Api/User.php @@ -40,7 +40,7 @@ public function all($id = null) return $this->get('/users'); } - return $this->get('/users?since=' . rawurldecode($id)); + return $this->get('/users', ['since' => rawurldecode($id)]); } /** diff --git a/test/Github/Tests/Api/UserTest.php b/test/Github/Tests/Api/UserTest.php index 8e505cfd862..b93d62b3c03 100644 --- a/test/Github/Tests/Api/UserTest.php +++ b/test/Github/Tests/Api/UserTest.php @@ -82,6 +82,25 @@ public function shouldGetAllUsers() $this->assertEquals($expectedArray, $api->all()); } + /** + * @test + */ + public function shouldGetAllUsersSince() + { + $expectedArray = array( + array('id' => 3, 'username' => 'test3'), + array('id' => 4, 'username' => 'test4') + ); + + $api = $this->getApiMock(); + $api->expects($this->once()) + ->method('get') + ->with('/users', ['since' => 2]) + ->will($this->returnValue($expectedArray)); + + $this->assertEquals($expectedArray, $api->all(2)); + } + /** * @test */