mirror of
https://github.com/appwrite/appwrite.git
synced 2026-11-18 20:36:03 +00:00
Add test
This commit is contained in:
1 parent
99be8b11b0
commit
0807cca2a9
2 files changed
+97
-45
No files matched your search
Generated
+48
-45
@@ -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": "a811ab43bece6d9d01be1caab8a08a75",
|
||||
"content-hash": "1737ce10d83c99185ebde7bcaf4fc70d",
|
||||
"packages": [
|
||||
{
|
||||
"name": "adhocore/jwt",
|
||||
@@ -3167,7 +3167,7 @@
|
||||
},
|
||||
{
|
||||
"name": "utopia-php/audit",
|
||||
"version": "2.9.0",
|
||||
"version": "2.9.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/utopia-php/audit.git",
|
||||
@@ -3206,7 +3206,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/utopia-php/audit/issues",
|
||||
"source": "https://github.com/utopia-php/audit/tree/2.9.0"
|
||||
"source": "https://github.com/utopia-php/audit/tree/2.9.1"
|
||||
},
|
||||
"time": "2026-07-15T10:27:51+00:00"
|
||||
},
|
||||
@@ -3635,16 +3635,16 @@
|
||||
},
|
||||
{
|
||||
"name": "utopia-php/database",
|
||||
"version": "6.4.4",
|
||||
"version": "dev-cache-empty-get-document",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/utopia-php/database.git",
|
||||
"reference": "a1796fd360d58abcc3bb3e1b615fcebc04ba9100"
|
||||
"reference": "6968bd0ce88aa963548f87e127fa8fd1f22180a6"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/utopia-php/database/zipball/a1796fd360d58abcc3bb3e1b615fcebc04ba9100",
|
||||
"reference": "a1796fd360d58abcc3bb3e1b615fcebc04ba9100",
|
||||
"url": "https://api.github.com/repos/utopia-php/database/zipball/6968bd0ce88aa963548f87e127fa8fd1f22180a6",
|
||||
"reference": "6968bd0ce88aa963548f87e127fa8fd1f22180a6",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -3689,9 +3689,9 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/utopia-php/database/issues",
|
||||
"source": "https://github.com/utopia-php/database/tree/6.4.4"
|
||||
"source": "https://github.com/utopia-php/database/tree/cache-empty-get-document"
|
||||
},
|
||||
"time": "2026-07-17T08:21:36+00:00"
|
||||
"time": "2026-07-23T11:43:56+00:00"
|
||||
},
|
||||
{
|
||||
"name": "utopia-php/detector",
|
||||
@@ -4108,16 +4108,16 @@
|
||||
},
|
||||
{
|
||||
"name": "utopia-php/image",
|
||||
"version": "0.8.7",
|
||||
"version": "0.8.9",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/utopia-php/image.git",
|
||||
"reference": "ed06c72998869f5d66026c7e4b7e1bcc1bbf45c7"
|
||||
"reference": "6647714267e43bae25c8e8ae7021264eca4a1e84"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/utopia-php/image/zipball/ed06c72998869f5d66026c7e4b7e1bcc1bbf45c7",
|
||||
"reference": "ed06c72998869f5d66026c7e4b7e1bcc1bbf45c7",
|
||||
"url": "https://api.github.com/repos/utopia-php/image/zipball/6647714267e43bae25c8e8ae7021264eca4a1e84",
|
||||
"reference": "6647714267e43bae25c8e8ae7021264eca4a1e84",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -4125,11 +4125,6 @@
|
||||
"ext-imagick": "*",
|
||||
"php": ">=8.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"laravel/pint": "1.24.*",
|
||||
"phpstan/phpstan": "2.1.*",
|
||||
"phpunit/phpunit": "10.5.*"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-imagick": "Imagick extension is required for Imagick adapter"
|
||||
},
|
||||
@@ -4153,9 +4148,9 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/utopia-php/image/issues",
|
||||
"source": "https://github.com/utopia-php/image/tree/0.8.7"
|
||||
"source": "https://github.com/utopia-php/image/tree/0.8.9"
|
||||
},
|
||||
"time": "2026-07-13T12:12:06+00:00"
|
||||
"time": "2026-07-20T18:04:09+00:00"
|
||||
},
|
||||
{
|
||||
"name": "utopia-php/locale",
|
||||
@@ -5421,31 +5416,31 @@
|
||||
"packages-dev": [
|
||||
{
|
||||
"name": "appwrite/sdk-generator",
|
||||
"version": "2.4.13",
|
||||
"version": "2.4.19",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/appwrite/sdk-generator.git",
|
||||
"reference": "7ead3b6ff1746ae950cacca55bc9800708d5beff"
|
||||
"reference": "d0e58c93a8d7021a69d2a5d6b30fa826a5404fb9"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/7ead3b6ff1746ae950cacca55bc9800708d5beff",
|
||||
"reference": "7ead3b6ff1746ae950cacca55bc9800708d5beff",
|
||||
"url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/d0e58c93a8d7021a69d2a5d6b30fa826a5404fb9",
|
||||
"reference": "d0e58c93a8d7021a69d2a5d6b30fa826a5404fb9",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-curl": "*",
|
||||
"ext-json": "*",
|
||||
"ext-mbstring": "*",
|
||||
"matthiasmullie/minify": "1.3.*",
|
||||
"matthiasmullie/minify": "^1.3",
|
||||
"php": ">=8.5",
|
||||
"twig/twig": "3.28.*"
|
||||
"twig/twig": "^3.28"
|
||||
},
|
||||
"require-dev": {
|
||||
"brianium/paratest": "7.*",
|
||||
"phpunit/phpunit": "11.*",
|
||||
"brianium/paratest": "^7",
|
||||
"phpunit/phpunit": "^11",
|
||||
"rector/rector": "^2.4",
|
||||
"squizlabs/php_codesniffer": "4.*"
|
||||
"squizlabs/php_codesniffer": "^4"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
@@ -5467,9 +5462,9 @@
|
||||
"description": "SDK generator for Appwrite APIs across multiple programming languages and platforms",
|
||||
"support": {
|
||||
"issues": "https://github.com/appwrite/sdk-generator/issues",
|
||||
"source": "https://github.com/appwrite/sdk-generator/tree/2.4.13"
|
||||
"source": "https://github.com/appwrite/sdk-generator/tree/2.4.19"
|
||||
},
|
||||
"time": "2026-07-13T07:30:15+00:00"
|
||||
"time": "2026-07-24T06:18:23+00:00"
|
||||
},
|
||||
{
|
||||
"name": "brianium/paratest",
|
||||
@@ -6586,16 +6581,16 @@
|
||||
},
|
||||
{
|
||||
"name": "phpunit/phpunit",
|
||||
"version": "12.5.31",
|
||||
"version": "12.5.32",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
||||
"reference": "0608d157a284f15cc73b99a3327eff06b66a176d"
|
||||
"reference": "c02591dd7840ed124a98d7770753329ad28e9f8f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/0608d157a284f15cc73b99a3327eff06b66a176d",
|
||||
"reference": "0608d157a284f15cc73b99a3327eff06b66a176d",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c02591dd7840ed124a98d7770753329ad28e9f8f",
|
||||
"reference": "c02591dd7840ed124a98d7770753329ad28e9f8f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -6664,7 +6659,7 @@
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
|
||||
"security": "https://github.com/sebastianbergmann/phpunit/security/policy",
|
||||
"source": "https://github.com/sebastianbergmann/phpunit/tree/12.5.31"
|
||||
"source": "https://github.com/sebastianbergmann/phpunit/tree/12.5.32"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -6672,7 +6667,7 @@
|
||||
"type": "other"
|
||||
}
|
||||
],
|
||||
"time": "2026-07-06T14:54:16+00:00"
|
||||
"time": "2026-07-25T06:54:13+00:00"
|
||||
},
|
||||
{
|
||||
"name": "rector/rector",
|
||||
@@ -7697,16 +7692,16 @@
|
||||
},
|
||||
{
|
||||
"name": "swoole/ide-helper",
|
||||
"version": "6.0.2",
|
||||
"version": "6.2.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/swoole/ide-helper.git",
|
||||
"reference": "6f12243dce071714c5febe059578d909698f9a52"
|
||||
"reference": "ad91a281e135f498426fb2e5297376581a4e2dca"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/swoole/ide-helper/zipball/6f12243dce071714c5febe059578d909698f9a52",
|
||||
"reference": "6f12243dce071714c5febe059578d909698f9a52",
|
||||
"url": "https://api.github.com/repos/swoole/ide-helper/zipball/ad91a281e135f498426fb2e5297376581a4e2dca",
|
||||
"reference": "ad91a281e135f498426fb2e5297376581a4e2dca",
|
||||
"shasum": ""
|
||||
},
|
||||
"type": "library",
|
||||
@@ -7723,9 +7718,9 @@
|
||||
"description": "IDE help files for Swoole.",
|
||||
"support": {
|
||||
"issues": "https://github.com/swoole/ide-helper/issues",
|
||||
"source": "https://github.com/swoole/ide-helper/tree/6.0.2"
|
||||
"source": "https://github.com/swoole/ide-helper/tree/6.2.2"
|
||||
},
|
||||
"time": "2025-03-23T07:31:41+00:00"
|
||||
"time": "2026-07-25T08:15:29+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/console",
|
||||
@@ -8412,9 +8407,17 @@
|
||||
"time": "2026-07-03T20:44:34+00:00"
|
||||
}
|
||||
],
|
||||
"aliases": [],
|
||||
"aliases": [
|
||||
{
|
||||
"package": "utopia-php/database",
|
||||
"version": "dev-cache-empty-get-document",
|
||||
"alias": "6.4.4",
|
||||
"alias_normalized": "6.4.4.0"
|
||||
}
|
||||
],
|
||||
"minimum-stability": "dev",
|
||||
"stability-flags": {
|
||||
"utopia-php/database": 20,
|
||||
"utopia-php/http": 5,
|
||||
"utopia-php/platform": 5
|
||||
},
|
||||
@@ -8438,5 +8441,5 @@
|
||||
"platform-dev": {
|
||||
"ext-fileinfo": "*"
|
||||
},
|
||||
"plugin-api-version": "2.9.0"
|
||||
"plugin-api-version": "2.6.0"
|
||||
}
|
||||
@@ -3732,6 +3732,55 @@ trait DatabasesBase
|
||||
}
|
||||
}
|
||||
|
||||
public function testGetDocumentCacheEmpty(): void
|
||||
{
|
||||
$data = $this->setupIndexes();
|
||||
$databaseId = $data['databaseId'];
|
||||
$containerId = $data['moviesId'];
|
||||
|
||||
$documentId = ID::unique();
|
||||
|
||||
// Read a document that does not exist yet -> negatively caches the miss.
|
||||
$missing = $this->client->call(Client::METHOD_GET, $this->getRecordUrl($databaseId, $containerId, $documentId), array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()));
|
||||
|
||||
$this->assertEquals(404, $missing['headers']['status-code']);
|
||||
|
||||
// Create that same id. This must purge the cached "not found".
|
||||
$created = $this->client->call(Client::METHOD_POST, $this->getRecordUrl($databaseId, $containerId), array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), [
|
||||
$this->getRecordIdParam() => $documentId,
|
||||
'data' => [
|
||||
'title' => 'Cached Empty',
|
||||
'releaseYear' => 2020,
|
||||
'birthDay' => null,
|
||||
],
|
||||
'permissions' => [
|
||||
Permission::read(Role::user($this->getUser()['$id'])),
|
||||
Permission::update(Role::user($this->getUser()['$id'])),
|
||||
Permission::delete(Role::user($this->getUser()['$id'])),
|
||||
],
|
||||
]);
|
||||
|
||||
$this->assertEquals(201, $created['headers']['status-code']);
|
||||
$this->assertEquals($documentId, $created['body']['$id']);
|
||||
|
||||
// The freshly created document must be visible right away. Without cache
|
||||
// invalidation on create this would still return 404 from the marker.
|
||||
$fetched = $this->client->call(Client::METHOD_GET, $this->getRecordUrl($databaseId, $containerId, $documentId), array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()));
|
||||
|
||||
$this->assertEquals(200, $fetched['headers']['status-code']);
|
||||
$this->assertEquals($documentId, $fetched['body']['$id']);
|
||||
$this->assertEquals('Cached Empty', $fetched['body']['title']);
|
||||
}
|
||||
|
||||
public function testGetDocumentWithQueries(): void
|
||||
{
|
||||
$data = $this->getDocumentsList();
|
||||
|
||||
Reference in new issue
Block a user