protected function MonitoringUITest::checkInnerThresholdSettings in Monitoring 7
Tests inner threshold settings UI and validation.
1 call to MonitoringUITest::checkInnerThresholdSettings()
- MonitoringUITest::testSensorSettingsUI in test/
tests/ monitoring.ui.test - Test the sensor settings UI.
File
- test/
tests/ monitoring.ui.test, line 399 - Contains \MonitoringUITest.
Class
- MonitoringUITest
- Tests for the Monitoring UI.
Code
protected function checkInnerThresholdSettings() {
// Test with valid values.
$thresholds = array(
'critical_low' => 5,
'warning_low' => 1,
'critical_high' => 10,
'warning_high' => 15,
);
$this
->submitThresholdSettings('test_sensor_inner', $thresholds);
$this
->assertText(t('Sensor settings saved.'));
$this
->assertThresholdSettingsUIDefaults('test_sensor_inner', $thresholds);
// Make sure that it is possible to save empty inner thresholds.
$thresholds = array(
'critical_low' => '',
'warning_low' => '',
'critical_high' => '',
'warning_high' => '',
);
$this
->submitThresholdSettings('test_sensor_inner', $thresholds);
$this
->assertText(t('Sensor settings saved.'));
$this
->assertThresholdSettingsUIDefaults('test_sensor_inner', $thresholds);
// Test validation.
$thresholds = array(
'critical_low' => 5,
'warning_low' => 15,
'critical_high' => 10,
'warning_high' => 20,
);
$this
->submitThresholdSettings('test_sensor_inner', $thresholds);
$this
->assertText('Warning low must be lower than critical low or empty.');
$thresholds = array(
'critical_low' => 5,
'warning_low' => 5,
'critical_high' => 5,
'warning_high' => 5,
);
$this
->submitThresholdSettings('test_sensor_inner', $thresholds);
$this
->assertText('Warning low must be lower than warning high or empty.');
$thresholds = array(
'critical_low' => 50,
'warning_low' => 95,
'critical_high' => 55,
'warning_high' => 100,
);
$this
->submitThresholdSettings('test_sensor_inner', $thresholds);
$this
->assertText('Warning low must be lower than critical low or empty.');
$thresholds = array(
'critical_low' => 'alphanumeric',
'warning_low' => 'alphanumeric',
'critical_high' => 'alphanumeric',
'warning_high' => 'alphanumeric',
);
$this
->submitThresholdSettings('test_sensor_inner', $thresholds);
$this
->assertText('Warning low must be a number.');
$this
->assertText('Warning high must be a number.');
$this
->assertText('Critical low must be a number.');
$this
->assertText('Critical high must be a number.');
$thresholds = array(
'critical_low' => 45,
'warning_low' => 35,
'critical_high' => 50,
'warning_high' => 40,
);
$this
->submitThresholdSettings('test_sensor_inner', $thresholds);
$this
->assertText('Warning high must be higher than critical high or empty.');
return $thresholds;
}