Skip to content

Commit f4e836c

Browse files
committed
test: add assertions
1 parent ffb2027 commit f4e836c

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

tests/system/Database/Live/ForgeTest.php

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1289,8 +1289,18 @@ public function testModifyColumnRename(): void
12891289
'unsigned' => false,
12901290
'auto_increment' => true,
12911291
],
1292+
'int' => [
1293+
'type' => 'INT',
1294+
'constraint' => 10,
1295+
'null' => false,
1296+
],
1297+
'varchar' => [
1298+
'type' => 'VARCHAR',
1299+
'constraint' => 7,
1300+
'null' => false,
1301+
],
12921302
'name' => [
1293-
'type' => 'varchar',
1303+
'type' => 'VARCHAR',
12941304
'constraint' => 255,
12951305
'null' => true,
12961306
],
@@ -1304,17 +1314,31 @@ public function testModifyColumnRename(): void
13041314
$this->forge->modifyColumn('forge_test_three', [
13051315
'name' => [
13061316
'name' => 'altered',
1307-
'type' => 'varchar',
1317+
'type' => 'VARCHAR',
13081318
'constraint' => 255,
13091319
'null' => true,
13101320
],
13111321
]);
13121322

13131323
$this->db->resetDataCache();
13141324

1325+
$fieldData = $this->db->getFieldData('forge_test_three');
1326+
$fields = [];
1327+
1328+
foreach ($fieldData as $obj) {
1329+
$fields[$obj->name] = $obj;
1330+
}
1331+
13151332
$this->assertFalse($this->db->fieldExists('name', 'forge_test_three'));
13161333
$this->assertTrue($this->db->fieldExists('altered', 'forge_test_three'));
13171334

1335+
$this->assertTrue($fields['altered']->nullable);
1336+
$this->assertFalse($fields['int']->nullable);
1337+
$this->assertFalse($fields['varchar']->nullable);
1338+
$this->assertNull($fields['altered']->default);
1339+
$this->assertNull($fields['int']->default);
1340+
$this->assertNull($fields['varchar']->default);
1341+
13181342
$this->forge->dropTable('forge_test_three', true);
13191343
}
13201344

0 commit comments

Comments
 (0)