]> BookStack Code Mirror - bookstack/blobdiff - tests/User/UserPreferencesTest.php
Notifications: Add phpunit test for notification sending
[bookstack] / tests / User / UserPreferencesTest.php
index a0e7e063f7297c5e5de823dd9c463c55558a2ad6..bc023b4cd3d4fb78a970e1809e25183292851ac8 100644 (file)
@@ -121,6 +121,21 @@ class UserPreferencesTest extends TestCase
         $resp->assertDontSee('All Page Updates & Comments');
     }
 
+    public function test_notification_preferences_not_accessible_to_guest()
+    {
+        $this->setSettings(['app-public' => 'true']);
+        $guest = $this->users->guest();
+        $this->permissions->grantUserRolePermissions($guest, ['receive-notifications']);
+
+        $resp = $this->get('/preferences/notifications');
+        $this->assertPermissionError($resp);
+
+        $resp = $this->put('/preferences/notifications', [
+            'preferences' => ['comment-replies' => 'true'],
+        ]);
+        $this->assertPermissionError($resp);
+    }
+
     public function test_update_sort_preference()
     {
         $editor = $this->users->editor();