You are here

monitoring.simplenews.test in Monitoring 7

File

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

/**
 * @file
 * Contains \MonitoringSimplenewsTest.
 */

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

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

  /**
   * Tests individual sensors.
   */
  function testSensors() {

    // No spool items - status OK.
    $result = $this
      ->runSensor('simplenews_pending');
    $this
      ->assertEqual($result
      ->getValue(), 0);

    // Crate a spool item in state pending.
    simplenews_save_spool(array(
      'mail' => 'mail@example.com',
      'nid' => 1,
      'tid' => 1,
      'snid' => 1,
      'data' => array(
        'data' => 'data',
      ),
    ));
    $result = $this
      ->runSensor('simplenews_pending');
    $this
      ->assertEqual($result
      ->getValue(), 1);
  }

}

Classes

Namesort descending Description
MonitoringSimplenewsTest Tests for simplenews sensor.