You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
virt/web/tests/TrafficNotificationThreshol...

20 lines
793 B
PHP

<?php
require dirname(__DIR__) . '/app/Services/TrafficNotificationThreshold.php';
use App\Services\TrafficNotificationThreshold as Threshold;
foreach ([
[9 * 1048576, 100 * 1048576, 'mb', '10', true],
[10 * 1048576, 100 * 1048576, 'mb', '10', false],
[99, 1000, 'per', '10', true], [100, 1000, 'per', '10', false],
[0, 100, 'per', '101', false], [0, 100, 'per', '-1', false],
[0, 100, 'mb', 'invalid', false], [0, 100, 'false', '10', false],
[INF, 100, 'per', 10, false],
] as [$remaining, $total, $mode, $value, $expected]) {
if (Threshold::belowLimit($remaining, $total, $mode, $value) !== $expected) {
throw new RuntimeException('VM quota reminder threshold failed');
}
}
echo "VM quota reminder policy passed (metering integration pending).\n";