function MonitoringElysiaTest::testElysiaCron in Monitoring 7
Tests elysia_cron last execution and last run sensors.
File
- test/
tests/ monitoring.elysia.test, line 31 - Contains \MonitoringElysiaTest.
Class
- MonitoringElysiaTest
- Tests for elysia sensor.
Code
function testElysiaCron() {
elysia_cron_set('system_cron');
db_update('elysia_cron')
->fields(array(
'last_execution_time' => 2,
'last_run' => REQUEST_TIME - 10,
))
->condition('name', 'system_cron')
->execute();
$result = $this
->runSensor('elysia_cron_system_cron_last_execution');
$this
->assertEqual($result
->getValue(), 2);
$result = $this
->runSensor('elysia_cron_system_cron_last_run');
// The sensor value is 10 as we inserted an entry that has the last_run
// value 10 seconds ago to REQUEST_TIME.
$this
->assertEqual($result
->getValue(), 10);
}