Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/VCS/Adapter/Git/GitHub.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ public function searchRepositories(string $owner, int $page, int $per_page, stri

$response = $this->call(self::METHOD_GET, $url, ['Authorization' => "Bearer $this->accessToken"], [
'q' => "{$search} user:{$owner} fork:true",
'page' => $page,
'per_page' => $per_page,
'sort' => 'updated'
]);
Expand All @@ -118,7 +119,10 @@ public function searchRepositories(string $owner, int $page, int $per_page, stri
throw new Exception("Repositories list missing in the response.");
}

return $response['body']['items'];
return [
'items' => $response['body']['items'],
'total' => $response['body']['total_count'],
];
}

/**
Expand Down
3 changes: 2 additions & 1 deletion tests/VCS/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@ public function testGetOwnerName(): void

public function testSearchRepositories(): void
{
$repos = $this->vcsAdapter->searchRepositories('test-kh', 1, 2);
['items' => $repos, 'total' => $total] = $this->vcsAdapter->searchRepositories('test-kh', 1, 2);
$this->assertCount(2, $repos);
$this->assertSame(6, $total);
}

public function testCreateComment(): void
Expand Down