L
laravel:controller-tests
About laravel:controller-tests
A Laravel skill for developers writing feature tests for controller endpoints. It covers request validation and recommends separating validation and business logic for focused tests.
Key features
- 01Test endpoint responses
- 02Assert session validation errors
- 03Recommend Form Requests
- 04Test business logic in Actions
- 05Build test data with factories
Use cases
- 01Test rejection of an empty registration email
- 02Check errors from a request class
- 03Write unit tests for business logic
Install
Copy the command and run it in a terminal.
$
npx skills add https:/ / github.com/ jpcaparas/ superpowers-laravel --skill laravel:controller-testsAfter installing, type/laravel:controller-testsin Claude Code to confirm it loaded.
Details
From the project READMEController Tests
Feature tests for endpoints
it('rejects empty email', function () {
$this->post('/register', ['email' => ''])->assertSessionHasErrors('email');
});
Better tests
- Move validation to Form Requests; assert errors from the request class
- Extract business logic into Actions; unit test them directly
- Use factories for realistic data; avoid heavy mocking
Comments
Markdown supported