@@ -1399,12 +1399,14 @@ public function testArrayAttribute(): void
13991399 $ this ->assertEquals ('Antony ' , $ document ->getAttribute ('names ' )[1 ]);
14001400 $ this ->assertEquals (100 , $ document ->getAttribute ('numbers ' )[1 ]);
14011401
1402- /**
1403- * functional index dependency cannot be dropped or rename
1404- */
1405- $ database ->createIndex ($ collection , 'idx_cards ' , Database::INDEX_KEY , ['cards ' ], [100 ]);
1402+ if ($ database ->getAdapter ()->getSupportForIndexArray ()) {
1403+ /**
1404+ * functional index dependency cannot be dropped or rename
1405+ */
1406+ $ database ->createIndex ($ collection , 'idx_cards ' , Database::INDEX_KEY , ['cards ' ], [100 ]);
1407+ }
14061408
1407- if ($ this -> getDatabase () ->getAdapter ()->getSupportForCastIndexArray ()) {
1409+ if ($ database ->getAdapter ()->getSupportForCastIndexArray ()) {
14081410 /**
14091411 * Delete attribute
14101412 */
@@ -1443,22 +1445,24 @@ public function testArrayAttribute(): void
14431445 $ this ->assertTrue ($ database ->deleteAttribute ($ collection , 'cards_new ' ));
14441446 }
14451447
1446- try {
1447- $ database ->createIndex ($ collection , 'indx ' , Database::INDEX_FULLTEXT , ['names ' ]);
1448- $ this ->fail ('Failed to throw exception ' );
1449- } catch (Throwable $ e ) {
1450- if ($ this ->getDatabase ()->getAdapter ()->getSupportForFulltextIndex ()) {
1451- $ this ->assertEquals ('"Fulltext" index is forbidden on array attributes ' , $ e ->getMessage ());
1452- } else {
1453- $ this ->assertEquals ('Fulltext index is not supported ' , $ e ->getMessage ());
1448+ if ($ database ->getAdapter ()->getSupportForIndexArray ()) {
1449+ try {
1450+ $ database ->createIndex ($ collection , 'indx ' , Database::INDEX_FULLTEXT , ['names ' ]);
1451+ $ this ->fail ('Failed to throw exception ' );
1452+ } catch (Throwable $ e ) {
1453+ if ($ database ->getAdapter ()->getSupportForFulltextIndex ()) {
1454+ $ this ->assertEquals ('"Fulltext" index is forbidden on array attributes ' , $ e ->getMessage ());
1455+ } else {
1456+ $ this ->assertEquals ('Fulltext index is not supported ' , $ e ->getMessage ());
1457+ }
14541458 }
1455- }
14561459
1457- try {
1458- $ database ->createIndex ($ collection , 'indx ' , Database::INDEX_KEY , ['numbers ' , 'names ' ], [100 ,100 ]);
1459- $ this ->fail ('Failed to throw exception ' );
1460- } catch (Throwable $ e ) {
1461- $ this ->assertEquals ('An index may only contain one array attribute ' , $ e ->getMessage ());
1460+ try {
1461+ $ database ->createIndex ($ collection , 'indx ' , Database::INDEX_KEY , ['numbers ' , 'names ' ], [100 ,100 ]);
1462+ $ this ->fail ('Failed to throw exception ' );
1463+ } catch (Throwable $ e ) {
1464+ $ this ->assertEquals ('An index may only contain one array attribute ' , $ e ->getMessage ());
1465+ }
14621466 }
14631467
14641468 $ this ->assertEquals (true , $ database ->createAttribute (
@@ -1470,32 +1474,36 @@ public function testArrayAttribute(): void
14701474 array: true
14711475 ));
14721476
1473- if ($ database ->getAdapter ()->getMaxIndexLength () > 0 ) {
1474- // If getMaxIndexLength() > 0 We clear length for array attributes
1475- $ database ->createIndex ($ collection , 'indx1 ' , Database::INDEX_KEY , ['long_size ' ], [], []);
1476- $ database ->createIndex ($ collection , 'indx2 ' , Database::INDEX_KEY , ['long_size ' ], [1000 ], []);
1477+ if ($ database ->getAdapter ()->getSupportForIndexArray ()) {
1478+
1479+
1480+ if ($ database ->getAdapter ()->getMaxIndexLength () > 0 ) {
1481+ // If getMaxIndexLength() > 0 We clear length for array attributes
1482+ $ database ->createIndex ($ collection , 'indx1 ' , Database::INDEX_KEY , ['long_size ' ], [], []);
1483+ $ database ->createIndex ($ collection , 'indx2 ' , Database::INDEX_KEY , ['long_size ' ], [1000 ], []);
1484+
1485+ try {
1486+ $ database ->createIndex ($ collection , 'indx_numbers ' , Database::INDEX_KEY , ['tv_show ' , 'numbers ' ], [], []); // [700, 255]
1487+ $ this ->fail ('Failed to throw exception ' );
1488+ } catch (Throwable $ e ) {
1489+ $ this ->assertEquals ('Index length is longer than the maximum: ' . $ database ->getAdapter ()->getMaxIndexLength (), $ e ->getMessage ());
1490+ }
1491+ }
1492+
1493+ // We clear orders for array attributes
1494+ $ database ->createIndex ($ collection , 'indx3 ' , Database::INDEX_KEY , ['names ' ], [255 ], ['desc ' ]);
14771495
14781496 try {
1479- $ database ->createIndex ($ collection , 'indx_numbers ' , Database::INDEX_KEY , ['tv_show ' , 'numbers ' ], [], []); // [700, 255]
1497+ $ database ->createIndex ($ collection , 'indx4 ' , Database::INDEX_KEY , ['age ' , 'names ' ], [10 , 255 ], []);
14801498 $ this ->fail ('Failed to throw exception ' );
14811499 } catch (Throwable $ e ) {
1482- $ this ->assertEquals ('Index length is longer than the maximum: ' . $ database -> getAdapter ()-> getMaxIndexLength () , $ e ->getMessage ());
1500+ $ this ->assertEquals ('Cannot set a length on "integer" attributes ' , $ e ->getMessage ());
14831501 }
1484- }
1485-
1486- // We clear orders for array attributes
1487- $ database ->createIndex ($ collection , 'indx3 ' , Database::INDEX_KEY , ['names ' ], [255 ], ['desc ' ]);
14881502
1489- try {
1490- $ database ->createIndex ($ collection , 'indx4 ' , Database::INDEX_KEY , ['age ' , 'names ' ], [10 , 255 ], []);
1491- $ this ->fail ('Failed to throw exception ' );
1492- } catch (Throwable $ e ) {
1493- $ this ->assertEquals ('Cannot set a length on "integer" attributes ' , $ e ->getMessage ());
1503+ $ this ->assertTrue ($ database ->createIndex ($ collection , 'indx6 ' , Database::INDEX_KEY , ['age ' , 'names ' ], [null , 999 ], []));
1504+ $ this ->assertTrue ($ database ->createIndex ($ collection , 'indx7 ' , Database::INDEX_KEY , ['age ' , 'booleans ' ], [0 , 999 ], []));
14941505 }
14951506
1496- $ this ->assertTrue ($ database ->createIndex ($ collection , 'indx6 ' , Database::INDEX_KEY , ['age ' , 'names ' ], [null , 999 ], []));
1497- $ this ->assertTrue ($ database ->createIndex ($ collection , 'indx7 ' , Database::INDEX_KEY , ['age ' , 'booleans ' ], [0 , 999 ], []));
1498-
14991507 if ($ this ->getDatabase ()->getAdapter ()->getSupportForQueryContains ()) {
15001508 try {
15011509 $ database ->find ($ collection , [
0 commit comments