Skip to content

Commit 5a3625d

Browse files
committed
Don't test the max_length attribute on MySQL >= 8.0.17
As of MySQL 8.0.17, the display width attribute for integer data types is deprecated and is not reported back anymore. https://dev.mysql.com/doc/refman/8.0/en/numeric-type-attributes.html
1 parent 5e775bc commit 5a3625d

1 file changed

Lines changed: 17 additions & 3 deletions

File tree

tests/system/Database/Live/ForgeTest.php

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,16 @@ public function testCreateTableWithArrayFieldConstraints()
249249
public function testCreateTableWithNullableFieldsGivesNullDataType(): void
250250
{
251251
$this->forge->addField([
252-
'id' => ['type' => 'INT', 'constraint' => 11, 'auto_increment' => true],
253-
'name' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
252+
'id' => [
253+
'type' => 'INT',
254+
'constraint' => 11,
255+
'auto_increment' => true,
256+
],
257+
'name' => [
258+
'type' => 'VARCHAR',
259+
'constraint' => 255,
260+
'null' => true,
261+
],
254262
]);
255263

256264
$createTable = $this->getPrivateMethodInvoker($this->forge, '_createTable');
@@ -620,7 +628,13 @@ public function testAddFields()
620628
$this->assertEquals($fieldsData[0]->type, 'int');
621629
$this->assertEquals($fieldsData[1]->type, 'varchar');
622630

623-
$this->assertEquals($fieldsData[0]->max_length, 11);
631+
if (version_compare($this->db->getVersion(), '8.0.17', '<'))
632+
{
633+
// As of MySQL 8.0.17, the display width attribute for integer data types
634+
// is deprecated and is not reported back anymore.
635+
// @see https://dev.mysql.com/doc/refman/8.0/en/numeric-type-attributes.html
636+
$this->assertEquals($fieldsData[0]->max_length, 11);
637+
}
624638

625639
$this->assertNull($fieldsData[0]->default);
626640
$this->assertNull($fieldsData[1]->default);

0 commit comments

Comments
 (0)