1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-10-04 19:51:39 +02:00

[ticket/17542] Optimize and simplify logic

PHPBB-17542
This commit is contained in:
Matt Friedman
2025-09-16 13:14:39 -07:00
parent 07d75791be
commit dac58f53d7

View File

@@ -24,18 +24,13 @@ class phpbb_mock_event_dispatcher extends \phpbb\event\dispatcher
public function trigger_event($eventName, $data = array()): array public function trigger_event($eventName, $data = array()): array
{ {
// Ensure tests never hard-exit when phpBB calls exit_handler() $data = (array) $data;
if ($eventName === 'core.exit_handler') if ($eventName === 'core.exit_handler')
{ {
// Set the override flag so exit_handler() returns instead of exit; $data['exit_handler_override'] = true;
if (is_array($data))
{
$data['exit_handler_override'] = true;
}
return (array) $data;
} }
// Default behaviour of the mock: return the input data unchanged return $data;
return (array) $data;
} }
} }