Implement webhook inspector

This commit is contained in:
2026-08-04 17:09:39 +02:00
parent b021836c14
commit 75d8b25b64
57 changed files with 5110 additions and 230 deletions
+55
View File
@@ -0,0 +1,55 @@
<?php
namespace Tests\Feature;
use App\Models\User;
use Illuminate\Auth\Notifications\VerifyEmail;
use Illuminate\Foundation\Testing\LazilyRefreshDatabase;
use Illuminate\Support\Facades\Notification;
use Tests\TestCase;
class AuthenticationTest extends TestCase
{
use LazilyRefreshDatabase;
public function test_a_user_can_register_and_is_asked_to_verify_email(): void
{
Notification::fake();
$response = $this->post(route('register.store'), [
'name' => 'Ada Lovelace',
'email' => 'ada@example.com',
'password' => 'password',
'password_confirmation' => 'password',
]);
$user = User::query()->where('email', 'ada@example.com')->firstOrFail();
$response->assertRedirect('/dashboard');
$this->assertAuthenticatedAs($user);
$this->assertNull($user->email_verified_at);
Notification::assertSentTo($user, VerifyEmail::class);
}
public function test_an_unverified_user_cannot_open_the_dashboard(): void
{
$user = User::factory()->unverified()->create();
$this->actingAs($user)->get(route('dashboard'))
->assertRedirect(route('verification.notice'));
}
public function test_a_verified_user_can_log_in_and_log_out(): void
{
$user = User::factory()->create(['password' => 'password']);
$this->post(route('login.store'), [
'email' => $user->email,
'password' => 'password',
])->assertRedirect('/dashboard');
$this->assertAuthenticatedAs($user);
$this->post(route('logout'))->assertRedirect('/');
$this->assertGuest();
}
}