Skip to content

Commit 27d8ac9

Browse files
committed
test: add test that DBs throw error on too long inputs
1 parent eb6ac9f commit 27d8ac9

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

tests/system/Database/Live/InsertTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,4 +275,14 @@ public function testInsertBatchWithQueryAndRawSqlAndManualColumns(): void
275275

276276
$this->forge->dropTable('user2', true);
277277
}
278+
279+
public function testInsertWithTooLongCharactersThrowsError(): void
280+
{
281+
$this->expectException(DatabaseException::class);
282+
283+
$this->db->table('misc')->insert([
284+
'key' => 'too_long',
285+
'value' => str_repeat('a', 401), // 'value' is VARCHAR(400), so this should throw an error
286+
]);
287+
}
278288
}

0 commit comments

Comments
 (0)