From 43f0849979b42f1c908afc1c6786c99bb2050a13 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Tue, 5 Aug 2025 20:38:26 +1200 Subject: [PATCH] Fix atomic num ops with limit 0 --- composer.lock | 16 +++++++------- .../e2e/Services/Databases/DatabasesBase.php | 22 ++++++++++++++++++- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/composer.lock b/composer.lock index 88356d5349..b3450f36fb 100644 --- a/composer.lock +++ b/composer.lock @@ -3542,16 +3542,16 @@ }, { "name": "utopia-php/database", - "version": "0.71.10", + "version": "0.71.11", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "83278d663f9c63c25a11d9e71c7922da7ec48636" + "reference": "644ed827aace63cbdf8c6c64a3998c11b43e3383" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/83278d663f9c63c25a11d9e71c7922da7ec48636", - "reference": "83278d663f9c63c25a11d9e71c7922da7ec48636", + "url": "https://api.github.com/repos/utopia-php/database/zipball/644ed827aace63cbdf8c6c64a3998c11b43e3383", + "reference": "644ed827aace63cbdf8c6c64a3998c11b43e3383", "shasum": "" }, "require": { @@ -3592,9 +3592,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/0.71.10" + "source": "https://github.com/utopia-php/database/tree/0.71.11" }, - "time": "2025-07-18T00:05:55+00:00" + "time": "2025-08-05T08:35:29+00:00" }, { "name": "utopia-php/detector", @@ -8364,7 +8364,7 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": {}, "prefer-stable": false, "prefer-lowest": false, "platform": { @@ -8388,5 +8388,5 @@ "platform-overrides": { "php": "8.3" }, - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.6.0" } diff --git a/tests/e2e/Services/Databases/DatabasesBase.php b/tests/e2e/Services/Databases/DatabasesBase.php index de5d33f29d..9b3e31dd70 100644 --- a/tests/e2e/Services/Databases/DatabasesBase.php +++ b/tests/e2e/Services/Databases/DatabasesBase.php @@ -5664,7 +5664,27 @@ trait DatabasesBase ]), ['min' => 7]); $this->assertEquals(400, $err['headers']['status-code']); - // Test type error on non-numeric attribut + // Test min limit exceeded with custom value + $err = $this->client->call(Client::METHOD_PATCH, '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents/' . $documentId . '/count/decrement', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ]), [ + 'value' => 3, + 'min' => 5, + ]); + $this->assertEquals(400, $err['headers']['status-code']); + + // Test min limit 0 + $err = $this->client->call(Client::METHOD_PATCH, '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents/' . $documentId . '/count/decrement', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ]), [ + 'value' => 10, + 'min' => 0, + ]); + $this->assertEquals(400, $err['headers']['status-code']); + + // Test type error on non-numeric attribute $typeErr = $this->client->call(Client::METHOD_PATCH, '/databases/' . $databaseId . '/collections/' . $collectionId . '/documents/' . $documentId . '/count/decrement', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'],