1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-31 15:24:31 +03:00

Notifications: Added testing to cover controls

This commit is contained in:
Dan Brown
2023-08-15 20:08:27 +01:00
parent 615741af9d
commit bc6e19b2a1
4 changed files with 175 additions and 1 deletions

View File

@ -2,6 +2,7 @@
namespace Tests\User;
use BookStack\Activity\Tools\UserEntityWatchOptions;
use Tests\TestCase;
class UserPreferencesTest extends TestCase
@ -79,7 +80,6 @@ class UserPreferencesTest extends TestCase
public function test_notification_preferences_updating()
{
$editor = $this->users->editor();
$this->permissions->grantUserRolePermissions($editor, ['receive-notifications']);
// View preferences with defaults
$resp = $this->actingAs($editor)->get('/preferences/notifications');
@ -102,6 +102,25 @@ class UserPreferencesTest extends TestCase
$html->assertFieldHasValue('preferences[comment-replies]', 'true');
}
public function test_notification_preferences_show_watches()
{
$editor = $this->users->editor();
$book = $this->entities->book();
$options = new UserEntityWatchOptions($editor, $book);
$options->updateWatchLevel('comments');
$resp = $this->actingAs($editor)->get('/preferences/notifications');
$resp->assertSee($book->name);
$resp->assertSee('All Page Updates & Comments');
$options->updateWatchLevel('default');
$resp = $this->actingAs($editor)->get('/preferences/notifications');
$resp->assertDontSee($book->name);
$resp->assertDontSee('All Page Updates & Comments');
}
public function test_update_sort_preference()
{
$editor = $this->users->editor();