1
0
Fork 0
mirror of synced 2024-09-21 12:01:56 +12:00

Bug fixing, upgrade tests to new syntax

This commit is contained in:
Matej Bačo 2022-08-24 09:22:13 +00:00
parent 01a57d91ad
commit bd7395cb44
9 changed files with 20 additions and 25 deletions

View file

@ -2042,7 +2042,7 @@ App::get('/v1/databases/:databaseId/collections/:collectionId/documents')
// Validate queries // Validate queries
$validator = new Documents($collection->getAttribute('attributes'), $collection->getAttribute('indexes')); $validator = new Documents($collection->getAttribute('attributes'), $collection->getAttribute('indexes'));
$valid = $validator->isValid($collection->getRead()); $valid = $validator->isValid($queries);
if (!$valid) { if (!$valid) {
throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, $validator->getDescription()); throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, $validator->getDescription());
} }

2
composer.lock generated
View file

@ -2874,7 +2874,7 @@
"description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms", "description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms",
"support": { "support": {
"issues": "https://github.com/appwrite/sdk-generator/issues", "issues": "https://github.com/appwrite/sdk-generator/issues",
"source": "https://github.com/appwrite/sdk-generator/tree/feat-change-default-functionID" "source": "https://github.com/appwrite/sdk-generator/tree/master"
}, },
"time": "2022-08-19T10:03:22+00:00" "time": "2022-08-19T10:03:22+00:00"
}, },

View file

@ -20,6 +20,6 @@ class TeamMemberships extends Base
*/ */
public function __construct() public function __construct()
{ {
parent::__construct('teamMemberships', self::ALLOWED_ATTRIBUTES); parent::__construct('memberships', self::ALLOWED_ATTRIBUTES);
} }
} }

View file

@ -390,7 +390,7 @@ trait AccountBase
'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-project' => $this->getProject()['$id'],
'cookie' => 'a_session_' . $this->getProject()['$id'] . '=' . $session, 'cookie' => 'a_session_' . $this->getProject()['$id'] . '=' . $session,
]), [ ]), [
'limit' => 1 'queries' => [ 'limit(1)' ],
]); ]);
$this->assertEquals($responseLimit['headers']['status-code'], 200); $this->assertEquals($responseLimit['headers']['status-code'], 200);
@ -407,7 +407,7 @@ trait AccountBase
'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-project' => $this->getProject()['$id'],
'cookie' => 'a_session_' . $this->getProject()['$id'] . '=' . $session, 'cookie' => 'a_session_' . $this->getProject()['$id'] . '=' . $session,
]), [ ]), [
'offset' => 1 'queries' => [ 'offset(1)' ],
]); ]);
$this->assertEquals($responseOffset['headers']['status-code'], 200); $this->assertEquals($responseOffset['headers']['status-code'], 200);
@ -424,8 +424,7 @@ trait AccountBase
'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-project' => $this->getProject()['$id'],
'cookie' => 'a_session_' . $this->getProject()['$id'] . '=' . $session, 'cookie' => 'a_session_' . $this->getProject()['$id'] . '=' . $session,
]), [ ]), [
'limit' => 1, 'queries' => [ 'limit(1)', 'offset(1)' ],
'offset' => 1
]); ]);
$this->assertEquals($responseLimitOffset['headers']['status-code'], 200); $this->assertEquals($responseLimitOffset['headers']['status-code'], 200);

View file

@ -986,10 +986,11 @@ trait DatabasesBase
'content-type' => 'application/json', 'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [ ], $this->getHeaders()), [
'orderAttributes' => ['releaseYear'], 'queries' => [ 'orderAsc("releaseYear")' ],
'orderTypes' => ['ASC'],
]); ]);
\var_dump($documents);
$this->assertEquals(200, $documents['headers']['status-code']); $this->assertEquals(200, $documents['headers']['status-code']);
$this->assertEquals(1944, $documents['body']['documents'][0]['releaseYear']); $this->assertEquals(1944, $documents['body']['documents'][0]['releaseYear']);
$this->assertEquals(2017, $documents['body']['documents'][1]['releaseYear']); $this->assertEquals(2017, $documents['body']['documents'][1]['releaseYear']);
@ -1007,8 +1008,7 @@ trait DatabasesBase
'content-type' => 'application/json', 'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [ ], $this->getHeaders()), [
'orderAttributes' => ['releaseYear'], 'queries' => [ 'orderDesc("releaseYear")' ],
'orderTypes' => ['DESC'],
]); ]);
$this->assertEquals(200, $documents['headers']['status-code']); $this->assertEquals(200, $documents['headers']['status-code']);

