fix: Make webhook account tests self-sufficient

Update account name before testing to ensure webhook data has
expected 'New Name' value, regardless of test execution order.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Jake Barnby
2026-02-06 20:59:58 +13:00
co-authored by Claude Opus 4.5
parent 8627251ae4
commit ce200d20d4
@@ -493,6 +493,17 @@ class WebhooksCustomClientTest extends Scope
$password = $data['password'];
$session = $data['session'];
// Update name first to make test self-sufficient
// (In parallel execution, testUpdateAccountName may not have run)
$this->client->call(Client::METHOD_PATCH, '/account/name', array_merge([
'origin' => 'http://localhost',
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
'cookie' => 'a_session_' . $this->getProject()['$id'] . '=' . $session,
]), [
'name' => 'New Name'
]);
$account = $this->client->call(Client::METHOD_PATCH, '/account/password', array_merge([
'origin' => 'http://localhost',
'content-type' => 'application/json',
@@ -544,6 +555,17 @@ class WebhooksCustomClientTest extends Scope
$newEmail = uniqid() . 'new@localhost.test';
$session = $data['session'];
// Update name first to make test self-sufficient
// (In parallel execution, testUpdateAccountName may not have run)
$this->client->call(Client::METHOD_PATCH, '/account/name', array_merge([
'origin' => 'http://localhost',
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
'cookie' => 'a_session_' . $this->getProject()['$id'] . '=' . $session,
]), [
'name' => 'New Name'
]);
$account = $this->client->call(Client::METHOD_PATCH, '/account/email', array_merge([
'origin' => 'http://localhost',
'content-type' => 'application/json',
@@ -593,6 +615,17 @@ class WebhooksCustomClientTest extends Scope
$email = $data['email'];
$session = $data['session'];
// Update name first to make test self-sufficient
// (In parallel execution, testUpdateAccountName may not have run)
$this->client->call(Client::METHOD_PATCH, '/account/name', array_merge([
'origin' => 'http://localhost',
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
'cookie' => 'a_session_' . $this->getProject()['$id'] . '=' . $session,
]), [
'name' => 'New Name'
]);
$account = $this->client->call(Client::METHOD_PATCH, '/account/prefs', array_merge([
'origin' => 'http://localhost',
'content-type' => 'application/json',