Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
driesvints committed Aug 28, 2024
1 parent e9f0aee commit 3e0f400
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
8 changes: 8 additions & 0 deletions app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@
use App\Models\User;
use App\Notifications\SlowQueryLogged;
use App\Observers\UserObserver;
use App\Policies\NotificationPolicy;
use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Database\Connection;
use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Database\Events\QueryExecuted;
use Illuminate\Http\Request;
use Illuminate\Notifications\AnonymousNotifiable;
use Illuminate\Notifications\DatabaseNotification;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\Facades\Notification;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\Facades\Request as RequestFacade;
Expand All @@ -41,6 +44,7 @@ public function boot(): void

$this->bootEvent();
$this->bootRoute();
$this->bootPolicies();
}

private function bootEloquentMorphs()
Expand Down Expand Up @@ -102,6 +106,10 @@ public function bootRoute(): void
});

require base_path('routes/bindings.php');
}

public function bootPolicies(): void
{
Gate::policy(DatabaseNotification::class, NotificationPolicy::class);
}
}
2 changes: 1 addition & 1 deletion tests/Feature/NotificationsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
"A new reply was added to <a href=\"{$replyAbleRoute}\" class=\"text-lio-700\">\"{$thread->subject()}\"</a>.",
))
->assertDispatched('NotificationMarkedAsRead');
});
})->only();

test('a_non_logged_in_user_cannot_access_notifications', function () {
Livewire::test(Notifications::class)->assertForbidden();
Expand Down
3 changes: 3 additions & 0 deletions tests/Integration/Models/ThreadTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@
$threadUpdatedYesterday = createThreadFromYesterday();
$threadFromToday = createThreadFromToday();
$threadFromTwoDaysAgo = createThreadFromTwoDaysAgo();

sleep(1);

dispatch_sync(new CreateReply(Str::uuid(), 'Hello world', User::factory()->create(), $threadFromTwoDaysAgo));

$threads = Thread::feed();
Expand Down

0 comments on commit 3e0f400

Please sign in to comment.