diff --git a/tests/php/test_navbar_stats_unavailable.php b/tests/php/test_navbar_stats_unavailable.php new file mode 100644 index 0000000000..662a2749b2 --- /dev/null +++ b/tests/php/test_navbar_stats_unavailable.php @@ -0,0 +1,56 @@ +CpuLoad = 0.5; +$thisServer->CpuUsagePercent = 12.34; +check('load with stats', $load(), 'Load: 0.50'); +check('cpu with stats', $cpu(), 'Cpu: 12.3%'); + +$thisServer->CpuLoad = 0; +$thisServer->CpuUsagePercent = 0; +check('an idle load of zero is a real value', $load(), 'Load: 0.00'); +check('an idle cpu of zero is a real value', $cpu(), 'Cpu: 0.0%'); + +echo "\n$passes passed, $failures failed\n"; +exit($failures ? 1 : 0); diff --git a/web/skins/classic/includes/functions.php b/web/skins/classic/includes/functions.php index 142eced7b9..5509c1e78f 100644 --- a/web/skins/classic/includes/functions.php +++ b/web/skins/classic/includes/functions.php @@ -858,7 +858,8 @@ function getCpuUsageHTML() { $thisServer->ReadStats(); $result .= '