User test updates for 0.15

This commit is contained in:
Jake Barnby
2022-07-01 12:02:59 +12:00
parent 845e32e5e1
commit bdd65ed448
2 changed files with 27 additions and 26 deletions
+4 -3
View File
@@ -84,7 +84,7 @@ trait GraphQLBase
public static string $UPDATE_USER_NAME = 'update_user_name';
public static string $UPDATE_USER_EMAIL = 'update_user_email';
public static string $UPDATE_USER_EMAIL_VERIFICATION = 'update_email_verification';
public static string $UPDATE_USER_PHONE_VERIFICATION = 'update_email_verification';
public static string $UPDATE_USER_PHONE_VERIFICATION = 'update_phone_verification';
public static string $UPDATE_USER_PASSWORD = 'update_user_password';
public static string $UPDATE_USER_PHONE = 'update_user_phone';
public static string $UPDATE_USER_PREFS = 'update_user_prefs';
@@ -488,6 +488,7 @@ trait GraphQLBase
case self::$UPDATE_USER_PHONE_VERIFICATION:
return 'mutation updateUserPhoneVerification($userId: String!, $phoneVerification: Boolean!){
usersUpdatePhoneVerification(userId: $userId, phoneVerification: $phoneVerification) {
_id
name
email
}
@@ -725,8 +726,8 @@ trait GraphQLBase
}
}';
case self::$UPDATE_PHONE_VERIFICATION:
return 'mutation confirmPhoneVerification($userId: String!, $secret: String!) {
accountUpdatePhoneVerification(userId: $userId, secret: $secret) {
return 'mutation confirmPhoneVerification($userId: String!, $phoneVerification: Boolean!) {
accountUpdatePhoneVerification(userId: $userId, phoneVerification: $phoneVerification) {
userId
secret
expire
+23 -23
View File
@@ -214,31 +214,31 @@ class GraphQLUsersTest extends Scope
$this->assertIsArray($user['body']['data']);
$this->assertArrayNotHasKey('errors', $user['body']);
$this->assertIsArray($user['body']['data']['usersUpdateVerification']);
$this->assertIsArray($user['body']['data']['usersUpdateEmailVerification']);
}
// public function testUpdateUserPhoneVerification()
// {
// $projectId = $this->getProject()['$id'];
// $query = $this->getQuery(self::$UPDATE_USER_PHONE_VERIFICATION);
// $graphQLPayload = [
// 'query' => $query,
// 'variables' => [
// 'userId' => $this->getUser()['$id'],
// 'phoneVerification' => true,
// ]
// ];
//
// $user = $this->client->call(Client::METHOD_POST, '/graphql', \array_merge([
// 'content-type' => 'application/json',
// 'x-appwrite-project' => $projectId,
// ], $this->getHeaders()), $graphQLPayload);
//
// $this->assertIsArray($user['body']['data']);
// $this->assertArrayNotHasKey('errors', $user['body']);
// $this->assertIsArray($user['body']['data']['usersUpdatePhoneVerification']);
// $this->assertEquals($this->getUser()['$id'], $user['body']['data']['usersUpdatePhoneVerification']['_id']);
// }
public function testUpdateUserPhoneVerification()
{
$projectId = $this->getProject()['$id'];
$query = $this->getQuery(self::$UPDATE_USER_PHONE_VERIFICATION);
$graphQLPayload = [
'query' => $query,
'variables' => [
'userId' => $this->getUser()['$id'],
'phoneVerification' => true,
]
];
$user = $this->client->call(Client::METHOD_POST, '/graphql', \array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $projectId,
], $this->getHeaders()), $graphQLPayload);
$this->assertIsArray($user['body']['data']);
$this->assertArrayNotHasKey('errors', $user['body']);
$this->assertIsArray($user['body']['data']['usersUpdatePhoneVerification']);
$this->assertEquals($this->getUser()['$id'], $user['body']['data']['usersUpdatePhoneVerification']['_id']);
}
public function testUpdateUserName()
{