First public release. - docs: document the audit log, user offboarding, CSV export and the "require a reason for destructive actions" setting across README, docs/ and CLAUDE/AGENTS.md; note retention for panel_audit - docs: fill the publishing placeholders (repo URL, security contact, issue-template links) and add a semantic-versioning policy - move agent/contributor context into CLAUDE/ (AGENTS.md + a README); root CLAUDE.md is now a thin @-import pointer - add a favicon (shield-lock, matching the login screen) to the login page and the app layout - CHANGELOG: promote [Unreleased] to [1.0.0]; keep the earlier internal build as [0.1.0] Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UfuvfwexztdS7LDpGuKsuK
51 lines
1.3 KiB
PHP
51 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature\Auth;
|
|
|
|
use Tests\TestCase;
|
|
|
|
class LoginTest extends TestCase
|
|
{
|
|
public function test_guests_are_redirected_to_the_login_screen(): void
|
|
{
|
|
$this->get('/dashboard')->assertRedirect(route('login'));
|
|
$this->get('/users')->assertRedirect(route('login'));
|
|
$this->get('/settings')->assertRedirect(route('login'));
|
|
}
|
|
|
|
public function test_login_screen_renders(): void
|
|
{
|
|
$this->get('/login')
|
|
->assertOk()
|
|
->assertSee('Zaloguj')
|
|
->assertSee(__('auth.login_label'));
|
|
}
|
|
|
|
public function test_authenticated_admin_is_redirected_away_from_login(): void
|
|
{
|
|
$this->actingAsPanelAdmin()
|
|
->get('/login')
|
|
->assertRedirect('/dashboard');
|
|
}
|
|
|
|
public function test_login_requires_credentials(): void
|
|
{
|
|
$this->from('/login')
|
|
->post('/login', [])
|
|
->assertRedirect('/login')
|
|
->assertSessionHasErrors(['login', 'password']);
|
|
|
|
$this->assertGuest('ldap');
|
|
}
|
|
|
|
public function test_logout_clears_the_session(): void
|
|
{
|
|
$this->actingAsPanelAdmin()
|
|
->withSession(['ad_admin' => ['login' => 'tester']])
|
|
->post('/logout')
|
|
->assertRedirect(route('login'));
|
|
|
|
$this->assertGuest('ldap');
|
|
}
|
|
}
|