You are here

protected function MonitoringUITest::submitThresholdSettings in Monitoring 7

Submits a threshold settings form for a given sensor.

Parameters

string $sensor_name: The sensor name for the sensor that should be submitted.

array $thresholds: Array of threshold values, keyed by the status, the value can be an integer or an array of integers for threshold types that need multiple values.

4 calls to MonitoringUITest::submitThresholdSettings()
MonitoringUITest::checkExceedsThresholdSettings in test/tests/monitoring.ui.test
Tests exceeds threshold settings UI and validation.
MonitoringUITest::checkFallsThresholdSettings in test/tests/monitoring.ui.test
Tests falls threshold settings UI and validation.
MonitoringUITest::checkInnerThresholdSettings in test/tests/monitoring.ui.test
Tests inner threshold settings UI and validation.
MonitoringUITest::checkOuterThresholdSettings in test/tests/monitoring.ui.test
Tests outer threshold settings UI and validation.

File

test/tests/monitoring.ui.test, line 267
Contains \MonitoringUITest.

Class

MonitoringUITest
Tests for the Monitoring UI.

Code

protected function submitThresholdSettings($sensor_name, array $thresholds) {
  $data = array();
  $sensor_info = $this->sensorManager
    ->getSensorInfoByName($sensor_name);
  foreach ($thresholds as $key => $value) {
    $form_field_name = monitoring_sensor_settings_key($sensor_info
      ->getName()) . '[thresholds][' . $key . ']';
    $data[$form_field_name] = $value;
  }
  $this
    ->drupalPost('admin/config/system/monitoring/sensors/' . $sensor_info
    ->getName(), $data, t('Save'));
}