mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2025-01-03 14:32:40 +00:00
Fix tests in absence of database extensions
This commit is contained in:
parent
b58a326461
commit
3ac010d5b6
6 changed files with 21 additions and 10 deletions
|
@ -26,8 +26,10 @@ class TestDriver extends \JKingWeb\Arsse\TestCase\Db\BaseDriver {
|
|||
}
|
||||
|
||||
public static function tearDownAfterClass(): void {
|
||||
static::$interface->close();
|
||||
static::$interface = null;
|
||||
if (static::$interface) {
|
||||
static::$interface->close();
|
||||
static::$interface = null;
|
||||
}
|
||||
parent::tearDownAfterClass();
|
||||
@unlink(static::$file);
|
||||
static::$file = null;
|
||||
|
|
|
@ -16,8 +16,10 @@ class TestResult extends \JKingWeb\Arsse\TestCase\Db\BaseResult {
|
|||
protected static $createTest = "CREATE TABLE arsse_test(id integer primary key)";
|
||||
|
||||
public static function tearDownAfterClass(): void {
|
||||
static::$interface->close();
|
||||
static::$interface = null;
|
||||
if (static::$interface) {
|
||||
static::$interface->close();
|
||||
static::$interface = null;
|
||||
}
|
||||
parent::tearDownAfterClass();
|
||||
}
|
||||
|
||||
|
|
|
@ -13,8 +13,10 @@ class TestStatement extends \JKingWeb\Arsse\TestCase\Db\BaseStatement {
|
|||
use \JKingWeb\Arsse\Test\DatabaseDrivers\SQLite3;
|
||||
|
||||
public static function tearDownAfterClass(): void {
|
||||
static::$interface->close();
|
||||
static::$interface = null;
|
||||
if (static::$interface) {
|
||||
static::$interface->close();
|
||||
static::$interface = null;
|
||||
}
|
||||
parent::tearDownAfterClass();
|
||||
}
|
||||
|
||||
|
|
|
@ -16,8 +16,10 @@ class TestUpdate extends \JKingWeb\Arsse\TestCase\Db\BaseUpdate {
|
|||
protected static $minimal2 = "pragma user_version=2";
|
||||
|
||||
public static function tearDownAfterClass(): void {
|
||||
static::$interface->close();
|
||||
static::$interface = null;
|
||||
if (static::$interface) {
|
||||
static::$interface->close();
|
||||
static::$interface = null;
|
||||
}
|
||||
parent::tearDownAfterClass();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,9 +18,12 @@ trait MySQL {
|
|||
protected static $stringOutput = true;
|
||||
|
||||
public static function dbInterface() {
|
||||
if (!class_exists("mysqli")) {
|
||||
return null;
|
||||
}
|
||||
$d = @new \mysqli(Arsse::$conf->dbMySQLHost, Arsse::$conf->dbMySQLUser, Arsse::$conf->dbMySQLPass, Arsse::$conf->dbMySQLDb, Arsse::$conf->dbMySQLPort);
|
||||
if ($d->connect_errno) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
$d->set_charset("utf8mb4");
|
||||
foreach (\JKingWeb\Arsse\Db\MySQL\PDODriver::makeSetupQueries() as $q) {
|
||||
|
|
|
@ -19,7 +19,7 @@ trait PostgreSQL {
|
|||
|
||||
public static function dbInterface() {
|
||||
$connString = \JKingWeb\Arsse\Db\PostgreSQL\Driver::makeConnectionString(false, Arsse::$conf->dbPostgreSQLUser, Arsse::$conf->dbPostgreSQLPass, Arsse::$conf->dbPostgreSQLDb, Arsse::$conf->dbPostgreSQLHost, Arsse::$conf->dbPostgreSQLPort, "");
|
||||
if ($d = @pg_connect($connString, \PGSQL_CONNECT_FORCE_NEW)) {
|
||||
if (function_exists("pg_connect") && $d = @pg_connect($connString, \PGSQL_CONNECT_FORCE_NEW)) {
|
||||
foreach (\JKingWeb\Arsse\Db\PostgreSQL\Driver::makeSetupQueries(Arsse::$conf->dbPostgreSQLSchema) as $q) {
|
||||
pg_query($d, $q);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue