You are here

protected function MonitoringUITest::assertThresholdSettingsUIDefaults in Monitoring 7

Asserts that defaults are set correctly in the settings form.

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::assertThresholdSettingsUIDefaults()
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 287
Contains \MonitoringUITest.

Class

MonitoringUITest
Tests for the Monitoring UI.

Code

protected function assertThresholdSettingsUIDefaults($sensor_name, $thresholds) {
  $sensor_info = $this->sensorManager
    ->getSensorInfoByName($sensor_name);
  $this
    ->drupalGet('admin/config/system/monitoring/sensors/' . $sensor_name);
  $this
    ->assertTitle(t('@label settings (@category) | Drupal', array(
    '@label' => $sensor_info
      ->getLabel(),
    '@category' => $sensor_info
      ->getCategory(),
  )));
  foreach ($thresholds as $key => $value) {
    $form_field_name = monitoring_sensor_settings_key($sensor_name) . '[thresholds][' . $key . ']';
    $this
      ->assertFieldByName($form_field_name, $value);
  }
}