From 020582d738cf053c84f9596dcaca2ee5f8d0bb4f Mon Sep 17 00:00:00 2001 From: Mahmud Date: Tue, 25 Oct 2022 00:43:37 +0300 Subject: [PATCH] Fix user class repository method --- lib/Github/Api/User.php | 13 +++---------- test/Github/Tests/Api/UserTest.php | 2 +- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/lib/Github/Api/User.php b/lib/Github/Api/User.php index c1ccc89e8c1..e5ef62e0c0f 100644 --- a/lib/Github/Api/User.php +++ b/lib/Github/Api/User.php @@ -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, ]); } diff --git a/test/Github/Tests/Api/UserTest.php b/test/Github/Tests/Api/UserTest.php index 0be80a28f01..9a8066b54e1 100644 --- a/test/Github/Tests/Api/UserTest.php +++ b/test/Github/Tests/Api/UserTest.php @@ -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'));