fix: harden sessions and domain validation

This commit is contained in:
Marco0300
2026-09-01 18:58:18 +02:00
parent 480494c5ed
commit 9f5142b071
9 changed files with 40 additions and 16 deletions
+5
View File
@@ -2,9 +2,14 @@
declare(strict_types=1);
require_once __DIR__ . '/../app/Domain/SLA/SlaThresholdClassifier.php';
require_once __DIR__ . '/../app/Domain/SLA/SlaCalculator.php';
use App\Domain\SLA\SlaThresholdClassifier;
$negativeRejected = false;
try { calculate_sla_usage(-1.0, [1.0]); } catch (InvalidArgumentException $exception) { $negativeRejected = true; }
if (!$negativeRejected) throw new RuntimeException('Negative SLA allocation must be rejected');
$classifier = new SlaThresholdClassifier();
if ($classifier->classify(7.5, 10.0) !== 'warning') throw new RuntimeException('75% should be warning.');
if ($classifier->classify(9.0, 10.0) !== 'critical') throw new RuntimeException('90% should be critical.');