mirror of
https://github.com/jez500/pricebuddy.git
synced 2026-11-24 19:58:13 +01:00
AuthenticateSession logs a user out after a password change. Laravel then redirects to a route named "login", which the app does not define, so the next request failed with HTTP 500.
35 lines
990 B
PHP
35 lines
990 B
PHP
<?php
|
|
|
|
namespace Tests\Feature\Http;
|
|
|
|
use App\Models\User;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Illuminate\Support\Facades\Hash;
|
|
use Tests\TestCase;
|
|
|
|
class GuestRedirectTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
/**
|
|
* Changing the password invalidates the other sessions of the user. The next request
|
|
* must go to the Filament login page. The app has no route named "login" (#236).
|
|
*/
|
|
public function test_session_with_stale_password_hash_redirects_to_filament_login(): void
|
|
{
|
|
$user = User::factory()->create();
|
|
|
|
$this->actingAs($user)
|
|
->withSession(['password_hash_web' => Hash::make('an-old-password')])
|
|
->get('/admin')
|
|
->assertRedirect(route('filament.admin.auth.login'));
|
|
|
|
$this->assertGuest();
|
|
}
|
|
|
|
public function test_guest_on_admin_redirects_to_filament_login(): void
|
|
{
|
|
$this->get('/admin')->assertRedirect(route('filament.admin.auth.login'));
|
|
}
|
|
}
|