You are here

monitoring.elysia.test in Monitoring 7

File

test/tests/monitoring.elysia.test
View source
<?php

/**
 * @file
 * Contains \MonitoringElysiaTest.
 */

/**
 * Tests for elysia sensor.
 */
class MonitoringElysiaTest extends MonitoringTestBase {
  public static function getInfo() {
    return array(
      'name' => 'Monitoring Elysia',
      'description' => 'Elysia sensor tests.',
      'group' => 'Monitoring',
      'dependencies' => array(
        'elysia_cron',
      ),
    );
  }

  /**
   * {@inheritdoc}
   */
  public function setUp() {
    parent::setUp(array(
      'elysia_cron',
    ));
  }

  /**
   * Tests elysia_cron last execution and last run sensors.
   */
  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);
  }

}

Classes

Namesort descending Description
MonitoringElysiaTest Tests for elysia sensor.