diff --git a/Dockerfile b/Dockerfile index dc80ae10..a2b3efd6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,11 @@ FROM supabase/postgres:15.1.0.96 as supabase-db -COPY ./tests/Transfer/resources/supabase/1_globals.sql /docker-entrypoint-initdb.d/1_globals.sql -COPY ./tests/Transfer/resources/supabase/2_main.sql /docker-entrypoint-initdb.d/2_main.sql +COPY ./tests/Migration/resources/supabase/1_globals.sql /docker-entrypoint-initdb.d/1_globals.sql +COPY ./tests/Migration/resources/supabase/2_main.sql /docker-entrypoint-initdb.d/2_main.sql RUN rm -rf /docker-entrypoint-initdb.d/migrate.sh FROM postgres:alpine3.18 as nhost-db -COPY ./tests/Transfer/resources/nhost/1_globals.sql /docker-entrypoint-initdb.d/1_globals.sql -COPY ./tests/Transfer/resources/nhost/2_main.sql /docker-entrypoint-initdb.d/2_main.sql +COPY ./tests/Migration/resources/nhost/1_globals.sql /docker-entrypoint-initdb.d/1_globals.sql +COPY ./tests/Migration/resources/nhost/2_main.sql /docker-entrypoint-initdb.d/2_main.sql # Use my fork of mockoon while waiting for range headers to be merged FROM node:20.4-alpine3.17 as mock-api diff --git a/README.md b/README.md index b8ed83b3..61aa1a33 100644 --- a/README.md +++ b/README.md @@ -19,9 +19,9 @@ Init in your application: ```php - ./tests/Transfer/E2E + ./tests/Migration/E2E \ No newline at end of file diff --git a/playground.php b/playground.php index 0f533188..52004159 100644 --- a/playground.php +++ b/playground.php @@ -1,21 +1,21 @@ load(); diff --git a/src/Transfer/Cache.php b/src/Migration/Cache.php similarity index 96% rename from src/Transfer/Cache.php rename to src/Migration/Cache.php index 4347a514..b25545da 100644 --- a/src/Transfer/Cache.php +++ b/src/Migration/Cache.php @@ -1,9 +1,9 @@ '3g2', 'video/3gp' => '3gp', diff --git a/src/Transfer/Target.php b/src/Migration/Target.php similarity index 99% rename from src/Transfer/Target.php rename to src/Migration/Target.php index eb52827e..41047158 100644 --- a/src/Transfer/Target.php +++ b/src/Migration/Target.php @@ -1,6 +1,6 @@ createMock(\Utopia\Transfer\Cache::class); + $cache = $this->createMock(\Utopia\Migration\Cache::class); $this->source->registerCache($cache); $this->assertNotNull($this->source->cache); diff --git a/tests/Transfer/E2E/Sources/NHostTest.php b/tests/Migration/E2E/Sources/NHostTest.php similarity index 92% rename from tests/Transfer/E2E/Sources/NHostTest.php rename to tests/Migration/E2E/Sources/NHostTest.php index 62aa586b..410216fa 100644 --- a/tests/Transfer/E2E/Sources/NHostTest.php +++ b/tests/Migration/E2E/Sources/NHostTest.php @@ -2,12 +2,12 @@ namespace Utopia\Tests\E2E\Sources; +use Utopia\Migration\Destination; +use Utopia\Migration\Resource; +use Utopia\Migration\Source; +use Utopia\Migration\Sources\NHost; +use Utopia\Migration\Transfer; use Utopia\Tests\E2E\Adapters\Mock; -use Utopia\Transfer\Destination; -use Utopia\Transfer\Resource; -use Utopia\Transfer\Source; -use Utopia\Transfer\Sources\NHost; -use Utopia\Transfer\Transfer; class NHostTest extends Base { @@ -139,7 +139,7 @@ public function testValidateUserTransfer($state): void $foundUser = null; foreach ($users as $user) { - /** @var \Utopia\Transfer\Resources\Auth\User $user */ + /** @var \Utopia\Migration\Resources\Auth\User $user */ if ($user->getEmail() === 'test@test.com') { $foundUser = $user; } @@ -170,7 +170,7 @@ public function testValidateDatabaseTransfer($state): void $foundDatabase = null; foreach ($databases as $database) { - /** @var \Utopia\Transfer\Resources\Database $database */ + /** @var \Utopia\Migration\Resources\Database $database */ if ($database->getDBName() === 'public') { $foundDatabase = $database; } @@ -193,7 +193,7 @@ public function testValidateDatabaseTransfer($state): void $foundCollection = null; foreach ($collections as $collection) { - /** @var \Utopia\Transfer\Resources\Database\Collection $collection */ + /** @var \Utopia\Migration\Resources\Database\Collection $collection */ if ($collection->getCollectionName() === 'TestTable') { $foundCollection = $collection; } @@ -223,7 +223,7 @@ public function testValidateStorageTransfer($state): void $foundBucket = null; foreach ($buckets as $bucket) { - /** @var \Utopia\Transfer\Resources\Bucket $bucket */ + /** @var \Utopia\Migration\Resources\Bucket $bucket */ if ($bucket->getId() === 'default') { $foundBucket = $bucket; } @@ -245,7 +245,7 @@ public function testValidateStorageTransfer($state): void $foundFile = null; foreach ($files as $file) { - /** @var \Utopia\Transfer\Resources\File $file */ + /** @var \Utopia\Migration\Resources\File $file */ if ($file->getFileName() === 'tulips.png') { $foundFile = $file; } @@ -258,7 +258,7 @@ public function testValidateStorageTransfer($state): void return; } - /** @var \Utopia\Transfer\Resources\Storage\File $foundFile */ + /** @var \Utopia\Migration\Resources\Storage\File $foundFile */ $this->assertEquals('success', $foundFile->getStatus()); $this->assertEquals('tulips.png', $foundFile->getFileName()); $this->assertEquals('default', $foundFile->getBucket()->getId()); diff --git a/tests/Transfer/E2E/Sources/SupabaseTest.php b/tests/Migration/E2E/Sources/SupabaseTest.php similarity index 91% rename from tests/Transfer/E2E/Sources/SupabaseTest.php rename to tests/Migration/E2E/Sources/SupabaseTest.php index 62807f81..832e7835 100644 --- a/tests/Transfer/E2E/Sources/SupabaseTest.php +++ b/tests/Migration/E2E/Sources/SupabaseTest.php @@ -2,12 +2,12 @@ namespace Utopia\Tests\E2E\Sources; +use Utopia\Migration\Destination; +use Utopia\Migration\Resource; +use Utopia\Migration\Source; +use Utopia\Migration\Sources\Supabase; +use Utopia\Migration\Transfer; use Utopia\Tests\E2E\Adapters\Mock; -use Utopia\Transfer\Destination; -use Utopia\Transfer\Resource; -use Utopia\Transfer\Source; -use Utopia\Transfer\Sources\Supabase; -use Utopia\Transfer\Transfer; class SupabaseTest extends Base { @@ -119,7 +119,7 @@ public function testValidateUserTransfer($state): void $foundUser = null; foreach ($users as $user) { - /** @var \Utopia\Transfer\Resources\Auth\User $user */ + /** @var \Utopia\Migration\Resources\Auth\User $user */ if ($user->getEmail() == 'albert.kihn95@yahoo.com') { $foundUser = $user; @@ -150,7 +150,7 @@ public function testValidateDatabaseTransfer($state): void $foundDatabase = null; foreach ($databases as $database) { - /** @var \Utopia\Transfer\Resources\Database $database */ + /** @var \Utopia\Migration\Resources\Database $database */ if ($database->getDBName() === 'public') { $foundDatabase = $database; } @@ -175,7 +175,7 @@ public function testValidateDatabaseTransfer($state): void $foundCollection = null; foreach ($collections as $collection) { - /** @var \Utopia\Transfer\Resources\Database\Collection $collection */ + /** @var \Utopia\Migration\Resources\Database\Collection $collection */ if ($collection->getDatabase()->getDBName() === 'public' && $collection->getCollectionName() === 'test') { $foundCollection = $collection; @@ -201,7 +201,7 @@ public function testValidateDatabaseTransfer($state): void $foundDocument = null; foreach ($documents as $document) { - /** @var \Utopia\Transfer\Resources\Database\Document $document */ + /** @var \Utopia\Migration\Resources\Database\Document $document */ if ($document->getCollection()->getDatabase()->getDBName() === 'public' && $document->getCollection()->getCollectionName() === 'test') { $foundDocument = $document; } @@ -230,7 +230,7 @@ public function testValidateStorageTransfer($state): void $foundBucket = null; foreach ($buckets as $bucket) { - /** @var \Utopia\Transfer\Resources\Storage\Bucket $bucket */ + /** @var \Utopia\Migration\Resources\Storage\Bucket $bucket */ if ($bucket->getBucketName() === 'Test Bucket 1') { $foundBucket = $bucket; } @@ -253,7 +253,7 @@ public function testValidateStorageTransfer($state): void $foundFile = null; foreach ($files as $file) { - /** @var \Utopia\Transfer\Resources\File $file */ + /** @var \Utopia\Migration\Resources\File $file */ if ($file->getFileName() === 'tulips.png') { $foundFile = $file; } @@ -266,7 +266,7 @@ public function testValidateStorageTransfer($state): void return; } - /** @var \Utopia\Transfer\Resources\Storage\File $foundFile */ + /** @var \Utopia\Migration\Resources\Storage\File $foundFile */ $this->assertEquals('success', $foundFile->getStatus()); $this->assertEquals('tulips.png', $foundFile->getFileName()); $this->assertEquals('image/png', $foundFile->getMimeType()); diff --git a/tests/Transfer/resources/nhost/1_globals.sql b/tests/Migration/resources/nhost/1_globals.sql similarity index 100% rename from tests/Transfer/resources/nhost/1_globals.sql rename to tests/Migration/resources/nhost/1_globals.sql diff --git a/tests/Transfer/resources/nhost/2_main.sql b/tests/Migration/resources/nhost/2_main.sql similarity index 100% rename from tests/Transfer/resources/nhost/2_main.sql rename to tests/Migration/resources/nhost/2_main.sql diff --git a/tests/Transfer/resources/nhost/api.json b/tests/Migration/resources/nhost/api.json similarity index 100% rename from tests/Transfer/resources/nhost/api.json rename to tests/Migration/resources/nhost/api.json diff --git a/tests/Transfer/resources/nhost/tulips.png b/tests/Migration/resources/nhost/tulips.png similarity index 100% rename from tests/Transfer/resources/nhost/tulips.png rename to tests/Migration/resources/nhost/tulips.png diff --git a/tests/Transfer/resources/supabase/1_globals.sql b/tests/Migration/resources/supabase/1_globals.sql similarity index 100% rename from tests/Transfer/resources/supabase/1_globals.sql rename to tests/Migration/resources/supabase/1_globals.sql diff --git a/tests/Transfer/resources/supabase/2_main.sql b/tests/Migration/resources/supabase/2_main.sql similarity index 100% rename from tests/Transfer/resources/supabase/2_main.sql rename to tests/Migration/resources/supabase/2_main.sql diff --git a/tests/Transfer/resources/supabase/api.json b/tests/Migration/resources/supabase/api.json similarity index 100% rename from tests/Transfer/resources/supabase/api.json rename to tests/Migration/resources/supabase/api.json diff --git a/tests/Transfer/resources/supabase/tulips.png b/tests/Migration/resources/supabase/tulips.png similarity index 100% rename from tests/Transfer/resources/supabase/tulips.png rename to tests/Migration/resources/supabase/tulips.png diff --git a/tests/Transfer/resources/updateBackups.sh b/tests/Migration/resources/updateBackups.sh similarity index 100% rename from tests/Transfer/resources/updateBackups.sh rename to tests/Migration/resources/updateBackups.sh