From 5bd420a823eaac4cb5e30b9c7f343ccbe8016159 Mon Sep 17 00:00:00 2001 From: Jake Barnby Date: Thu, 22 Sep 2022 20:29:42 +1200 Subject: [PATCH] Remove redundant test class prefixes --- .gitattributes | 35 +++-------- .../{GraphQLAbuseTest.php => AbuseTest.php} | 4 +- ...GraphQLAccountTest.php => AccountTest.php} | 4 +- .../{GraphQLAuthTest.php => AuthTest.php} | 5 +- ...GraphQLAvatarsTest.php => AvatarsTest.php} | 4 +- .../GraphQL/{GraphQLBase.php => Base.php} | 6 +- .../{GraphQLBatchTest.php => BatchTest.php} | 2 +- ...ontentTypeTest.php => ContentTypeTest.php} | 4 +- ...eClientTest.php => DatabaseClientTest.php} | 4 +- ...eServerTest.php => DatabaseServerTest.php} | 58 ++++++++++++++++++- ...ClientTest.php => FunctionsClientTest.php} | 4 +- ...ServerTest.php => FunctionsServerTest.php} | 4 +- .../{GraphQLHealthTest.php => HealthTest.php} | 4 +- ...alizationTest.php => LocalizationTest.php} | 4 +- .../{GraphQLScopeTest.php => ScopeTest.php} | 4 +- ...geClientTest.php => StorageClientTest.php} | 4 +- ...geServerTest.php => StorageServerTest.php} | 4 +- ...eamsClientTest.php => TeamsClientTest.php} | 4 +- ...eamsServerTest.php => TeamsServerTest.php} | 4 +- .../{GraphQLUsersTest.php => UsersTest.php} | 4 +- 20 files changed, 100 insertions(+), 66 deletions(-) rename tests/e2e/Services/GraphQL/{GraphQLAbuseTest.php => AbuseTest.php} (97%) rename tests/e2e/Services/GraphQL/{GraphQLAccountTest.php => AccountTest.php} (99%) rename tests/e2e/Services/GraphQL/{GraphQLAuthTest.php => AuthTest.php} (99%) rename tests/e2e/Services/GraphQL/{GraphQLAvatarsTest.php => AvatarsTest.php} (98%) rename tests/e2e/Services/GraphQL/{GraphQLBase.php => Base.php} (99%) rename tests/e2e/Services/GraphQL/{GraphQLBatchTest.php => BatchTest.php} (99%) rename tests/e2e/Services/GraphQL/{GraphQLContentTypeTest.php => ContentTypeTest.php} (99%) rename tests/e2e/Services/GraphQL/{GraphQLDatabaseClientTest.php => DatabaseClientTest.php} (99%) rename tests/e2e/Services/GraphQL/{GraphQLDatabaseServerTest.php => DatabaseServerTest.php} (94%) rename tests/e2e/Services/GraphQL/{GraphQLFunctionsClientTest.php => FunctionsClientTest.php} (98%) rename tests/e2e/Services/GraphQL/{GraphQLFunctionsServerTest.php => FunctionsServerTest.php} (99%) rename tests/e2e/Services/GraphQL/{GraphQLHealthTest.php => HealthTest.php} (99%) rename tests/e2e/Services/GraphQL/{GraphQLLocalizationTest.php => LocalizationTest.php} (98%) rename tests/e2e/Services/GraphQL/{GraphQLScopeTest.php => ScopeTest.php} (97%) rename tests/e2e/Services/GraphQL/{GraphQLStorageClientTest.php => StorageClientTest.php} (99%) rename tests/e2e/Services/GraphQL/{GraphQLStorageServerTest.php => StorageServerTest.php} (99%) rename tests/e2e/Services/GraphQL/{GraphQLTeamsClientTest.php => TeamsClientTest.php} (98%) rename tests/e2e/Services/GraphQL/{GraphQLTeamsServerTest.php => TeamsServerTest.php} (99%) rename tests/e2e/Services/GraphQL/{GraphQLUsersTest.php => UsersTest.php} (99%) diff --git a/.gitattributes b/.gitattributes index 6d7eedfcb..e80027d4e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,28 +1,7 @@ -app/config/* linguist-detectable=false -app/config/*/* linguist-detectable=false -app/config/*/*/* linguist-detectable=false -app/config/*/*/*/* linguist-detectable=false -app/views/* linguist-detectable=false -app/views/*/* linguist-detectable=false -app/views/*/*/* linguist-detectable=false -app/views/*/*/*/* linguist-detectable=false -app/controllers/* linguist-detectable=false -app/controllers/*/* linguist-detectable=false -app/controllers/*/*/* linguist-detectable=false -app/controllers/*/*/*/* linguist-detectable=false -app/controllers/*/*/*/*/* linguist-detectable=false -src/* linguist-detectable=false -src/*/* linguist-detectable=false -src/*/*/* linguist-detectable=false -src/*/*/*/* linguist-detectable=false -src/*/*/*/*/* linguist-detectable=false -tests/* linguist-detectable=false -tests/*/* linguist-detectable=false -tests/*/*/* linguist-detectable=false -tests/*/*/*/* linguist-detectable=false -tests/*/*/*/*/* linguist-detectable=false -tests/*/*/*/*/*/* linguist-detectable=false -public/scripts/* linguist-detectable=false -public/scripts/*/*/* linguist-detectable=false -public/scripts/*/*/*/* linguist-detectable=false -public/dist/scripts/* linguist-detectable=false +app/config/** linguist-detectable=false +app/views/** linguist-detectable=false +app/controllers/** linguist-detectable=false +src/** linguist-detectable=false +tests/** linguist-detectable=false +public/scripts/** linguist-detectable=false +public/dist/scripts/** linguist-detectable=false diff --git a/tests/e2e/Services/GraphQL/GraphQLAbuseTest.php b/tests/e2e/Services/GraphQL/AbuseTest.php similarity index 97% rename from tests/e2e/Services/GraphQL/GraphQLAbuseTest.php rename to tests/e2e/Services/GraphQL/AbuseTest.php index 6a6117d36..1c5d2b4db 100644 --- a/tests/e2e/Services/GraphQL/GraphQLAbuseTest.php +++ b/tests/e2e/Services/GraphQL/AbuseTest.php @@ -10,11 +10,11 @@ use Utopia\App; use Utopia\Database\Permission; use Utopia\Database\Role; -class GraphQLAbuseTest extends Scope +class AbuseTest extends Scope { use ProjectCustom; use SideServer; - use GraphQLBase; + use Base; public function testComplexQueryBlocked() { diff --git a/tests/e2e/Services/GraphQL/GraphQLAccountTest.php b/tests/e2e/Services/GraphQL/AccountTest.php similarity index 99% rename from tests/e2e/Services/GraphQL/GraphQLAccountTest.php rename to tests/e2e/Services/GraphQL/AccountTest.php index 13b0a9e5e..b24fc8b60 100644 --- a/tests/e2e/Services/GraphQL/GraphQLAccountTest.php +++ b/tests/e2e/Services/GraphQL/AccountTest.php @@ -8,11 +8,11 @@ use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\SideClient; use Utopia\Database\ID; -class GraphQLAccountTest extends Scope +class AccountTest extends Scope { use ProjectCustom; use SideClient; - use GraphQLBase; + use Base; public function testCreateAccount(): array { diff --git a/tests/e2e/Services/GraphQL/GraphQLAuthTest.php b/tests/e2e/Services/GraphQL/AuthTest.php similarity index 99% rename from tests/e2e/Services/GraphQL/GraphQLAuthTest.php rename to tests/e2e/Services/GraphQL/AuthTest.php index 14a549869..8eb0937d8 100644 --- a/tests/e2e/Services/GraphQL/GraphQLAuthTest.php +++ b/tests/e2e/Services/GraphQL/AuthTest.php @@ -10,11 +10,11 @@ use Utopia\Database\ID; use Utopia\Database\Role; use Utopia\Database\Permission; -class GraphQLAuthTest extends Scope +class AuthTest extends Scope { use ProjectCustom; use SideClient; - use GraphQLBase; + use Base; private array $account1; private array $account2; @@ -79,6 +79,7 @@ class GraphQLAuthTest extends Scope // Create session 2 $graphQLPayload['variables']['email'] = $email2; + $session2 = $this->client->call(Client::METHOD_POST, '/graphql', [ 'content-type' => 'application/json', 'x-appwrite-project' => $projectId, diff --git a/tests/e2e/Services/GraphQL/GraphQLAvatarsTest.php b/tests/e2e/Services/GraphQL/AvatarsTest.php similarity index 98% rename from tests/e2e/Services/GraphQL/GraphQLAvatarsTest.php rename to tests/e2e/Services/GraphQL/AvatarsTest.php index 2d504e38c..cfb9061df 100644 --- a/tests/e2e/Services/GraphQL/GraphQLAvatarsTest.php +++ b/tests/e2e/Services/GraphQL/AvatarsTest.php @@ -7,11 +7,11 @@ use Tests\E2E\Scopes\ProjectCustom; use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\SideServer; -class GraphQLAvatarsTest extends Scope +class AvatarsTest extends Scope { use ProjectCustom; use SideServer; - use GraphQLBase; + use Base; public function testGetCreditCardIcon() { diff --git a/tests/e2e/Services/GraphQL/GraphQLBase.php b/tests/e2e/Services/GraphQL/Base.php similarity index 99% rename from tests/e2e/Services/GraphQL/GraphQLBase.php rename to tests/e2e/Services/GraphQL/Base.php index 5919214f1..a58cb0467 100644 --- a/tests/e2e/Services/GraphQL/GraphQLBase.php +++ b/tests/e2e/Services/GraphQL/Base.php @@ -2,7 +2,7 @@ namespace Tests\E2E\Services\GraphQL; -trait GraphQLBase +trait Base { // Databases public static string $CREATE_DATABASE = 'create_database'; @@ -560,8 +560,8 @@ trait GraphQLBase } }'; case self::$GET_USERS: - return 'query listUsers($search: String, $queries: [String!]) { - usersList(search: $search, queries: $queries) { + return 'query listUsers($queries: [String!], $search: String) { + usersList(queries: $queries, search: $search) { total users { _id diff --git a/tests/e2e/Services/GraphQL/GraphQLBatchTest.php b/tests/e2e/Services/GraphQL/BatchTest.php similarity index 99% rename from tests/e2e/Services/GraphQL/GraphQLBatchTest.php rename to tests/e2e/Services/GraphQL/BatchTest.php index 67684efa7..48738bd50 100644 --- a/tests/e2e/Services/GraphQL/GraphQLBatchTest.php +++ b/tests/e2e/Services/GraphQL/BatchTest.php @@ -8,7 +8,7 @@ use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\SideClient; use Utopia\Database\ID; -class GraphQLBatchTest extends Scope +class BatchTest extends Scope { use ProjectCustom; use SideClient; diff --git a/tests/e2e/Services/GraphQL/GraphQLContentTypeTest.php b/tests/e2e/Services/GraphQL/ContentTypeTest.php similarity index 99% rename from tests/e2e/Services/GraphQL/GraphQLContentTypeTest.php rename to tests/e2e/Services/GraphQL/ContentTypeTest.php index 6015943d9..bd9b09774 100644 --- a/tests/e2e/Services/GraphQL/GraphQLContentTypeTest.php +++ b/tests/e2e/Services/GraphQL/ContentTypeTest.php @@ -11,11 +11,11 @@ use Utopia\Database\ID; use Utopia\Database\Permission; use Utopia\Database\Role; -class GraphQLContentTypeTest extends Scope +class ContentTypeTest extends Scope { use ProjectCustom; use SideServer; - use GraphQLBase; + use Base; public function testGraphQLContentType() { diff --git a/tests/e2e/Services/GraphQL/GraphQLDatabaseClientTest.php b/tests/e2e/Services/GraphQL/DatabaseClientTest.php similarity index 99% rename from tests/e2e/Services/GraphQL/GraphQLDatabaseClientTest.php rename to tests/e2e/Services/GraphQL/DatabaseClientTest.php index fcb62ec61..32ad527f2 100644 --- a/tests/e2e/Services/GraphQL/GraphQLDatabaseClientTest.php +++ b/tests/e2e/Services/GraphQL/DatabaseClientTest.php @@ -10,11 +10,11 @@ use Utopia\Database\ID; use Utopia\Database\Permission; use Utopia\Database\Role; -class GraphQLDatabaseClientTest extends Scope +class DatabaseClientTest extends Scope { use ProjectCustom; use SideClient; - use GraphQLBase; + use Base; public function testCreateDatabase(): array { diff --git a/tests/e2e/Services/GraphQL/GraphQLDatabaseServerTest.php b/tests/e2e/Services/GraphQL/DatabaseServerTest.php similarity index 94% rename from tests/e2e/Services/GraphQL/GraphQLDatabaseServerTest.php rename to tests/e2e/Services/GraphQL/DatabaseServerTest.php index 5958cc809..e8c867e7e 100644 --- a/tests/e2e/Services/GraphQL/GraphQLDatabaseServerTest.php +++ b/tests/e2e/Services/GraphQL/DatabaseServerTest.php @@ -11,11 +11,11 @@ use Utopia\Database\ID; use Utopia\Database\Permission; use Utopia\Database\Role; -class GraphQLDatabaseServerTest extends Scope +class DatabaseServerTest extends Scope { use ProjectCustom; use SideServer; - use GraphQLBase; + use Base; public function testCreateDatabase(): array { @@ -862,6 +862,37 @@ class GraphQLDatabaseServerTest extends Scope $this->assertStringContainsString('New Document Name', $document['data']); } +// /** +// * @depends testCreateCustomEntity +// * @throws Exception +// */ +// public function testUpdateCustomEntity(array $data) { +// $projectId = $this->getProject()['$id']; +// $query = $this->getQuery(self::$UPDATE_CUSTOM_ENTITY); +// $gqlPayload = [ +// 'query' => $query, +// 'variables' => [ +// 'id' => $data['_id'], +// 'data' => [ +// 'name' => 'New Custom Entity Name', +// ], +// ] +// ]; +// +// $entity = $this->client->call(Client::METHOD_POST, '/graphql', array_merge([ +// 'content-type' => 'application/json', +// 'x-appwrite-project' => $projectId, +// ], $this->getHeaders()), $gqlPayload); +// +// \var_dump($entity); +// +// $this->assertArrayNotHasKey('errors', $entity['body']); +// $this->assertIsArray($entity['body']['data']); +// $entity = $entity['body']['data']['actorsUpdate']; +// $this->assertIsArray($entity); +// $this->assertStringContainsString('New Custom Entity Name', $entity['data']); +// } + /** * @depends testCreateDocument * @throws Exception @@ -965,4 +996,27 @@ class GraphQLDatabaseServerTest extends Scope $this->assertIsNotArray($database['body']); $this->assertEquals(204, $database['headers']['status-code']); } + +// /** +// * @depends testCreateCustomEntity +// * @throws Exception +// */ +// public function testDeleteCustomEntity(array $data) { +// $projectId = $this->getProject()['$id']; +// $query = $this->getQuery(self::$DELETE_CUSTOM_ENTITY); +// $gqlPayload = [ +// 'query' => $query, +// 'variables' => [ +// 'id' => $data['_id'], +// ] +// ]; +// +// $entity = $this->client->call(Client::METHOD_POST, '/graphql', array_merge([ +// 'content-type' => 'application/json', +// 'x-appwrite-project' => $projectId, +// ], $this->getHeaders()), $gqlPayload); +// +// $this->assertIsNotArray($entity['body']); +// $this->assertEquals(204, $entity['headers']['status-code']); +// } } diff --git a/tests/e2e/Services/GraphQL/GraphQLFunctionsClientTest.php b/tests/e2e/Services/GraphQL/FunctionsClientTest.php similarity index 98% rename from tests/e2e/Services/GraphQL/GraphQLFunctionsClientTest.php rename to tests/e2e/Services/GraphQL/FunctionsClientTest.php index ec84d7e07..7bfcd66d4 100644 --- a/tests/e2e/Services/GraphQL/GraphQLFunctionsClientTest.php +++ b/tests/e2e/Services/GraphQL/FunctionsClientTest.php @@ -10,11 +10,11 @@ use Tests\E2E\Scopes\SideClient; use Utopia\Database\ID; use Utopia\Database\Role; -class GraphQLFunctionsClientTest extends Scope +class FunctionsClientTest extends Scope { use ProjectCustom; use SideClient; - use GraphQLBase; + use Base; public function testCreateFunction(): array { diff --git a/tests/e2e/Services/GraphQL/GraphQLFunctionsServerTest.php b/tests/e2e/Services/GraphQL/FunctionsServerTest.php similarity index 99% rename from tests/e2e/Services/GraphQL/GraphQLFunctionsServerTest.php rename to tests/e2e/Services/GraphQL/FunctionsServerTest.php index e7992faf7..a51072bb9 100644 --- a/tests/e2e/Services/GraphQL/GraphQLFunctionsServerTest.php +++ b/tests/e2e/Services/GraphQL/FunctionsServerTest.php @@ -10,11 +10,11 @@ use Tests\E2E\Scopes\SideServer; use Utopia\Database\ID; use Utopia\Database\Role; -class GraphQLFunctionsServerTest extends Scope +class FunctionsServerTest extends Scope { use ProjectCustom; use SideServer; - use GraphQLBase; + use Base; public function testCreateFunction(): array { diff --git a/tests/e2e/Services/GraphQL/GraphQLHealthTest.php b/tests/e2e/Services/GraphQL/HealthTest.php similarity index 99% rename from tests/e2e/Services/GraphQL/GraphQLHealthTest.php rename to tests/e2e/Services/GraphQL/HealthTest.php index a43401d33..76153a751 100644 --- a/tests/e2e/Services/GraphQL/GraphQLHealthTest.php +++ b/tests/e2e/Services/GraphQL/HealthTest.php @@ -7,11 +7,11 @@ use Tests\E2E\Scopes\ProjectCustom; use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\SideServer; -class GraphQLHealthTest extends Scope +class HealthTest extends Scope { use ProjectCustom; use SideServer; - use GraphQLBase; + use Base; public function testGetHTTPHealth() { diff --git a/tests/e2e/Services/GraphQL/GraphQLLocalizationTest.php b/tests/e2e/Services/GraphQL/LocalizationTest.php similarity index 98% rename from tests/e2e/Services/GraphQL/GraphQLLocalizationTest.php rename to tests/e2e/Services/GraphQL/LocalizationTest.php index d87f9de57..38200911c 100644 --- a/tests/e2e/Services/GraphQL/GraphQLLocalizationTest.php +++ b/tests/e2e/Services/GraphQL/LocalizationTest.php @@ -7,11 +7,11 @@ use Tests\E2E\Scopes\ProjectCustom; use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\SideServer; -class GraphQLLocalizationTest extends Scope +class LocalizationTest extends Scope { use ProjectCustom; use SideServer; - use GraphQLBase; + use Base; public function testGetLocale(): array { diff --git a/tests/e2e/Services/GraphQL/GraphQLScopeTest.php b/tests/e2e/Services/GraphQL/ScopeTest.php similarity index 97% rename from tests/e2e/Services/GraphQL/GraphQLScopeTest.php rename to tests/e2e/Services/GraphQL/ScopeTest.php index d002f5012..03be6e3f7 100644 --- a/tests/e2e/Services/GraphQL/GraphQLScopeTest.php +++ b/tests/e2e/Services/GraphQL/ScopeTest.php @@ -9,11 +9,11 @@ use Tests\E2E\Scopes\SideClient; use Tests\E2E\Scopes\SideServer; use Utopia\Database\ID; -class GraphQLScopeTest extends Scope +class ScopeTest extends Scope { use ProjectCustom; use SideServer; - use GraphQLBase; + use Base; public function testInvalidScope() { diff --git a/tests/e2e/Services/GraphQL/GraphQLStorageClientTest.php b/tests/e2e/Services/GraphQL/StorageClientTest.php similarity index 99% rename from tests/e2e/Services/GraphQL/GraphQLStorageClientTest.php rename to tests/e2e/Services/GraphQL/StorageClientTest.php index 612c81abb..3c7804e0b 100644 --- a/tests/e2e/Services/GraphQL/GraphQLStorageClientTest.php +++ b/tests/e2e/Services/GraphQL/StorageClientTest.php @@ -11,11 +11,11 @@ use Utopia\Database\ID; use Utopia\Database\Permission; use Utopia\Database\Role; -class GraphQLStorageClientTest extends Scope +class StorageClientTest extends Scope { use ProjectCustom; use SideClient; - use GraphQLBase; + use Base; public function testCreateBucket(): array { diff --git a/tests/e2e/Services/GraphQL/GraphQLStorageServerTest.php b/tests/e2e/Services/GraphQL/StorageServerTest.php similarity index 99% rename from tests/e2e/Services/GraphQL/GraphQLStorageServerTest.php rename to tests/e2e/Services/GraphQL/StorageServerTest.php index 76943effe..fc6c23f12 100644 --- a/tests/e2e/Services/GraphQL/GraphQLStorageServerTest.php +++ b/tests/e2e/Services/GraphQL/StorageServerTest.php @@ -11,11 +11,11 @@ use Utopia\Database\ID; use Utopia\Database\Permission; use Utopia\Database\Role; -class GraphQLStorageServerTest extends Scope +class StorageServerTest extends Scope { use ProjectCustom; use SideServer; - use GraphQLBase; + use Base; public function testCreateBucket(): array { diff --git a/tests/e2e/Services/GraphQL/GraphQLTeamsClientTest.php b/tests/e2e/Services/GraphQL/TeamsClientTest.php similarity index 98% rename from tests/e2e/Services/GraphQL/GraphQLTeamsClientTest.php rename to tests/e2e/Services/GraphQL/TeamsClientTest.php index cde974fab..6fb2ba87e 100644 --- a/tests/e2e/Services/GraphQL/GraphQLTeamsClientTest.php +++ b/tests/e2e/Services/GraphQL/TeamsClientTest.php @@ -8,10 +8,10 @@ use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\SideClient; use Utopia\Database\ID; -class GraphQLTeamsClientTest extends Scope +class TeamsClientTest extends Scope { use ProjectCustom; - use GraphQLBase; + use Base; use SideClient; public function testCreateTeam(): array diff --git a/tests/e2e/Services/GraphQL/GraphQLTeamsServerTest.php b/tests/e2e/Services/GraphQL/TeamsServerTest.php similarity index 99% rename from tests/e2e/Services/GraphQL/GraphQLTeamsServerTest.php rename to tests/e2e/Services/GraphQL/TeamsServerTest.php index 6917be1e1..118086834 100644 --- a/tests/e2e/Services/GraphQL/GraphQLTeamsServerTest.php +++ b/tests/e2e/Services/GraphQL/TeamsServerTest.php @@ -8,10 +8,10 @@ use Tests\E2E\Scopes\Scope; use Tests\E2E\Scopes\SideServer; use Utopia\Database\ID; -class GraphQLTeamsServerTest extends Scope +class TeamsServerTest extends Scope { use ProjectCustom; - use GraphQLBase; + use Base; use SideServer; public function testCreateTeam(): array diff --git a/tests/e2e/Services/GraphQL/GraphQLUsersTest.php b/tests/e2e/Services/GraphQL/UsersTest.php similarity index 99% rename from tests/e2e/Services/GraphQL/GraphQLUsersTest.php rename to tests/e2e/Services/GraphQL/UsersTest.php index c8fbed9b2..99229b46d 100644 --- a/tests/e2e/Services/GraphQL/GraphQLUsersTest.php +++ b/tests/e2e/Services/GraphQL/UsersTest.php @@ -9,11 +9,11 @@ use Tests\E2E\Scopes\SideServer; use Utopia\Database\ID; use Utopia\Database\Query; -class GraphQLUsersTest extends Scope +class UsersTest extends Scope { use ProjectCustom; use SideServer; - use GraphQLBase; + use Base; public function testCreateUser(): array {