You are here

protected function MonitoringUITest::submitThresholdSettings in Monitoring 8

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::doTestExceedsThresholdSettings in tests/src/Functional/MonitoringUITest.php
Tests exceeds threshold settings UI and validation.
MonitoringUITest::doTestFallsThresholdSettings in tests/src/Functional/MonitoringUITest.php
Tests falls threshold settings UI and validation.
MonitoringUITest::doTestInnerThresholdSettings in tests/src/Functional/MonitoringUITest.php
Tests inner threshold settings UI and validation.
MonitoringUITest::doTestOuterThresholdSettings in tests/src/Functional/MonitoringUITest.php
Tests outer threshold settings UI and validation.

File

tests/src/Functional/MonitoringUITest.php, line 672

Class

MonitoringUITest
Tests for the Monitoring UI.

Namespace

Drupal\Tests\monitoring\Functional

Code

protected function submitThresholdSettings($sensor_name, array $thresholds) {
  $data = array();
  $sensor_config = SensorConfig::load($sensor_name);
  foreach ($thresholds as $key => $value) {
    $form_field_name = 'thresholds[' . $key . ']';
    $data[$form_field_name] = $value;
  }
  $this
    ->drupalPostForm('admin/config/system/monitoring/sensors/' . $sensor_config
    ->id(), $data, t('Save'));
}