Skip to content

Commit 1833872

Browse files
committed
updated with suggestions
1 parent 5f46cf9 commit 1833872

6 files changed

Lines changed: 9 additions & 51 deletions

File tree

tests/VCS/Adapter/ForgejoTest.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@ class ForgejoTest extends GiteaTest
1818
protected string $webhookSignatureHeader = 'X-Forgejo-Signature';
1919
protected string $avatarDomain = 'http://localhost:3000/avatars/';
2020

21-
protected function createVCSAdapter(): Git
22-
{
23-
return new Forgejo(new Cache(new None()));
24-
}
25-
2621
public function setupAdapter(): void
2722
{
2823
if (empty(static::$accessToken)) {

tests/VCS/Adapter/GitHubTest.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,6 @@ class GitHubTest extends Base
1616
protected static string $installationId = '';
1717
protected static string $defaultBranch = 'main';
1818

19-
protected function createVCSAdapter(): Git
20-
{
21-
return new GitHub(new Cache(new None()));
22-
}
23-
2419
public function setupAdapter(): void
2520
{
2621
$privateKey = str_replace('\\n', "\n", System::getEnv('TESTS_GITHUB_PRIVATE_KEY') ?? '');

tests/VCS/Adapter/GitLabTest.php

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,6 @@ class GitLabTest extends Base
1515
protected static string $owner = '';
1616
protected static string $defaultBranch = 'main';
1717

18-
protected function createVCSAdapter(): Git
19-
{
20-
return new GitLab(new Cache(new None()));
21-
}
22-
2318
public function setupAdapter(): void
2419
{
2520
if (empty(static::$accessToken)) {
@@ -63,24 +58,6 @@ protected function setupGitLab(): void
6358
}
6459

6560

66-
public function testGetOwnerNameWithRepositoryId(): void
67-
{
68-
$repositoryName = 'test-get-owner-name-' . \uniqid();
69-
$this->vcsAdapter->createRepository(static::$owner, $repositoryName, false);
70-
71-
try {
72-
$repo = $this->vcsAdapter->getRepository(static::$owner, $repositoryName);
73-
$repositoryId = $repo['id'] ?? 0;
74-
75-
$result = $this->vcsAdapter->getOwnerName('', $repositoryId);
76-
77-
$this->assertIsString($result);
78-
$this->assertNotEmpty($result);
79-
} finally {
80-
$this->vcsAdapter->deleteRepository(static::$owner, $repositoryName);
81-
}
82-
}
83-
8461
public function testSearchRepositories(): void
8562
{
8663
$repositoryName = 'test-search-repositories-' . \uniqid();

tests/VCS/Adapter/GiteaTest.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@ class GiteaTest extends Base
1919
protected string $webhookSignatureHeader = 'X-Gitea-Signature';
2020
protected string $avatarDomain = 'gravatar.com';
2121

22-
protected function createVCSAdapter(): Git
23-
{
24-
return new Gitea(new Cache(new None()));
25-
}
26-
2722
public function setupAdapter(): void
2823
{
2924
if (empty(static::$accessToken)) {

tests/VCS/Adapter/GogsTest.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@ class GogsTest extends GiteaTest
1818
protected string $avatarDomain = 'gravatar.com';
1919
protected static string $defaultBranch = 'master';
2020

21-
protected function createVCSAdapter(): Git
22-
{
23-
return new Gogs(new Cache(new None()));
24-
}
25-
2621
public function setupAdapter(): void
2722
{
2823
if (empty(static::$accessToken)) {

tests/VCS/Base.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ abstract class Base extends TestCase
1414
protected static string $owner = '';
1515
protected static string $defaultBranch = 'main';
1616

17-
abstract protected function createVCSAdapter(): Git;
18-
1917
abstract protected function setupAdapter(): void;
2018

2119
public function setUp(): void
@@ -616,18 +614,21 @@ public function testSearchRepositories(): void
616614
{
617615
$repo1Name = 'test-search-repo1-' . \uniqid();
618616
$repo2Name = 'test-search-repo2-' . \uniqid();
619-
617+
620618
$this->vcsAdapter->createRepository(static::$owner, $repo1Name, false);
621619
$this->vcsAdapter->createRepository(static::$owner, $repo2Name, false);
622-
620+
623621
try {
624-
$result = $this->vcsAdapter->searchRepositories(static::$owner, 1, 10);
625-
622+
$result = [];
623+
$this->assertEventually(function () use (&$result) {
624+
$result = $this->vcsAdapter->searchRepositories(static::$owner, 1, 10);
625+
$this->assertGreaterThanOrEqual(2, $result['total']);
626+
}, 30000, 2000);
627+
626628
$this->assertIsArray($result);
627629
$this->assertArrayHasKey('items', $result);
628630
$this->assertArrayHasKey('total', $result);
629-
$this->assertGreaterThanOrEqual(2, $result['total']);
630-
631+
631632
$this->assertArrayHasKey('pushed_at', $result['items'][0]);
632633
$this->assertTrue(
633634
$result['items'][0]['pushed_at'] === null || \strtotime($result['items'][0]['pushed_at']) !== false

0 commit comments

Comments
 (0)