@@ -1402,14 +1402,12 @@ public function testArrayAttribute(): void
14021402 $ this ->assertEquals ('Antony ' , $ document ->getAttribute ('names ' )[1 ]);
14031403 $ this ->assertEquals (100 , $ document ->getAttribute ('numbers ' )[1 ]);
14041404
1405- if ($ database ->getAdapter ()->getSupportForIndexArray ()) {
1406- /**
1407- * functional index dependency cannot be dropped or rename
1408- */
1409- $ database ->createIndex ($ collection , 'idx_cards ' , Database::INDEX_KEY , ['cards ' ], [100 ]);
1410- }
1405+ /**
1406+ * functional index dependency cannot be dropped or rename
1407+ */
1408+ $ database ->createIndex ($ collection , 'idx_cards ' , Database::INDEX_KEY , ['cards ' ], [100 ]);
14111409
1412- if ($ database ->getAdapter ()->getSupportForCastIndexArray ()) {
1410+ if ($ this -> getDatabase () ->getAdapter ()->getSupportForCastIndexArray ()) {
14131411 /**
14141412 * Delete attribute
14151413 */
@@ -1448,24 +1446,22 @@ public function testArrayAttribute(): void
14481446 $ this ->assertTrue ($ database ->deleteAttribute ($ collection , 'cards_new ' ));
14491447 }
14501448
1451- if ($ database ->getAdapter ()->getSupportForIndexArray ()) {
1452- try {
1453- $ database ->createIndex ($ collection , 'indx ' , Database::INDEX_FULLTEXT , ['names ' ]);
1454- $ this ->fail ('Failed to throw exception ' );
1455- } catch (Throwable $ e ) {
1456- if ($ database ->getAdapter ()->getSupportForFulltextIndex ()) {
1457- $ this ->assertEquals ('"Fulltext" index is forbidden on array attributes ' , $ e ->getMessage ());
1458- } else {
1459- $ this ->assertEquals ('Fulltext index is not supported ' , $ e ->getMessage ());
1460- }
1449+ try {
1450+ $ database ->createIndex ($ collection , 'indx ' , Database::INDEX_FULLTEXT , ['names ' ]);
1451+ $ this ->fail ('Failed to throw exception ' );
1452+ } catch (Throwable $ e ) {
1453+ if ($ this ->getDatabase ()->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 ());
14611457 }
1458+ }
14621459
1463- try {
1464- $ database ->createIndex ($ collection , 'indx ' , Database::INDEX_KEY , ['numbers ' , 'names ' ], [100 ,100 ]);
1465- $ this ->fail ('Failed to throw exception ' );
1466- } catch (Throwable $ e ) {
1467- $ this ->assertEquals ('An index may only contain one array attribute ' , $ e ->getMessage ());
1468- }
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 ());
14691465 }
14701466
14711467 $ this ->assertEquals (true , $ database ->createAttribute (
@@ -1477,36 +1473,32 @@ public function testArrayAttribute(): void
14771473 array: true
14781474 ));
14791475
1480- if ($ database ->getAdapter ()->getSupportForIndexArray ()) {
1481-
1482-
1483- if ($ database ->getAdapter ()->getMaxIndexLength () > 0 ) {
1484- // If getMaxIndexLength() > 0 We clear length for array attributes
1485- $ database ->createIndex ($ collection , 'indx1 ' , Database::INDEX_KEY , ['long_size ' ], [], []);
1486- $ database ->createIndex ($ collection , 'indx2 ' , Database::INDEX_KEY , ['long_size ' ], [1000 ], []);
1487-
1488- try {
1489- $ database ->createIndex ($ collection , 'indx_numbers ' , Database::INDEX_KEY , ['tv_show ' , 'numbers ' ], [], []); // [700, 255]
1490- $ this ->fail ('Failed to throw exception ' );
1491- } catch (Throwable $ e ) {
1492- $ this ->assertEquals ('Index length is longer than the maximum: ' . $ database ->getAdapter ()->getMaxIndexLength (), $ e ->getMessage ());
1493- }
1494- }
1495-
1496- // We clear orders for array attributes
1497- $ database ->createIndex ($ collection , 'indx3 ' , Database::INDEX_KEY , ['names ' ], [255 ], ['desc ' ]);
1476+ if ($ database ->getAdapter ()->getMaxIndexLength () > 0 ) {
1477+ // If getMaxIndexLength() > 0 We clear length for array attributes
1478+ $ database ->createIndex ($ collection , 'indx1 ' , Database::INDEX_KEY , ['long_size ' ], [], []);
1479+ $ database ->createIndex ($ collection , 'indx2 ' , Database::INDEX_KEY , ['long_size ' ], [1000 ], []);
14981480
14991481 try {
1500- $ database ->createIndex ($ collection , 'indx4 ' , Database::INDEX_KEY , ['age ' , 'names ' ], [10 , 255 ], []);
1482+ $ database ->createIndex ($ collection , 'indx_numbers ' , Database::INDEX_KEY , ['tv_show ' , 'numbers ' ], [], []); // [700, 255]
15011483 $ this ->fail ('Failed to throw exception ' );
15021484 } catch (Throwable $ e ) {
1503- $ this ->assertEquals ('Cannot set a length on "integer" attributes ' , $ e ->getMessage ());
1485+ $ this ->assertEquals ('Index length is longer than the maximum: ' . $ database -> getAdapter ()-> getMaxIndexLength () , $ e ->getMessage ());
15041486 }
1487+ }
1488+
1489+ // We clear orders for array attributes
1490+ $ database ->createIndex ($ collection , 'indx3 ' , Database::INDEX_KEY , ['names ' ], [255 ], ['desc ' ]);
15051491
1506- $ this ->assertTrue ($ database ->createIndex ($ collection , 'indx6 ' , Database::INDEX_KEY , ['age ' , 'names ' ], [null , 999 ], []));
1507- $ this ->assertTrue ($ database ->createIndex ($ collection , 'indx7 ' , Database::INDEX_KEY , ['age ' , 'booleans ' ], [0 , 999 ], []));
1492+ try {
1493+ $ database ->createIndex ($ collection , 'indx4 ' , Database::INDEX_KEY , ['age ' , 'names ' ], [10 , 255 ], []);
1494+ $ this ->fail ('Failed to throw exception ' );
1495+ } catch (Throwable $ e ) {
1496+ $ this ->assertEquals ('Cannot set a length on "integer" attributes ' , $ e ->getMessage ());
15081497 }
15091498
1499+ $ this ->assertTrue ($ database ->createIndex ($ collection , 'indx6 ' , Database::INDEX_KEY , ['age ' , 'names ' ], [null , 999 ], []));
1500+ $ this ->assertTrue ($ database ->createIndex ($ collection , 'indx7 ' , Database::INDEX_KEY , ['age ' , 'booleans ' ], [0 , 999 ], []));
1501+
15101502 if ($ this ->getDatabase ()->getAdapter ()->getSupportForQueryContains ()) {
15111503 try {
15121504 $ database ->find ($ collection , [
0 commit comments