Fix a lot of notices/warnings/deprecation notes in the test directory
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
namespace Friendica\Test\Util\Database;
|
||||
|
||||
use Friendica\Database\Database;
|
||||
use Friendica\Database\DatabaseException;
|
||||
use PDO;
|
||||
use PDOException;
|
||||
|
||||
@@ -80,7 +81,7 @@ class StaticDatabase extends Database
|
||||
/**
|
||||
* Does a commit
|
||||
*
|
||||
* @return boolean Was the command executed successfully?
|
||||
* @return bool Was the command executed successfully?
|
||||
*/
|
||||
public function commit()
|
||||
{
|
||||
@@ -96,6 +97,8 @@ class StaticDatabase extends Database
|
||||
* Either through explicit calling or through implicit using the Database
|
||||
*
|
||||
* @param array $server $_SERVER variables
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function statConnect(array $server)
|
||||
{
|
||||
@@ -119,6 +122,10 @@ class StaticDatabase extends Database
|
||||
$db_data = $server['MYSQL_DATABASE'];
|
||||
}
|
||||
|
||||
if (empty($db_host) || empty($db_user) || empty($db_data)) {
|
||||
throw new DatabaseException('Either one of the following settings are missing: Host, User or Database', 999, 'CONNECT');
|
||||
}
|
||||
|
||||
$port = 0;
|
||||
$serveraddr = trim($db_host);
|
||||
$serverdata = explode(':', $serveraddr);
|
||||
@@ -128,7 +135,7 @@ class StaticDatabase extends Database
|
||||
}
|
||||
$server = trim($server);
|
||||
$user = trim($db_user);
|
||||
$pass = trim($db_pw);
|
||||
$pass = trim($db_pw ?? '');
|
||||
$db = trim($db_data);
|
||||
|
||||
if (!(strlen($server) && strlen($user))) {
|
||||
|
||||
Reference in New Issue
Block a user