Skip to content
This repository was archived by the owner on Jun 2, 2025. It is now read-only.

Commit 4c1ff9f

Browse files
committed
Split test into two
1 parent ae66749 commit 4c1ff9f

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

tests/WP_SQLite_Translator_Tests.php

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1252,16 +1252,14 @@ public function testColumnWithOnUpdate() {
12521252
$this->assertNull( $result[0]->updated_at );
12531253
}
12541254

1255-
public function testTypeKeywordsAsKeyNames() {
1255+
public function testDataTypeKeywordsAsKeyNames() {
12561256
// CREATE TABLE with a data type as a key name
12571257
$this->assertQuery(
12581258
'CREATE TABLE `_tmp_table` (
12591259
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
12601260
`timestamp` datetime NOT NULL,
1261-
`INDEX` timestamp,
12621261
PRIMARY KEY (`id`),
12631262
KEY `timestamp` (`timestamp`),
1264-
KEY numeric (numeric)
12651263
);'
12661264
);
12671265
$results = $this->assertQuery( 'DESCRIBE _tmp_table;' );
@@ -1283,6 +1281,33 @@ public function testTypeKeywordsAsKeyNames() {
12831281
'Default' => null,
12841282
'Extra' => '',
12851283
),
1284+
),
1285+
$results
1286+
);
1287+
}
1288+
1289+
1290+
public function testReservedKeywordsAsFieldNames() {
1291+
// CREATE TABLE with a reserved keyword as a field name
1292+
$this->assertQuery(
1293+
'CREATE TABLE `_tmp_table` (
1294+
`id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
1295+
`INDEX` timestamp,
1296+
PRIMARY KEY (`id`),
1297+
KEY numeric (numeric)
1298+
);'
1299+
);
1300+
$results = $this->assertQuery( 'DESCRIBE _tmp_table;' );
1301+
$this->assertEquals(
1302+
array(
1303+
(object) array(
1304+
'Field' => 'id',
1305+
'Type' => 'bigint(20) unsigned',
1306+
'Null' => 'NO',
1307+
'Key' => 'PRI',
1308+
'Default' => '0',
1309+
'Extra' => '',
1310+
),
12861311
(object) array(
12871312
'Field' => 'INDEX',
12881313
'Type' => 'timestamp',

0 commit comments

Comments
 (0)