fix unit tests on php < 7.3

This commit is contained in:
El RIDO 2021-06-13 12:40:06 +02:00
parent 68b097087d
commit 078c5785dd
No known key found for this signature in database
GPG Key ID: 0F5C940A6BD81F92
2 changed files with 17 additions and 10 deletions

View File

@ -233,11 +233,14 @@ class Database extends AbstractData
}
self::$_cache[$pasteid] = false;
try {
$paste = self::_select(
'SELECT * FROM ' . self::_sanitizeIdentifier('paste') .
' WHERE dataid = ?', array($pasteid), true
);
} catch (Exception $e) {
$paste = false;
}
if ($paste === false) {
return false;
}
@ -643,15 +646,18 @@ class Database extends AbstractData
* @access private
* @static
* @param string $key
* @throws PDOException
* @return string
*/
private static function _getConfig($key)
{
try {
$row = self::_select(
'SELECT value FROM ' . self::_sanitizeIdentifier('config') .
' WHERE id = ?', array($key), true
);
} catch (PDOException $e) {
return '';
}
return $row ? $row['value'] : '';
}

View File

@ -259,6 +259,7 @@ class ModelTest extends PHPUnit_Framework_TestCase
$paste = $model->getPaste();
$paste->setData($pasteData);
$paste->store();
$paste->exists();
$db = new PDO(
$options['model_options']['dsn'],