From c2e711b021b80913d888a9c982b9186ffeabedb5 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Tue, 30 May 2023 14:07:12 +1200 Subject: [PATCH 01/10] Update framework to fix route mismatches (cherry picked from commit d42f6738a9badc02176913b21b72e01c461681d8) # Conflicts: # composer.lock --- composer.json | 2 +- composer.lock | 30 ++++++++++++------- .../e2e/Services/Databases/DatabasesBase.php | 6 ++++ 3 files changed, 27 insertions(+), 11 deletions(-) diff --git a/composer.json b/composer.json index 78f960d3d1..3f15bcfb67 100644 --- a/composer.json +++ b/composer.json @@ -51,7 +51,7 @@ "utopia-php/config": "0.2.*", "utopia-php/database": "0.36.*", "utopia-php/domains": "1.1.*", - "utopia-php/framework": "0.28.*", + "utopia-php/framework": "dev-fix-route-mistmatch as 0.28.1", "utopia-php/image": "0.5.*", "utopia-php/locale": "0.4.*", "utopia-php/logger": "0.3.*", diff --git a/composer.lock b/composer.lock index 978d14f490..35f54f5cec 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": "169ab6e7dd540e45309d3c5093506fad", + "content-hash": "6b8b1c976fb0a44257d3820fe87af179", "packages": [ { "name": "adhocore/jwt", @@ -2221,23 +2221,24 @@ }, { "name": "utopia-php/framework", - "version": "0.28.1", + "version": "dev-fix-route-mistmatch", "source": { "type": "git", "url": "https://github.com/utopia-php/framework.git", - "reference": "7f22c556fc5991e54e5811a68fb39809b21bda55" + "reference": "e8e12a880539679010b86576e843be9f4c7f3329" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/framework/zipball/7f22c556fc5991e54e5811a68fb39809b21bda55", - "reference": "7f22c556fc5991e54e5811a68fb39809b21bda55", + "url": "https://api.github.com/repos/utopia-php/framework/zipball/e8e12a880539679010b86576e843be9f4c7f3329", + "reference": "e8e12a880539679010b86576e843be9f4c7f3329", "shasum": "" }, "require": { - "php": ">=8.0.0" + "php": ">=8.0" }, "require-dev": { "laravel/pint": "^1.2", + "phpstan/phpstan": "1.9.x-dev", "phpunit/phpunit": "^9.5.25", "vimeo/psalm": "4.27.0" }, @@ -2259,9 +2260,9 @@ ], "support": { "issues": "https://github.com/utopia-php/framework/issues", - "source": "https://github.com/utopia-php/framework/tree/0.28.1" + "source": "https://github.com/utopia-php/framework/tree/fix-route-mistmatch" }, - "time": "2023-03-02T08:16:01+00:00" + "time": "2023-05-30T01:59:18+00:00" }, { "name": "utopia-php/image", @@ -5652,9 +5653,18 @@ "time": "2023-02-08T07:49:20+00:00" } ], - "aliases": [], + "aliases": [ + { + "package": "utopia-php/framework", + "version": "dev-fix-route-mistmatch", + "alias": "0.28.1", + "alias_normalized": "0.28.1.0" + } + ], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": { + "utopia-php/framework": 20 + }, "prefer-stable": false, "prefer-lowest": false, "platform": { diff --git a/tests/e2e/Services/Databases/DatabasesBase.php b/tests/e2e/Services/Databases/DatabasesBase.php index 0648db849e..88849a4c8e 100644 --- a/tests/e2e/Services/Databases/DatabasesBase.php +++ b/tests/e2e/Services/Databases/DatabasesBase.php @@ -1086,6 +1086,12 @@ trait DatabasesBase $this->assertEquals(400, $document4['headers']['status-code']); + // Delete document 4 with incomplete path + $this->assertEquals(404, $this->client->call(Client::METHOD_DELETE, '/databases/' . $databaseId . '/collections/' . $data['moviesId'] . '/documents/', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + ], $this->getHeaders()))['headers']['status-code']); + return $data; } From 3dd67cb17fd511cc8d2b5467b4d58ab6e521924e Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Tue, 30 May 2023 18:17:28 +1200 Subject: [PATCH 02/10] Fix visibility (cherry picked from commit b092405b04e9e928520f04c01cc4cfc98d074a68) --- app/controllers/general.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/general.php b/app/controllers/general.php index fe25f5c273..00d5c6347f 100644 --- a/app/controllers/general.php +++ b/app/controllers/general.php @@ -437,7 +437,7 @@ App::error() $log->addExtra('line', $error->getLine()); $log->addExtra('trace', $error->getTraceAsString()); $log->addExtra('detailedTrace', $error->getTrace()); - $log->addExtra('roles', Authorization::$roles); + $log->addExtra('roles', Authorization::getRoles()); $action = $route->getLabel("sdk.namespace", "UNKNOWN_NAMESPACE") . '.' . $route->getLabel("sdk.method", "UNKNOWN_METHOD"); $log->setAction($action); From bab804b8e119f5eb16647f1d449094cffbecafaf Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Tue, 30 May 2023 18:26:17 +1200 Subject: [PATCH 03/10] Fix tests (cherry picked from commit 0661f1f8899d8dfed18c832d3332959b175b4f6e) --- tests/e2e/Client.php | 54 +++++++------------ tests/e2e/General/HTTPTest.php | 34 ++++-------- tests/e2e/Scopes/Scope.php | 11 ++-- .../e2e/Services/Databases/DatabasesBase.php | 2 +- .../Projects/ProjectsConsoleClientTest.php | 19 ++++++- 5 files changed, 51 insertions(+), 69 deletions(-) diff --git a/tests/e2e/Client.php b/tests/e2e/Client.php index e98472b2b8..21e4ccc958 100644 --- a/tests/e2e/Client.php +++ b/tests/e2e/Client.php @@ -160,35 +160,21 @@ class Client * @param array $params * @param array $headers * @param bool $decode - * @return array|string + * @return array * @throws Exception */ - public function call(string $method, string $path = '', array $headers = [], array $params = [], bool $decode = true) + public function call(string $method, string $path = '', array $headers = [], array $params = [], bool $decode = true): array { $headers = array_merge($this->headers, $headers); $ch = curl_init($this->endpoint . $path . (($method == self::METHOD_GET && !empty($params)) ? '?' . http_build_query($params) : '')); $responseHeaders = []; - $responseStatus = -1; - $responseType = ''; - $responseBody = ''; - switch ($headers['content-type']) { - case 'application/json': - $query = json_encode($params); - break; - - case 'multipart/form-data': - $query = $this->flatten($params); - break; - - case 'application/graphql': - $query = $params[0]; - break; - - default: - $query = http_build_query($params); - break; - } + $query = match ($headers['content-type']) { + 'application/json' => json_encode($params), + 'multipart/form-data' => $this->flatten($params), + 'application/graphql' => $params[0], + default => http_build_query($params), + }; foreach ($headers as $i => $header) { $headers[] = $i . ':' . $header; @@ -220,7 +206,7 @@ class Client curl_setopt($ch, CURLOPT_POSTFIELDS, $query); } - // Allow self signed certificates + // Allow self-signed certificates if ($this->selfSigned) { curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); @@ -230,22 +216,18 @@ class Client $responseType = $responseHeaders['content-type'] ?? ''; $responseStatus = curl_getinfo($ch, CURLINFO_HTTP_CODE); - if ($decode) { - switch (substr($responseType, 0, strpos($responseType, ';'))) { - case 'application/json': - $json = json_decode($responseBody, true); + if ($decode && substr($responseType, 0, strpos($responseType, ';')) == 'application/json') { + $json = json_decode($responseBody, true); - if ($json === null) { - throw new Exception('Failed to parse response: ' . $responseBody); - } - - $responseBody = $json; - $json = null; - break; + if ($json === null) { + throw new Exception('Failed to parse response: ' . $responseBody); } + + $responseBody = $json; + $json = null; } - if ((curl_errno($ch)/* || 200 != $responseStatus*/)) { + if ((curl_errno($ch))) { throw new Exception(curl_error($ch) . ' with status code ' . $responseStatus, $responseStatus); } @@ -273,7 +255,7 @@ class Client { $cookies = []; - parse_str(strtr($cookie, array('&' => '%26', '+' => '%2B', ';' => '&')), $cookies); + parse_str(strtr($cookie, ['&' => '%26', '+' => '%2B', ';' => '&']), $cookies); return $cookies; } diff --git a/tests/e2e/General/HTTPTest.php b/tests/e2e/General/HTTPTest.php index f033cd6d42..09a7048eef 100644 --- a/tests/e2e/General/HTTPTest.php +++ b/tests/e2e/General/HTTPTest.php @@ -12,6 +12,12 @@ class HTTPTest extends Scope use ProjectNone; use SideNone; + public function setUp(): void + { + parent::setUp(); + $this->client->setEndpoint('http://localhost'); + } + public function testOptions() { /** @@ -32,24 +38,6 @@ class HTTPTest extends Scope $this->assertEmpty($response['body']); } - public function testError() - { - /** - * Test for SUCCESS - */ - $this->markTestIncomplete('This test needs to be updated for the new console.'); - // $response = $this->client->call(Client::METHOD_GET, '/error', \array_merge([ - // 'origin' => 'http://localhost', - // 'content-type' => 'application/json', - // ]), []); - - // $this->assertEquals(404, $response['headers']['status-code']); - // $this->assertEquals('Not Found', $response['body']['message']); - // $this->assertEquals(Exception::GENERAL_ROUTE_NOT_FOUND, $response['body']['type']); - // $this->assertEquals(404, $response['body']['code']); - // $this->assertEquals('dev', $response['body']['version']); - } - public function testHumans() { /** @@ -57,7 +45,7 @@ class HTTPTest extends Scope */ $response = $this->client->call(Client::METHOD_GET, '/humans.txt', \array_merge([ 'origin' => 'http://localhost', - ]), []); + ])); $this->assertEquals(200, $response['headers']['status-code']); $this->assertStringContainsString('# humanstxt.org/', $response['body']); @@ -70,7 +58,7 @@ class HTTPTest extends Scope */ $response = $this->client->call(Client::METHOD_GET, '/robots.txt', \array_merge([ 'origin' => 'http://localhost', - ]), []); + ])); $this->assertEquals(200, $response['headers']['status-code']); $this->assertStringContainsString('# robotstxt.org/', $response['body']); @@ -87,7 +75,7 @@ class HTTPTest extends Scope */ $response = $this->client->call(Client::METHOD_GET, '/.well-known/acme-challenge/8DdIKX257k6Dih5s_saeVMpTnjPJdKO5Ase0OCiJrIg', \array_merge([ 'origin' => 'http://localhost', - ]), []); + ])); $this->assertEquals(404, $response['headers']['status-code']); // 'Unknown path', but validation passed @@ -97,9 +85,9 @@ class HTTPTest extends Scope */ $response = $this->client->call(Client::METHOD_GET, '/.well-known/acme-challenge/../../../../../../../etc/passwd', \array_merge([ 'origin' => 'http://localhost', - ]), []); + ])); - $this->assertEquals(400, $response['headers']['status-code']); + $this->assertEquals(404, $response['headers']['status-code']); // Cleanup $this->client->setEndpoint($previousEndpoint); diff --git a/tests/e2e/Scopes/Scope.php b/tests/e2e/Scopes/Scope.php index 42057e8e94..14eb83897b 100644 --- a/tests/e2e/Scopes/Scope.php +++ b/tests/e2e/Scopes/Scope.php @@ -17,10 +17,7 @@ abstract class Scope extends TestCase protected function setUp(): void { $this->client = new Client(); - - $this->client - ->setEndpoint($this->endpoint) - ; + $this->client->setEndpoint($this->endpoint); } protected function tearDown(): void @@ -45,10 +42,10 @@ abstract class Scope extends TestCase { sleep(2); - $resquest = json_decode(file_get_contents('http://request-catcher:5000/__last_request__'), true); - $resquest['data'] = json_decode($resquest['data'], true); + $request = json_decode(file_get_contents('http://request-catcher:5000/__last_request__'), true); + $request['data'] = json_decode($request['data'], true); - return $resquest; + return $request; } /** diff --git a/tests/e2e/Services/Databases/DatabasesBase.php b/tests/e2e/Services/Databases/DatabasesBase.php index 88849a4c8e..1fa03fc593 100644 --- a/tests/e2e/Services/Databases/DatabasesBase.php +++ b/tests/e2e/Services/Databases/DatabasesBase.php @@ -3053,7 +3053,7 @@ trait DatabasesBase $databaseId = $database['body']['$id']; // Create collection - $movies = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/', array_merge([ + $movies = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] diff --git a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php index 91699f2dba..288903f0a1 100644 --- a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php +++ b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php @@ -783,11 +783,11 @@ class ProjectsConsoleClientTest extends Scope $this->assertEquals($response['headers']['status-code'], 501); - $response = $this->client->call(Client::METHOD_POST, '/account/anonymous', array_merge([ + $response = $this->client->call(Client::METHOD_POST, '/account/sessions/anonymous', array_merge([ 'origin' => 'http://localhost', 'content-type' => 'application/json', 'x-appwrite-project' => $id, - ]), []); + ])); $this->assertEquals($response['headers']['status-code'], 501); @@ -843,6 +843,19 @@ class ProjectsConsoleClientTest extends Scope 'name' => $name, ]); + $email = uniqid() . 'user@localhost.test'; + + $response = $this->client->call(Client::METHOD_POST, '/account', array_merge([ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'x-appwrite-project' => $id, + ]), [ + 'userId' => ID::unique(), + 'email' => $email, + 'password' => $password, + 'name' => $name, + ]); + $this->assertEquals($response['headers']['status-code'], 501); /** @@ -858,6 +871,8 @@ class ProjectsConsoleClientTest extends Scope $this->assertEquals(200, $response['headers']['status-code']); $this->assertNotEmpty($response['body']['$id']); + $email = uniqid() . 'user@localhost.test'; + $response = $this->client->call(Client::METHOD_POST, '/account', array_merge([ 'origin' => 'http://localhost', 'content-type' => 'application/json', From b101404eda2e8262c8b7d382e219594a7816209a Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Tue, 30 May 2023 18:53:58 +1200 Subject: [PATCH 04/10] Update to release version of framework --- composer.json | 2 +- composer.lock | 27 +++++++++------------------ 2 files changed, 10 insertions(+), 19 deletions(-) diff --git a/composer.json b/composer.json index 3f15bcfb67..78f960d3d1 100644 --- a/composer.json +++ b/composer.json @@ -51,7 +51,7 @@ "utopia-php/config": "0.2.*", "utopia-php/database": "0.36.*", "utopia-php/domains": "1.1.*", - "utopia-php/framework": "dev-fix-route-mistmatch as 0.28.1", + "utopia-php/framework": "0.28.*", "utopia-php/image": "0.5.*", "utopia-php/locale": "0.4.*", "utopia-php/logger": "0.3.*", diff --git a/composer.lock b/composer.lock index 35f54f5cec..4368987f5c 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": "6b8b1c976fb0a44257d3820fe87af179", + "content-hash": "169ab6e7dd540e45309d3c5093506fad", "packages": [ { "name": "adhocore/jwt", @@ -2221,16 +2221,16 @@ }, { "name": "utopia-php/framework", - "version": "dev-fix-route-mistmatch", + "version": "0.28.2", "source": { "type": "git", "url": "https://github.com/utopia-php/framework.git", - "reference": "e8e12a880539679010b86576e843be9f4c7f3329" + "reference": "bc0144ff3983afa6724c43f2ce578fdbceec21f9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/framework/zipball/e8e12a880539679010b86576e843be9f4c7f3329", - "reference": "e8e12a880539679010b86576e843be9f4c7f3329", + "url": "https://api.github.com/repos/utopia-php/framework/zipball/bc0144ff3983afa6724c43f2ce578fdbceec21f9", + "reference": "bc0144ff3983afa6724c43f2ce578fdbceec21f9", "shasum": "" }, "require": { @@ -2260,9 +2260,9 @@ ], "support": { "issues": "https://github.com/utopia-php/framework/issues", - "source": "https://github.com/utopia-php/framework/tree/fix-route-mistmatch" + "source": "https://github.com/utopia-php/framework/tree/0.28.2" }, - "time": "2023-05-30T01:59:18+00:00" + "time": "2023-05-30T06:47:57+00:00" }, { "name": "utopia-php/image", @@ -5653,18 +5653,9 @@ "time": "2023-02-08T07:49:20+00:00" } ], - "aliases": [ - { - "package": "utopia-php/framework", - "version": "dev-fix-route-mistmatch", - "alias": "0.28.1", - "alias_normalized": "0.28.1.0" - } - ], + "aliases": [], "minimum-stability": "stable", - "stability-flags": { - "utopia-php/framework": 20 - }, + "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, "platform": { From 5f5ed7dc19d5d66d3a3b5e2782bfa1464ad5bd50 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Tue, 30 May 2023 19:41:06 +1200 Subject: [PATCH 05/10] Fix graphql upload test path --- tests/e2e/Services/GraphQL/StorageServerTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/Services/GraphQL/StorageServerTest.php b/tests/e2e/Services/GraphQL/StorageServerTest.php index afaef08321..7fea895b1c 100644 --- a/tests/e2e/Services/GraphQL/StorageServerTest.php +++ b/tests/e2e/Services/GraphQL/StorageServerTest.php @@ -77,7 +77,7 @@ class StorageServerTest extends Scope 'file' => new CURLFile(realpath(__DIR__ . '/../../../resources/logo.png'), 'image/png', 'logo.png'), ]; - $file = $this->client->call(Client::METHOD_POST, '/graphql/upload', \array_merge([ + $file = $this->client->call(Client::METHOD_POST, '/graphql', \array_merge([ 'content-type' => 'multipart/form-data', 'x-appwrite-project' => $projectId, ], $this->getHeaders()), $gqlPayload); From d2bfe46fca5340b29e5407704e9d6bc010903fb6 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Tue, 30 May 2023 14:52:59 +1200 Subject: [PATCH 06/10] Set min length to 0 for default value when creating or updating a string attribute (cherry picked from commit c61e54f69b5b2b5259334d49c697dff416cbc9dc) --- app/controllers/api/databases.php | 6 ++-- .../e2e/Services/Databases/DatabasesBase.php | 32 +++++++++++++++---- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/app/controllers/api/databases.php b/app/controllers/api/databases.php index 8a18e28dba..ec8bbb2294 100644 --- a/app/controllers/api/databases.php +++ b/app/controllers/api/databases.php @@ -1095,7 +1095,7 @@ App::post('/v1/databases/:databaseId/collections/:collectionId/attributes/string ->param('key', '', new Key(), 'Attribute Key.') ->param('size', null, new Range(1, APP_DATABASE_ATTRIBUTE_STRING_MAX_LENGTH, Range::TYPE_INTEGER), 'Attribute size for text attributes, in number of characters.') ->param('required', null, new Boolean(), 'Is attribute required?') - ->param('default', null, new Text(0), 'Default value for attribute when not provided. Cannot be set when attribute is required.', true) + ->param('default', null, new Text(0, 0), 'Default value for attribute when not provided. Cannot be set when attribute is required.', true) ->param('array', false, new Boolean(), 'Is attribute an array?', true) ->inject('response') ->inject('dbForProject') @@ -1104,7 +1104,7 @@ App::post('/v1/databases/:databaseId/collections/:collectionId/attributes/string ->action(function (string $databaseId, string $collectionId, string $key, ?int $size, ?bool $required, ?string $default, bool $array, Response $response, Database $dbForProject, EventDatabase $database, Event $events) { // Ensure attribute default is within required size - $validator = new Text($size); + $validator = new Text($size, 0); if (!is_null($default) && !$validator->isValid($default)) { throw new Exception(Exception::ATTRIBUTE_VALUE_INVALID, $validator->getDescription()); } @@ -1769,7 +1769,7 @@ App::patch('/v1/databases/:databaseId/collections/:collectionId/attributes/strin ->param('collectionId', '', new UID(), 'Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).') ->param('key', '', new Key(), 'Attribute Key.') ->param('required', null, new Boolean(), 'Is attribute required?') - ->param('default', null, new Nullable(new Text(0)), 'Default value for attribute when not provided. Cannot be set when attribute is required.') + ->param('default', null, new Nullable(new Text(0, 0)), 'Default value for attribute when not provided. Cannot be set when attribute is required.') ->inject('response') ->inject('dbForProject') ->inject('events') diff --git a/tests/e2e/Services/Databases/DatabasesBase.php b/tests/e2e/Services/Databases/DatabasesBase.php index 0648db849e..c511bf9902 100644 --- a/tests/e2e/Services/Databases/DatabasesBase.php +++ b/tests/e2e/Services/Databases/DatabasesBase.php @@ -157,6 +157,7 @@ trait DatabasesBase public function testCreateAttributes(array $data): array { $databaseId = $data['databaseId']; + $title = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $data['moviesId'] . '/attributes/string', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], @@ -167,6 +168,17 @@ trait DatabasesBase 'required' => true, ]); + $description = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $data['moviesId'] . '/attributes/string', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'key' => 'description', + 'size' => 256, + 'required' => false, + 'default' => '', + ]); + $releaseYear = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $data['moviesId'] . '/attributes/integer', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], @@ -226,6 +238,13 @@ trait DatabasesBase $this->assertEquals($title['body']['size'], 256); $this->assertEquals($title['body']['required'], true); + $this->assertEquals(202, $description['headers']['status-code']); + $this->assertEquals($description['body']['key'], 'description'); + $this->assertEquals($description['body']['type'], 'string'); + $this->assertEquals($description['body']['size'], 256); + $this->assertEquals($description['body']['required'], false); + $this->assertEquals($description['body']['default'], ''); + $this->assertEquals(202, $releaseYear['headers']['status-code']); $this->assertEquals($releaseYear['body']['key'], 'releaseYear'); $this->assertEquals($releaseYear['body']['type'], 'integer'); @@ -266,13 +285,14 @@ trait DatabasesBase ]), []); $this->assertIsArray($movies['body']['attributes']); - $this->assertCount(6, $movies['body']['attributes']); + $this->assertCount(7, $movies['body']['attributes']); $this->assertEquals($movies['body']['attributes'][0]['key'], $title['body']['key']); - $this->assertEquals($movies['body']['attributes'][1]['key'], $releaseYear['body']['key']); - $this->assertEquals($movies['body']['attributes'][2]['key'], $duration['body']['key']); - $this->assertEquals($movies['body']['attributes'][3]['key'], $actors['body']['key']); - $this->assertEquals($movies['body']['attributes'][4]['key'], $datetime['body']['key']); - $this->assertEquals($movies['body']['attributes'][5]['key'], $relationship['body']['key']); + $this->assertEquals($movies['body']['attributes'][1]['key'], $description['body']['key']); + $this->assertEquals($movies['body']['attributes'][2]['key'], $releaseYear['body']['key']); + $this->assertEquals($movies['body']['attributes'][3]['key'], $duration['body']['key']); + $this->assertEquals($movies['body']['attributes'][4]['key'], $actors['body']['key']); + $this->assertEquals($movies['body']['attributes'][5]['key'], $datetime['body']['key']); + $this->assertEquals($movies['body']['attributes'][6]['key'], $relationship['body']['key']); return $data; } From 225f21454cca8acbce0af6dd2084433fe2b0fdce Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Tue, 30 May 2023 19:44:13 +1200 Subject: [PATCH 07/10] Update changelog --- CHANGES.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index b77ca2e3ce..857521fd2b 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,9 @@ +# Version 1.3.5 + +## Bugs + +- Fix minimum length for string attribute default values [#5606](https://github.com/appwrite/appwrite/pull/5606) + # Version 1.3.4 ## Bugs From a3474f8a3b5165980f8bacec5bf5a79119f30e0a Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Tue, 30 May 2023 15:45:29 +0000 Subject: [PATCH 08/10] feat: prepare 1.3.5 release --- CHANGES.md | 1 + README-CN.md | 6 +-- README.md | 6 +-- app/init.php | 4 +- composer.lock | 79 ++++++++++++++-------------- src/Appwrite/Migration/Migration.php | 1 + 6 files changed, 50 insertions(+), 47 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 857521fd2b..8c6e7120b7 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,7 @@ ## Bugs - Fix minimum length for string attribute default values [#5606](https://github.com/appwrite/appwrite/pull/5606) +- Update framework to fix route mismatches [#5603](https://github.com/appwrite/appwrite/pull/5603) # Version 1.3.4 diff --git a/README-CN.md b/README-CN.md index 1463722084..1aa4b7011a 100644 --- a/README-CN.md +++ b/README-CN.md @@ -66,7 +66,7 @@ docker run -it --rm \ --volume /var/run/docker.sock:/var/run/docker.sock \ --volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \ --entrypoint="install" \ - appwrite/appwrite:1.3.4 + appwrite/appwrite:1.3.5 ``` ### Windows @@ -78,7 +78,7 @@ docker run -it --rm ^ --volume //var/run/docker.sock:/var/run/docker.sock ^ --volume "%cd%"/appwrite:/usr/src/code/appwrite:rw ^ --entrypoint="install" ^ - appwrite/appwrite:1.3.4 + appwrite/appwrite:1.3.5 ``` #### PowerShell @@ -88,7 +88,7 @@ docker run -it --rm ` --volume /var/run/docker.sock:/var/run/docker.sock ` --volume ${pwd}/appwrite:/usr/src/code/appwrite:rw ` --entrypoint="install" ` - appwrite/appwrite:1.3.4 + appwrite/appwrite:1.3.5 ``` 运行后,可以在浏览器上访问 http://localhost 找到 Appwrite 控制台。在非 Linux 的本机主机上完成安装后,服务器可能需要几分钟才能启动。 diff --git a/README.md b/README.md index 414c4bd0c3..bbaaba2311 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ docker run -it --rm \ --volume /var/run/docker.sock:/var/run/docker.sock \ --volume "$(pwd)"/appwrite:/usr/src/code/appwrite:rw \ --entrypoint="install" \ - appwrite/appwrite:1.3.4 + appwrite/appwrite:1.3.5 ``` ### Windows @@ -87,7 +87,7 @@ docker run -it --rm ^ --volume //var/run/docker.sock:/var/run/docker.sock ^ --volume "%cd%"/appwrite:/usr/src/code/appwrite:rw ^ --entrypoint="install" ^ - appwrite/appwrite:1.3.4 + appwrite/appwrite:1.3.5 ``` #### PowerShell @@ -97,7 +97,7 @@ docker run -it --rm ` --volume /var/run/docker.sock:/var/run/docker.sock ` --volume ${pwd}/appwrite:/usr/src/code/appwrite:rw ` --entrypoint="install" ` - appwrite/appwrite:1.3.4 + appwrite/appwrite:1.3.5 ``` Once the Docker installation is complete, go to http://localhost to access the Appwrite console from your browser. Please note that on non-Linux native hosts, the server might take a few minutes to start after completing the installation. diff --git a/app/init.php b/app/init.php index 2dd01d2134..d959cf24b5 100644 --- a/app/init.php +++ b/app/init.php @@ -100,8 +100,8 @@ const APP_LIMIT_WRITE_RATE_PERIOD_DEFAULT = 60; // Default maximum write rate pe const APP_LIMIT_LIST_DEFAULT = 25; // Default maximum number of items to return in list API calls const APP_KEY_ACCCESS = 24 * 60 * 60; // 24 hours const APP_CACHE_UPDATE = 24 * 60 * 60; // 24 hours -const APP_CACHE_BUSTER = 503; -const APP_VERSION_STABLE = '1.3.4'; +const APP_CACHE_BUSTER = 504; +const APP_VERSION_STABLE = '1.3.5'; const APP_DATABASE_ATTRIBUTE_EMAIL = 'email'; const APP_DATABASE_ATTRIBUTE_ENUM = 'enum'; const APP_DATABASE_ATTRIBUTE_IP = 'ip'; diff --git a/composer.lock b/composer.lock index 4368987f5c..c0a9e17f18 100644 --- a/composer.lock +++ b/composer.lock @@ -481,21 +481,21 @@ }, { "name": "guzzlehttp/guzzle", - "version": "7.5.1", + "version": "7.7.0", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "b964ca597e86b752cd994f27293e9fa6b6a95ed9" + "reference": "fb7566caccf22d74d1ab270de3551f72a58399f5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/b964ca597e86b752cd994f27293e9fa6b6a95ed9", - "reference": "b964ca597e86b752cd994f27293e9fa6b6a95ed9", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/fb7566caccf22d74d1ab270de3551f72a58399f5", + "reference": "fb7566caccf22d74d1ab270de3551f72a58399f5", "shasum": "" }, "require": { "ext-json": "*", - "guzzlehttp/promises": "^1.5", + "guzzlehttp/promises": "^1.5.3 || ^2.0", "guzzlehttp/psr7": "^1.9.1 || ^2.4.5", "php": "^7.2.5 || ^8.0", "psr/http-client": "^1.0", @@ -507,7 +507,8 @@ "require-dev": { "bamarni/composer-bin-plugin": "^1.8.1", "ext-curl": "*", - "php-http/client-integration-tests": "^3.0", + "php-http/client-integration-tests": "dev-master#2c025848417c1135031fdf9c728ee53d0a7ceaee as 3.0.999", + "php-http/message-factory": "^1.1", "phpunit/phpunit": "^8.5.29 || ^9.5.23", "psr/log": "^1.1 || ^2.0 || ^3.0" }, @@ -589,7 +590,7 @@ ], "support": { "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/7.5.1" + "source": "https://github.com/guzzle/guzzle/tree/7.7.0" }, "funding": [ { @@ -605,38 +606,37 @@ "type": "tidelift" } ], - "time": "2023-04-17T16:30:08+00:00" + "time": "2023-05-21T14:04:53+00:00" }, { "name": "guzzlehttp/promises", - "version": "1.5.2", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "b94b2807d85443f9719887892882d0329d1e2598" + "reference": "3a494dc7dc1d7d12e511890177ae2d0e6c107da6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/b94b2807d85443f9719887892882d0329d1e2598", - "reference": "b94b2807d85443f9719887892882d0329d1e2598", + "url": "https://api.github.com/repos/guzzle/promises/zipball/3a494dc7dc1d7d12e511890177ae2d0e6c107da6", + "reference": "3a494dc7dc1d7d12e511890177ae2d0e6c107da6", "shasum": "" }, "require": { - "php": ">=5.5" + "php": "^7.2.5 || ^8.0" }, "require-dev": { - "symfony/phpunit-bridge": "^4.4 || ^5.1" + "bamarni/composer-bin-plugin": "^1.8.1", + "phpunit/phpunit": "^8.5.29 || ^9.5.23" }, "type": "library", "extra": { - "branch-alias": { - "dev-master": "1.5-dev" + "bamarni-bin": { + "bin-links": true, + "forward-command": false } }, "autoload": { - "files": [ - "src/functions_include.php" - ], "psr-4": { "GuzzleHttp\\Promise\\": "src/" } @@ -673,7 +673,7 @@ ], "support": { "issues": "https://github.com/guzzle/promises/issues", - "source": "https://github.com/guzzle/promises/tree/1.5.2" + "source": "https://github.com/guzzle/promises/tree/2.0.0" }, "funding": [ { @@ -689,7 +689,7 @@ "type": "tidelift" } ], - "time": "2022-08-28T14:55:35+00:00" + "time": "2023-05-21T13:50:22+00:00" }, { "name": "guzzlehttp/psr7", @@ -3086,16 +3086,16 @@ }, { "name": "doctrine/deprecations", - "version": "v1.0.0", + "version": "v1.1.0", "source": { "type": "git", "url": "https://github.com/doctrine/deprecations.git", - "reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de" + "reference": "8cffffb2218e01f3b370bf763e00e81697725259" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/deprecations/zipball/0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de", - "reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/8cffffb2218e01f3b370bf763e00e81697725259", + "reference": "8cffffb2218e01f3b370bf763e00e81697725259", "shasum": "" }, "require": { @@ -3123,9 +3123,9 @@ "homepage": "https://www.doctrine-project.org/", "support": { "issues": "https://github.com/doctrine/deprecations/issues", - "source": "https://github.com/doctrine/deprecations/tree/v1.0.0" + "source": "https://github.com/doctrine/deprecations/tree/v1.1.0" }, - "time": "2022-05-02T15:47:09+00:00" + "time": "2023-05-29T18:55:17+00:00" }, { "name": "doctrine/instantiator", @@ -3382,16 +3382,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.15.4", + "version": "v4.15.5", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "6bb5176bc4af8bcb7d926f88718db9b96a2d4290" + "reference": "11e2663a5bc9db5d714eedb4277ee300403b4a9e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/6bb5176bc4af8bcb7d926f88718db9b96a2d4290", - "reference": "6bb5176bc4af8bcb7d926f88718db9b96a2d4290", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/11e2663a5bc9db5d714eedb4277ee300403b4a9e", + "reference": "11e2663a5bc9db5d714eedb4277ee300403b4a9e", "shasum": "" }, "require": { @@ -3432,9 +3432,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.4" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.15.5" }, - "time": "2023-03-05T19:49:14+00:00" + "time": "2023-05-19T20:20:00+00:00" }, { "name": "phar-io/manifest", @@ -3785,22 +3785,23 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "1.20.3", + "version": "1.21.3", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "6c04009f6cae6eda2f040745b6b846080ef069c2" + "reference": "b0c366dd2cea79407d635839d25423ba07c55dd6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/6c04009f6cae6eda2f040745b6b846080ef069c2", - "reference": "6c04009f6cae6eda2f040745b6b846080ef069c2", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/b0c366dd2cea79407d635839d25423ba07c55dd6", + "reference": "b0c366dd2cea79407d635839d25423ba07c55dd6", "shasum": "" }, "require": { "php": "^7.2 || ^8.0" }, "require-dev": { + "nikic/php-parser": "^4.15", "php-parallel-lint/php-parallel-lint": "^1.2", "phpstan/extension-installer": "^1.0", "phpstan/phpstan": "^1.5", @@ -3824,9 +3825,9 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.20.3" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.21.3" }, - "time": "2023-04-25T09:01:03+00:00" + "time": "2023-05-29T19:31:28+00:00" }, { "name": "phpunit/php-code-coverage", diff --git a/src/Appwrite/Migration/Migration.php b/src/Appwrite/Migration/Migration.php index 397d41efdd..dd57e3e81d 100644 --- a/src/Appwrite/Migration/Migration.php +++ b/src/Appwrite/Migration/Migration.php @@ -60,6 +60,7 @@ abstract class Migration '1.3.2' => 'V18', '1.3.3' => 'V18', '1.3.4' => 'V18', + '1.3.5' => 'V18', ]; /** From 927c7c3359be984f5a210029a3429e9dc2528ed0 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Tue, 30 May 2023 16:16:43 +0000 Subject: [PATCH 09/10] feat: update composer --- composer.lock | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/composer.lock b/composer.lock index c0a9e17f18..3531381c10 100644 --- a/composer.lock +++ b/composer.lock @@ -522,9 +522,6 @@ "bamarni-bin": { "bin-links": true, "forward-command": false - }, - "branch-alias": { - "dev-master": "7.5-dev" } }, "autoload": { @@ -4550,16 +4547,16 @@ }, { "name": "sebastian/diff", - "version": "4.0.4", + "version": "4.0.5", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d" + "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3461e3fccc7cfdfc2720be910d3bd73c69be590d", - "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/74be17022044ebaaecfdf0c5cd504fc9cd5a7131", + "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131", "shasum": "" }, "require": { @@ -4604,7 +4601,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/4.0.4" + "source": "https://github.com/sebastianbergmann/diff/tree/4.0.5" }, "funding": [ { @@ -4612,7 +4609,7 @@ "type": "github" } ], - "time": "2020-10-26T13:10:38+00:00" + "time": "2023-05-07T05:35:17+00:00" }, { "name": "sebastian/environment", @@ -5579,16 +5576,16 @@ }, { "name": "twig/twig", - "version": "v3.5.1", + "version": "v3.6.0", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "a6e0510cc793912b451fd40ab983a1d28f611c15" + "reference": "106c170d08e8415d78be2d16c3d057d0d108262b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/a6e0510cc793912b451fd40ab983a1d28f611c15", - "reference": "a6e0510cc793912b451fd40ab983a1d28f611c15", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/106c170d08e8415d78be2d16c3d057d0d108262b", + "reference": "106c170d08e8415d78be2d16c3d057d0d108262b", "shasum": "" }, "require": { @@ -5597,15 +5594,10 @@ "symfony/polyfill-mbstring": "^1.3" }, "require-dev": { - "psr/container": "^1.0", + "psr/container": "^1.0|^2.0", "symfony/phpunit-bridge": "^4.4.9|^5.0.9|^6.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.5-dev" - } - }, "autoload": { "psr-4": { "Twig\\": "src/" @@ -5639,7 +5631,7 @@ ], "support": { "issues": "https://github.com/twigphp/Twig/issues", - "source": "https://github.com/twigphp/Twig/tree/v3.5.1" + "source": "https://github.com/twigphp/Twig/tree/v3.6.0" }, "funding": [ { @@ -5651,7 +5643,7 @@ "type": "tidelift" } ], - "time": "2023-02-08T07:49:20+00:00" + "time": "2023-05-03T19:06:57+00:00" } ], "aliases": [], From 9e1313d15ae0a61f5258ac35e474fbbf406044f9 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Tue, 30 May 2023 16:59:13 +0000 Subject: [PATCH 10/10] feat: update dependencies --- composer.lock | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/composer.lock b/composer.lock index f5e4a402a9..c53fcd972f 100644 --- a/composer.lock +++ b/composer.lock @@ -481,16 +481,16 @@ }, { "name": "guzzlehttp/guzzle", - "version": "7.6.1", + "version": "7.7.0", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "8444a2bacf1960bc6a2b62ed86b8e72e11eebe51" + "reference": "fb7566caccf22d74d1ab270de3551f72a58399f5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/8444a2bacf1960bc6a2b62ed86b8e72e11eebe51", - "reference": "8444a2bacf1960bc6a2b62ed86b8e72e11eebe51", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/fb7566caccf22d74d1ab270de3551f72a58399f5", + "reference": "fb7566caccf22d74d1ab270de3551f72a58399f5", "shasum": "" }, "require": { @@ -587,7 +587,7 @@ ], "support": { "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/7.6.1" + "source": "https://github.com/guzzle/guzzle/tree/7.7.0" }, "funding": [ { @@ -603,7 +603,7 @@ "type": "tidelift" } ], - "time": "2023-05-15T20:43:01+00:00" + "time": "2023-05-21T14:04:53+00:00" }, { "name": "guzzlehttp/promises", @@ -3782,16 +3782,16 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "1.20.4", + "version": "1.21.3", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "7d568c87a9df9c5f7e8b5f075fc469aa8cb0a4cd" + "reference": "b0c366dd2cea79407d635839d25423ba07c55dd6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/7d568c87a9df9c5f7e8b5f075fc469aa8cb0a4cd", - "reference": "7d568c87a9df9c5f7e8b5f075fc469aa8cb0a4cd", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/b0c366dd2cea79407d635839d25423ba07c55dd6", + "reference": "b0c366dd2cea79407d635839d25423ba07c55dd6", "shasum": "" }, "require": { @@ -3822,9 +3822,9 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.20.4" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.21.3" }, - "time": "2023-05-02T09:19:37+00:00" + "time": "2023-05-29T19:31:28+00:00" }, { "name": "phpunit/php-code-coverage",