Skip to content

Commit 7da7023

Browse files
Enhance index validation tests by adding support checks for spatial attributes, unique indexes, and fulltext indexes
1 parent 8bd5e0e commit 7da7023

1 file changed

Lines changed: 18 additions & 4 deletions

File tree

tests/e2e/Adapter/Scopes/IndexTests.php

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,11 @@ public function testIndexValidation(): void
175175
$database->getAdapter()->getSupportForMultipleFulltextIndexes(),
176176
$database->getAdapter()->getSupportForIdenticalIndexes(),
177177
$database->getAdapter()->getSupportForObject(),
178-
$database->getAdapter()->getSupportForTrigramIndex()
178+
$database->getAdapter()->getSupportForTrigramIndex(),
179+
$database->getAdapter()->getSupportForSpatialAttributes(),
180+
$database->getAdapter()->getSupportForIndex(),
181+
$database->getAdapter()->getSupportForUniqueIndex(),
182+
$database->getAdapter()->getSupportForFulltextIndex()
179183
);
180184
if ($database->getAdapter()->getSupportForIdenticalIndexes()) {
181185
$errorMessage = 'Index length 701 is larger than the size for title1: 700"';
@@ -268,12 +272,18 @@ public function testIndexValidation(): void
268272
$database->getAdapter()->getSupportForMultipleFulltextIndexes(),
269273
$database->getAdapter()->getSupportForIdenticalIndexes(),
270274
$database->getAdapter()->getSupportForObject(),
271-
$database->getAdapter()->getSupportForTrigramIndex()
275+
$database->getAdapter()->getSupportForTrigramIndex(),
276+
$database->getAdapter()->getSupportForSpatialAttributes(),
277+
$database->getAdapter()->getSupportForIndex(),
278+
$database->getAdapter()->getSupportForUniqueIndex(),
279+
$database->getAdapter()->getSupportForFulltextIndex()
272280
);
273281

274282
$this->assertFalse($validator->isValid($newIndex));
275283

276-
if (!$database->getAdapter()->getSupportForMultipleFulltextIndexes()) {
284+
if (!$database->getAdapter()->getSupportForFulltextIndex()) {
285+
$this->assertEquals('Fulltext index is not supported', $validator->getDescription());
286+
} elseif (!$database->getAdapter()->getSupportForMultipleFulltextIndexes()) {
277287
$this->assertEquals('There is already a fulltext index in the collection', $validator->getDescription());
278288
} elseif ($database->getAdapter()->getSupportForAttributes()) {
279289
$this->assertEquals('Attribute "integer" cannot be part of a fulltext index, must be of type string', $validator->getDescription());
@@ -285,7 +295,11 @@ public function testIndexValidation(): void
285295
$this->fail('Failed to throw exception');
286296
}
287297
} catch (Exception $e) {
288-
$this->assertEquals('Fulltext index is not supported', $e->getMessage());
298+
if (!$database->getAdapter()->getSupportForFulltextIndex()) {
299+
$this->assertEquals('Fulltext index is not supported', $e->getMessage());
300+
} else {
301+
$this->assertEquals('Attribute "integer" cannot be part of a fulltext index, must be of type string', $e->getMessage());
302+
}
289303
}
290304

291305

0 commit comments

Comments
 (0)