-
Notifications
You must be signed in to change notification settings - Fork 2
Running Tests
Azizul Hakim edited this page Jan 3, 2026
·
2 revisions
Testing with the Pest PHP framework.
php artisan testphp artisan test tests/Feature/UserFeatureTest.phpphp artisan test --filter="test_user_can_be_created"php artisan test --coveragetests/
├── Feature/ # API endpoint tests
├── Unit/ # Service/repository tests
└── Mock/ # Mock data classes
it('can create user', function () {
$response = $this->postJson('/api/v1/users', [
'name' => 'John Doe',
'email' => 'john@example.com',
'password' => 'password123'
]);
$response->assertStatus(201);
});it('can get user by id', function () {
$user = User::factory()->create();
$service = app(UserService::class);
$result = $service->findById($user->id);
expect($result->id)->toBe($user->id);
});Database: Uses in-memory SQLite Traits: RefreshDatabase for clean state Mocking: Mock data classes for consistent test data
# Test authentication
curl -X POST http://localhost:8000/api/v1/login \
-H "Content-Type: application/json" \
-d '{"email": "superadmin@ims.com", "password": "123456"}'
# Test users endpoint
curl -X GET http://localhost:8000/api/v1/users \
-H "Authorization: Bearer YOUR_TOKEN"For detailed documentation, see the Features Guide.
Copyright 2026, @AHS12 All Right Reserved
- Home - Documentation Overview
- Quick Start - Installation and setup
- Project Structure - Directory organization
- Features Overview - Summary of capabilities
- Backup System - Database backups
- Extra Information - Additional tools
- Observability - Dashboard & Telemetry
- Health Checks - System status
- Running Tests - Testing guide
- API Documentation - API specs & UI
- Docker Guide - Container setup