function testBindSysEvent() { $this->title('System Bind and Trigger'); $callback = array($this, 'callback'); Raxan::bindSysEvent('test_event', $callback); Raxan::triggerSysEvent('test_event'); $this->compare($this->msgFromCallback, 'done', 'Callback Object'); Raxan::bindSysEvent('test_event2', 'regular_callback_function'); Raxan::triggerSysEvent('test_event2'); $this->compare($GLOBALS['msgFromCallback'], 'done', 'Callback Function'); }
public function __construct() { $call = array($this, 'raiseEvent'); $a = $this->methods(); foreach ($a as $n) { if ($n[0] != '_' && strpos($n, '_')) { $this->events[$n] = true; Raxan::bindSysEvent($n, $call); } } }