Browse Source

Fix test errors when PostgreSQL or MySQL are not available

J. King 1 month ago
parent
commit
86d52c8ff9
2 changed files with 7 additions and 5 deletions
  1. 6
    4
      tests/cases/Database/Base.php
  2. 1
    1
      tests/cases/DatabaseDrivers/MySQL.php

+ 6
- 4
tests/cases/Database/Base.php View File

@@ -100,10 +100,12 @@ abstract class Base extends \JKingWeb\Arsse\Test\AbstractTest {
100 100
     }
101 101
 
102 102
     public static function tearDownAfterClass() {
103
-        // wipe the database absolutely clean
104
-        static::dbRaze(static::$drv);
105
-        // clean up
106
-        static::$drv = null;
103
+        if (static::$drv) {
104
+            // wipe the database absolutely clean
105
+            static::dbRaze(static::$drv);
106
+            // clean up
107
+            static::$drv = null;
108
+        }
107 109
         static::$failureReason = "";
108 110
         static::clearData();
109 111
     }

+ 1
- 1
tests/cases/DatabaseDrivers/MySQL.php View File

@@ -18,7 +18,7 @@ trait MySQL {
18 18
     protected static $stringOutput = true;
19 19
     
20 20
     public static function dbInterface() {
21
-        $d = new \mysqli(Arsse::$conf->dbMySQLHost, Arsse::$conf->dbMySQLUser, Arsse::$conf->dbMySQLPass, Arsse::$conf->dbMySQLDb, Arsse::$conf->dbMySQLPort);
21
+        $d = @new \mysqli(Arsse::$conf->dbMySQLHost, Arsse::$conf->dbMySQLUser, Arsse::$conf->dbMySQLPass, Arsse::$conf->dbMySQLDb, Arsse::$conf->dbMySQLPort);
22 22
         if ($d->connect_errno) {
23 23
             return;
24 24
         }

Loading…
Cancel
Save