Skip to content

Commit cdf7fbc

Browse files
committed
Reduce test time() issues
Signed-off-by: Matt Friedman <maf675@gmail.com>
1 parent 2ccc808 commit cdf7fbc

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

tests/event/listener_test.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,15 @@ public function test_load_template_data($user_id, $method_data, $subscriptions,
233233
{
234234
$this->config['wpn_webpush_dropdown_subscribe'] = true;
235235
$this->user->data['user_id'] = $user_id;
236+
237+
$this->set_listener();
238+
239+
$method_data['method'] = $this->notification_method_webpush;
240+
241+
$this->notifications->expects(self::once())
242+
->method('get_subscription_methods')
243+
->willReturn([$method_data['id'] => $method_data]);
244+
236245
$this->template->expects($expected ? self::once() : self::never())
237246
->method('assign_vars')
238247
->with([
@@ -243,16 +252,7 @@ public function test_load_template_data($user_id, $method_data, $subscriptions,
243252
'U_WEBPUSH_WORKER_URL' => $this->controller_helper->route('phpbb_webpushnotifications_ucp_push_worker_controller'),
244253
'SUBSCRIPTIONS' => $subscriptions,
245254
'WEBPUSH_FORM_TOKENS' => $this->form_helper->get_form_tokens(\phpbb\webpushnotifications\ucp\controller\webpush::FORM_TOKEN_UCP),
246-
]
247-
);
248-
249-
$this->set_listener();
250-
251-
$method_data['method'] = $this->notification_method_webpush;
252-
253-
$this->notifications->expects(self::once())
254-
->method('get_subscription_methods')
255-
->willReturn([$method_data['id'] => $method_data]);
255+
]);
256256

257257
$dispatcher = new \phpbb\event\dispatcher();
258258
$dispatcher->addListener('core.page_header_after', [$this->listener, 'load_template_data']);

0 commit comments

Comments
 (0)