14 lines
707 B
PHP
14 lines
707 B
PHP
<?php
|
|||
|
|
declare(strict_types=1);
|
||
|
|
|
||
|
|
require_once __DIR__ . '/../app/Domain/SLA/SlaThresholdClassifier.php';
|
||
|
|
|
||
|
|
use App\Domain\SLA\SlaThresholdClassifier;
|
||
|
|
|
||
|
|
$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.');
|
||
|
|
if ($classifier->classify(10.01, 10.0) !== 'exceeded') throw new RuntimeException('Over allocation should be exceeded.');
|
||
|
|
if ($classifier->classify(0.0, 0.0) !== 'within_limit') throw new RuntimeException('No allocation and no usage should be within limit.');
|
||
|
|
printf("SLA domain tests: 4 passed\n");
|