Features: - Implement two fee types: entrance fee and annual fee (both NT$1,000) - Add 50% discount for disability certificate holders - Add disability certificate upload in member profile - Integrate disability verification into cashier approval workflow - Add membership fee settings in system admin Document permissions: - Fix hard-coded role logic in Document model - Use permission-based authorization instead of role checks Additional features: - Add announcements, general ledger, and trial balance modules - Add income management and accounting entries - Add comprehensive test suite with factories - Update UI translations to Traditional Chinese 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
61 lines
1.5 KiB
PHP
61 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature\Auth;
|
|
|
|
use App\Http\Middleware\VerifyCsrfToken;
|
|
use App\Models\User;
|
|
use App\Providers\RouteServiceProvider;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Tests\TestCase;
|
|
|
|
class AuthenticationTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
public function test_login_screen_can_be_rendered(): void
|
|
{
|
|
$response = $this->get('/login');
|
|
|
|
$response->assertStatus(200);
|
|
}
|
|
|
|
public function test_users_can_authenticate_using_the_login_screen(): void
|
|
{
|
|
$user = User::factory()->create();
|
|
|
|
$response = $this->withoutMiddleware(VerifyCsrfToken::class)
|
|
->post('/login', [
|
|
'email' => $user->email,
|
|
'password' => 'password',
|
|
]);
|
|
|
|
$this->assertAuthenticated();
|
|
$response->assertRedirect(RouteServiceProvider::HOME);
|
|
}
|
|
|
|
public function test_users_can_not_authenticate_with_invalid_password(): void
|
|
{
|
|
$user = User::factory()->create();
|
|
|
|
$this->withoutMiddleware(VerifyCsrfToken::class)
|
|
->post('/login', [
|
|
'email' => $user->email,
|
|
'password' => 'wrong-password',
|
|
]);
|
|
|
|
$this->assertGuest();
|
|
}
|
|
|
|
public function test_users_can_logout(): void
|
|
{
|
|
$user = User::factory()->create();
|
|
|
|
$response = $this->withoutMiddleware(VerifyCsrfToken::class)
|
|
->actingAs($user)
|
|
->post('/logout');
|
|
|
|
$this->assertGuest();
|
|
$response->assertRedirect('/');
|
|
}
|
|
}
|