@@ -30,11 +30,6 @@ abstract static protected function getAdapterName(): string;
3030 */
3131 abstract static protected function getAdapterRowLimit (): int ;
3232
33- /**
34- * @return int
35- */
36- abstract static protected function getUsedIndexes (): int ;
37-
3833 public function setUp (): void
3934 {
4035 Authorization::setRole ('role:all ' );
@@ -1270,10 +1265,10 @@ public function testWritePermissionsUpdateFailure(Document $document)
12701265
12711266 public function testExceptionAttributeLimit ()
12721267 {
1273- if (static :: getAdapterName () === ' mariadb ' || static :: getAdapterName () === ' mysql ' ) {
1268+ if ($ this -> getDatabase ()-> getAttributeLimit () > 0 ) {
12741269 // load the collection up to the limit
12751270 $ attributes = [];
1276- for ($ i =0 ; $ i < 1012 ; $ i ++) {
1271+ for ($ i =0 ; $ i < $ this -> getDatabase ()-> getAttributeLimit () ; $ i ++) {
12771272 $ attributes [] = new Document ([
12781273 '$id ' => "test {$ i }" ,
12791274 'type ' => Database::VAR_INTEGER ,
@@ -1300,7 +1295,7 @@ public function testExceptionAttributeLimit()
13001295 */
13011296 public function testCheckAttributeCountLimit ()
13021297 {
1303- if (static :: getAdapterName () === ' mariadb ' || static :: getAdapterName () === ' mysql ' ) {
1298+ if ($ this -> getDatabase ()-> getAttributeLimit () > 0 ) {
13041299 $ collection = static ::getDatabase ()->getCollection ('attributeLimit ' );
13051300
13061301 // create same attribute in testExceptionAttributeLimit
@@ -1464,7 +1459,7 @@ public function testExceptionIndexLimit()
14641459 // MariaDB, MySQL, and MongoDB create 3 indexes per new collection
14651460 // MongoDB create 4 indexes per new collection
14661461 // Add up to the limit, then check if the next index throws IndexLimitException
1467- for ($ i =0 ; $ i < (64 - static :: getUsedIndexes ()); $ i ++) {
1462+ for ($ i =0 ; $ i < ($ this -> getDatabase ()-> getIndexLimit ()); $ i ++) {
14681463 $ this ->assertEquals (true , static ::getDatabase ()->createIndex ('indexLimit ' , "index {$ i }" , Database::INDEX_KEY , ["test {$ i }" ], [16 ]));
14691464 }
14701465 $ this ->expectException (LimitException::class);
@@ -1543,4 +1538,18 @@ public function testUniqueIndexDuplicateUpdate()
15431538
15441539 static ::getDatabase ()->updateDocument ('movies ' , $ document ->getId (), $ document ->setAttribute ('name ' , 'Frozen ' ));
15451540 }
1541+
1542+ public function testGetAttributeLimit ()
1543+ {
1544+ if (static ::getAdapterName () === 'mariadb ' || static ::getAdapterName () === 'mysql ' ) {
1545+ $ this ->assertEquals (1012 , $ this ->getDatabase ()->getAttributeLimit ());
1546+ } else {
1547+ $ this ->assertEquals (0 , $ this ->getDatabase ()->getAttributeLimit ());
1548+ }
1549+ }
1550+
1551+ public function testGetIndexLimit ()
1552+ {
1553+ $ this ->assertEquals (61 , $ this ->getDatabase ()->getIndexLimit ());
1554+ }
15461555}
0 commit comments