aboutsummaryrefslogtreecommitdiff
path: root/lib/Minz/ModelPdo.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Minz/ModelPdo.php')
-rw-r--r--lib/Minz/ModelPdo.php8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Minz/ModelPdo.php b/lib/Minz/ModelPdo.php
index f27ae5dc7..7804b3302 100644
--- a/lib/Minz/ModelPdo.php
+++ b/lib/Minz/ModelPdo.php
@@ -16,6 +16,11 @@ class Minz_ModelPdo {
*/
public static bool $usesSharedPdo = true;
+ /**
+ * If true, the connection to the database will be a dummy one. Useful for unit tests.
+ */
+ public static bool $dummyConnection = false;
+
private static ?Minz_Pdo $sharedPdo = null;
private static string $sharedCurrentUser = '';
@@ -97,6 +102,9 @@ class Minz_ModelPdo {
$this->pdo = $currentPdo;
return;
}
+ if (self::$dummyConnection) {
+ return;
+ }
if ($currentUser == null) {
throw new Minz_PDOConnectionException('Current user must not be empty!', '', Minz_Exception::ERROR);
}