View file

@ -293,7 +293,7 @@ class FunctionsCustomClientTest extends Scope
'x-appwrite-project' => $projectId, 'x-appwrite-project' => $projectId,
'x-appwrite-key' => $apikey, 'x-appwrite-key' => $apikey,
], [ ], [
'cursor' => $base['body']['executions'][0]['$id'] 'queries' => [ 'cursorAfter("' . $base['body']['executions'][0]['$id'] . '")' ],
]); ]);
$this->assertCount(1, $executions['body']['executions']); $this->assertCount(1, $executions['body']['executions']);
@ -304,8 +304,7 @@ class FunctionsCustomClientTest extends Scope
'x-appwrite-project' => $projectId, 'x-appwrite-project' => $projectId,
'x-appwrite-key' => $apikey, 'x-appwrite-key' => $apikey,
], [ ], [
'cursor' => $base['body']['executions'][1]['$id'], 'queries' => [ 'cursorBefore("' . $base['body']['executions'][1]['$id'] . '")' ],
'cursorDirection' => Database::CURSOR_BEFORE
]); ]);
// Cleanup : Delete function // Cleanup : Delete function

View file

@ -98,7 +98,7 @@ class StorageCustomServerTest extends Scope
'content-type' => 'application/json', 'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [ ], $this->getHeaders()), [
'cursor' => $response['body']['buckets'][0]['$id'], 'queries' => [ 'cursorAfter("' . $response['body']['buckets'][0]['$id'] . '")' ],
]); ]);
$this->assertEquals(200, $response['headers']['status-code']); $this->assertEquals(200, $response['headers']['status-code']);

View file

@ -128,7 +128,7 @@ trait TeamsBase
'content-type' => 'application/json', 'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [ ], $this->getHeaders()), [
'limit' => 2, 'queries' => [ 'limit(2)' ],
]); ]);
$this->assertEquals(200, $response['headers']['status-code']); $this->assertEquals(200, $response['headers']['status-code']);
@ -140,7 +140,7 @@ trait TeamsBase
'content-type' => 'application/json', 'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [ ], $this->getHeaders()), [
'offset' => 1, 'queries' => [ 'offset(1)' ],
]); ]);
$this->assertEquals(200, $response['headers']['status-code']); $this->assertEquals(200, $response['headers']['status-code']);
@ -191,7 +191,7 @@ trait TeamsBase
'content-type' => 'application/json', 'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [ ], $this->getHeaders()), [
'limit' => 2, 'queries' => [ 'limit(2)' ],
]); ]);
$this->assertEquals(200, $teams['headers']['status-code']); $this->assertEquals(200, $teams['headers']['status-code']);
@ -203,8 +203,7 @@ trait TeamsBase
'content-type' => 'application/json', 'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [ ], $this->getHeaders()), [
'limit' => 1, 'queries' => [ 'limit(1)', 'cursorAfter("' . $teams['body']['teams'][0]['$id'] . '")' ],
'cursor' => $teams['body']['teams'][0]['$id']
]); ]);
$this->assertEquals(200, $response['headers']['status-code']); $this->assertEquals(200, $response['headers']['status-code']);
@ -217,9 +216,7 @@ trait TeamsBase
'content-type' => 'application/json', 'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [ ], $this->getHeaders()), [
'limit' => 1, 'queries' => [ 'limit(1)', 'cursorBefore("' . $teams['body']['teams'][1]['$id'] . '")' ],
'cursor' => $teams['body']['teams'][1]['$id'],
'cursorDirection' => Database::CURSOR_BEFORE
]); ]);
$this->assertEquals(200, $response['headers']['status-code']); $this->assertEquals(200, $response['headers']['status-code']);
@ -235,7 +232,7 @@ trait TeamsBase
'content-type' => 'application/json', 'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [ ], $this->getHeaders()), [
'cursor' => 'unknown' 'queries' => [ 'cursorAfter("unknown")' ],
]); ]);
$this->assertEquals(400, $response['headers']['status-code']); $this->assertEquals(400, $response['headers']['status-code']);

View file

@ -209,7 +209,7 @@ trait TeamsBaseClient
'content-type' => 'application/json', 'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [ ], $this->getHeaders()), [
'cursor' => $memberships['body']['memberships'][0]['$id'] 'queries' => [ 'cursorAfter("' . $memberships['body']['memberships'][0]['$id'] . '")' ]
]); ]);
$this->assertEquals(200, $response['headers']['status-code']); $this->assertEquals(200, $response['headers']['status-code']);