Skip to content

Commit 8d35393

Browse files
author
Your Name
committed
updated with suggestion of pagination test and the owner name test
1 parent a1f0f09 commit 8d35393

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

tests/VCS/Adapter/GiteaTest.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -658,15 +658,18 @@ public function testSearchRepositoriesPagination(): void
658658
$this->vcsAdapter->createRepository(self::$owner, $repo2, false);
659659

660660
try {
661-
// Test limit=1 only returns 1 repo
662661
$result = $this->vcsAdapter->searchRepositories('', self::$owner, 1, 1, 'test-pagination');
663662

664663
$this->assertSame(1, count($result['items']));
665664
$this->assertGreaterThanOrEqual(2, $result['total']);
666665

667-
// Test page 2
668666
$result2 = $this->vcsAdapter->searchRepositories('', self::$owner, 2, 1, 'test-pagination');
669667
$this->assertSame(1, count($result2['items']));
668+
669+
$result20 = $this->vcsAdapter->searchRepositories('', self::$owner, 20, 1, 'test-pagination');
670+
$this->assertIsArray($result20);
671+
$this->assertEmpty($result20['items']);
672+
670673
} finally {
671674
$this->vcsAdapter->deleteRepository(self::$owner, $repo1);
672675
$this->vcsAdapter->deleteRepository(self::$owner, $repo2);
@@ -725,6 +728,14 @@ public function testGetOwnerName(): void
725728
$this->vcsAdapter->getOwnerName('');
726729
}
727730

731+
public function testGetOwnerNameWithRandomInput(): void
732+
{
733+
$this->expectException(\Exception::class);
734+
$this->expectExceptionMessage('not applicable for Gitea');
735+
736+
$this->vcsAdapter->getOwnerName('random-gibberish-' . \uniqid());
737+
}
738+
728739
public function testGetPullRequestFromBranch(): void
729740
{
730741
$repositoryName = 'test-get-pr-from-branch-' . \uniqid();

0 commit comments

Comments
 (0)