Skip to content

Commit 8f19797

Browse files
updated tests to match the new limit
1 parent f31edfe commit 8f19797

2 files changed

Lines changed: 17 additions & 23 deletions

File tree

tests/e2e/Adapter/Scopes/AttributeTests.php

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -950,28 +950,19 @@ public function testExceptionWidthLimit(): void
950950
}
951951

952952
$attributes = [];
953-
954-
$attributes[] = new Document([
955-
'$id' => ID::custom('varchar_16000'),
956-
'type' => Database::VAR_STRING,
957-
'size' => 16000,
958-
'required' => true,
959-
'default' => null,
960-
'signed' => true,
961-
'array' => false,
962-
'filters' => [],
963-
]);
964-
965-
$attributes[] = new Document([
966-
'$id' => ID::custom('varchar_200'),
967-
'type' => Database::VAR_STRING,
968-
'size' => 200,
969-
'required' => true,
970-
'default' => null,
971-
'signed' => true,
972-
'array' => false,
973-
'filters' => [],
974-
]);
953+
$limit = (int)($database->getAdapter()->getDocumentSizeLimit() / (200 * 4));
954+
for ($i = 0; $i < $limit; $i++) {
955+
$attributes[] = new Document([
956+
'$id' => ID::unique(),
957+
'type' => Database::VAR_STRING,
958+
'size' => 200,
959+
'required' => true,
960+
'default' => null,
961+
'signed' => true,
962+
'array' => false,
963+
'filters' => [],
964+
]);
965+
}
975966

976967
try {
977968
$database->createCollection("attributes_row_size", $attributes);

tests/e2e/Adapter/Scopes/CollectionTests.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -586,8 +586,11 @@ public function testRowSizeToLarge(): void
586586
$collection_1 = $database->createCollection('row_size_1');
587587
$collection_2 = $database->createCollection('row_size_2');
588588

589-
$this->assertEquals(true, $database->createAttribute($collection_1->getId(), 'attr_1', Database::VAR_STRING, 16000, true));
589+
$limit = (int)($database->getAdapter()->getDocumentSizeLimit() / (200 * 4)) - 1;
590590

591+
for ($i = 0; $i < $limit; $i++) {
592+
$this->assertEquals(true, $database->createAttribute($collection_1->getId(), 'attr_1_'.$i, Database::VAR_STRING, 200, true));
593+
}
591594
try {
592595
$database->createAttribute($collection_1->getId(), 'attr_2', Database::VAR_STRING, Database::LENGTH_KEY, true);
593596
$this->fail('Failed to throw exception');

0 commit comments

Comments
 (0)