You are here

public function MonitoringCoreKernelTest::testConfigValueSensorPluginCronSafeThreshold in Monitoring 8

Tests cron safe threshold (poormanscron) sensor.

See also

\Drupal\monitoring\Plugin\monitoring\SensorPlugin\ConfigValueSensorPlugin

File

tests/src/Kernel/MonitoringCoreKernelTest.php, line 105

Class

MonitoringCoreKernelTest
Kernel tests for the core pieces of monitoring.

Namespace

Drupal\Tests\monitoring\Kernel

Code

public function testConfigValueSensorPluginCronSafeThreshold() {

  // Run sensor, all is OK.
  $result = $this
    ->runSensor('core_cron_safe_threshold');
  $this
    ->assertTrue($result
    ->isOk());

  // Enable cron safe threshold and run sensor.
  $this
    ->config('automated_cron.settings')
    ->set('interval', 3600)
    ->save();
  $result = $this
    ->runSensor('core_cron_safe_threshold');
  $this
    ->assertTrue($result
    ->isCritical());
  $this
    ->assertEqual($result
    ->getMessage(), 'TRUE, expected FALSE');
}