Skip to content

Commit f2118ea

Browse files
committed
fix CI runs
1 parent c42dc4a commit f2118ea

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

tests/core/recenttopics_events_test.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,36 @@ function get_forum_parents($row) { return []; }
6767
class test_event_dispatcher extends \Symfony\Component\EventDispatcher\EventDispatcher
6868
implements \phpbb\event\dispatcher_interface
6969
{
70+
/** @var bool */
71+
private $disabled = false;
72+
7073
/**
7174
* Mirrors phpbb\event\dispatcher::trigger_event().
7275
* Wraps $data in a phpbb\event\data object, dispatches it, and returns
7376
* the (possibly modified) data array filtered to the original keys.
7477
*/
7578
public function trigger_event($event_name, $data = [])
7679
{
80+
if ($this->disabled)
81+
{
82+
return $data;
83+
}
7784
$event = new \phpbb\event\data($data);
7885
parent::dispatch($event, $event_name);
7986
return $event->get_data_filtered(array_keys($data));
8087
}
88+
89+
/** Temporarily disable event dispatching. */
90+
public function disable(): void
91+
{
92+
$this->disabled = true;
93+
}
94+
95+
/** Re-enable event dispatching. */
96+
public function enable(): void
97+
{
98+
$this->disabled = false;
99+
}
81100
}
82101

83102
// ---------------------------------------------------------------------------

0 commit comments

Comments
 (0)