fix: harden sessions and domain validation
This commit is contained in:
@@ -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.');
|
||||
|
||||
Reference in New Issue
Block a user