2022-07-04 16:14:37 +12:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Tests\E2E\Services\GraphQL;
|
|
|
|
|
2022-07-06 20:56:58 +12:00
|
|
|
use CURLFile;
|
2022-07-04 16:14:37 +12:00
|
|
|
use Tests\E2E\Client;
|
|
|
|
use Tests\E2E\Scopes\ProjectCustom;
|
|
|
|
use Tests\E2E\Scopes\Scope;
|
|
|
|
use Tests\E2E\Scopes\SideServer;
|
2023-01-16 22:25:40 +13:00
|
|
|
use Utopia\Database\Helpers\ID;
|
|
|
|
use Utopia\Database\Helpers\Role;
|
2022-07-04 16:14:37 +12:00
|
|
|
|
2022-09-22 20:29:42 +12:00
|
|
|
class FunctionsServerTest extends Scope
|
2022-07-04 16:14:37 +12:00
|
|
|
{
|
|
|
|
use ProjectCustom;
|
|
|
|
use SideServer;
|
2022-09-22 20:29:42 +12:00
|
|
|
use Base;
|
2022-07-04 16:14:37 +12:00
|
|
|
|
|
|
|
public function testCreateFunction(): array
|
|
|
|
{
|
|
|
|
$projectId = $this->getProject()['$id'];
|
|
|
|
$query = $this->getQuery(self::$CREATE_FUNCTION);
|
|
|
|
$gqlPayload = [
|
|
|
|
'query' => $query,
|
|
|
|
'variables' => [
|
2022-09-22 13:53:41 +12:00
|
|
|
'functionId' => ID::unique(),
|
2022-07-04 16:14:37 +12:00
|
|
|
'name' => 'Test Function',
|
2022-09-22 14:16:13 +12:00
|
|
|
'runtime' => 'php-8.0',
|
|
|
|
'execute' => [Role::any()->toString()],
|
2023-08-24 08:23:52 +12:00
|
|
|
]
|
2022-07-04 16:14:37 +12:00
|
|
|
];
|
|
|
|
|
|
|
|
$function = $this->client->call(Client::METHOD_POST, '/graphql', \array_merge([
|
|
|
|
'content-type' => 'application/json',
|
|
|
|
'x-appwrite-project' => $projectId,
|
|
|
|
], $this->getHeaders()), $gqlPayload);
|
|
|
|
|
|
|
|
$this->assertIsArray($function['body']['data']);
|
|
|
|
$this->assertArrayNotHasKey('errors', $function['body']);
|
2022-09-22 14:16:13 +12:00
|
|
|
|
2022-07-04 16:14:37 +12:00
|
|
|
$function = $function['body']['data']['functionsCreate'];
|
2022-12-08 16:08:57 +13:00
|
|
|
$functionId = $function['_id'];
|
2022-09-22 14:16:13 +12:00
|
|
|
|
|
|
|
$query = '
|
|
|
|
mutation createVariables($functionId: String!) {
|
|
|
|
var1: functionsCreateVariable(functionId: $functionId, key: "name", value: "John Doe") {
|
2022-12-08 16:08:57 +13:00
|
|
|
_id
|
2022-09-22 14:16:13 +12:00
|
|
|
}
|
|
|
|
var2: functionsCreateVariable(functionId: $functionId, key: "age", value: "42") {
|
2022-12-08 16:08:57 +13:00
|
|
|
_id
|
2022-09-22 14:16:13 +12:00
|
|
|
}
|
|
|
|
}
|
|
|
|
';
|
|
|
|
$gqlPayload = [
|
|
|
|
'query' => $query,
|
|
|
|
'variables' => [
|
|
|
|
'functionId' => $functionId,
|
2023-08-24 08:23:52 +12:00
|
|
|
]
|
2022-09-22 14:16:13 +12:00
|
|
|
];
|
|
|
|
|
|
|
|
$variables = $this->client->call(Client::METHOD_POST, '/graphql', [
|
|
|
|
'content-type' => 'application/json',
|
|
|
|
'x-appwrite-project' => $projectId,
|
|
|
|
'x-appwrite-key' => $this->getProject()['apiKey'],
|
|
|
|
], $gqlPayload);
|
|
|
|
|
|
|
|
$this->assertIsArray($variables['body']['data']);
|
|
|
|
$this->assertArrayNotHasKey('errors', $variables['body']);
|
2022-07-04 16:14:37 +12:00
|
|
|
|
|
|
|
return $function;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @depends testCreateFunction
|
|
|
|
* @param $function
|
|
|
|
* @return array
|
|
|
|
* @throws \Exception
|
|
|
|
*/
|
|
|
|
public function testCreateDeployment($function): array
|
|
|
|
{
|
|
|
|
$projectId = $this->getProject()['$id'];
|
|
|
|
$query = $this->getQuery(self::$CREATE_DEPLOYMENT);
|
2023-08-24 08:23:52 +12:00
|
|
|
$code = realpath(__DIR__ . '/../../../resources/functions') . "/php/code.tar.gz";
|
2022-07-04 16:14:37 +12:00
|
|
|
$gqlPayload = [
|
2022-07-07 17:50:49 +12:00
|
|
|
'operations' => \json_encode([
|
|
|
|
'query' => $query,
|
|
|
|
'variables' => [
|
2022-12-08 16:08:57 +13:00
|
|
|
'functionId' => $function['_id'],
|
2022-09-22 14:16:13 +12:00
|
|
|
'entrypoint' => 'index.php',
|
2022-07-07 17:50:49 +12:00
|
|
|
'activate' => true,
|
|
|
|
'code' => null,
|
2023-08-24 08:23:52 +12:00
|
|
|
]
|
2022-07-07 17:50:49 +12:00
|
|
|
]),
|
|
|
|
'map' => \json_encode([
|
2023-08-24 08:23:52 +12:00
|
|
|
'code' => ["variables.code"]
|
2022-07-07 17:50:49 +12:00
|
|
|
]),
|
|
|
|
'code' => new CURLFile($code, 'application/gzip', 'code.tar.gz'),
|
2022-07-04 16:14:37 +12:00
|
|
|
];
|
|
|
|
|
|
|
|
$deployment = $this->client->call(Client::METHOD_POST, '/graphql', \array_merge([
|
2022-07-07 17:50:49 +12:00
|
|
|
'content-type' => 'multipart/form-data',
|
2022-07-04 16:14:37 +12:00
|
|
|
'x-appwrite-project' => $projectId,
|
|
|
|
], $this->getHeaders()), $gqlPayload);
|
|
|
|
|
|
|
|
$this->assertIsArray($deployment['body']['data']);
|
|
|
|
$this->assertArrayNotHasKey('errors', $deployment['body']);
|
|
|
|
|
2022-07-18 22:35:34 +12:00
|
|
|
sleep(15);
|
2022-07-07 17:50:49 +12:00
|
|
|
|
|
|
|
return $deployment['body']['data']['functionsCreateDeployment'];
|
2022-07-04 16:14:37 +12:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* * @depends testCreateFunction
|
|
|
|
* @depends testCreateDeployment
|
|
|
|
* @param $function
|
|
|
|
* @return array
|
|
|
|
* @throws \Exception
|
|
|
|
*/
|
2022-07-07 17:50:49 +12:00
|
|
|
public function testCreateExecution($function): array
|
2022-07-04 16:14:37 +12:00
|
|
|
{
|
|
|
|
$projectId = $this->getProject()['$id'];
|
|
|
|
$query = $this->getQuery(self::$CREATE_EXECUTION);
|
|
|
|
$gqlPayload = [
|
|
|
|
'query' => $query,
|
|
|
|
'variables' => [
|
2022-12-08 16:08:57 +13:00
|
|
|
'functionId' => $function['_id'],
|
2023-08-24 08:23:52 +12:00
|
|
|
]
|
2022-07-04 16:14:37 +12:00
|
|
|
];
|
|
|
|
|
|
|
|
$execution = $this->client->call(Client::METHOD_POST, '/graphql', \array_merge([
|
|
|
|
'content-type' => 'application/json',
|
|
|
|
'x-appwrite-project' => $projectId,
|
|
|
|
], $this->getHeaders()), $gqlPayload);
|
|
|
|
|
|
|
|
$this->assertIsArray($execution['body']['data']);
|
|
|
|
$this->assertArrayNotHasKey('errors', $execution['body']);
|
|
|
|
|
2022-07-07 17:50:49 +12:00
|
|
|
return $execution['body']['data']['functionsCreateExecution'];
|
2022-07-04 16:14:37 +12:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @depends testCreateFunction
|
2022-07-07 17:50:49 +12:00
|
|
|
* @depends testGetDeployment
|
2022-07-04 16:14:37 +12:00
|
|
|
* @param $function
|
|
|
|
* @param $deployment
|
|
|
|
* @return array
|
|
|
|
* @throws \Exception
|
|
|
|
*/
|
2022-07-07 17:51:20 +12:00
|
|
|
public function testCreateRetryBuild($function, $deployment): void
|
2022-07-04 16:14:37 +12:00
|
|
|
{
|
|
|
|
$projectId = $this->getProject()['$id'];
|
2022-07-04 18:16:06 +12:00
|
|
|
$query = $this->getQuery(self::$RETRY_BUILD);
|
2022-07-04 16:14:37 +12:00
|
|
|
$gqlPayload = [
|
|
|
|
'query' => $query,
|
|
|
|
'variables' => [
|
2022-12-08 16:08:57 +13:00
|
|
|
'functionId' => $function['_id'],
|
|
|
|
'deploymentId' => $deployment['_id'],
|
2022-07-07 17:50:49 +12:00
|
|
|
'buildId' => $deployment['buildId'],
|
2023-08-24 08:23:52 +12:00
|
|
|
]
|
2022-07-04 16:14:37 +12:00
|
|
|
];
|
|
|
|
|
|
|
|
$retryBuild = $this->client->call(Client::METHOD_POST, '/graphql', \array_merge([
|
|
|
|
'content-type' => 'application/json',
|
|
|
|
'x-appwrite-project' => $projectId,
|
|
|
|
], $this->getHeaders()), $gqlPayload);
|
|
|
|
|
2022-07-07 17:51:20 +12:00
|
|
|
$this->assertIsArray($retryBuild['body']['errors']);
|
2023-08-24 08:23:52 +12:00
|
|
|
$this->assertEquals("Build not failed", $retryBuild['body']['errors'][0]['message']);
|
2022-07-04 16:14:37 +12:00
|
|
|
}
|
|
|
|
|
|
|
|
public function testGetFunctions(): array
|
|
|
|
{
|
|
|
|
$projectId = $this->getProject()['$id'];
|
|
|
|
$query = $this->getQuery(self::$GET_FUNCTIONS);
|
|
|
|
$gqlPayload = [
|
|
|
|
'query' => $query,
|
|
|
|
];
|
|
|
|
|
|
|
|
$functions = $this->client->call(Client::METHOD_POST, '/graphql', \array_merge([
|
|
|
|
'content-type' => 'application/json',
|
|
|
|
'x-appwrite-project' => $projectId,
|
|
|
|
], $this->getHeaders()), $gqlPayload);
|
|
|
|
|
|
|
|
$this->assertIsArray($functions['body']['data']);
|
|
|
|
$this->assertArrayNotHasKey('errors', $functions['body']);
|
|
|
|
$functions = $functions['body']['data']['functionsList'];
|
|
|
|
$this->assertIsArray($functions);
|
|
|
|
|
|
|
|
return $functions;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @depends testCreateFunction
|
|
|
|
* @param $function
|
|
|
|
* @return array
|
|
|
|
* @throws \Exception
|
|
|
|
*/
|
|
|
|
public function testGetFunction($function): array
|
|
|
|
{
|
|
|
|
$projectId = $this->getProject()['$id'];
|
|
|
|
$query = $this->getQuery(self::$GET_FUNCTION);
|
|
|
|
$gqlPayload = [
|
|
|
|
'query' => $query,
|
|
|
|
'variables' => [
|
2022-12-08 16:08:57 +13:00
|
|
|
'functionId' => $function['_id'],
|
2023-08-24 08:23:52 +12:00
|
|
|
]
|
2022-07-04 16:14:37 +12:00
|
|
|
];
|
|
|
|
|
|
|
|
$function = $this->client->call(Client::METHOD_POST, '/graphql', \array_merge([
|
|
|
|
'content-type' => 'application/json',
|
|
|
|
'x-appwrite-project' => $projectId,
|
|
|
|
], $this->getHeaders()), $gqlPayload);
|
|
|
|
|
|
|
|
$this->assertIsArray($function['body']['data']);
|
|
|
|
$this->assertArrayNotHasKey('errors', $function['body']);
|
|
|
|
$function = $function['body']['data']['functionsGet'];
|
|
|
|
$this->assertIsArray($function);
|
|
|
|
|
|
|
|
return $function;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testGetRuntimes(): array
|
|
|
|
{
|
|
|
|
$projectId = $this->getProject()['$id'];
|
|
|
|
$query = $this->getQuery(self::$GET_RUNTIMES);
|
|
|
|
$gqlPayload = [
|
|
|
|
'query' => $query,
|
|
|
|
];
|
|
|
|
|
|
|
|
$runtimes = $this->client->call(Client::METHOD_POST, '/graphql', \array_merge([
|
|
|
|
'content-type' => 'application/json',
|
|
|
|
'x-appwrite-project' => $projectId,
|
|
|
|
], $this->getHeaders()), $gqlPayload);
|
|
|
|
|
|
|
|
$this->assertIsArray($runtimes['body']['data']);
|
|
|
|
$this->assertArrayNotHasKey('errors', $runtimes['body']);
|
|
|
|
$runtimes = $runtimes['body']['data']['functionsListRuntimes'];
|
|
|
|
$this->assertIsArray($runtimes);
|
|
|
|
|
|
|
|
return $runtimes;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @depends testCreateFunction
|
|
|
|
* @param $function
|
|
|
|
* @return array
|
|
|
|
* @throws \Exception
|
|
|
|
*/
|
|
|
|
public function testGetDeployments($function)
|
|
|
|
{
|
|
|
|
$projectId = $this->getProject()['$id'];
|
|
|
|
$query = $this->getQuery(self::$GET_DEPLOYMENTS);
|
|
|
|
$gqlPayload = [
|
|
|
|
'query' => $query,
|
|
|
|
'variables' => [
|
2022-12-08 16:08:57 +13:00
|
|
|
'functionId' => $function['_id'],
|
2023-08-24 08:23:52 +12:00
|
|
|
]
|
2022-07-04 16:14:37 +12:00
|
|
|
];
|
|
|
|
|
|
|
|
$deployments = $this->client->call(Client::METHOD_POST, '/graphql', \array_merge([
|
|
|
|
'content-type' => 'application/json',
|
|
|
|
'x-appwrite-project' => $projectId,
|
|
|
|
], $this->getHeaders()), $gqlPayload);
|
|
|
|
|
|
|
|
$this->assertIsArray($deployments['body']['data']);
|
|
|
|
$this->assertArrayNotHasKey('errors', $deployments['body']);
|
|
|
|
$deployments = $deployments['body']['data']['functionsListDeployments'];
|
|
|
|
$this->assertIsArray($deployments);
|
|
|
|
|
|
|
|
return $deployments;
|
|
|
|
}
|
|
|
|
|
2022-07-07 17:50:49 +12:00
|
|
|
/**
|
|
|
|
* @depends testCreateFunction
|
|
|
|
* @depends testCreateDeployment
|
|
|
|
* @param $function
|
|
|
|
* @return array
|
|
|
|
* @throws \Exception
|
|
|
|
*/
|
|
|
|
public function testGetDeployment($function, $deployment)
|
|
|
|
{
|
|
|
|
$projectId = $this->getProject()['$id'];
|
|
|
|
$query = $this->getQuery(self::$GET_DEPLOYMENT);
|
|
|
|
$gqlPayload = [
|
|
|
|
'query' => $query,
|
|
|
|
'variables' => [
|
2022-12-08 16:08:57 +13:00
|
|
|
'functionId' => $function['_id'],
|
|
|
|
'deploymentId' => $deployment['_id'],
|
2023-08-24 08:23:52 +12:00
|
|
|
]
|
2022-07-07 17:50:49 +12:00
|
|
|
];
|
|
|
|
|
|
|
|
$deployment = $this->client->call(Client::METHOD_POST, '/graphql', \array_merge([
|
|
|
|
'content-type' => 'application/json',
|
|
|
|
'x-appwrite-project' => $projectId,
|
|
|
|
], $this->getHeaders()), $gqlPayload);
|
|
|
|
|
|
|
|
$this->assertIsArray($deployment['body']['data']);
|
|
|
|
$this->assertArrayNotHasKey('errors', $deployment['body']);
|
|
|
|
$deployment = $deployment['body']['data']['functionsGetDeployment'];
|
|
|
|
$this->assertIsArray($deployment);
|
|
|
|
|
|
|
|
return $deployment;
|
|
|
|
}
|
|
|
|
|
2022-07-04 16:14:37 +12:00
|
|
|
/**
|
|
|
|
* @depends testCreateFunction
|
|
|
|
* @param $function
|
|
|
|
* @return array
|
|
|
|
* @throws \Exception
|
|
|
|
*/
|
|
|
|
public function testGetExecutions($function): array
|
|
|
|
{
|
|
|
|
$projectId = $this->getProject()['$id'];
|
|
|
|
$query = $this->getQuery(self::$GET_EXECUTIONS);
|
|
|
|
$gqlPayload = [
|
|
|
|
'query' => $query,
|
|
|
|
'variables' => [
|
2022-12-08 16:08:57 +13:00
|
|
|
'functionId' => $function['_id'],
|
2023-08-24 08:23:52 +12:00
|
|
|
]
|
2022-07-04 16:14:37 +12:00
|
|
|
];
|
|
|
|
|
|
|
|
$executions = $this->client->call(Client::METHOD_POST, '/graphql', \array_merge([
|
|
|
|
'content-type' => 'application/json',
|
|
|
|
'x-appwrite-project' => $projectId,
|
|
|
|
], $this->getHeaders()), $gqlPayload);
|
|
|
|
|
|
|
|
$this->assertIsArray($executions['body']['data']);
|
|
|
|
$this->assertArrayNotHasKey('errors', $executions['body']);
|
|
|
|
$executions = $executions['body']['data']['functionsListExecutions'];
|
|
|
|
$this->assertIsArray($executions);
|
|
|
|
|
|
|
|
return $executions;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @depends testCreateFunction
|
|
|
|
* @depends testCreateExecution
|
|
|
|
* @param $function
|
|
|
|
* @param $execution
|
|
|
|
* @return array
|
|
|
|
* @throws \Exception
|
|
|
|
*/
|
|
|
|
public function testGetExecution($function, $execution): array
|
|
|
|
{
|
|
|
|
$projectId = $this->getProject()['$id'];
|
|
|
|
$query = $this->getQuery(self::$GET_EXECUTION);
|
|
|
|
$gqlPayload = [
|
|
|
|
'query' => $query,
|
|
|
|
'variables' => [
|
2022-12-08 16:08:57 +13:00
|
|
|
'functionId' => $function['_id'],
|
|
|
|
'executionId' => $execution['_id'],
|
2023-08-24 08:23:52 +12:00
|
|
|
]
|
2022-07-04 16:14:37 +12:00
|
|
|
];
|
|
|
|
|
|
|
|
$execution = $this->client->call(Client::METHOD_POST, '/graphql', \array_merge([
|
|
|
|
'content-type' => 'application/json',
|
|
|
|
'x-appwrite-project' => $projectId,
|
|
|
|
], $this->getHeaders()), $gqlPayload);
|
|
|
|
|
|
|
|
$this->assertIsArray($execution['body']['data']);
|
|
|
|
$this->assertArrayNotHasKey('errors', $execution['body']);
|
|
|
|
$execution = $execution['body']['data']['functionsGetExecution'];
|
|
|
|
$this->assertIsArray($execution);
|
|
|
|
|
|
|
|
return $execution;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @depends testCreateFunction
|
|
|
|
* @param $function
|
|
|
|
* @return array
|
|
|
|
* @throws \Exception
|
|
|
|
*/
|
|
|
|
public function testUpdateFunction($function): array
|
|
|
|
{
|
|
|
|
$projectId = $this->getProject()['$id'];
|
|
|
|
$query = $this->getQuery(self::$UPDATE_FUNCTION);
|
|
|
|
$gqlPayload = [
|
|
|
|
'query' => $query,
|
|
|
|
'variables' => [
|
2022-12-08 16:08:57 +13:00
|
|
|
'functionId' => $function['_id'],
|
2022-07-04 16:14:37 +12:00
|
|
|
'name' => 'Test Function Updated',
|
2022-09-22 14:16:13 +12:00
|
|
|
'execute' => [Role::any()->toString()],
|
2022-07-04 16:14:37 +12:00
|
|
|
'vars' => [
|
|
|
|
'name' => 'John Doe',
|
|
|
|
'age' => 42,
|
|
|
|
],
|
2023-08-24 08:23:52 +12:00
|
|
|
]
|
2022-07-04 16:14:37 +12:00
|
|
|
];
|
|
|
|
|
|
|
|
$function = $this->client->call(Client::METHOD_POST, '/graphql', \array_merge([
|
|
|
|
'content-type' => 'application/json',
|
|
|
|
'x-appwrite-project' => $projectId,
|
|
|
|
], $this->getHeaders()), $gqlPayload);
|
|
|
|
|
|
|
|
$this->assertIsArray($function['body']['data']);
|
|
|
|
$this->assertArrayNotHasKey('errors', $function['body']);
|
|
|
|
$function = $function['body']['data']['functionsUpdate'];
|
|
|
|
$this->assertIsArray($function);
|
|
|
|
|
|
|
|
return $function;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @depends testCreateFunction
|
2022-07-07 17:50:49 +12:00
|
|
|
* @depends testCreateDeployment
|
2022-07-04 16:14:37 +12:00
|
|
|
* @param $function
|
2022-07-07 17:50:49 +12:00
|
|
|
* @param $deployment
|
2022-07-04 16:14:37 +12:00
|
|
|
* @throws \Exception
|
|
|
|
*/
|
2022-07-07 17:50:49 +12:00
|
|
|
public function testDeleteDeployment($function, $deployment): void
|
2022-07-04 16:14:37 +12:00
|
|
|
{
|
|
|
|
$projectId = $this->getProject()['$id'];
|
2022-07-07 17:50:49 +12:00
|
|
|
$query = $this->getQuery(self::$DELETE_DEPLOYMENT);
|
2022-07-04 16:14:37 +12:00
|
|
|
$gqlPayload = [
|
|
|
|
'query' => $query,
|
|
|
|
'variables' => [
|
2022-12-08 16:08:57 +13:00
|
|
|
'functionId' => $function['_id'],
|
|
|
|
'deploymentId' => $deployment['_id'],
|
2023-08-24 08:23:52 +12:00
|
|
|
]
|
2022-07-04 16:14:37 +12:00
|
|
|
];
|
|
|
|
|
|
|
|
$response = $this->client->call(Client::METHOD_POST, '/graphql', \array_merge([
|
|
|
|
'content-type' => 'application/json',
|
|
|
|
'x-appwrite-project' => $projectId,
|
|
|
|
], $this->getHeaders()), $gqlPayload);
|
|
|
|
|
2022-07-18 21:38:13 +12:00
|
|
|
$this->assertIsNotArray($response['body']);
|
2022-07-13 23:21:02 +12:00
|
|
|
$this->assertEquals(204, $response['headers']['status-code']);
|
2022-07-04 16:14:37 +12:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @depends testCreateFunction
|
2022-07-07 17:50:49 +12:00
|
|
|
* @depends testDeleteDeployment
|
2022-07-04 16:14:37 +12:00
|
|
|
* @param $function
|
|
|
|
* @throws \Exception
|
|
|
|
*/
|
2022-07-07 17:50:49 +12:00
|
|
|
public function testDeleteFunction($function): void
|
2022-07-04 16:14:37 +12:00
|
|
|
{
|
|
|
|
$projectId = $this->getProject()['$id'];
|
2022-07-07 17:50:49 +12:00
|
|
|
$query = $this->getQuery(self::$DELETE_FUNCTION);
|
2022-07-04 16:14:37 +12:00
|
|
|
$gqlPayload = [
|
|
|
|
'query' => $query,
|
|
|
|
'variables' => [
|
2022-12-08 16:08:57 +13:00
|
|
|
'functionId' => $function['_id'],
|
2023-08-24 08:23:52 +12:00
|
|
|
]
|
2022-07-04 16:14:37 +12:00
|
|
|
];
|
|
|
|
|
|
|
|
$response = $this->client->call(Client::METHOD_POST, '/graphql', \array_merge([
|
|
|
|
'content-type' => 'application/json',
|
|
|
|
'x-appwrite-project' => $projectId,
|
|
|
|
], $this->getHeaders()), $gqlPayload);
|
|
|
|
|
2022-07-18 21:38:13 +12:00
|
|
|
$this->assertIsNotArray($response['body']);
|
2022-07-13 23:21:02 +12:00
|
|
|
$this->assertEquals(204, $response['headers']['status-code']);
|
2022-07-04 16:14:37 +12:00
|
|
|
}
|
2022-07-06 15:51:37 +12:00
|
|
|
}
|