about summary refs log tree commit diff stats
path: root/tests/bootstrap.php
diff options
context:
space:
mode:
authorAndrew Dolgov <fox@fakecake.org>2026-06-21 12:06:53 +0300
committerAndrew Dolgov <fox@fakecake.org>2026-06-21 12:06:53 +0300
commit7edf66a0b06a9764084ef426e53eaa28d7bd4ade (patch)
tree73ab3c28aba500bf74870c9b38e019ac3efde6b9 /tests/bootstrap.php
parentcae23c5e14a0ed4d80e9edde351cb4066e3e350c (diff)
downloadthe-epube-7edf66a0b06a9764084ef426e53eaa28d7bd4ade.tar.gz
the-epube-7edf66a0b06a9764084ef426e53eaa28d7bd4ade.tar.xz
fix validate_session() not being used in AuthRequired check
Diffstat (limited to 'tests/bootstrap.php')
-rw-r--r--tests/bootstrap.php8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/bootstrap.php b/tests/bootstrap.php
index 8cae8e1..a484982 100644
--- a/tests/bootstrap.php
+++ b/tests/bootstrap.php
@@ -5,3 +5,11 @@
 	putenv("IS_TESTING=true");
 
 	require_once "common.php";
+
+	// Stub validate_session() for unit tests (no DB needed).
+	// Integration tests load sessions.php which defines the real function.
+	if (!function_exists('validate_session')) {
+		function validate_session() : bool {
+			return !empty($_SESSION["owner"]) && !empty($_SESSION["pass_hash"]);
+		}
+	}