本文整理汇总了PHP中phpunit_util::event_triggered方法的典型用法代码示例。如果您正苦于以下问题:PHP phpunit_util::event_triggered方法的具体用法?PHP phpunit_util::event_triggered怎么用?PHP phpunit_util::event_triggered使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phpunit_util
的用法示例。
在下文中一共展示了phpunit_util::event_triggered方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: trigger
/**
* Trigger event.
*/
public final function trigger()
{
global $CFG;
if ($this->restored) {
throw new \coding_exception('Can not trigger restored event');
}
if ($this->triggered or $this->dispatched) {
throw new \coding_exception('Can not trigger event twice');
}
$this->validate_before_trigger();
$this->triggered = true;
if (isset($CFG->loglifetime) and $CFG->loglifetime != -1) {
if ($data = $this->get_legacy_logdata()) {
$manager = get_log_manager();
if (method_exists($manager, 'legacy_add_to_log')) {
if (is_array($data[0])) {
// Some events require several entries in 'log' table.
foreach ($data as $d) {
call_user_func_array(array($manager, 'legacy_add_to_log'), $d);
}
} else {
call_user_func_array(array($manager, 'legacy_add_to_log'), $data);
}
}
}
}
if (PHPUNIT_TEST and \phpunit_util::is_redirecting_events()) {
$this->dispatched = true;
\phpunit_util::event_triggered($this);
return;
}
\core\event\manager::dispatch($this);
$this->dispatched = true;
if ($legacyeventname = static::get_legacy_eventname()) {
events_trigger_legacy($legacyeventname, $this->get_legacy_eventdata());
}
}
示例2: trigger
/**
* Trigger event.
*/
public final function trigger()
{
global $CFG;
if ($this->restored) {
throw new \coding_exception('Can not trigger restored event');
}
if ($this->triggered or $this->dispatched) {
throw new \coding_exception('Can not trigger event twice');
}
$this->validate_before_trigger();
$this->triggered = true;
if (isset($CFG->loglifetime) and $CFG->loglifetime != -1) {
if ($data = $this->get_legacy_logdata()) {
call_user_func_array('add_to_log', $data);
}
}
if (PHPUNIT_TEST and \phpunit_util::is_redirecting_events()) {
$this->dispatched = true;
\phpunit_util::event_triggered($this);
return;
}
\core\event\manager::dispatch($this);
$this->dispatched = true;
if ($legacyeventname = static::get_legacy_eventname()) {
events_trigger_legacy($legacyeventname, $this->get_legacy_eventdata());
}
}