function RulesEventDispatcherTestCase::testStartAndStop

Same name and namespace in other branches
  1. 7.x-2.x tests/rules.test \RulesEventDispatcherTestCase::testStartAndStop()

Tests start and stop functionality.

File

d7-tests/rules_test_event_dispatcher_case.test, line 34

Class

RulesEventDispatcherTestCase
Test event dispatcher functionality.

Code

public function testStartAndStop() {
  $handler = rules_get_event_handler('rules_test_event');
  $rule = rules_reaction_rule();
  $rule->event('rules_test_event');
  // The handler should not yet be watching.
  $this->assertFalse($handler->isWatching());
  // Once saved, the event cache rebuild should start the watcher.
  $rule->save();
  RulesEventSet::rebuildEventCache();
  $this->assertTrue($handler->isWatching());
  // Deleting should stop the watcher.
  $rule->delete();
  $this->assertFalse($handler->isWatching());
}