now favicons

This commit is contained in:
Mark Gregory
2026-06-10 13:10:09 +01:00
parent c59b16d791
commit 9518ff889b
37 changed files with 324 additions and 168 deletions
+4 -4
View File
@@ -22,7 +22,7 @@ class AuthenticationTest extends TestCase
{
$user = User::factory()->create();
$response = $this->post(route('login.store'), [
$response = $this->csrfPost(route('login.store'), [
'email' => $user->email,
'password' => 'password',
]);
@@ -38,7 +38,7 @@ class AuthenticationTest extends TestCase
{
$user = User::factory()->create();
$response = $this->post(route('login.store'), [
$response = $this->csrfPost(route('login.store'), [
'email' => $user->email,
'password' => 'wrong-password',
]);
@@ -59,7 +59,7 @@ class AuthenticationTest extends TestCase
$user = User::factory()->withTwoFactor()->create();
$response = $this->post(route('login.store'), [
$response = $this->csrfPost(route('login.store'), [
'email' => $user->email,
'password' => 'password',
]);
@@ -72,7 +72,7 @@ class AuthenticationTest extends TestCase
{
$user = User::factory()->create();
$response = $this->actingAs($user)->post(route('logout'));
$response = $this->actingAs($user)->csrfPost(route('logout'));
$response->assertRedirect(route('home'));
+4 -4
View File
@@ -33,7 +33,7 @@ class PasswordResetTest extends TestCase
$user = User::factory()->create();
$this->post(route('password.request'), ['email' => $user->email]);
$this->csrfPost(route('password.email'), ['email' => $user->email]);
Notification::assertSentTo($user, ResetPassword::class);
}
@@ -44,7 +44,7 @@ class PasswordResetTest extends TestCase
$user = User::factory()->create();
$this->post(route('password.request'), ['email' => $user->email]);
$this->csrfPost(route('password.email'), ['email' => $user->email]);
Notification::assertSentTo($user, ResetPassword::class, function ($notification) {
$response = $this->get(route('password.reset', $notification->token));
@@ -61,10 +61,10 @@ class PasswordResetTest extends TestCase
$user = User::factory()->create();
$this->post(route('password.request'), ['email' => $user->email]);
$this->csrfPost(route('password.email'), ['email' => $user->email]);
Notification::assertSentTo($user, ResetPassword::class, function ($notification) use ($user) {
$response = $this->post(route('password.update'), [
$response = $this->csrfPost(route('password.update'), [
'token' => $notification->token,
'email' => $user->email,
'password' => 'password',
+1 -1
View File
@@ -26,7 +26,7 @@ class RegistrationTest extends TestCase
public function test_new_users_can_register(): void
{
$response = $this->post(route('register.store'), [
$response = $this->csrfPost(route('register.store'), [
'name' => 'John Doe',
'email' => 'test@example.com',
'password' => 'password',
@@ -34,7 +34,7 @@ class TwoFactorChallengeTest extends TestCase
$user = User::factory()->withTwoFactor()->create();
$this->post(route('login.store'), [
$this->csrfPost(route('login.store'), [
'email' => $user->email,
'password' => 'password',
])->assertRedirect(route('two-factor.login'));
+28
View File
@@ -2,11 +2,39 @@
namespace Tests;
use Illuminate\Foundation\Http\Middleware\ValidateCsrfToken;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
use Laravel\Fortify\Features;
abstract class TestCase extends BaseTestCase
{
protected function setUp(): void
{
parent::setUp();
config([
'app.debug' => false,
'session.driver' => 'array',
'cache.default' => 'array',
'mail.default' => 'array',
]);
$this->withoutMiddleware(ValidateCsrfToken::class);
}
/**
* POST with a real CSRF token for Fortify/web form tests.
*
* @param array<string, mixed> $data
*/
protected function csrfPost(string $uri, array $data = []): \Illuminate\Testing\TestResponse
{
$token = 'test-csrf-token';
return $this->withSession(['_token' => $token])
->post($uri, ['_token' => $token, ...$data]);
}
protected function skipUnlessFortifyHas(string $feature, ?string $message = null): void
{
if (! Features::enabled($feature)) {