diff --git a/app/controllers/api/databases.php b/app/controllers/api/databases.php index c28bc7c30..eb2ba8089 100644 --- a/app/controllers/api/databases.php +++ b/app/controllers/api/databases.php @@ -2395,7 +2395,7 @@ App::post('/v1/databases/:databaseId/collections/:collectionId/indexes') ->param('databaseId', '', new UID(), 'Database ID.') ->param('collectionId', '', new UID(), 'Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).') ->param('key', null, new Key(), 'Index Key.') - ->param('type', null, new WhiteList([Database::INDEX_KEY, Database::INDEX_FULLTEXT, Database::INDEX_UNIQUE, Database::INDEX_SPATIAL, Database::INDEX_ARRAY]), 'Index type.') + ->param('type', null, new WhiteList([Database::INDEX_KEY, Database::INDEX_FULLTEXT, Database::INDEX_UNIQUE, Database::INDEX_SPATIAL]), 'Index type.') ->param('attributes', null, new ArrayList(new Key(true), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Array of attributes to index. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' attributes are allowed, each 32 characters long.') ->param('orders', [], new ArrayList(new WhiteList(['ASC', 'DESC'], false, Database::VAR_STRING), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Array of index orders. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' orders are allowed.', true) ->inject('response') @@ -2503,7 +2503,7 @@ App::post('/v1/databases/:databaseId/collections/:collectionId/indexes') 'lengths' => $lengths, 'orders' => $orders, ]); - +var_dump($collection->getAttribute('attributes')); $validator = new IndexValidator( $collection->getAttribute('attributes'), $dbForProject->getAdapter()->getMaxIndexLength() diff --git a/composer.json b/composer.json index f52e873a8..d35e40aa7 100644 --- a/composer.json +++ b/composer.json @@ -46,10 +46,10 @@ "utopia-php/abuse": "0.35.*", "utopia-php/analytics": "0.10.*", "utopia-php/audit": "0.37.*", - "utopia-php/cache": "0.8.*", + "utopia-php/cache": "0.9.*", "utopia-php/cli": "0.15.*", "utopia-php/config": "0.2.*", - "utopia-php/database": "0.47.*", + "utopia-php/database": "dev-contains-v2 as 0.47.99", "utopia-php/domains": "0.3.*", "utopia-php/dsn": "0.1.*", "utopia-php/framework": "0.31.1", diff --git a/composer.lock b/composer.lock index 24fac1640..3125dd11f 100644 --- a/composer.lock +++ b/composer.lock @@ -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": "5aee7a482a26ad9c91a49d8d7d177837", + "content-hash": "b22dd49cd16c7094d2cca4c90210fc45", "packages": [ { "name": "adhocore/jwt", @@ -1759,16 +1759,16 @@ }, { "name": "utopia-php/cache", - "version": "0.8.0", + "version": "0.9.0", "source": { "type": "git", "url": "https://github.com/utopia-php/cache.git", - "reference": "212e66100a1f32e674fca5d9bc317cc998303089" + "reference": "4fc7b4789b5f0ce74835c1ecfec4f3afe6f0e34e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/cache/zipball/212e66100a1f32e674fca5d9bc317cc998303089", - "reference": "212e66100a1f32e674fca5d9bc317cc998303089", + "url": "https://api.github.com/repos/utopia-php/cache/zipball/4fc7b4789b5f0ce74835c1ecfec4f3afe6f0e34e", + "reference": "4fc7b4789b5f0ce74835c1ecfec4f3afe6f0e34e", "shasum": "" }, "require": { @@ -1779,6 +1779,7 @@ }, "require-dev": { "laravel/pint": "1.2.*", + "phpstan/phpstan": "1.9.x-dev", "phpunit/phpunit": "^9.3", "vimeo/psalm": "4.13.1" }, @@ -1802,9 +1803,9 @@ ], "support": { "issues": "https://github.com/utopia-php/cache/issues", - "source": "https://github.com/utopia-php/cache/tree/0.8.0" + "source": "https://github.com/utopia-php/cache/tree/0.9.0" }, - "time": "2022-10-16T16:48:09+00:00" + "time": "2024-01-07T18:11:23+00:00" }, { "name": "utopia-php/cli", @@ -1908,23 +1909,23 @@ }, { "name": "utopia-php/database", - "version": "0.47.0", + "version": "dev-contains-v2", "source": { "type": "git", "url": "https://github.com/utopia-php/database.git", - "reference": "a87cc66ebea6686066e03c64867fc7db07fa80cf" + "reference": "75b75b09f8a849c2fe374472019a9ba5824bad1e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/database/zipball/a87cc66ebea6686066e03c64867fc7db07fa80cf", - "reference": "a87cc66ebea6686066e03c64867fc7db07fa80cf", + "url": "https://api.github.com/repos/utopia-php/database/zipball/75b75b09f8a849c2fe374472019a9ba5824bad1e", + "reference": "75b75b09f8a849c2fe374472019a9ba5824bad1e", "shasum": "" }, "require": { "ext-mbstring": "*", "ext-pdo": "*", "php": ">=8.0", - "utopia-php/cache": "0.8.*", + "utopia-php/cache": "0.9.*", "utopia-php/framework": "0.*.*", "utopia-php/mongo": "0.3.*" }, @@ -1958,9 +1959,9 @@ ], "support": { "issues": "https://github.com/utopia-php/database/issues", - "source": "https://github.com/utopia-php/database/tree/0.47.0" + "source": "https://github.com/utopia-php/database/tree/contains-v2" }, - "time": "2023-12-14T11:02:15+00:00" + "time": "2024-01-18T12:37:43+00:00" }, { "name": "utopia-php/domains", @@ -2272,16 +2273,16 @@ }, { "name": "utopia-php/messaging", - "version": "0.8.0", + "version": "0.8.1", "source": { "type": "git", "url": "https://github.com/utopia-php/messaging.git", - "reference": "64eca3faf02a79831f219d4f3ae05cd278a88b4b" + "reference": "bfb5014d3a8752901e50da1ae21bf309a6af5006" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/messaging/zipball/64eca3faf02a79831f219d4f3ae05cd278a88b4b", - "reference": "64eca3faf02a79831f219d4f3ae05cd278a88b4b", + "url": "https://api.github.com/repos/utopia-php/messaging/zipball/bfb5014d3a8752901e50da1ae21bf309a6af5006", + "reference": "bfb5014d3a8752901e50da1ae21bf309a6af5006", "shasum": "" }, "require": { @@ -2316,9 +2317,9 @@ ], "support": { "issues": "https://github.com/utopia-php/messaging/issues", - "source": "https://github.com/utopia-php/messaging/tree/0.8.0" + "source": "https://github.com/utopia-php/messaging/tree/0.8.1" }, - "time": "2023-12-15T06:44:08+00:00" + "time": "2024-01-10T23:55:03+00:00" }, { "name": "utopia-php/migration", @@ -2908,22 +2909,22 @@ }, { "name": "utopia-php/vcs", - "version": "0.6.4", + "version": "0.6.5", "source": { "type": "git", "url": "https://github.com/utopia-php/vcs.git", - "reference": "b2595a50a4897a8c88319240810055b7a96efd6d" + "reference": "104e47ea8e38c156ec0e0bd415caa3dcd5046fe2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/vcs/zipball/b2595a50a4897a8c88319240810055b7a96efd6d", - "reference": "b2595a50a4897a8c88319240810055b7a96efd6d", + "url": "https://api.github.com/repos/utopia-php/vcs/zipball/104e47ea8e38c156ec0e0bd415caa3dcd5046fe2", + "reference": "104e47ea8e38c156ec0e0bd415caa3dcd5046fe2", "shasum": "" }, "require": { "adhocore/jwt": "^1.1", "php": ">=8.0", - "utopia-php/cache": "^0.8.0", + "utopia-php/cache": "^0.9.0", "utopia-php/framework": "0.*.*" }, "require-dev": { @@ -2951,9 +2952,9 @@ ], "support": { "issues": "https://github.com/utopia-php/vcs/issues", - "source": "https://github.com/utopia-php/vcs/tree/0.6.4" + "source": "https://github.com/utopia-php/vcs/tree/0.6.5" }, - "time": "2023-12-26T15:38:19+00:00" + "time": "2024-01-08T17:11:12+00:00" }, { "name": "utopia-php/websocket", @@ -3140,16 +3141,16 @@ "packages-dev": [ { "name": "appwrite/sdk-generator", - "version": "0.36.0", + "version": "0.36.2", "source": { "type": "git", "url": "https://github.com/appwrite/sdk-generator.git", - "reference": "3a10f1f895ed71120442ff71eb6adec3fd6b4e8a" + "reference": "0aa67479d75f0e0cb7b60454031534d7f0abaece" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/3a10f1f895ed71120442ff71eb6adec3fd6b4e8a", - "reference": "3a10f1f895ed71120442ff71eb6adec3fd6b4e8a", + "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/0aa67479d75f0e0cb7b60454031534d7f0abaece", + "reference": "0aa67479d75f0e0cb7b60454031534d7f0abaece", "shasum": "" }, "require": { @@ -3185,9 +3186,9 @@ "description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms", "support": { "issues": "https://github.com/appwrite/sdk-generator/issues", - "source": "https://github.com/appwrite/sdk-generator/tree/0.36.0" + "source": "https://github.com/appwrite/sdk-generator/tree/0.36.2" }, - "time": "2023-11-20T10:03:06+00:00" + "time": "2024-01-19T01:04:35+00:00" }, { "name": "doctrine/deprecations", @@ -3770,16 +3771,16 @@ }, { "name": "phpdocumentor/type-resolver", - "version": "1.7.3", + "version": "1.8.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "3219c6ee25c9ea71e3d9bbaf39c67c9ebd499419" + "reference": "fad452781b3d774e3337b0c0b245dd8e5a4455fc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/3219c6ee25c9ea71e3d9bbaf39c67c9ebd499419", - "reference": "3219c6ee25c9ea71e3d9bbaf39c67c9ebd499419", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/fad452781b3d774e3337b0c0b245dd8e5a4455fc", + "reference": "fad452781b3d774e3337b0c0b245dd8e5a4455fc", "shasum": "" }, "require": { @@ -3822,9 +3823,9 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.7.3" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.8.0" }, - "time": "2023-08-12T11:01:26+00:00" + "time": "2024-01-11T11:49:22+00:00" }, { "name": "phpspec/prophecy", @@ -5380,16 +5381,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.8.0", + "version": "3.8.1", "source": { "type": "git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", - "reference": "5805f7a4e4958dbb5e944ef1e6edae0a303765e7" + "reference": "14f5fff1e64118595db5408e946f3a22c75807f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/5805f7a4e4958dbb5e944ef1e6edae0a303765e7", - "reference": "5805f7a4e4958dbb5e944ef1e6edae0a303765e7", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/14f5fff1e64118595db5408e946f3a22c75807f7", + "reference": "14f5fff1e64118595db5408e946f3a22c75807f7", "shasum": "" }, "require": { @@ -5399,11 +5400,11 @@ "php": ">=5.4.0" }, "require-dev": { - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0" + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.3.4" }, "bin": [ - "bin/phpcs", - "bin/phpcbf" + "bin/phpcbf", + "bin/phpcs" ], "type": "library", "extra": { @@ -5456,7 +5457,7 @@ "type": "open_collective" } ], - "time": "2023-12-08T12:32:31+00:00" + "time": "2024-01-11T20:47:48+00:00" }, { "name": "swoole/ide-helper", @@ -5827,9 +5828,18 @@ "time": "2023-11-21T18:54:41+00:00" } ], - "aliases": [], + "aliases": [ + { + "package": "utopia-php/database", + "version": "dev-contains-v2", + "alias": "0.47.99", + "alias_normalized": "0.47.99.0" + } + ], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": { + "utopia-php/database": 20 + }, "prefer-stable": false, "prefer-lowest": false, "platform": { diff --git a/docker-compose.yml b/docker-compose.yml index 8fca5d67f..84fadd2e3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -856,7 +856,7 @@ services: - OPR_PROXY_HEALTHCHECK=enabled mariadb: - image: mariadb:10.7 # fix issues when upgrading using: mysql_upgrade -u root -p + image: mariadb:10.11 # fix issues when upgrading using: mysql_upgrade -u root -p container_name: appwrite-mariadb <<: *x-logging networks: diff --git a/phpunit.xml b/phpunit.xml index 90ebd4225..e77286605 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -6,7 +6,7 @@ convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" - stopOnFailure="false" + stopOnFailure="true" > diff --git a/tests/e2e/Services/Databases/DatabasesBase.php b/tests/e2e/Services/Databases/DatabasesBase.php index b8772b5db..a94e1afde 100644 --- a/tests/e2e/Services/Databases/DatabasesBase.php +++ b/tests/e2e/Services/Databases/DatabasesBase.php @@ -381,6 +381,29 @@ trait DatabasesBase 'twoWayKey' => 'movie' ]); + $strings = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $data['moviesId'] . '/attributes/string', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'key' => 'strings', + 'size' => 512, + 'required' => false, + 'array' => true, + ]); + + $integers = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $data['moviesId'] . '/attributes/integer', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'key' => 'integers', + 'required' => false, + 'array' => true, + 'min' => 1, + 'max' => 999, + ]); + $this->assertEquals(202, $title['headers']['status-code']); $this->assertEquals($title['body']['key'], 'title'); $this->assertEquals($title['body']['type'], 'string'); @@ -431,6 +454,20 @@ trait DatabasesBase $this->assertEquals($relationship['body']['twoWay'], true); $this->assertEquals($relationship['body']['twoWayKey'], 'movie'); + $this->assertEquals(202, $strings['headers']['status-code']); + $this->assertEquals($strings['body']['key'], 'strings'); + $this->assertEquals($strings['body']['type'], 'string'); + $this->assertEquals($strings['body']['size'], 512); + $this->assertEquals($strings['body']['required'], false); + $this->assertEquals($strings['body']['array'], true); + + $this->assertEquals(202, $integers['headers']['status-code']); + $this->assertEquals($integers['body']['key'], 'integers'); + $this->assertEquals($integers['body']['type'], 'integer'); + $this->assertArrayNotHasKey('size', $integers['body']); + $this->assertEquals($integers['body']['required'], false); + $this->assertEquals($integers['body']['array'], true); + // wait for database worker to create attributes sleep(2); @@ -441,7 +478,7 @@ trait DatabasesBase ])); $this->assertIsArray($movies['body']['attributes']); - $this->assertCount(8, $movies['body']['attributes']); + $this->assertCount(10, $movies['body']['attributes']); $this->assertEquals($movies['body']['attributes'][0]['key'], $title['body']['key']); $this->assertEquals($movies['body']['attributes'][1]['key'], $description['body']['key']); $this->assertEquals($movies['body']['attributes'][2]['key'], $tagline['body']['key']); @@ -450,6 +487,8 @@ trait DatabasesBase $this->assertEquals($movies['body']['attributes'][5]['key'], $actors['body']['key']); $this->assertEquals($movies['body']['attributes'][6]['key'], $datetime['body']['key']); $this->assertEquals($movies['body']['attributes'][7]['key'], $relationship['body']['key']); + $this->assertEquals($movies['body']['attributes'][8]['key'], $strings['body']['key']); + $this->assertEquals($movies['body']['attributes'][9]['key'], $integers['body']['key']); return $data; } @@ -673,6 +712,29 @@ trait DatabasesBase 'twoWayKey' => 'twoWayKey' ]); + $strings = $this->client->call(Client::METHOD_POST, $attributesPath . '/string', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'key' => 'names', + 'size' => 512, + 'required' => false, + 'array' => true, + ]); + + $integers = $this->client->call(Client::METHOD_POST, $attributesPath . '/integer', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ]), [ + 'key' => 'numbers', + 'required' => false, + 'array' => true, + 'min' => 1, + 'max' => 999, + ]); + $this->assertEquals(202, $string['headers']['status-code']); $this->assertEquals('string', $string['body']['key']); $this->assertEquals('string', $string['body']['type']); @@ -757,6 +819,22 @@ trait DatabasesBase $this->assertEquals(true, $relationship['body']['twoWay']); $this->assertEquals('twoWayKey', $relationship['body']['twoWayKey']); + $this->assertEquals(202, $strings['headers']['status-code']); + $this->assertEquals('names', $strings['body']['key']); + $this->assertEquals('string', $strings['body']['type']); + $this->assertEquals(false, $strings['body']['required']); + $this->assertEquals(true, $strings['body']['array']); + $this->assertEquals(null, $strings['body']['default']); + + $this->assertEquals(202, $integers['headers']['status-code']); + $this->assertEquals('numbers', $integers['body']['key']); + $this->assertEquals('integer', $integers['body']['type']); + $this->assertEquals(false, $integers['body']['required']); + $this->assertEquals(true, $integers['body']['array']); + $this->assertEquals(1, $integers['body']['min']); + $this->assertEquals(999, $integers['body']['max']); + $this->assertEquals(null, $integers['body']['default']); + // Wait for database worker to create attributes sleep(5); @@ -820,6 +898,18 @@ trait DatabasesBase 'x-appwrite-key' => $this->getProject()['apiKey'] ])); + $stringsResponse = $this->client->call(Client::METHOD_GET, $attributesPath . '/' . $strings['body']['key'], array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ])); + + $integersResponse = $this->client->call(Client::METHOD_GET, $attributesPath . '/' . $integers['body']['key'], array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'] + ])); + $this->assertEquals(200, $stringResponse['headers']['status-code']); $this->assertEquals($string['body']['key'], $stringResponse['body']['key']); $this->assertEquals($string['body']['type'], $stringResponse['body']['type']); @@ -920,11 +1010,11 @@ trait DatabasesBase ])); $this->assertEquals(200, $attributes['headers']['status-code']); - $this->assertEquals(10, $attributes['body']['total']); + $this->assertEquals(12, $attributes['body']['total']); $attributes = $attributes['body']['attributes']; $this->assertIsArray($attributes); - $this->assertCount(10, $attributes); + $this->assertCount(12, $attributes); $this->assertEquals($stringResponse['body']['key'], $attributes[0]['key']); $this->assertEquals($stringResponse['body']['type'], $attributes[0]['type']); @@ -1009,6 +1099,22 @@ trait DatabasesBase $this->assertEquals($relationshipResponse['body']['twoWay'], $attributes[9]['twoWay']); $this->assertEquals($relationshipResponse['body']['twoWayKey'], $attributes[9]['twoWayKey']); + $this->assertEquals($stringsResponse['body']['key'], $attributes[10]['key']); + $this->assertEquals($stringsResponse['body']['type'], $attributes[10]['type']); + $this->assertEquals($stringsResponse['body']['status'], $attributes[10]['status']); + $this->assertEquals($stringsResponse['body']['required'], $attributes[10]['required']); + $this->assertEquals($stringsResponse['body']['array'], $attributes[10]['array']); + $this->assertEquals($stringsResponse['body']['default'], $attributes[10]['default']); + + $this->assertEquals($integersResponse['body']['key'], $attributes[11]['key']); + $this->assertEquals($integersResponse['body']['type'], $attributes[11]['type']); + $this->assertEquals($integersResponse['body']['status'], $attributes[11]['status']); + $this->assertEquals($integersResponse['body']['required'], $attributes[11]['required']); + $this->assertEquals($integersResponse['body']['array'], $attributes[11]['array']); + $this->assertEquals($integersResponse['body']['default'], $attributes[11]['default']); + $this->assertEquals($integersResponse['body']['min'], $attributes[11]['min']); + $this->assertEquals($integersResponse['body']['max'], $attributes[11]['max']); + $collection = $this->client->call(Client::METHOD_GET, '/databases/' . $databaseId . '/collections/' . $collectionId, array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], @@ -1020,7 +1126,7 @@ trait DatabasesBase $attributes = $collection['body']['attributes']; $this->assertIsArray($attributes); - $this->assertCount(10, $attributes); + $this->assertCount(12, $attributes); $this->assertEquals($stringResponse['body']['key'], $attributes[0]['key']); $this->assertEquals($stringResponse['body']['type'], $attributes[0]['type']); @@ -1105,6 +1211,22 @@ trait DatabasesBase $this->assertEquals($relationshipResponse['body']['twoWay'], $attributes[9]['twoWay']); $this->assertEquals($relationshipResponse['body']['twoWayKey'], $attributes[9]['twoWayKey']); + $this->assertEquals($stringsResponse['body']['key'], $attributes[10]['key']); + $this->assertEquals($stringsResponse['body']['type'], $attributes[10]['type']); + $this->assertEquals($stringsResponse['body']['status'], $attributes[10]['status']); + $this->assertEquals($stringsResponse['body']['required'], $attributes[10]['required']); + $this->assertEquals($stringsResponse['body']['array'], $attributes[10]['array']); + $this->assertEquals($stringsResponse['body']['default'], $attributes[10]['default']); + + $this->assertEquals($integersResponse['body']['key'], $attributes[11]['key']); + $this->assertEquals($integersResponse['body']['type'], $attributes[11]['type']); + $this->assertEquals($integersResponse['body']['status'], $attributes[11]['status']); + $this->assertEquals($integersResponse['body']['required'], $attributes[11]['required']); + $this->assertEquals($integersResponse['body']['array'], $attributes[11]['array']); + $this->assertEquals($integersResponse['body']['default'], $attributes[11]['default']); + $this->assertEquals($integersResponse['body']['min'], $attributes[11]['min']); + $this->assertEquals($integersResponse['body']['max'], $attributes[11]['max']); + /** * Test for FAILURE */ @@ -1269,6 +1391,18 @@ trait DatabasesBase $this->assertEquals(400, $tooLong['headers']['status-code']); $this->assertStringContainsString('Index length is longer than the maximum', $tooLong['body']['message']); + $fulltextArray = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $data['moviesId'] . '/indexes', array_merge([ + 'content-type' => 'application/json', + 'x-appwrite-project' => $this->getProject()['$id'], + 'x-appwrite-key' => $this->getProject()['apiKey'], + ]), [ + 'key' => 'ft', + 'type' => 'fulltext', + 'attributes' => ['strings'], + ]); + $this->assertEquals(400, $fulltextArray['headers']['status-code']); + $this->assertStringContainsString('"Fulltext" index is forbidden on array attributes', $fulltextArray['body']['message']); + return $data; }