Skip to content

Commit 48bd26c

Browse files
acrobatNyholm
authored andcommitted
Use parameters array instead of inline query param (#546)
1 parent 0a0826b commit 48bd26c

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

lib/Github/Api/User.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function all($id = null)
4040
return $this->get('/users');
4141
}
4242

43-
return $this->get('/users?since=' . rawurldecode($id));
43+
return $this->get('/users', ['since' => rawurldecode($id)]);
4444
}
4545

4646
/**

test/Github/Tests/Api/UserTest.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,25 @@ public function shouldGetAllUsers()
8282
$this->assertEquals($expectedArray, $api->all());
8383
}
8484

85+
/**
86+
* @test
87+
*/
88+
public function shouldGetAllUsersSince()
89+
{
90+
$expectedArray = array(
91+
array('id' => 3, 'username' => 'test3'),
92+
array('id' => 4, 'username' => 'test4')
93+
);
94+
95+
$api = $this->getApiMock();
96+
$api->expects($this->once())
97+
->method('get')
98+
->with('/users', ['since' => 2])
99+
->will($this->returnValue($expectedArray));
100+
101+
$this->assertEquals($expectedArray, $api->all(2));
102+
}
103+
85104
/**
86105
* @test
87106
*/

0 commit comments

Comments
 (0)