Skip to content

Commit 8575f6f

Browse files
committed
Fix tests
1 parent cdecbbd commit 8575f6f

File tree

1 file changed

+34
-1
lines changed

1 file changed

+34
-1
lines changed

tests/event/listener_test.php

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ public function test_getSubscribedEvents()
149149
'core.ucp_display_module_before',
150150
'core.acp_main_notice',
151151
'core.acp_board_config_edit_add',
152+
'core.acp_board_config_emoji_enabled',
152153
'core.validate_config_variable',
153154
'core.help_manager_add_block_after',
154155
], array_keys(\phpbb\webpushnotifications\event\listener::getSubscribedEvents()));
@@ -376,7 +377,6 @@ public function test_acp_pwa_options($mode, $display_vars, $expected_keys)
376377
$keys = array_keys($display_vars['vars']);
377378

378379
self::assertEquals($expected_keys, $keys);
379-
380380
}
381381

382382
public function validate_pwa_options_data()
@@ -420,6 +420,21 @@ public function validate_pwa_options_data()
420420
[
421421
'pwa_options:string',
422422
['pwa_short_name' => 'foo❤️'],
423+
[],
424+
],
425+
[
426+
'pwa_options:string',
427+
['pwa_short_name' => 'Фаны phpBB'],
428+
[],
429+
],
430+
[
431+
'pwa_options:string',
432+
['pwa_short_name' => 'Фаны phpBB Board'],
433+
['PWA_SHORT_NAME_INVALID'],
434+
],
435+
[
436+
'pwa_options:string',
437+
['pwa_short_name' => 'foo❤️bar foo bar'],
423438
['PWA_SHORT_NAME_INVALID'],
424439
],
425440
[
@@ -472,6 +487,24 @@ public function test_validate_pwa_options($validate, $cfg_array, $expected_error
472487
self::assertEquals($expected_error, $error);
473488
}
474489

490+
public function test_acp_pwa_allow_emoji()
491+
{
492+
$config_name_ary = ['foo'];
493+
$expected = ['foo', 'pwa_short_name'];
494+
495+
$this->set_listener();
496+
497+
$dispatcher = new \phpbb\event\dispatcher();
498+
$dispatcher->addListener('core.acp_board_config_emoji_enabled', [$this->listener, 'acp_pwa_allow_emoji']);
499+
500+
$event_data = ['config_name_ary'];
501+
$event_data_after = $dispatcher->trigger_event('core.acp_board_config_emoji_enabled', compact($event_data));
502+
503+
extract($event_data_after, EXTR_OVERWRITE);
504+
505+
self::assertEquals($expected, $config_name_ary);
506+
}
507+
475508
public function test_wpn_faq()
476509
{
477510
$this->language->add_lang('webpushnotifications_faq', 'phpbb/webpushnotifications');

0 commit comments

Comments
 (0)