From 8e12bc2303a44f14e0aa7abd6c1d64db376a9042 Mon Sep 17 00:00:00 2001 From: fogelito Date: Thu, 19 Mar 2026 14:49:09 +0200 Subject: [PATCH] Mongo database tests --- app/controllers/api/migrations.php | 2 +- composer.json | 2 +- composer.lock | 52 +++++++++---------- .../Http/Databases/Collections/Create.php | 2 + .../Database/Validator/Queries/Types.php | 2 +- .../e2e/Services/Databases/DatabasesBase.php | 1 + tests/extensions/Async/Eventually.php | 8 ++- 7 files changed, 39 insertions(+), 30 deletions(-) diff --git a/app/controllers/api/migrations.php b/app/controllers/api/migrations.php index a7ab43610b..ec87d03b3a 100644 --- a/app/controllers/api/migrations.php +++ b/app/controllers/api/migrations.php @@ -22,7 +22,7 @@ use Utopia\Database\Helpers\ID; use Utopia\Database\Query; use Utopia\Database\QueryContext; use Utopia\Database\Validator\Authorization; -use Utopia\Database\Validator\Queries\V2 as DocumentsValidator; +use Utopia\Database\Validator\Queries\Queries as DocumentsValidator; use Utopia\Database\Validator\Query\Cursor; use Utopia\Database\Validator\UID; use Utopia\Http\Http; diff --git a/composer.json b/composer.json index c36f893b2e..6398b38a8a 100644 --- a/composer.json +++ b/composer.json @@ -61,7 +61,7 @@ "utopia-php/compression": "0.1.*", "utopia-php/config": "1.*", "utopia-php/console": "0.1.*", - "utopia-php/database": "dev-joins8 as 5.3.1", + "utopia-php/database": "dev-joins8 as 5.3.15", "utopia-php/detector": "0.2.*", "utopia-php/domains": "1.*", "utopia-php/emails": "0.6.*", diff --git a/composer.lock b/composer.lock index 72efbc81a0..1818fe9ea1 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": "5746ded7729d3ef54c8e922287b98bca", + "content-hash": "685d2d49e6e9b92df4084e091a16ca6a", "packages": [ { "name": "adhocore/jwt", @@ -686,23 +686,23 @@ }, { "name": "google/protobuf", - "version": "v4.33.5", + "version": "v4.33.6", "source": { "type": "git", "url": "https://github.com/protocolbuffers/protobuf-php.git", - "reference": "ebe8010a61b2ae0cff0d246fe1c4d44e9f7dfa6d" + "reference": "84b008c23915ed94536737eae46f41ba3bccfe67" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/ebe8010a61b2ae0cff0d246fe1c4d44e9f7dfa6d", - "reference": "ebe8010a61b2ae0cff0d246fe1c4d44e9f7dfa6d", + "url": "https://api.github.com/repos/protocolbuffers/protobuf-php/zipball/84b008c23915ed94536737eae46f41ba3bccfe67", + "reference": "84b008c23915ed94536737eae46f41ba3bccfe67", "shasum": "" }, "require": { "php": ">=8.1.0" }, "require-dev": { - "phpunit/phpunit": ">=5.0.0 <8.5.27" + "phpunit/phpunit": ">=10.5.62 <11.0.0" }, "suggest": { "ext-bcmath": "Need to support JSON deserialization" @@ -724,9 +724,9 @@ "proto" ], "support": { - "source": "https://github.com/protocolbuffers/protobuf-php/tree/v4.33.5" + "source": "https://github.com/protocolbuffers/protobuf-php/tree/v4.33.6" }, - "time": "2026-01-29T20:49:00+00:00" + "time": "2026-03-18T17:32:05+00:00" }, { "name": "halaxa/json-machine", @@ -1996,16 +1996,16 @@ }, { "name": "phpseclib/phpseclib", - "version": "3.0.49", + "version": "3.0.50", "source": { "type": "git", "url": "https://github.com/phpseclib/phpseclib.git", - "reference": "6233a1e12584754e6b5daa69fe1289b47775c1b9" + "reference": "aa6ad8321ed103dc3624fb600a25b66ebf78ec7b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/6233a1e12584754e6b5daa69fe1289b47775c1b9", - "reference": "6233a1e12584754e6b5daa69fe1289b47775c1b9", + "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/aa6ad8321ed103dc3624fb600a25b66ebf78ec7b", + "reference": "aa6ad8321ed103dc3624fb600a25b66ebf78ec7b", "shasum": "" }, "require": { @@ -2086,7 +2086,7 @@ ], "support": { "issues": "https://github.com/phpseclib/phpseclib/issues", - "source": "https://github.com/phpseclib/phpseclib/tree/3.0.49" + "source": "https://github.com/phpseclib/phpseclib/tree/3.0.50" }, "funding": [ { @@ -2102,7 +2102,7 @@ "type": "tidelift" } ], - "time": "2026-01-27T09:17:28+00:00" + "time": "2026-03-19T02:57:58+00:00" }, { "name": "psr/clock", @@ -3854,12 +3854,12 @@ "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "3d9d0d49a692b57d96ad1fe44b301660b83f7116" + "reference": "0fdc9afb5302503090d858a8a40d3c38844b27f2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/3d9d0d49a692b57d96ad1fe44b301660b83f7116", - "reference": "3d9d0d49a692b57d96ad1fe44b301660b83f7116", + "url": "https://api.github.com/repos/utopia-php/database/zipball/0fdc9afb5302503090d858a8a40d3c38844b27f2", + "reference": "0fdc9afb5302503090d858a8a40d3c38844b27f2", "shasum": "" }, "require": { @@ -3936,7 +3936,7 @@ "source": "https://github.com/utopia-php/database/tree/joins8", "issues": "https://github.com/utopia-php/database/issues" }, - "time": "2026-03-18T09:09:51+00:00" + "time": "2026-03-19T07:32:29+00:00" }, { "name": "utopia-php/detector", @@ -5469,16 +5469,16 @@ "packages-dev": [ { "name": "appwrite/sdk-generator", - "version": "1.11.9", + "version": "1.11.10", "source": { "type": "git", "url": "https://github.com/appwrite/sdk-generator.git", - "reference": "2f0f6ec54736ba7efdff188a9451b56f1665f25a" + "reference": "96e6b79a241fc615627a820107ca64bbd1b550a6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/2f0f6ec54736ba7efdff188a9451b56f1665f25a", - "reference": "2f0f6ec54736ba7efdff188a9451b56f1665f25a", + "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/96e6b79a241fc615627a820107ca64bbd1b550a6", + "reference": "96e6b79a241fc615627a820107ca64bbd1b550a6", "shasum": "" }, "require": { @@ -5514,9 +5514,9 @@ "description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms", "support": { "issues": "https://github.com/appwrite/sdk-generator/issues", - "source": "https://github.com/appwrite/sdk-generator/tree/1.11.9" + "source": "https://github.com/appwrite/sdk-generator/tree/1.11.10" }, - "time": "2026-03-17T08:16:49+00:00" + "time": "2026-03-19T05:27:36+00:00" }, { "name": "brianium/paratest", @@ -8467,8 +8467,8 @@ { "package": "utopia-php/database", "version": "dev-joins8", - "alias": "5.3.1", - "alias_normalized": "5.3.1.0" + "alias": "5.3.15", + "alias_normalized": "5.3.15.0" }, { "package": "utopia-php/migration", diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Create.php index 216ec07e05..fe50c06b36 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Create.php @@ -112,6 +112,8 @@ class Create extends Action 'enabled' => $enabled, 'name' => $name, 'search' => \implode(' ', [$collectionId, $name]), + 'attributes' => null, + 'indexes' => null, ])); } catch (DuplicateException) { throw new Exception($this->getDuplicateException(), params: [$collectionId]); diff --git a/src/Appwrite/Utopia/Database/Validator/Queries/Types.php b/src/Appwrite/Utopia/Database/Validator/Queries/Types.php index 285521b264..63692b4c74 100644 --- a/src/Appwrite/Utopia/Database/Validator/Queries/Types.php +++ b/src/Appwrite/Utopia/Database/Validator/Queries/Types.php @@ -5,7 +5,7 @@ namespace Appwrite\Utopia\Database\Validator\Queries; use Utopia\Database\Database; use Utopia\Database\Query; use Utopia\Database\QueryContext; -use Utopia\Database\Validator\Queries\V2 as DocumentsValidator; +use Utopia\Database\Validator\Queries\Queries as DocumentsValidator; use Utopia\Validator; class Types extends Validator diff --git a/tests/e2e/Services/Databases/DatabasesBase.php b/tests/e2e/Services/Databases/DatabasesBase.php index 1cd019f103..45fb9214a8 100644 --- a/tests/e2e/Services/Databases/DatabasesBase.php +++ b/tests/e2e/Services/Databases/DatabasesBase.php @@ -6224,6 +6224,7 @@ trait DatabasesBase ], 'libraryName' => 'Library 1', ], + 'fullName' => 'Jake', ], 'permissions' => [ Permission::read(Role::user($this->getUser()['$id'])), diff --git a/tests/extensions/Async/Eventually.php b/tests/extensions/Async/Eventually.php index 10f6b41eee..3d8897e608 100644 --- a/tests/extensions/Async/Eventually.php +++ b/tests/extensions/Async/Eventually.php @@ -4,6 +4,7 @@ namespace Appwrite\Tests\Async; use Appwrite\Tests\Async\Exceptions\Critical; use PHPUnit\Framework\Constraint\Constraint; +use Utopia\Console; final class Eventually extends Constraint { @@ -26,8 +27,13 @@ final class Eventually extends Constraint return true; } catch (Critical $exception) { throw $exception; - } catch (\Exception $exception) { + } catch (\Throwable $exception) { $lastException = $exception; + } finally { + if (ob_get_level() > 0) { + ob_flush(); + } + flush(); } usleep($this->waitMs * 1000);