From f306c03030f952b864f06c05ed444baeba7db9eb Mon Sep 17 00:00:00 2001 From: ArnabChatterjee20k Date: Tue, 28 Oct 2025 18:32:17 +0530 Subject: [PATCH] updated tests and index creation --- app/config/collections/projects.php | 10 ++ app/controllers/api/migrations.php | 8 +- composer.json | 2 +- composer.lock | 100 ++++++++++++++---- .../Databases/Collections/Indexes/Create.php | 48 ++++----- .../Collections/Indexes/Create.php | 14 +-- .../Databases/DocumentsDB/DatabasesBase.php | 10 +- .../Databases/Legacy/DatabasesBase.php | 15 +-- .../Database/Validator/CompoundUIDTest.php | 4 +- .../Database/Validator/CustomIdTest.php | 4 +- 10 files changed, 128 insertions(+), 87 deletions(-) diff --git a/app/config/collections/projects.php b/app/config/collections/projects.php index 78a59b1f0d..4d7b0bcec1 100644 --- a/app/config/collections/projects.php +++ b/app/config/collections/projects.php @@ -70,6 +70,16 @@ return [ 'array' => false, 'filters' => [], ], + [ + '$id' => ID::custom('databases'), + 'type' => Database::VAR_STRING, + 'format' => '', + 'size' => 65535, + 'signed' => true, + 'required' => false, + 'array' => true, + 'filters' => [], + ], ], 'indexes' => [ [ diff --git a/app/controllers/api/migrations.php b/app/controllers/api/migrations.php index cf9f23c2ce..339cab88fe 100644 --- a/app/controllers/api/migrations.php +++ b/app/controllers/api/migrations.php @@ -563,12 +563,10 @@ App::get('/v1/migrations/appwrite/report') ->param('projectID', '', new Text(512), "Source's Project ID") ->param('key', '', new Text(512), "Source's API Key") ->inject('response') - ->inject('dbForProject') - ->inject('project') - ->inject('user') - ->action(function (array $resources, string $endpoint, string $projectID, string $key, Response $response) { + ->inject('getDatabasesDB') + ->action(function (array $resources, string $endpoint, string $projectID, string $key, Response $response, callable $getDatabasesDB) { - $appwrite = new Appwrite($projectID, $endpoint, $key); + $appwrite = new Appwrite($projectID, $endpoint, $key, $getDatabasesDB); try { $report = $appwrite->report($resources); diff --git a/composer.json b/composer.json index 3d28409c8d..7691feea13 100644 --- a/composer.json +++ b/composer.json @@ -65,7 +65,7 @@ "utopia-php/locale": "0.8.*", "utopia-php/logger": "0.6.*", "utopia-php/messaging": "0.20.*", - "utopia-php/migration": "1.*", + "utopia-php/migration": "dev-feat-documents-db as 1.1.1", "utopia-php/orchestration": "0.9.*", "utopia-php/platform": "0.7.*", "utopia-php/pools": "0.8.*", diff --git a/composer.lock b/composer.lock index a08ca2abd0..829677b089 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": "7f99c98a17e1d3608bf1c26f76bca972", + "content-hash": "47ceb116e4bcf4f621bdc3e198d30c4c", "packages": [ { "name": "adhocore/jwt", @@ -3785,6 +3785,54 @@ }, "time": "2020-10-24T09:49:09+00:00" }, + { + "name": "utopia-php/console", + "version": "0.0.1", + "source": { + "type": "git", + "url": "https://github.com/utopia-php/console.git", + "reference": "f77104e4a888fa9cb3e08f32955ec09479ab7a92" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/utopia-php/console/zipball/f77104e4a888fa9cb3e08f32955ec09479ab7a92", + "reference": "f77104e4a888fa9cb3e08f32955ec09479ab7a92", + "shasum": "" + }, + "require": { + "php": ">=7.4" + }, + "require-dev": { + "laravel/pint": "1.2.*", + "phpstan/phpstan": "^1.10", + "phpunit/phpunit": "^9.3", + "squizlabs/php_codesniffer": "^3.6", + "swoole/ide-helper": "4.8.8" + }, + "type": "library", + "autoload": { + "psr-4": { + "Utopia\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Console helpers for logging, prompting, and executing commands", + "keywords": [ + "cli", + "console", + "php", + "terminal", + "utopia" + ], + "support": { + "issues": "https://github.com/utopia-php/console/issues", + "source": "https://github.com/utopia-php/console/tree/0.0.1" + }, + "time": "2025-10-20T14:41:36+00:00" + }, { "name": "utopia-php/database", "version": "dev-var_object", @@ -3845,16 +3893,16 @@ }, { "name": "utopia-php/detector", - "version": "0.2.0", + "version": "0.2.1", "source": { "type": "git", "url": "https://github.com/utopia-php/detector.git", - "reference": "795ed56169af833fd6a4ea58a6c747e05ccc7ba6" + "reference": "89f96e864220de13800cf398a1f1686a85401eaa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/detector/zipball/795ed56169af833fd6a4ea58a6c747e05ccc7ba6", - "reference": "795ed56169af833fd6a4ea58a6c747e05ccc7ba6", + "url": "https://api.github.com/repos/utopia-php/detector/zipball/89f96e864220de13800cf398a1f1686a85401eaa", + "reference": "89f96e864220de13800cf398a1f1686a85401eaa", "shasum": "" }, "require": { @@ -3884,9 +3932,9 @@ ], "support": { "issues": "https://github.com/utopia-php/detector/issues", - "source": "https://github.com/utopia-php/detector/tree/0.2.0" + "source": "https://github.com/utopia-php/detector/tree/0.2.1" }, - "time": "2025-10-21T13:57:30+00:00" + "time": "2025-10-27T13:38:33+00:00" }, { "name": "utopia-php/dns", @@ -4342,16 +4390,16 @@ }, { "name": "utopia-php/migration", - "version": "1.2.1", + "version": "dev-feat-documents-db", "source": { "type": "git", "url": "https://github.com/utopia-php/migration.git", - "reference": "d0f9978aff8be3c160df50fcbb1ae35ffea7476b" + "reference": "c4a6fe9a575dee566c80c954f7f133275032583d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/utopia-php/migration/zipball/d0f9978aff8be3c160df50fcbb1ae35ffea7476b", - "reference": "d0f9978aff8be3c160df50fcbb1ae35ffea7476b", + "url": "https://api.github.com/repos/utopia-php/migration/zipball/c4a6fe9a575dee566c80c954f7f133275032583d", + "reference": "c4a6fe9a575dee566c80c954f7f133275032583d", "shasum": "" }, "require": { @@ -4359,9 +4407,9 @@ "ext-curl": "*", "ext-openssl": "*", "php": ">=8.1", - "utopia-php/database": "1.*", + "utopia-php/console": "0.0.*", + "utopia-php/database": "dev-var_object as 1.4.5", "utopia-php/dsn": "0.2.*", - "utopia-php/framework": "0.33.*", "utopia-php/storage": "0.18.*" }, "require-dev": { @@ -4369,7 +4417,6 @@ "laravel/pint": "1.*", "phpstan/phpstan": "1.*", "phpunit/phpunit": "11.*", - "utopia-php/cli": "0.16.*", "vlucas/phpdotenv": "5.*" }, "type": "library", @@ -4392,9 +4439,9 @@ ], "support": { "issues": "https://github.com/utopia-php/migration/issues", - "source": "https://github.com/utopia-php/migration/tree/1.2.1" + "source": "https://github.com/utopia-php/migration/tree/feat-documents-db" }, - "time": "2025-10-13T01:55:03+00:00" + "time": "2025-10-27T10:19:57+00:00" }, { "name": "utopia-php/mongo", @@ -5266,16 +5313,16 @@ "packages-dev": [ { "name": "appwrite/sdk-generator", - "version": "1.4.14", + "version": "1.4.15", "source": { "type": "git", "url": "https://github.com/appwrite/sdk-generator.git", - "reference": "b9405ccaeac5619c76558a82b7bfeb440b665b9f" + "reference": "b4a2fd9e92903c2e156f17fc5dafe102e6cfdfda" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/b9405ccaeac5619c76558a82b7bfeb440b665b9f", - "reference": "b9405ccaeac5619c76558a82b7bfeb440b665b9f", + "url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/b4a2fd9e92903c2e156f17fc5dafe102e6cfdfda", + "reference": "b4a2fd9e92903c2e156f17fc5dafe102e6cfdfda", "shasum": "" }, "require": { @@ -5311,9 +5358,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/1.4.14" + "source": "https://github.com/appwrite/sdk-generator/tree/1.4.15" }, - "time": "2025-10-27T11:17:01+00:00" + "time": "2025-10-28T04:52:59+00:00" }, { "name": "doctrine/annotations", @@ -8784,11 +8831,18 @@ "version": "dev-var_object", "alias": "1.4.5", "alias_normalized": "1.4.5.0" + }, + { + "package": "utopia-php/migration", + "version": "dev-feat-documents-db", + "alias": "1.1.1", + "alias_normalized": "1.1.1.0" } ], "minimum-stability": "dev", "stability-flags": { - "utopia-php/database": 20 + "utopia-php/database": 20, + "utopia-php/migration": 20 }, "prefer-stable": true, "prefer-lowest": false, diff --git a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Create.php index f1c3e07400..85d9fe8a53 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/Databases/Collections/Indexes/Create.php @@ -163,22 +163,22 @@ class Create extends Action throw new Exception($this->getParentInvalidTypeException(), "Cannot create an index for a relationship $contextType: " . $oldAttributes[$attributeIndex]['key']); } - // Ensure attribute is available - if ($attributeStatus !== 'available') { - $contextType = ucfirst($contextType); - throw new Exception($this->getParentNotAvailableException(), "$contextType not available: " . $oldAttributes[$attributeIndex]['key']); - } + // Ensure attribute is available + if ($attributeStatus !== 'available') { + $contextType = ucfirst($contextType); + throw new Exception($this->getParentNotAvailableException(), "$contextType not available: " . $oldAttributes[$attributeIndex]['key']); + } if (empty($lengths[$i])) { $lengths[$i] = null; } - if ($attributeArray === true) { - $lengths[$i] = Database::MAX_ARRAY_INDEX_LENGTH; - $orders[$i] = null; + if ($attributeArray === true) { + $lengths[$i] = Database::MAX_ARRAY_INDEX_LENGTH; + $orders[$i] = null; + } } } - $index = new Document([ '$id' => ID::custom($db->getSequence() . '_' . $collection->getSequence() . '_' . $key), 'key' => $key, @@ -193,28 +193,19 @@ class Create extends Action 'orders' => $orders, ]); - $maxIndexLength = $dbForDatabases->getAdapter()->getMaxIndexLength(); - $internalIndexesKeys = $dbForDatabases->getAdapter()->getInternalIndexesKeys(); - $supportForIndexArray = $dbForDatabases->getAdapter()->getSupportForIndexArray(); - $supportForSpatialAttributes = $dbForDatabases->getAdapter()->getSupportForSpatialAttributes(); - $supportForSpatialIndexNull = $dbForDatabases->getAdapter()->getSupportForSpatialIndexNull(); - $supportForSpatialIndexOrder = $dbForDatabases->getAdapter()->getSupportForSpatialIndexOrder(); - $supportForAttributes = $dbForDatabases->getAdapter()->getSupportForAttributes(); - $supportForMultipleFulltextIndexes = $dbForDatabases->getAdapter()->getSupportForMultipleFulltextIndexes(); - $supportForIdenticalIndexes = $dbForDatabases->getAdapter()->getSupportForIdenticalIndexes(); - $validator = new IndexValidator( $collection->getAttribute('attributes'), $collection->getAttribute('indexes'), - $maxIndexLength, - $internalIndexesKeys, - $supportForIndexArray, - $supportForSpatialAttributes, - $supportForSpatialIndexNull, - $supportForSpatialIndexOrder, - $supportForAttributes, - $supportForMultipleFulltextIndexes, - $supportForIdenticalIndexes + $dbForDatabases->getAdapter()->getMaxIndexLength(), + $dbForDatabases->getAdapter()->getInternalIndexesKeys(), + $dbForDatabases->getAdapter()->getSupportForIndexArray(), + $dbForDatabases->getAdapter()->getSupportForSpatialIndexNull(), + $dbForDatabases->getAdapter()->getSupportForSpatialIndexOrder(), + $dbForDatabases->getAdapter()->getSupportForVectors(), + $dbForDatabases->getAdapter()->getSupportForAttributes(), + $dbForDatabases->getAdapter()->getSupportForMultipleFulltextIndexes(), + $dbForDatabases->getAdapter()->getSupportForIdenticalIndexes(), + $dbForDatabases->getAdapter()->getSupportForObject() ); if (!$validator->isValid($index)) { @@ -256,4 +247,3 @@ class Create extends Action ->dynamic($index, $this->getResponseModel()); } } -} \ No newline at end of file diff --git a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Indexes/Create.php b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Indexes/Create.php index ea09c11b23..09ec5abca1 100644 --- a/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Indexes/Create.php +++ b/src/Appwrite/Platform/Modules/Databases/Http/DocumentsDB/Collections/Indexes/Create.php @@ -36,11 +36,11 @@ class Create extends IndexCreate ->setHttpPath('/v1/documentsdb/:databaseId/collections/:collectionId/indexes') ->desc('Create index') ->groups(['api', 'database']) - ->label('event', 'databases.[databaseId].tables.[tableId].indexes.[indexId].create') + ->label('event', 'databases.[databaseId].collections.[collectionId].indexes.[indexId].create') ->label('scope', 'collections.write') ->label('resourceType', RESOURCE_TYPE_DATABASES) ->label('audits.event', 'index.create') - ->label('audits.resource', 'database/{request.databaseId}/collection/{request.tableId}') + ->label('audits.resource', 'database/{request.databaseId}/collection/{request.collectionId}') ->label('sdk', new Method( namespace: 'documentsDB', group: $this->getSdkGroup(), @@ -55,11 +55,11 @@ class Create extends IndexCreate ], contentType: ContentType::JSON )) - ->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]), '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('databaseId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Database ID.', false, ['dbForProject']) + ->param('collectionId', '', fn (Database $dbForProject) => new UID($dbForProject->getAdapter()->getMaxUIDLength()), 'Collection ID. You can create a new collection using the Database service [server integration](https://appwrite.io/docs/server/databases#databasesCreateCollection).', false, ['dbForProject']) + ->param('key', null, fn (Database $dbForProject) => new Key(false, $dbForProject->getAdapter()->getMaxUIDLength()), 'Index Key.', false, ['dbForProject']) + ->param('type', null, new WhiteList([Database::INDEX_KEY, Database::INDEX_FULLTEXT, Database::INDEX_UNIQUE, Database::INDEX_SPATIAL]), 'Index type.') + ->param('attributes', null, fn (Database $dbForProject) => new ArrayList(new Key(true, $dbForProject->getAdapter()->getMaxUIDLength()), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Array of attributes to index. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE . ' attributes are allowed, each 32 characters long.', false, ['dbForProject']) ->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) ->param('lengths', [], new ArrayList(new Nullable(new Integer()), APP_LIMIT_ARRAY_PARAMS_SIZE), 'Length of index. Maximum of ' . APP_LIMIT_ARRAY_PARAMS_SIZE, optional: true) ->inject('response') diff --git a/tests/e2e/Services/Databases/DocumentsDB/DatabasesBase.php b/tests/e2e/Services/Databases/DocumentsDB/DatabasesBase.php index d53b8ed7b8..8736357f36 100644 --- a/tests/e2e/Services/Databases/DocumentsDB/DatabasesBase.php +++ b/tests/e2e/Services/Databases/DocumentsDB/DatabasesBase.php @@ -3,8 +3,8 @@ namespace Tests\E2E\Services\Databases\DocumentsDB; use Appwrite\Extend\Exception; -use Tests\E2E\Client; use Appwrite\Tests\Retry; +use Tests\E2E\Client; use Utopia\Database\Database; use Utopia\Database\DateTime; use Utopia\Database\Document; @@ -456,7 +456,7 @@ trait DatabasesBase $this->assertEquals([128, 200], $index['body']['lengths']); // Test case for lengths array overriding - // set a length for an array attribute, it should get overriden with Database::ARRAY_INDEX_LENGTH + // set a length for an array attribute, it should get overriden with Database::MAX_ARRAY_INDEX_LENGTH $create = $this->client->call(Client::METHOD_POST, "/documentsdb/{$databaseId}/collections/{$collectionId}/indexes", [ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], @@ -465,7 +465,7 @@ trait DatabasesBase 'key' => 'lengthOverrideTestIndex', 'type' => 'key', 'attributes' => ['actors-new'], - 'lengths' => [Database::ARRAY_INDEX_LENGTH] + 'lengths' => [Database::MAX_ARRAY_INDEX_LENGTH] ]); $this->assertEquals(202, $create['headers']['status-code']); @@ -474,7 +474,7 @@ trait DatabasesBase 'x-appwrite-project' => $this->getProject()['$id'], 'x-appwrite-key' => $this->getProject()['apiKey'] ]); - $this->assertEquals([Database::ARRAY_INDEX_LENGTH], $index['body']['lengths']); + $this->assertEquals([Database::MAX_ARRAY_INDEX_LENGTH], $index['body']['lengths']); // Test case for count of lengths greater than attributes (should throw 400) $create = $this->client->call(Client::METHOD_POST, "/documentsdb/{$databaseId}/collections/{$collectionId}/indexes", [ @@ -3050,7 +3050,7 @@ trait DatabasesBase Query::notEqual('longtext', 'appwrite')->toString(), ], ]); - + $this->assertEquals(408, $response['headers']['status-code']); }, 100000, 500); diff --git a/tests/e2e/Services/Databases/Legacy/DatabasesBase.php b/tests/e2e/Services/Databases/Legacy/DatabasesBase.php index cf3e417d84..5551a1d268 100644 --- a/tests/e2e/Services/Databases/Legacy/DatabasesBase.php +++ b/tests/e2e/Services/Databases/Legacy/DatabasesBase.php @@ -1309,11 +1309,10 @@ trait DatabasesBase // MongoDB only allows one fulltext index per collection, so it returns a different error if ($this->isMongoDB()) { - $this->assertEquals($fulltextReleaseYear['body']['message'], 'Attribute "releaseYear" cannot be part of a fulltext index, must be of type string'); + $this->assertEquals('There is already a fulltext index in the collection', $fulltextReleaseYear['body']['message']); } else { $this->assertEquals('Attribute "releaseYear" cannot be part of a fulltext index, must be of type string', $fulltextReleaseYear['body']['message']); } - $noAttributes = $this->client->call(Client::METHOD_POST, '/databases/' . $databaseId . '/collections/' . $data['moviesId'] . '/indexes', array_merge([ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], @@ -1502,17 +1501,7 @@ trait DatabasesBase $this->assertEquals([128, 200], $index['body']['lengths']); // Test case for lengths array overriding - // set a length for an array attribute, it should get overridden with Database::ARRAY_INDEX_LENGTH - if ($this->isMongoDB()) { - // MongoDB doesn't support identical indexes, so delete the existing one first - $this->client->call(Client::METHOD_DELETE, "/databases/{$databaseId}/collections/{$collectionId}/indexes/index-actors", [ - 'content-type' => 'application/json', - 'x-appwrite-project' => $this->getProject()['$id'], - 'x-appwrite-key' => $this->getProject()['apiKey'] - ]); - sleep(2); - } - + // set a length for an array attribute, it should get overriden with Database::ARRAY_INDEX_LENGTH $create = $this->client->call(Client::METHOD_POST, "/databases/{$databaseId}/collections/{$collectionId}/indexes", [ 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], diff --git a/tests/unit/Utopia/Database/Validator/CompoundUIDTest.php b/tests/unit/Utopia/Database/Validator/CompoundUIDTest.php index 1997a85018..b443cf590b 100644 --- a/tests/unit/Utopia/Database/Validator/CompoundUIDTest.php +++ b/tests/unit/Utopia/Database/Validator/CompoundUIDTest.php @@ -29,8 +29,8 @@ class CompoundUIDTest extends TestCase $this->assertEquals($this->object->isValid('as$$5da:sdasdas'), false); $this->assertEquals($this->object->isValid(false), false); $this->assertEquals($this->object->isValid(null), false); - $this->assertEquals($this->object->isValid('socialAccountForYoutubeAndRestSubscribers:12345'), true); - $this->assertEquals($this->object->isValid('socialAccountForYoutubeAndRSubscriber:12345'), true); + $this->assertEquals($this->object->isValid('socialAccountForYoutubeAndRestSubscribers:12345'), false); + $this->assertEquals($this->object->isValid('socialAccountForYoutubeAndRSubscriber:12345'), false); $this->assertEquals($this->object->isValid('socialAccount:ForYoutubeSubscribe'), true); $this->assertEquals($this->object->isValid('socialAccountForYoutubeSubscribe:socialAccountForYoutubeSubscribe'), true); } diff --git a/tests/unit/Utopia/Database/Validator/CustomIdTest.php b/tests/unit/Utopia/Database/Validator/CustomIdTest.php index 4dc029ac1d..e8c37a3f72 100644 --- a/tests/unit/Utopia/Database/Validator/CustomIdTest.php +++ b/tests/unit/Utopia/Database/Validator/CustomIdTest.php @@ -30,8 +30,8 @@ class CustomIdTest extends TestCase $this->assertEquals($this->object->isValid('as$$5dasdasdas'), false); $this->assertEquals($this->object->isValid(false), false); $this->assertEquals($this->object->isValid(null), false); - $this->assertEquals($this->object->isValid('socialAccountForYoutubeAndRestSubscribers'), true); - $this->assertEquals($this->object->isValid('socialAccountForYoutubeAndRSubscriber'), true); + $this->assertEquals($this->object->isValid('socialAccountForYoutubeAndRestSubscribers'), false); + $this->assertEquals($this->object->isValid('socialAccountForYoutubeAndRSubscriber'), false); $this->assertEquals($this->object->isValid('socialAccountForYoutubeSubscribe'), true); $this->assertEquals($this->object->isValid('socialAccountForYoutubeSubscrib'), true); }