Skip to content

Commit fd4cc59

Browse files
committed
Fix tests that are incorrectly using direct SQLite queries
1 parent 11b408a commit fd4cc59

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

tests/WP_SQLite_Driver_Tests.php

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3218,18 +3218,18 @@ public function testCreateTemporaryTableIfNotExists(): void {
32183218
}
32193219

32203220
public function testTranslatesComplexDelete() {
3221-
$this->sqlite->query(
3221+
$this->assertQuery(
32223222
"CREATE TABLE wptests_dummy (
3223-
ID INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
3223+
ID INTEGER PRIMARY KEY AUTO_INCREMENT NOT NULL,
32243224
user_login TEXT NOT NULL default '',
32253225
option_name TEXT NOT NULL default '',
32263226
option_value TEXT NOT NULL default ''
32273227
);"
32283228
);
3229-
$this->sqlite->query(
3229+
$this->assertQuery(
32303230
"INSERT INTO wptests_dummy (user_login, option_name, option_value) VALUES ('admin', '_transient_timeout_test', '1675963960');"
32313231
);
3232-
$this->sqlite->query(
3232+
$this->assertQuery(
32333233
"INSERT INTO wptests_dummy (user_login, option_name, option_value) VALUES ('admin', '_transient_test', '1675963960');"
32343234
);
32353235

@@ -3239,10 +3239,7 @@ public function testTranslatesComplexDelete() {
32393239
AND a.option_name NOT LIKE '\_transient\_timeout_%'
32403240
AND b.option_name = CONCAT( '_transient_timeout_', SUBSTRING( a.option_name, 12 ) );"
32413241
);
3242-
$this->assertEquals(
3243-
2,
3244-
$result
3245-
);
3242+
$this->assertEquals( 2, $result );
32463243
}
32473244

32483245
public function testTranslatesDoubleAlterTable() {
@@ -3321,11 +3318,11 @@ public function testTranslatesUtf8Insert() {
33213318

33223319
public function testTranslatesRandom() {
33233320
$this->assertIsNumeric(
3324-
$this->sqlite->query( 'SELECT RAND() AS rand' )->fetchColumn()
3321+
$this->assertQuery( 'SELECT RAND() AS rand' )[0]->rand
33253322
);
33263323

33273324
$this->assertIsNumeric(
3328-
$this->sqlite->query( 'SELECT RAND(5) AS rand' )->fetchColumn()
3325+
$this->assertQuery( 'SELECT RAND(5) AS rand' )[0]->rand
33293326
);
33303327
}
33313328

0 commit comments

Comments
 (0)