From 8739b09cf9cfcbf761a22e8474ecc00422614e79 Mon Sep 17 00:00:00 2001 From: Binyamin Yawitz <316103+byawitz@users.noreply.github.com> Date: Wed, 4 Sep 2024 14:59:56 -0400 Subject: [PATCH] feat: adding utopia/system and adjusting --- composer.json | 1 + composer.lock | 58 +++++++++++++++++++++++++++++++- docker-compose.yml | 4 +-- tests/Detector/DetectorTest.php | 8 ++--- tests/VCS/Adapter/GitHubTest.php | 8 ++--- tests/VCS/Base.php | 4 +-- 6 files changed, 69 insertions(+), 14 deletions(-) diff --git a/composer.json b/composer.json index e7e56fbb..1cf050d0 100644 --- a/composer.json +++ b/composer.json @@ -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": { diff --git a/composer.lock b/composer.lock index e5de20d3..71947da1 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "c3ad23b95dd1e4ffd5c03253b7d12928", + "content-hash": "fb5e0a876e935787529c46b1650024dc", "packages": [ { "name": "adhocore/jwt", @@ -263,6 +263,62 @@ "source": "https://github.com/utopia-php/servers/tree/0.1.0" }, "time": "2024-08-08T14:31:39+00:00" + }, + { + "name": "utopia-php/system", + "version": "0.8.0", + "source": { + "type": "git", + "url": "https://github.com/utopia-php/system.git", + "reference": "a2cbfb3c69b9ecb8b6f06c5774f3cf279ea7665e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/utopia-php/system/zipball/a2cbfb3c69b9ecb8b6f06c5774f3cf279ea7665e", + "reference": "a2cbfb3c69b9ecb8b6f06c5774f3cf279ea7665e", + "shasum": "" + }, + "require": { + "php": ">=8.0.0" + }, + "require-dev": { + "laravel/pint": "1.13.*", + "phpstan/phpstan": "1.10.*", + "phpunit/phpunit": "9.6.*" + }, + "type": "library", + "autoload": { + "psr-4": { + "Utopia\\System\\": "src/System" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Eldad Fux", + "email": "eldad@appwrite.io" + }, + { + "name": "Torsten Dittmann", + "email": "torsten@appwrite.io" + } + ], + "description": "A simple library for obtaining information about the host's system.", + "keywords": [ + "framework", + "php", + "system", + "upf", + "utopia" + ], + "support": { + "issues": "https://github.com/utopia-php/system/issues", + "source": "https://github.com/utopia-php/system/tree/0.8.0" + }, + "time": "2024-04-01T10:22:28+00:00" } ], "packages-dev": [ diff --git a/docker-compose.yml b/docker-compose.yml index bf600426..1698ec46 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,3 @@ -version: '3.9' - services: tests: build: @@ -11,4 +9,4 @@ services: environment: - PRIVATE_KEY - APP_IDENTIFIER - - INSTALLATION_ID \ No newline at end of file + - INSTALLATION_ID diff --git a/tests/Detector/DetectorTest.php b/tests/Detector/DetectorTest.php index 2ac4826e..7f3ae4e5 100644 --- a/tests/Detector/DetectorTest.php +++ b/tests/Detector/DetectorTest.php @@ -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; @@ -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 @@ -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); } diff --git a/tests/VCS/Adapter/GitHubTest.php b/tests/VCS/Adapter/GitHubTest.php index 9e8b4c9f..b738145e 100644 --- a/tests/VCS/Adapter/GitHubTest.php +++ b/tests/VCS/Adapter/GitHubTest.php @@ -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; @@ -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); } diff --git a/tests/VCS/Base.php b/tests/VCS/Base.php index b87413ba..e31ef618 100644 --- a/tests/VCS/Base.php +++ b/tests/VCS/Base.php @@ -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; @@ -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); }