mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-09-25 18:59:04 +02:00
DBUtils: Introduce setConn()
method
This commit is contained in:
parent
2405c7a1fc
commit
da56ba898d
@ -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}
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user