Skip to content

Commit

Permalink
feat: adding utopia/system and adjusting
Browse files Browse the repository at this point in the history
  • Loading branch information
byawitz committed Sep 4, 2024
1 parent 5995ae7 commit 8739b09
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 14 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"php": ">=8.0",
"adhocore/jwt": "^1.1",
"utopia-php/framework": "1.0.*",
"utopia-php/system": "0.8.*",
"utopia-php/cache": "0.10.*"
},
"require-dev": {
Expand Down
58 changes: 57 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3.9'

services:
tests:
build:
Expand All @@ -11,4 +9,4 @@ services:
environment:
- PRIVATE_KEY
- APP_IDENTIFIER
- INSTALLATION_ID
- INSTALLATION_ID
8 changes: 4 additions & 4 deletions tests/Detector/DetectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Utopia\Tests;

use PHPUnit\Framework\TestCase;
use Utopia\Http\Http;
use Utopia\Cache\Adapter\None;
use Utopia\Cache\Cache;
use Utopia\Detector\Adapter\Bun;
Expand All @@ -18,6 +17,7 @@
use Utopia\Detector\Adapter\Ruby;
use Utopia\Detector\Adapter\Swift;
use Utopia\Detector\Detector;
use Utopia\System\System;
use Utopia\VCS\Adapter\Git\GitHub;

class DetectorTest extends TestCase
Expand Down Expand Up @@ -53,9 +53,9 @@ public function detect($files, $languages): ?string
public function setUp(): void
{
$this->github = new GitHub(new Cache(new None()));
$privateKey = Http::getEnv('PRIVATE_KEY') ?? '';
$githubAppId = Http::getEnv('APP_IDENTIFIER') ?? '';
$installationId = Http::getEnv('INSTALLATION_ID') ?? '';
$privateKey = System::getEnv('PRIVATE_KEY') ?? '';
$githubAppId = System::getEnv('APP_IDENTIFIER') ?? '';
$installationId = System::getEnv('INSTALLATION_ID') ?? '';
$this->github->initializeVariables($installationId, $privateKey, $githubAppId);
}

Expand Down
8 changes: 4 additions & 4 deletions tests/VCS/Adapter/GitHubTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace Utopia\Tests\VCS\Adapter;

use Utopia\Http\Http;
use Utopia\Cache\Adapter\None;
use Utopia\Cache\Cache;
use Utopia\System\System;
use Utopia\Tests\Base;
use Utopia\VCS\Adapter\Git;
use Utopia\VCS\Adapter\Git\GitHub;
Expand All @@ -19,9 +19,9 @@ protected function createVCSAdapter(): Git
public function setUp(): void
{
$this->vcsAdapter = new GitHub(new Cache(new None()));
$privateKey = Http::getEnv('PRIVATE_KEY') ?? '';
$githubAppId = Http::getEnv('APP_IDENTIFIER') ?? '';
$installationId = Http::getEnv('INSTALLATION_ID') ?? '';
$privateKey = System::getEnv('PRIVATE_KEY') ?? '';
$githubAppId = System::getEnv('APP_IDENTIFIER') ?? '';
$installationId = System::getEnv('INSTALLATION_ID') ?? '';
$this->vcsAdapter->initializeVariables($installationId, $privateKey, $githubAppId);
}

Expand Down
4 changes: 2 additions & 2 deletions tests/VCS/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Exception;
use PHPUnit\Framework\TestCase;
use Utopia\Http\Http;
use Utopia\System\System;
use Utopia\VCS\Adapter\Git;
use Utopia\VCS\Adapter\Git\GitHub;

Expand Down Expand Up @@ -44,7 +44,7 @@ public function testGetPullRequestFromBranch(): void

public function testGetOwnerName(): void
{
$installationId = Http::getEnv('INSTALLATION_ID') ?? '';
$installationId = System::getEnv('INSTALLATION_ID') ?? '';
$owner = $this->vcsAdapter->getOwnerName($installationId);
$this->assertEquals('test-kh', $owner);
}
Expand Down

0 comments on commit 8739b09

Please sign in to comment.