-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun-all.php
More file actions
67 lines (56 loc) · 3.06 KB
/
run-all.php
File metadata and controls
67 lines (56 loc) · 3.06 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
declare(strict_types=1);
/**
* Run All Examples
*
* Executes all kariricode/dotenv validation examples in sequence.
* Each example is self-contained and demonstrates a specific feature.
*/
$examples = [
'01-basic-loading' => 'Basic Loading & get() method',
'02-type-casting' => 'Auto Type Casting (int, float, bool, null, JSON)',
'03-validation-dsl' => 'Fluent Validation DSL',
'04-schema-validation' => 'Schema-Based Validation (.env.schema)',
'05-encryption' => 'AES-256-GCM Encryption & Decryption',
'06-processors' => 'Variable Processors (Trim, Base64, CSV, URL)',
'07-boot-env' => 'bootEnv() Cascade Loading',
'08-env-helper' => 'env() Helper Function (use function)',
];
echo "\n";
echo "╔═══════════════════════════════════════════════════════════╗\n";
echo "║ KaririCode\\Dotenv — Full Feature Validation ║\n";
echo "╚═══════════════════════════════════════════════════════════╝\n\n";
$total = count($examples);
$passed = 0;
$failed = 0;
foreach ($examples as $file => $description) {
$path = __DIR__ . "/examples/{$file}.php";
echo "┌─────────────────────────────────────────────────────────\n";
echo "│ Running: {$description}\n";
echo "└─────────────────────────────────────────────────────────\n";
ob_start();
try {
require $path;
$output = ob_get_clean();
echo $output;
++$passed;
} catch (Throwable $e) {
$output = ob_get_clean();
if ($output !== '') {
echo $output;
}
echo "\n ✗ EXCEPTION: " . $e::class . "\n";
echo " " . $e->getMessage() . "\n";
++$failed;
}
}
echo "╔═══════════════════════════════════════════════════════════╗\n";
echo "║ RESULTS ║\n";
echo "╠═══════════════════════════════════════════════════════════╣\n";
printf("║ Examples: %-4d Passed: %-4d Failed: %-4d ║\n", $total, $passed, $failed);
echo "╚═══════════════════════════════════════════════════════════╝\n\n";
if ($failed > 0) {
echo "✗ Some examples failed. Review the output above.\n\n";
exit(1);
}
echo "✓ All {$total} examples completed successfully!\n\n";