Skip to content

Commit 3e0f400

Browse files
committed
wip
1 parent e9f0aee commit 3e0f400

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

app/Providers/AppServiceProvider.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,16 @@
88
use App\Models\User;
99
use App\Notifications\SlowQueryLogged;
1010
use App\Observers\UserObserver;
11+
use App\Policies\NotificationPolicy;
1112
use Illuminate\Cache\RateLimiting\Limit;
1213
use Illuminate\Database\Connection;
1314
use Illuminate\Database\Eloquent\Relations\Relation;
1415
use Illuminate\Database\Events\QueryExecuted;
1516
use Illuminate\Http\Request;
1617
use Illuminate\Notifications\AnonymousNotifiable;
18+
use Illuminate\Notifications\DatabaseNotification;
1719
use Illuminate\Support\Facades\DB;
20+
use Illuminate\Support\Facades\Gate;
1821
use Illuminate\Support\Facades\Notification;
1922
use Illuminate\Support\Facades\RateLimiter;
2023
use Illuminate\Support\Facades\Request as RequestFacade;
@@ -41,6 +44,7 @@ public function boot(): void
4144

4245
$this->bootEvent();
4346
$this->bootRoute();
47+
$this->bootPolicies();
4448
}
4549

4650
private function bootEloquentMorphs()
@@ -102,6 +106,10 @@ public function bootRoute(): void
102106
});
103107

104108
require base_path('routes/bindings.php');
109+
}
105110

111+
public function bootPolicies(): void
112+
{
113+
Gate::policy(DatabaseNotification::class, NotificationPolicy::class);
106114
}
107115
}

tests/Feature/NotificationsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
"A new reply was added to <a href=\"{$replyAbleRoute}\" class=\"text-lio-700\">\"{$thread->subject()}\"</a>.",
7575
))
7676
->assertDispatched('NotificationMarkedAsRead');
77-
});
77+
})->only();
7878

7979
test('a_non_logged_in_user_cannot_access_notifications', function () {
8080
Livewire::test(Notifications::class)->assertForbidden();

tests/Integration/Models/ThreadTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@
8787
$threadUpdatedYesterday = createThreadFromYesterday();
8888
$threadFromToday = createThreadFromToday();
8989
$threadFromTwoDaysAgo = createThreadFromTwoDaysAgo();
90+
91+
sleep(1);
92+
9093
dispatch_sync(new CreateReply(Str::uuid(), 'Hello world', User::factory()->create(), $threadFromTwoDaysAgo));
9194

9295
$threads = Thread::feed();

0 commit comments

Comments
 (0)