-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_controller.php
More file actions
52 lines (40 loc) · 1.85 KB
/
Copy pathtest_controller.php
File metadata and controls
52 lines (40 loc) · 1.85 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
49
50
51
52
<?php
require_once 'vendor/autoload.php';
$app = require_once 'bootstrap/app.php';
$app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap();
try {
echo "Test du contrôleur StudentScholarshipController\n";
$controller = app(\App\Http\Controllers\StudentScholarshipController::class);
$request = new \Illuminate\Http\Request();
$response = $controller->index($request);
// Vérifier si c'est une réponse Inertia
if ($response instanceof \Inertia\Response) {
// Essayer d'accéder aux propriétés directement
$reflection = new ReflectionClass($response);
$propsProperty = $reflection->getProperty('props');
$propsProperty->setAccessible(true);
$data = $propsProperty->getValue($response);
echo "Données chargées avec succès\n";
echo "Clés disponibles: " . implode(', ', array_keys($data)) . "\n";
if (isset($data['studentScholarships'])) {
echo "- Type de studentScholarships: " . gettype($data['studentScholarships']) . "\n";
if (is_array($data['studentScholarships']) && isset($data['studentScholarships']['data'])) {
echo "- Attributions: " . count($data['studentScholarships']['data']) . "\n";
}
}
if (isset($data['scholarships'])) {
echo "- Bourses disponibles: " . count($data['scholarships']) . "\n";
}
if (isset($data['academicYears'])) {
echo "- Années académiques: " . count($data['academicYears']) . "\n";
}
if (isset($data['filters'])) {
echo "- Filtres: " . json_encode($data['filters']) . "\n";
}
} else {
echo "Erreur: réponse inattendue - " . get_class($response) . "\n";
}
} catch (Exception $e) {
echo "Erreur: " . $e->getMessage() . "\n";
echo "Trace: " . $e->getTraceAsString() . "\n";
}