-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_controller.php
More file actions
48 lines (41 loc) · 1.27 KB
/
Copy pathtest_controller.php
File metadata and controls
48 lines (41 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
// Enable error reporting
error_reporting(E_ALL);
ini_set('display_errors', 1);
// Test the quiz manager controller directly
echo "Testing QuizmanagerController::create()...\n";
// Start session and set fake user
session_start();
$_SESSION['user_id'] = 1;
$_SESSION['role'] = 'quiz_manager';
echo "Session set\n";
// Include necessary files
require_once 'core/Database.php';
require_once 'core/Controller.php';
require_once 'app/models/Quiz.php';
require_once 'app/controllers/QuizmanagerController.php';
echo "Files included\n";
// Create controller instance
try {
$controller = new QuizmanagerController();
echo "Controller created successfully\n";
} catch (Exception $e) {
echo "Error creating controller: " . $e->getMessage() . "\n";
exit(1);
}
// Try to call the create method
try {
echo "Calling create method...\n";
ob_start(); // Capture output
$controller->create();
$output = ob_get_clean();
echo "Method called successfully\n";
echo "Output length: " . strlen($output) . " characters\n";
if (strlen($output) > 0) {
echo "First 500 chars of output:\n" . substr($output, 0, 500) . "\n";
}
} catch (Exception $e) {
echo "Error: " . $e->getMessage() . "\n";
echo "Stack trace:\n" . $e->getTraceAsString() . "\n";
}
?>