Skip to content

Commit

Permalink
Fix user class repository method
Browse files Browse the repository at this point in the history
  • Loading branch information
DAGpro committed Oct 24, 2022
1 parent 665ba27 commit 020582d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
13 changes: 3 additions & 10 deletions lib/Github/Api/User.php
Expand Up @@ -159,23 +159,16 @@ public function subscriptions($username)
*
* @link https://developer.github.com/v3/repos/#list-user-repositories
*
* @param string $username the username
* @param string $type role in the repository
* @param string $sort sort by
* @param string $direction direction of sort, asc or desc
* @param string $visibility visibility of repository
* @param string $affiliation relationship to repository
*
* @return array list of the user repositories
*/
public function repositories($username, $type = 'owner', $sort = 'full_name', $direction = 'asc', $visibility = 'all', $affiliation = 'owner,collaborator,organization_member')
public function repositories(string $username, string $type = 'owner', string $sort = 'full_name', string $direction = 'asc', int $perPage = 30, int $page = 1)
{
return $this->get('/users/'.rawurlencode($username).'/repos', [
'type' => $type,
'sort' => $sort,
'direction' => $direction,
'visibility' => $visibility,
'affiliation' => $affiliation,
'per_page' => $perPage,
'page' => $page,
]);
}

Expand Down
2 changes: 1 addition & 1 deletion test/Github/Tests/Api/UserTest.php
Expand Up @@ -191,7 +191,7 @@ public function shouldGetUserRepositories()
$api = $this->getApiMock();
$api->expects($this->once())
->method('get')
->with('/users/l3l0/repos', ['type' => 'owner', 'sort' => 'full_name', 'direction' => 'asc', 'visibility' => 'all', 'affiliation' => 'owner,collaborator,organization_member'])
->with('/users/l3l0/repos', ['type' => 'owner', 'sort' => 'full_name', 'direction' => 'asc', 'per_page' => 30, 'page' => 1])
->will($this->returnValue($expectedArray));

$this->assertEquals($expectedArray, $api->repositories('l3l0'));
Expand Down

0 comments on commit 020582d

Please sign in to comment.