From ae5267cda75a480bc5778e2cc140f2dd4d38fe13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Mon, 17 Mar 2025 16:02:16 +0100 Subject: [PATCH 1/2] Fix response model for adapters (frameworks) --- .../Platform/Modules/Sites/Http/Frameworks/XList.php | 6 ++++++ tests/e2e/Services/Sites/SitesCustomClientTest.php | 1 + tests/e2e/Services/Sites/SitesCustomServerTest.php | 5 +++++ 3 files changed, 12 insertions(+) diff --git a/src/Appwrite/Platform/Modules/Sites/Http/Frameworks/XList.php b/src/Appwrite/Platform/Modules/Sites/Http/Frameworks/XList.php index 8eb74a284a..b96390fae8 100644 --- a/src/Appwrite/Platform/Modules/Sites/Http/Frameworks/XList.php +++ b/src/Appwrite/Platform/Modules/Sites/Http/Frameworks/XList.php @@ -52,6 +52,12 @@ class XList extends Base { $frameworks = Config::getParam('frameworks'); + foreach ($frameworks as $key => $framework) { + if (!empty($framework['adapters'])) { + $frameworks[$key]['adapters'] = \array_values($framework['adapters']); + } + } + $response->dynamic(new Document([ 'total' => count($frameworks), 'frameworks' => \array_values($frameworks) diff --git a/tests/e2e/Services/Sites/SitesCustomClientTest.php b/tests/e2e/Services/Sites/SitesCustomClientTest.php index 76d8a666d4..f43518bb47 100644 --- a/tests/e2e/Services/Sites/SitesCustomClientTest.php +++ b/tests/e2e/Services/Sites/SitesCustomClientTest.php @@ -37,6 +37,7 @@ class SitesCustomClientTest extends Scope $this->assertArrayHasKey('variables', $template); $this->assertArrayHasKey('screenshotDark', $template); $this->assertArrayHasKey('screenshotLight', $template); + $this->assertArrayHasKey('ada', $template); } // List templates with pagination diff --git a/tests/e2e/Services/Sites/SitesCustomServerTest.php b/tests/e2e/Services/Sites/SitesCustomServerTest.php index 6ecb35d5a9..d9c2f31636 100644 --- a/tests/e2e/Services/Sites/SitesCustomServerTest.php +++ b/tests/e2e/Services/Sites/SitesCustomServerTest.php @@ -1364,6 +1364,11 @@ class SitesCustomServerTest extends Scope $this->assertArrayHasKey('buildRuntime', $framework); $this->assertArrayHasKey('runtimes', $framework); $this->assertArrayHasKey('adapters', $framework); + $this->assertIsArray($framework['adapters']); + $this->assertArrayHasKey('key', $framework['adapters'][0]); + $this->assertArrayHasKey('installCommand', $framework['adapters'][0]); + $this->assertArrayHasKey('buildCommand', $framework['adapters'][0]); + $this->assertArrayHasKey('outputDirectory', $framework['adapters'][0]); } public function testSiteStatic(): void From 23b245e05850c18a6d018366e0e60b0809007ad7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Mon, 17 Mar 2025 16:03:52 +0100 Subject: [PATCH 2/2] Leftover --- tests/e2e/Services/Sites/SitesCustomClientTest.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/e2e/Services/Sites/SitesCustomClientTest.php b/tests/e2e/Services/Sites/SitesCustomClientTest.php index f43518bb47..76d8a666d4 100644 --- a/tests/e2e/Services/Sites/SitesCustomClientTest.php +++ b/tests/e2e/Services/Sites/SitesCustomClientTest.php @@ -37,7 +37,6 @@ class SitesCustomClientTest extends Scope $this->assertArrayHasKey('variables', $template); $this->assertArrayHasKey('screenshotDark', $template); $this->assertArrayHasKey('screenshotLight', $template); - $this->assertArrayHasKey('ada', $template); } // List templates with pagination