Write focused controller tests using HTTP assertions; keep heavy logic in Actions/Services and unit test them
Instal·la
npx skillscat add noartem/skills/laravel-controller-tests Instal·la des del registre de SkillsCat.
Sobre aquest skill
Here's a thinking process: 1. **Analyze the Request:** - **Input:** An AI agent skill description from a public software directory. - **Author-provided short description:** "Write focused controller tests using HTTP assertions; keep heavy logic in Actions/Services and unit test them" - **SKILL.md excerpt:** Provided, showing Laravel controller tests, feature tests for endpoints, better practices (move validation to Form Requests, extract business logic into Actions, use factories).
SKILL.md
Controller 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