public function RulesEventDispatcherTestCase::testStartAndStop in Rules 7.2
Same name and namespace in other branches
- 8.3 d7-tests/rules_test_event_dispatcher_case.test \RulesEventDispatcherTestCase::testStartAndStop()
Tests start and stop functionality.
File
- tests/
rules.test, line 2168 - Rules tests.
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());
}