You are here

protected function MonitoringUITest::assertThresholdSettingsUIDefaults in Monitoring 8

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::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 692

Class

MonitoringUITest
Tests for the Monitoring UI.

Namespace

Drupal\Tests\monitoring\Functional

Code

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