1
0
Fork 0
mirror of synced 2024-09-29 08:51:28 +13:00

adds more queries in tests, upgrade db library

This commit is contained in:
prateek banga 2023-08-10 00:11:18 +05:30
parent 426c315927
commit 185d09d764
3 changed files with 52 additions and 32 deletions

View file

@ -43,13 +43,13 @@
"ext-sockets": "*",
"appwrite/php-clamav": "2.0.*",
"appwrite/php-runtimes": "0.11.*",
"utopia-php/abuse": "0.29.*",
"utopia-php/abuse": "0.30.*",
"utopia-php/analytics": "0.10.*",
"utopia-php/audit": "0.31.*",
"utopia-php/audit": "0.32.*",
"utopia-php/cache": "0.8.*",
"utopia-php/cli": "0.15.*",
"utopia-php/config": "0.2.*",
"utopia-php/database": "0.40.*",
"utopia-php/database": "0.41.*",
"utopia-php/domains": "1.1.*",
"utopia-php/dsn": "0.1.*",
"utopia-php/framework": "0.28.*",

42
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "b9dd376db262a8457dc9c25c422aa705",
"content-hash": "8068408e6b0e275fb7887c956b918d03",
"packages": [
{
"name": "adhocore/jwt",
@ -1225,23 +1225,23 @@
},
{
"name": "utopia-php/abuse",
"version": "0.29.0",
"version": "0.30.0",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/abuse.git",
"reference": "7589d0c7a6f685fcbb02d57875f034bd233ec262"
"reference": "9ba1b9ca96386aedfb5be23d739433652124e00f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/abuse/zipball/7589d0c7a6f685fcbb02d57875f034bd233ec262",
"reference": "7589d0c7a6f685fcbb02d57875f034bd233ec262",
"url": "https://api.github.com/repos/utopia-php/abuse/zipball/9ba1b9ca96386aedfb5be23d739433652124e00f",
"reference": "9ba1b9ca96386aedfb5be23d739433652124e00f",
"shasum": ""
},
"require": {
"ext-curl": "*",
"ext-pdo": "*",
"php": ">=8.0",
"utopia-php/database": "0.40.*"
"utopia-php/database": "0.41.*"
},
"require-dev": {
"laravel/pint": "1.5.*",
@ -1268,9 +1268,9 @@
],
"support": {
"issues": "https://github.com/utopia-php/abuse/issues",
"source": "https://github.com/utopia-php/abuse/tree/0.29.0"
"source": "https://github.com/utopia-php/abuse/tree/0.30.0"
},
"time": "2023-08-03T08:22:12+00:00"
"time": "2023-08-09T17:34:55+00:00"
},
{
"name": "utopia-php/analytics",
@ -1320,21 +1320,21 @@
},
{
"name": "utopia-php/audit",
"version": "0.31.0",
"version": "0.32.0",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/audit.git",
"reference": "f1b0165fccb6ec665f7ae947bfed56a8f6b877cb"
"reference": "db769bcbc3bc4a187e3be97f5e532311ad8fae27"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/audit/zipball/f1b0165fccb6ec665f7ae947bfed56a8f6b877cb",
"reference": "f1b0165fccb6ec665f7ae947bfed56a8f6b877cb",
"url": "https://api.github.com/repos/utopia-php/audit/zipball/db769bcbc3bc4a187e3be97f5e532311ad8fae27",
"reference": "db769bcbc3bc4a187e3be97f5e532311ad8fae27",
"shasum": ""
},
"require": {
"php": ">=8.0",
"utopia-php/database": "0.40.*"
"utopia-php/database": "0.41.*"
},
"require-dev": {
"laravel/pint": "1.5.*",
@ -1361,9 +1361,9 @@
],
"support": {
"issues": "https://github.com/utopia-php/audit/issues",
"source": "https://github.com/utopia-php/audit/tree/0.31.0"
"source": "https://github.com/utopia-php/audit/tree/0.32.0"
},
"time": "2023-08-03T08:22:32+00:00"
"time": "2023-08-09T17:34:57+00:00"
},
{
"name": "utopia-php/cache",
@ -1516,16 +1516,16 @@
},
{
"name": "utopia-php/database",
"version": "0.40.0",
"version": "0.41.0",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/database.git",
"reference": "ec586ba1c5fc83856df4feaa05464da72b72ee0d"
"reference": "98dc6a94e636fe8f955c20fa4833db8986b5c27a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/database/zipball/ec586ba1c5fc83856df4feaa05464da72b72ee0d",
"reference": "ec586ba1c5fc83856df4feaa05464da72b72ee0d",
"url": "https://api.github.com/repos/utopia-php/database/zipball/98dc6a94e636fe8f955c20fa4833db8986b5c27a",
"reference": "98dc6a94e636fe8f955c20fa4833db8986b5c27a",
"shasum": ""
},
"require": {
@ -1566,9 +1566,9 @@
],
"support": {
"issues": "https://github.com/utopia-php/database/issues",
"source": "https://github.com/utopia-php/database/tree/0.40.0"
"source": "https://github.com/utopia-php/database/tree/0.41.0"
},
"time": "2023-08-03T08:01:37+00:00"
"time": "2023-08-09T02:52:31+00:00"
},
{
"name": "utopia-php/domains",

View file

@ -5,10 +5,12 @@ namespace Tests\E2E\Services\Databases;
use Appwrite\Extend\Exception;
use Tests\E2E\Client;
use Utopia\Database\Database;
use Utopia\Database\Document;
use Utopia\Database\DateTime;
use Utopia\Database\Helpers\ID;
use Utopia\Database\Helpers\Permission;
use Utopia\Database\Helpers\Role;
use Utopia\Database\Query;
use Utopia\Database\Validator\Datetime as DatetimeValidator;
trait DatabasesBase
@ -322,15 +324,24 @@ trait DatabasesBase
public function testListAttributes(array $data): void
{
$databaseId = $data['databaseId'];
$attributes = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $data['moviesId'] . '/attributes', array_merge([
$response = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $data['moviesId'] . '/attributes', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
'x-appwrite-key' => $this->getProject()['apiKey'],
]), [
'queries' => ['equal("type", "string")'],
'queries' => ['equal("type", "string")', 'limit(2)', 'cursorAfter(title)'],
]);
$this->assertEquals(200, $attributes['headers']['status-code']);
$this->assertEquals(4, $attributes['body']['total']);
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertEquals(2, \count($response['body']['attributes']));
$response = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $data['moviesId'] . '/attributes', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
'x-appwrite-key' => $this->getProject()['apiKey'],
]), [
'queries' => ['select(key)'],
]);
$this->assertEquals(Exception::GENERAL_ARGUMENT_INVALID, $response['body']['type']);
$this->assertEquals(400, $response['headers']['status-code']);
}
/**
@ -1070,15 +1081,24 @@ trait DatabasesBase
public function testListIndexes(array $data): void
{
$databaseId = $data['databaseId'];
$indexes = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $data['moviesId'] . '/indexes', array_merge([
$response = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $data['moviesId'] . '/indexes', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
'x-appwrite-key' => $this->getProject()['apiKey'],
]), [
'queries' => ['equal("type", "key")'],
'queries' => ['equal("type", "key")', 'limit(2)'],
]);
$this->assertEquals(200, $indexes['headers']['status-code']);
$this->assertEquals(3, $indexes['body']['total']);
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertEquals(2, \count($response['body']['indexes']));
$response = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $data['moviesId'] . '/indexes', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
'x-appwrite-key' => $this->getProject()['apiKey'],
]), [
'queries' => ['select(key)'],
]);
$this->assertEquals(Exception::GENERAL_ARGUMENT_INVALID, $response['body']['type']);
$this->assertEquals(400, $response['headers']['status-code']);
}
/**