- Extract business logic from controllers into Action classes: Post/, Workspace/, Hashtag/, Label/, Invite/, ApiKey/ - Create subdomain routing: app.trypost.test (Inertia dashboard), api.trypost.test (REST API with token auth) - Add ApiToken model with tp_ prefix, token_lookup/hash auth - Add AuthenticateApiToken middleware for API authentication - Create Api controllers with JSON Resources for all entities - Create App controllers that use Actions + Inertia responses - Organize Form Requests into Api/ and App/ directories - Add api_tokens migration - Update all route names with app. prefix - Update all tests to use new route names (684 passing)
29 lines
766 B
PHP
29 lines
766 B
PHP
<?php
|
|
|
|
use App\Models\User;
|
|
use Illuminate\Auth\Notifications\VerifyEmail;
|
|
use Illuminate\Support\Facades\Notification;
|
|
|
|
test('sends verification notification', function () {
|
|
Notification::fake();
|
|
|
|
$user = User::factory()->unverified()->create();
|
|
|
|
$this->actingAs($user)
|
|
->post(route('verification.send'))
|
|
->assertRedirect(route('app.home'));
|
|
|
|
Notification::assertSentTo($user, VerifyEmail::class);
|
|
});
|
|
|
|
test('does not send verification notification if email is verified', function () {
|
|
Notification::fake();
|
|
|
|
$user = User::factory()->create();
|
|
|
|
$this->actingAs($user)
|
|
->post(route('verification.send'))
|
|
->assertRedirect(route('app.calendar', absolute: false));
|
|
|
|
Notification::assertNothingSent();
|
|
});
|