Skip to content

Commit 8960d27

Browse files
authored
Merge pull request #83 from phpbb-extensions/iMattPro-patch-1
Update README.md
2 parents 10ba38e + 31f0dcc commit 8960d27

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,24 +33,24 @@ To run this extension from the repo (and not from a pre-built package) on a loca
3333

3434
## Testing Push Notifications
3535

36-
Testing push notifications necessitates user-to-user interactions to observe the notification behavior accurately. Follow the steps outlined below to effectively test push notifications:
36+
Testing push notifications necessitates user-to-user interactions to observe the notification behavior accurately. Follow the steps outlined below to effectively test push notifications (the browser recommendations are what we have seen work in local environments):
3737

3838
1. **User Account Setup:**
39-
- Create at least two distinct user accounts for testing purposes.
40-
- In the notifications preferences for _**User Account 1**_, subscribe to receive Push Notifications (and assign web push notification types if necessary).
39+
- Create at least two distinct board user accounts for testing purposes.
40+
- Using Google Chrome, visit `UCP -> Board Preferences -> Edit notification options` for _**User Account 1**_ and enable Push Notifications (and enable all web push notification types if necessary). Your browser may ask you to allow notifications, which you should accept. Leave Chrome open and running the background.
4141

4242
2. **Message, Quote, or Reply Interaction:**
43-
- Initiate a user-to-user interaction by performing one of the following actions using _**User Account 2**_:
43+
- Initiate a user-to-user interaction by performing one of the following actions using _**User Account 2**_ in separate browser such as Firefox, Edge or Safari:
4444
- **Private Message:** Send a direct message from _**User Account 2**_ to _**User Account 1**_.
4545
- **Quote:** Quote a post or message authored by _**User Account 1**_ using _**User Account 2**_.
4646
- **Reply:** Respond to a post or message authored by _**User Account 1**_ using _**User Account 2**_.
4747

4848
3. **Observing Push Notifications:**
49-
- Once the interaction is performed from _**User Account 2**_ to engage with _**User Account 1**_, you promptly should see a notification for _**User Account 1**_.
49+
- Once the interaction is performed from _**User Account 2**_ to engage with _**User Account 1**_, you promptly should see a notification from Google Chrome for _**User Account 1**_.
5050

5151
4. **Caveats for Local Testing**
52-
- Local testing of Push Notifications only works from a `localhost` address or if your local server has a secure SSL certificate.
53-
- We have seen success on Windows using manually installed PHP, Apache and MySQL. However, for reasons not yet known we do not see success on Mac using MAMP.
52+
- Local testing of Push Notifications only works from a `http://localhost` address or if your local test server has a secure SSL certificate, e.g.: `https://local.phpbb.board`.
53+
- Depending on your local server's setup, operating system, and browsers, it is still possible that testing push notifications may not work (for example, in a local environment running on macOS, only Chrome will show notifications).
5454

5555
## License
5656

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)