function RulesEventDispatcherTestCase::testStartAndStop

Same name in other branches
  1. 8.x-3.x d7-tests/rules_test_event_dispatcher_case.test \RulesEventDispatcherTestCase::testStartAndStop()

Tests start and stop functionality.

File

tests/rules.test, line 2169

Class

RulesEventDispatcherTestCase
Tests 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());
}