Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
80.00% |
4 / 5 |
|
50.00% |
1 / 2 |
CRAP | |
0.00% |
0 / 1 |
| phpbb_mock_event_dispatcher | |
80.00% |
4 / 5 |
|
50.00% |
1 / 2 |
3.07 | |
0.00% |
0 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| trigger_event | |
75.00% |
3 / 4 |
|
0.00% |
0 / 1 |
2.06 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * |
| 4 | * This file is part of the phpBB Forum Software package. |
| 5 | * |
| 6 | * @copyright (c) phpBB Limited <https://www.phpbb.com> |
| 7 | * @license GNU General Public License, version 2 (GPL-2.0) |
| 8 | * |
| 9 | * For full copyright and license information, please see |
| 10 | * the docs/CREDITS.txt file. |
| 11 | * |
| 12 | */ |
| 13 | |
| 14 | class phpbb_mock_event_dispatcher extends \phpbb\event\dispatcher |
| 15 | { |
| 16 | /** |
| 17 | * Constructor. |
| 18 | * |
| 19 | * Overwrite the constructor to get rid of ContainerInterface param instance |
| 20 | */ |
| 21 | public function __construct() |
| 22 | { |
| 23 | } |
| 24 | |
| 25 | public function trigger_event($eventName, $data = array()): array |
| 26 | { |
| 27 | $data = (array) $data; |
| 28 | |
| 29 | // Throw an exception if we reach the core's exit_handler() |
| 30 | if ($eventName === 'core.exit_handler') |
| 31 | { |
| 32 | throw new \RuntimeException('Exit handler called'); |
| 33 | } |
| 34 | |
| 35 | return $data; |
| 36 | } |
| 37 | } |