DBUtils: Introduce setConn() method

This commit is contained in:
Yonas Habteab 2022-06-01 14:54:48 +02:00
parent 2405c7a1fc
commit da56ba898d

View File

@ -37,6 +37,20 @@ class DBUtils
return self::$conn; return self::$conn;
} }
/**
* Set the database connection
*
* You can set the DB connection beforehand if you want, but you don't need to. You can just call
* the {@see getConn()} method if you have a valid resource factory configured. This is only used
* for the unit tests in order to allow to fake the DB connection.
*
* @param Connection $conn
*/
public static function setConn(Connection $conn): void
{
self::$conn = $conn;
}
/** /**
* Get whether the DB connection being used is an instance of {@see Pgsql} * Get whether the DB connection being used is an instance of {@see Pgsql}
* *