We use PHPUnit (via Laravel's Artisan command) for backend testing.
To run the full test suite:
php artisan testphp artisan test tests/Feature/ExampleTest.phpRun tests matching a keyword:
php artisan test --filter=UserTestLocated in tests/Feature. These test full HTTP requests and ensuring the application handles routes, controllers, and database interactions correctly.
- Example:
POST /loginlogs the user in. - Example:
GET /booksreturns a list of books.
Located in tests/Unit. These test individual methods or classes in isolation.
- Example: Testing a custom Helper function.
- Example: Testing a Model scope.
We aim for good coverage of critical paths, especially:
- Authentication & Authorization flows.
- Book Loan logic (approvals, rejections).
- Data integrity (Foreign key constraints).