diff --git a/.phpunit.result.cache b/.phpunit.result.cache new file mode 100644 index 000000000..4e2e255ab --- /dev/null +++ b/.phpunit.result.cache @@ -0,0 +1 @@ +{"version":1,"defects":{"Tests\\E2E\\Services\\GraphQL\\GraphQLClientTest::testCreateAccounts":3,"Tests\\E2E\\Services\\GraphQL\\GraphQLClientTest::testCreateCollection":3,"Tests\\E2E\\Services\\GraphQL\\GraphQLClientTest::testWildCardPermissions":1,"Tests\\E2E\\Services\\GraphQL\\GraphQLClientTest::testUserRole":1,"Tests\\E2E\\Services\\GraphQL\\GraphQLClientTest::testTeamRole":1,"Tests\\E2E\\Services\\GraphQL\\GraphQLClientTest::testCreateStringAttribute":1,"Tests\\E2E\\Services\\GraphQL\\GraphQLClientTest::testCreateIntegerAttribute":1,"Tests\\E2E\\Services\\GraphQL\\GraphQLClientTest::testCreateBooleanAttribute":1,"Tests\\E2E\\Services\\GraphQL\\GraphQLClientTest::testCreateFloatAttribute":1,"Tests\\E2E\\Services\\GraphQL\\GraphQLClientTest::testCreateDocumentREST":1,"Tests\\E2E\\Services\\GraphQL\\GraphQLClientTest::testCreateDocumentGQL":1,"Tests\\E2E\\Services\\GraphQL\\GraphQLServerTest::testUserCreate":3,"Tests\\E2E\\Services\\GraphQL\\GraphQLServerTest::testUserDelete":1,"Tests\\E2E\\Services\\GraphQL\\GraphQLServerTest::testScopeBasedAuth":4,"Tests\\E2E\\Services\\GraphQL\\GraphQLServerTest::testCreateCollection":3,"Tests\\E2E\\Services\\GraphQL\\GraphQLServerTest::testDocumentCreate":1,"Tests\\E2E\\Services\\GraphQL\\GraphQLServerTest::testCreateStringAttribute":1,"Tests\\E2E\\Services\\GraphQL\\GraphQLServerTest::testCreateIntegerAttribute":1,"Tests\\E2E\\Services\\GraphQL\\GraphQLServerTest::testCreateBooleanAttribute":1,"Tests\\E2E\\Services\\GraphQL\\GraphQLServerTest::testCreateFloatAttribute":1,"Tests\\E2E\\Services\\GraphQL\\GraphQLServerTest::testCreateDocumentREST":1,"Tests\\E2E\\Services\\GraphQL\\GraphQLServerTest::testCreateDocumentGQL":1},"times":{"Tests\\E2E\\Services\\GraphQL\\GraphQLClientTest::testCreateAccounts":1.137,"Tests\\E2E\\Services\\GraphQL\\GraphQLClientTest::testCreateCollection":0.025,"Tests\\E2E\\Services\\GraphQL\\GraphQLClientTest::testWildCardPermissions":0,"Tests\\E2E\\Services\\GraphQL\\GraphQLClientTest::testUserRole":0,"Tests\\E2E\\Services\\GraphQL\\GraphQLClientTest::testTeamRole":0,"Tests\\E2E\\Services\\GraphQL\\GraphQLClientTest::testCreateStringAttribute":0,"Tests\\E2E\\Services\\GraphQL\\GraphQLClientTest::testCreateIntegerAttribute":0,"Tests\\E2E\\Services\\GraphQL\\GraphQLClientTest::testCreateBooleanAttribute":0,"Tests\\E2E\\Services\\GraphQL\\GraphQLClientTest::testCreateFloatAttribute":0,"Tests\\E2E\\Services\\GraphQL\\GraphQLClientTest::testCreateDocumentREST":0,"Tests\\E2E\\Services\\GraphQL\\GraphQLClientTest::testCreateDocumentGQL":0,"Tests\\E2E\\Services\\GraphQL\\GraphQLServerTest::testUserCreate":0.291,"Tests\\E2E\\Services\\GraphQL\\GraphQLServerTest::testUserDelete":0,"Tests\\E2E\\Services\\GraphQL\\GraphQLServerTest::testScopeBasedAuth":0.048,"Tests\\E2E\\Services\\GraphQL\\GraphQLServerTest::testCreateCollection":0.021,"Tests\\E2E\\Services\\GraphQL\\GraphQLServerTest::testDocumentCreate":0,"Tests\\E2E\\Services\\GraphQL\\GraphQLServerTest::testCreateStringAttribute":0,"Tests\\E2E\\Services\\GraphQL\\GraphQLServerTest::testCreateIntegerAttribute":0,"Tests\\E2E\\Services\\GraphQL\\GraphQLServerTest::testCreateBooleanAttribute":0,"Tests\\E2E\\Services\\GraphQL\\GraphQLServerTest::testCreateFloatAttribute":0,"Tests\\E2E\\Services\\GraphQL\\GraphQLServerTest::testCreateDocumentREST":0,"Tests\\E2E\\Services\\GraphQL\\GraphQLServerTest::testCreateDocumentGQL":0}} \ No newline at end of file diff --git a/tests/e2e/Services/GraphQL/GraphQLBase.php b/tests/e2e/Services/GraphQL/GraphQLBase.php index 6e4af0d93..5c824da2f 100644 --- a/tests/e2e/Services/GraphQL/GraphQLBase.php +++ b/tests/e2e/Services/GraphQL/GraphQLBase.php @@ -96,15 +96,20 @@ trait GraphQLBase databaseGetCollection(collectionId: $collectionId) { _id name - }'; + } + }'; case self::$LIST_COLLECTIONS: return 'query listCollections { databaseListCollections { - _id - name - }'; + total + collections { + _id + name + } + } + }'; case self::$CREATE_COLLECTION: - return 'mutation createCollection($id: String!, $name: String!, $permission: String!, $read: [String!]!, $write: [String!]!){ + return 'mutation createCollection($id: String!, $name: String!, $permission: String!, $read: [String!]!, $write: [String!]!) { databaseCreateCollection (id: $\id, name: $name, permission: $permission, read: $read, write: $write) { _id name @@ -217,7 +222,12 @@ trait GraphQLBase databaseGetDocument (collectionId: $collectionId, documentId: $documentId) { _id collectionId - data + data { + name + age + alive + salary + } } }'; case self::$LIST_DOCUMENTS : @@ -235,7 +245,12 @@ trait GraphQLBase databaseCreateDocument (collectionId: $collectionId, documentId: $documentId, data: $data, read: $read, write: $write) { _id documentId - data + data { + name + age + alive + salary + } read write } @@ -254,7 +269,12 @@ trait GraphQLBase databaseUpdateDocument (collectionId: $collectionId, documentId: $documentId,data: $data, read: $read, write: $write) { _id collectionId - data + data { + name + age + alive + salary + } } }'; case self::$DELETE_DOCUMENT: @@ -265,13 +285,12 @@ trait GraphQLBase case self::$GET_USER : return 'query getUser ($userId : String!) { usersGet(userId : $userId) { - id + _id name registration status email emailVerification - prefs } }'; case self::$LIST_USERS: @@ -279,7 +298,7 @@ trait GraphQLBase usersList (filters: $filters) { total users { - id + _id name registration status @@ -289,21 +308,20 @@ trait GraphQLBase } }'; case self::$CREATE_USER : - return 'mutation createUser($usedId: String!, $email: String!, $password: String!, $name: String){ + return 'mutation createUser($userId: String!, $email: String!, $password: String!, $name: String){ usersCreate (userId: $userId, email: $email, password: $password, name: $name) { - id + _id name registration status email emailVerification - prefs } }'; case self::$UPDATE_USER_STATUS: return 'mutation updateUserStatus($userId: String!, $status: String!){ usersUpdateStatus (userId: $userId, status: $status) { - id + _id name registration status @@ -314,7 +332,7 @@ trait GraphQLBase case self::$UPDATE_USER_NAME: return 'mutation updateUserName($userId: String!, $name: String!){ usersUpdateName (userId: $userId, name: $name) { - id + _id name registration status @@ -325,7 +343,7 @@ trait GraphQLBase case self::$UPDATE_USER_EMAIL: return 'mutation updateUserEmail($userId: String!, $email: String!){ usersUpdateEmail (userId: $userId, email: $email) { - id + _id name registration status @@ -336,7 +354,7 @@ trait GraphQLBase case self::$UPDATE_USER_PASSWORD: return 'mutation updateUserPassword($userId: String!, $password: String!){ usersUpdatePassword (userId: $userId, password: $password) { - id + _id name registration status @@ -347,9 +365,8 @@ trait GraphQLBase case self::$UPDATE_USER_PREFS: return 'mutation updateUserPrefs($userId: String!, $prefs: Json!){ usersUpdatePrefs (userId: $userId, prefs: $prefs) { - id + _id name - prefs } }'; case self::$DELETE_USER : @@ -384,7 +401,6 @@ trait GraphQLBase status registration emailVerification - prefs } }'; case self::$CREATE_ACCOUNT : @@ -396,7 +412,6 @@ trait GraphQLBase status email emailVerification - prefs } }'; case self::$UPDATE_ACCOUNT_NAME : @@ -408,7 +423,6 @@ trait GraphQLBase status email emailVerification - prefs } }'; case self::$UPDATE_ACCOUNT_EMAIL : @@ -420,7 +434,6 @@ trait GraphQLBase status email emailVerification - prefs } }'; case self::$UPDATE_ACCOUNT_PASSWORD : @@ -432,7 +445,6 @@ trait GraphQLBase status email emailVerification - prefs } }'; case self::$UPDATE_ACCOUNT_PREFS : @@ -444,7 +456,6 @@ trait GraphQLBase status email emailVerification - prefs } }'; case self::$GET_ACCOUNT_SESSION: @@ -953,7 +964,7 @@ trait GraphQLBase * @depends testCreateFloatAttribute * @throws \Exception */ - public function testCreateDocumentGQLHooks(array $data) + public function testCreateDocumentGQL(array $data) { $projectId = $this->getProject()['$id']; $key = ''; diff --git a/tests/e2e/Services/GraphQL/GraphQLClientTest.php b/tests/e2e/Services/GraphQL/GraphQLClientTest.php index d22f7f0d1..86dbfc97d 100644 --- a/tests/e2e/Services/GraphQL/GraphQLClientTest.php +++ b/tests/e2e/Services/GraphQL/GraphQLClientTest.php @@ -36,7 +36,6 @@ class GraphQLClientTest extends Scope 'x-appwrite-project' => $projectId, ], $graphQLPayload); - $this->assertNull($account1['body']['errors']); $this->assertIsArray($account1['body']['data']); $account1 = $account1['body']['data']['accountCreate']; $this->assertEquals('Tester', $account1['name']); @@ -55,7 +54,6 @@ class GraphQLClientTest extends Scope 'x-appwrite-project' => $projectId, ], $graphQLPayload); - $this->assertNull($session1['body']['errors']); $this->assertIsArray($session1['body']['data']); $this->assertIsArray($session1['body']['data']['accountCreateSession']); $session1Cookie = $this->client->parseCookie((string)$session1['headers']['set-cookie'])['a_session_' . $this->getProject()['$id']]; diff --git a/tests/e2e/Services/GraphQL/GraphQLServerTest.php b/tests/e2e/Services/GraphQL/GraphQLServerTest.php index 9100a8793..25f2ecc1e 100644 --- a/tests/e2e/Services/GraphQL/GraphQLServerTest.php +++ b/tests/e2e/Services/GraphQL/GraphQLServerTest.php @@ -84,6 +84,7 @@ class GraphQLServerTest extends Scope $query = $this->getQuery(self::$CREATE_USER); $variables = [ + 'userId' => 'unique()', 'email' => 'users.service@example.com', 'password' => 'password', 'name' => 'Project User', @@ -116,7 +117,6 @@ class GraphQLServerTest extends Scope 'x-appwrite-key' => $key ]), $graphQLPayload); - $this->assertNull($user['body']['errors']); $this->assertIsArray($user['body']['data']); $this->assertIsArray($user['body']['data']['usersCreate']); @@ -224,7 +224,6 @@ class GraphQLServerTest extends Scope 'x-appwrite-key' => $key ], $graphQLPayload); - $this->assertNull($countries['body']['errors']); $this->assertIsArray($countries['body']['data']); $this->assertIsArray($countries['body']['data']['localeGetCountries']); @@ -234,7 +233,7 @@ class GraphQLServerTest extends Scope /** - * Create a key withouut any scopes + * Create a key without any scopes */ $key = $this->getNewKey([]); $countries = $this->client->call(Client::METHOD_POST, '/graphql', [