From 7735b67a3faea8431c13697ea5969e842d4d4e5e Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Sun, 6 Feb 2022 15:19:33 +0400 Subject: [PATCH] feat: fix tests --- app/workers/functions.php | 6 +++--- tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/workers/functions.php b/app/workers/functions.php index 52c3df4fb1..f1970b1962 100644 --- a/app/workers/functions.php +++ b/app/workers/functions.php @@ -334,16 +334,16 @@ class FunctionsV1 extends Worker ->setParam('projectId', $projectId) ->setParam('userId', $userId) ->setParam('webhooks', $webhooks) - ->setParam('event', 'functions.executions.update') + ->setParam('event', $event) ->setParam('eventData', $execution->getArrayCopy(array_keys($executionModel->getRules()))); $executionUpdate->trigger(); /** Trigger realtime event */ - $target = Realtime::fromPayload('functions.executions.update', $execution); + $target = Realtime::fromPayload($event, $execution); Realtime::send( projectId: $projectId, payload: $execution->getArrayCopy(), - event: 'functions.executions.update', + event: $event, channels: $target['channels'], roles: $target['roles'] ); diff --git a/tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php b/tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php index 4f930ed6b5..94db8cc15a 100644 --- a/tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php +++ b/tests/e2e/Services/Webhooks/WebhooksCustomServerTest.php @@ -476,7 +476,7 @@ class WebhooksCustomServerTest extends Scope $execution = $this->client->call(Client::METHOD_POST, '/functions/'.$data['functionId'].'/executions', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], - ], $this->getHeaders()), ['executionId' => 'unique()',]); + ], $this->getHeaders()), []); $this->assertEquals($execution['headers']['status-code'], 201); $this->assertNotEmpty($execution['body']['$id']);