-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathBase.php
More file actions
84 lines (63 loc) · 2.42 KB
/
Copy pathBase.php
File metadata and controls
84 lines (63 loc) · 2.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<?php
namespace Utopia\Tests;
use PHPUnit\Framework\TestCase;
use Utopia\App;
use Utopia\VCS\Adapter\Git;
abstract class Base extends TestCase
{
protected Git $vcsAdapter;
protected function setUp(): void
{
$this->vcsAdapter = $this->createVCSAdapter();
}
abstract protected function createVCSAdapter(): Git;
abstract public function testUpdateComment(): void;
abstract public function testGenerateCloneCommand(): void;
abstract public function testGenerateCloneCommandWithCommitHash(): void;
abstract public function testgetEvent(): void;
abstract public function testGetRepositoryName(): void;
abstract public function testGetComment(): void;
abstract public function testGetPullRequest(): void;
public function testGetPullRequestFromBranch(): void
{
$result = $this->vcsAdapter->getPullRequestFromBranch('vermakhushboo', 'basic-js-crud', 'test');
$this->assertIsArray($result);
$this->assertNotEmpty($result);
}
public function testGetOwnerName(): void
{
$installationId = App::getEnv('INSTALLATION_ID') ?? '';
$owner = $this->vcsAdapter->getOwnerName($installationId);
$this->assertEquals('test-kh', $owner);
}
public function testSearchRepositories(): void
{
$repos = $this->vcsAdapter->searchRepositories('test-kh', 1, 2);
$this->assertCount(2, $repos);
}
public function testCreateComment(): void
{
$commentId = $this->vcsAdapter->createComment('test-kh', 'test2', 1, 'hello');
$this->assertNotEmpty($commentId);
}
public function testListBranches(): void
{
$branches = $this->vcsAdapter->listBranches('vermakhushboo', 'basic-js-crud');
$this->assertIsArray($branches);
$this->assertNotEmpty($branches);
}
public function testListRepositoryLanguages(): void
{
$languages = $this->vcsAdapter->listRepositoryLanguages('vermakhushboo', 'basic-js-crud');
$this->assertIsArray($languages);
$this->assertContains('JavaScript', $languages);
$this->assertContains('HTML', $languages);
$this->assertContains('CSS', $languages);
}
public function testListRepositoryContents(): void
{
$contents = $this->vcsAdapter->listRepositoryContents('appwrite', 'appwrite', 'src/Appwrite');
$this->assertIsArray($contents);
$this->assertNotEmpty($contents);
}
}