Skip to content

Commit

Permalink
Fix MySQL syntax errors in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JanJakes committed Dec 2, 2024
1 parent 647eaae commit b47db70
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions tests/WP_SQLite_Driver_Tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ public function testUpdateWithoutWhereButWithLimit() {
public function testCastAsBinary() {
$this->assertQuery(
// Use a confusing alias to make sure it replaces only the correct token
"SELECT CAST('ABC' AS BINARY) as binary;"
"SELECT CAST('ABC' AS BINARY) as `binary`;"
);
$results = $this->engine->get_query_results();
$this->assertCount( 1, $results );
Expand Down Expand Up @@ -470,7 +470,7 @@ public function testShowCreateTableWithCorrectDefaultValues() {
"CREATE TABLE _tmp__table (
ID BIGINT PRIMARY KEY AUTO_INCREMENT NOT NULL,
default_empty_string VARCHAR(255) default '',
null_no_default VARCHAR(255),
null_no_default VARCHAR(255)
);"
);

Expand Down Expand Up @@ -596,7 +596,7 @@ public function testShowTableStatusFrom() {
);

$this->assertQuery(
"SHOW TABLE STATUS FROM 'mydb';"
"SHOW TABLE STATUS FROM mydb;"

Check failure on line 599 in tests/WP_SQLite_Driver_Tests.php

View workflow job for this annotation

GitHub Actions / Check code style

String "SHOW TABLE STATUS FROM mydb;" does not require double quotes; use single quotes instead

Check failure on line 599 in tests/WP_SQLite_Driver_Tests.php

View workflow job for this annotation

GitHub Actions / Check code style

String "SHOW TABLE STATUS FROM mydb;" does not require double quotes; use single quotes instead
);

$this->assertCount(
Expand All @@ -619,7 +619,7 @@ public function testShowTableStatusIn() {
);

$this->assertQuery(
"SHOW TABLE STATUS IN 'mydb';"
"SHOW TABLE STATUS IN mydb;"

Check failure on line 622 in tests/WP_SQLite_Driver_Tests.php

View workflow job for this annotation

GitHub Actions / Check code style

String "SHOW TABLE STATUS IN mydb;" does not require double quotes; use single quotes instead

Check failure on line 622 in tests/WP_SQLite_Driver_Tests.php

View workflow job for this annotation

GitHub Actions / Check code style

String "SHOW TABLE STATUS IN mydb;" does not require double quotes; use single quotes instead
);

$this->assertCount(
Expand Down Expand Up @@ -649,7 +649,7 @@ public function testShowTableStatusInTwoTables() {
);"
);
$this->assertQuery(
"SHOW TABLE STATUS IN 'mydb';"
"SHOW TABLE STATUS IN mydb;"

Check failure on line 652 in tests/WP_SQLite_Driver_Tests.php

View workflow job for this annotation

GitHub Actions / Check code style

String "SHOW TABLE STATUS IN mydb;" does not require double quotes; use single quotes instead

Check failure on line 652 in tests/WP_SQLite_Driver_Tests.php

View workflow job for this annotation

GitHub Actions / Check code style

String "SHOW TABLE STATUS IN mydb;" does not require double quotes; use single quotes instead
);

$this->assertCount(
Expand Down Expand Up @@ -807,7 +807,7 @@ public function testCreateTableWithTrailingComma() {
$result = $this->assertQuery(
'CREATE TABLE wptests_users (
ID bigint(20) unsigned NOT NULL auto_increment,
PRIMARY KEY (ID),
PRIMARY KEY (ID)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci'
);
$this->assertEquals( '', $this->engine->get_error_message() );
Expand All @@ -818,7 +818,7 @@ public function testCreateTableSpatialIndex() {
$result = $this->assertQuery(
'CREATE TABLE wptests_users (
ID bigint(20) unsigned NOT NULL auto_increment,
UNIQUE KEY (ID),
UNIQUE KEY (ID)
)'
);
$this->assertEquals( '', $this->engine->get_error_message() );
Expand All @@ -832,7 +832,7 @@ public function testCreateTableWithMultiValueColumnTypeModifiers() {
decimal_column DECIMAL(10,2) NOT NULL DEFAULT 0,
float_column FLOAT(10,2) NOT NULL DEFAULT 0,
enum_column ENUM('a', 'b', 'c') NOT NULL DEFAULT 'a',
PRIMARY KEY (ID),
PRIMARY KEY (ID)
)"
);
$this->assertEquals( '', $this->engine->get_error_message() );
Expand Down Expand Up @@ -2716,7 +2716,7 @@ public function testZeroPlusStringToFloatComparison() {
public function testCalcFoundRows() {
$result = $this->assertQuery(
"CREATE TABLE wptests_dummy (
ID INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
ID INTEGER PRIMARY KEY AUTO_INCREMENT NOT NULL,
user_login TEXT NOT NULL default ''
);"
);
Expand Down Expand Up @@ -3030,7 +3030,7 @@ public function testTranslateLikeBinaryAndGlob() {
// Create a temporary table for testing
$this->assertQuery(
"CREATE TABLE _tmp_table (
ID INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
ID INTEGER PRIMARY KEY AUTO_INCREMENT NOT NULL,
name varchar(20) NOT NULL default ''
);"
);
Expand Down Expand Up @@ -3114,7 +3114,7 @@ public function testTranslateLikeBinaryAndGlob() {
public function testOnConflictReplace() {
$this->assertQuery(
"CREATE TABLE _tmp_table (
ID INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
ID INTEGER PRIMARY KEY AUTO_INCREMENT NOT NULL,
name varchar(20) NOT NULL default 'default-value',
unique_name varchar(20) NOT NULL default 'unique-default-value',
inline_unique_name varchar(20) NOT NULL default 'inline-unique-default-value',
Expand Down

0 comments on commit b47db70

Please sign in to comment.