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:
@ -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();
|
||||
|
Reference in New Issue
Block a user