You are here

function MonitoringSimplenewsTest::testSensors in Monitoring 7

Tests individual sensors.

File

test/tests/monitoring.simplenews.test, line 31
Contains \MonitoringSimplenewsTest.

Class

MonitoringSimplenewsTest
Tests for simplenews sensor.

Code

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);
}