mirror of
https://github.com/phpbb/phpbb.git
synced 2025-10-04 19:51:39 +02:00
[ticket/17542] Mock event dispatcher override early exits
PHPBB-17542
This commit is contained in:
@@ -22,8 +22,20 @@ class phpbb_mock_event_dispatcher extends \phpbb\event\dispatcher
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public function trigger_event($eventName, $data = array())
|
public function trigger_event($eventName, $data = array()): array
|
||||||
{
|
{
|
||||||
return array();
|
// Ensure tests never hard-exit when phpBB calls exit_handler()
|
||||||
|
if ($eventName === 'core.exit_handler')
|
||||||
|
{
|
||||||
|
// Set the override flag so exit_handler() returns instead of exit;
|
||||||
|
if (is_array($data))
|
||||||
|
{
|
||||||
|
$data['exit_handler_override'] = true;
|
||||||
|
}
|
||||||
|
return (array) $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Default behaviour of the mock: return the input data unchanged
|
||||||
|
return (array) $data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user