public function MonitoringUITest::testSensorEditPage in Monitoring 8
Tests the sensor detail page for actual and expected values.
File
- tests/
src/ Functional/ MonitoringUITest.php, line 413
Class
- MonitoringUITest
- Tests for the Monitoring UI.
Namespace
Drupal\Tests\monitoring\FunctionalCode
public function testSensorEditPage() {
$account = $this
->drupalCreateUser(array(
'administer monitoring',
'monitoring reports',
));
$this
->drupalLogin($account);
// Visit the edit page of "core theme default" (config value sensor)
// and make sure the expected and current values are displayed.
$this
->drupalGet('admin/config/system/monitoring/sensors/core_theme_default');
$this
->assertText('The expected value of config system.theme:default, current value: ' . $this
->config('system.theme')
->get('default'));
// Visit the edit page of "core maintainance mode" (state value sensor)
// and make sure the expected and current values are displayed.
$this
->drupalGet('admin/config/system/monitoring/sensors/core_maintenance_mode');
$this
->assertText('The expected value of state system.maintenance_mode, current value: FALSE');
// Make sure delete link is not available for this sensor.
$this
->assertNoLink(t('Delete'));
// Make sure details page is available for an enabled sensor.
$this
->assertLink('Details');
// Test the checkbox in edit sensor settings for the bool sensor
// Cron safe threshold enabled/disabled.
$this
->drupalGet('admin/config/system/monitoring/sensors/core_cron_safe_threshold');
// Make sure delete action available for this sensor.
$this
->assertLink(t('Delete'));
$this
->assertNoFieldChecked('edit-settings-value');
$this
->drupalPostForm(NULL, array(
'settings[value]' => 'Checked',
), t('Save'));
$this
->drupalGet('admin/config/system/monitoring/sensors/core_cron_safe_threshold');
$this
->assertFieldChecked('edit-settings-value');
// Test whether the details page is available.
$this
->assertLink(t('Details'));
$this
->clickLink(t('Details'));
$this
->assertText('Result');
$this
->assertLink(t('Edit'));
$this
->clickLink(t('Edit'));
$this
->assertText('Sensor plugin settings');
// Test detail page is not available for a disabled sensor.
$this
->drupalGet('admin/config/system/monitoring/sensors/node_new_all');
$this
->assertNoLink('Details');
}