mirror of
https://github.com/appwrite/appwrite.git
synced 2026-05-26 13:51:13 +00:00
testValidateCollectionIndexes
This commit is contained in:
+1
-1
@@ -49,7 +49,7 @@
|
||||
"utopia-php/cache": "0.8.*",
|
||||
"utopia-php/cli": "0.13.*",
|
||||
"utopia-php/config": "0.2.*",
|
||||
"utopia-php/database": "0.36.*",
|
||||
"utopia-php/database":"dev-index-length-validation as 0.36.1",
|
||||
"utopia-php/domains": "1.1.*",
|
||||
"utopia-php/framework": "0.28.*",
|
||||
"utopia-php/image": "0.5.*",
|
||||
|
||||
Generated
+45
-43
@@ -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": "169ab6e7dd540e45309d3c5093506fad",
|
||||
"content-hash": "d10761b503cdf45b1c33899f769667ae",
|
||||
"packages": [
|
||||
{
|
||||
"name": "adhocore/jwt",
|
||||
@@ -481,16 +481,16 @@
|
||||
},
|
||||
{
|
||||
"name": "guzzlehttp/guzzle",
|
||||
"version": "7.5.1",
|
||||
"version": "7.6.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/guzzle/guzzle.git",
|
||||
"reference": "b964ca597e86b752cd994f27293e9fa6b6a95ed9"
|
||||
"reference": "8444a2bacf1960bc6a2b62ed86b8e72e11eebe51"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/b964ca597e86b752cd994f27293e9fa6b6a95ed9",
|
||||
"reference": "b964ca597e86b752cd994f27293e9fa6b6a95ed9",
|
||||
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/8444a2bacf1960bc6a2b62ed86b8e72e11eebe51",
|
||||
"reference": "8444a2bacf1960bc6a2b62ed86b8e72e11eebe51",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -521,9 +521,6 @@
|
||||
"bamarni-bin": {
|
||||
"bin-links": true,
|
||||
"forward-command": false
|
||||
},
|
||||
"branch-alias": {
|
||||
"dev-master": "7.5-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
@@ -589,7 +586,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/guzzle/guzzle/issues",
|
||||
"source": "https://github.com/guzzle/guzzle/tree/7.5.1"
|
||||
"source": "https://github.com/guzzle/guzzle/tree/7.6.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -605,7 +602,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-04-17T16:30:08+00:00"
|
||||
"time": "2023-05-15T20:43:01+00:00"
|
||||
},
|
||||
{
|
||||
"name": "guzzlehttp/promises",
|
||||
@@ -2109,16 +2106,16 @@
|
||||
},
|
||||
{
|
||||
"name": "utopia-php/database",
|
||||
"version": "0.36.1",
|
||||
"version": "dev-index-length-validation",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/utopia-php/database.git",
|
||||
"reference": "f6ab65e59a199da5155c114564077b1ab8c4daef"
|
||||
"reference": "1502b9353fba6a2c3e06dabc0155ce5445303045"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/utopia-php/database/zipball/f6ab65e59a199da5155c114564077b1ab8c4daef",
|
||||
"reference": "f6ab65e59a199da5155c114564077b1ab8c4daef",
|
||||
"url": "https://api.github.com/repos/utopia-php/database/zipball/1502b9353fba6a2c3e06dabc0155ce5445303045",
|
||||
"reference": "1502b9353fba6a2c3e06dabc0155ce5445303045",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -2161,9 +2158,9 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/utopia-php/database/issues",
|
||||
"source": "https://github.com/utopia-php/database/tree/0.36.1"
|
||||
"source": "https://github.com/utopia-php/database/tree/index-length-validation"
|
||||
},
|
||||
"time": "2023-04-27T08:39:55+00:00"
|
||||
"time": "2023-05-18T07:51:41+00:00"
|
||||
},
|
||||
{
|
||||
"name": "utopia-php/domains",
|
||||
@@ -3784,22 +3781,23 @@
|
||||
},
|
||||
{
|
||||
"name": "phpstan/phpdoc-parser",
|
||||
"version": "1.20.3",
|
||||
"version": "1.21.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpstan/phpdoc-parser.git",
|
||||
"reference": "6c04009f6cae6eda2f040745b6b846080ef069c2"
|
||||
"reference": "6df62b08faef4f899772bc7c3bbabb93d2b7a21c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/6c04009f6cae6eda2f040745b6b846080ef069c2",
|
||||
"reference": "6c04009f6cae6eda2f040745b6b846080ef069c2",
|
||||
"url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/6df62b08faef4f899772bc7c3bbabb93d2b7a21c",
|
||||
"reference": "6df62b08faef4f899772bc7c3bbabb93d2b7a21c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.2 || ^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"nikic/php-parser": "^4.15",
|
||||
"php-parallel-lint/php-parallel-lint": "^1.2",
|
||||
"phpstan/extension-installer": "^1.0",
|
||||
"phpstan/phpstan": "^1.5",
|
||||
@@ -3823,9 +3821,9 @@
|
||||
"description": "PHPDoc parser with support for nullable, intersection and generic types",
|
||||
"support": {
|
||||
"issues": "https://github.com/phpstan/phpdoc-parser/issues",
|
||||
"source": "https://github.com/phpstan/phpdoc-parser/tree/1.20.3"
|
||||
"source": "https://github.com/phpstan/phpdoc-parser/tree/1.21.0"
|
||||
},
|
||||
"time": "2023-04-25T09:01:03+00:00"
|
||||
"time": "2023-05-17T13:13:44+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-code-coverage",
|
||||
@@ -4548,16 +4546,16 @@
|
||||
},
|
||||
{
|
||||
"name": "sebastian/diff",
|
||||
"version": "4.0.4",
|
||||
"version": "4.0.5",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/sebastianbergmann/diff.git",
|
||||
"reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d"
|
||||
"reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3461e3fccc7cfdfc2720be910d3bd73c69be590d",
|
||||
"reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d",
|
||||
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/74be17022044ebaaecfdf0c5cd504fc9cd5a7131",
|
||||
"reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -4602,7 +4600,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/sebastianbergmann/diff/issues",
|
||||
"source": "https://github.com/sebastianbergmann/diff/tree/4.0.4"
|
||||
"source": "https://github.com/sebastianbergmann/diff/tree/4.0.5"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -4610,7 +4608,7 @@
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2020-10-26T13:10:38+00:00"
|
||||
"time": "2023-05-07T05:35:17+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/environment",
|
||||
@@ -5577,16 +5575,16 @@
|
||||
},
|
||||
{
|
||||
"name": "twig/twig",
|
||||
"version": "v3.5.1",
|
||||
"version": "v3.6.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/twigphp/Twig.git",
|
||||
"reference": "a6e0510cc793912b451fd40ab983a1d28f611c15"
|
||||
"reference": "106c170d08e8415d78be2d16c3d057d0d108262b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/twigphp/Twig/zipball/a6e0510cc793912b451fd40ab983a1d28f611c15",
|
||||
"reference": "a6e0510cc793912b451fd40ab983a1d28f611c15",
|
||||
"url": "https://api.github.com/repos/twigphp/Twig/zipball/106c170d08e8415d78be2d16c3d057d0d108262b",
|
||||
"reference": "106c170d08e8415d78be2d16c3d057d0d108262b",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -5595,15 +5593,10 @@
|
||||
"symfony/polyfill-mbstring": "^1.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"psr/container": "^1.0",
|
||||
"psr/container": "^1.0|^2.0",
|
||||
"symfony/phpunit-bridge": "^4.4.9|^5.0.9|^6.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "3.5-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Twig\\": "src/"
|
||||
@@ -5637,7 +5630,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/twigphp/Twig/issues",
|
||||
"source": "https://github.com/twigphp/Twig/tree/v3.5.1"
|
||||
"source": "https://github.com/twigphp/Twig/tree/v3.6.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -5649,12 +5642,21 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-02-08T07:49:20+00:00"
|
||||
"time": "2023-05-03T19:06:57+00:00"
|
||||
}
|
||||
],
|
||||
"aliases": [
|
||||
{
|
||||
"package": "utopia-php/database",
|
||||
"version": "dev-index-length-validation",
|
||||
"alias": "0.36.1",
|
||||
"alias_normalized": "0.36.1.0"
|
||||
}
|
||||
],
|
||||
"aliases": [],
|
||||
"minimum-stability": "stable",
|
||||
"stability-flags": [],
|
||||
"stability-flags": {
|
||||
"utopia-php/database": 20
|
||||
},
|
||||
"prefer-stable": false,
|
||||
"prefer-lowest": false,
|
||||
"platform": {
|
||||
@@ -5678,5 +5680,5 @@
|
||||
"platform-overrides": {
|
||||
"php": "8.0"
|
||||
},
|
||||
"plugin-api-version": "2.3.0"
|
||||
"plugin-api-version": "2.2.0"
|
||||
}
|
||||
|
||||
@@ -3,9 +3,13 @@
|
||||
namespace Tests\Unit\General;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Utopia\Database\Document;
|
||||
use Utopia\Database\Helpers\ID;
|
||||
use Utopia\Database\Validator\Index;
|
||||
|
||||
class CollectionsTest extends TestCase
|
||||
{
|
||||
/** @var array<mixed> $collections */
|
||||
protected array $collections;
|
||||
|
||||
public function setUp(): void
|
||||
@@ -29,4 +33,23 @@ class CollectionsTest extends TestCase
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function testValidateCollectionIndexes(): void
|
||||
{
|
||||
$validator = new Index();
|
||||
|
||||
foreach ($this->collections as $collection) {
|
||||
$document = new Document();
|
||||
|
||||
foreach ($collection['attributes'] as $attribute) {
|
||||
$document->setAttribute('attributes', new Document($attribute), Document::SET_TYPE_APPEND);
|
||||
}
|
||||
|
||||
foreach ($collection['indexes'] as $index) {
|
||||
$document->setAttribute('indexes', new Document($index), Document::SET_TYPE_APPEND);
|
||||
}
|
||||
|
||||
$this->assertTrue($validator->isValid($document));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user