laravel-controller-tests

star 136

Write focused controller tests using HTTP assertions; keep heavy logic in Actions/Services and unit test them

jpcaparas By jpcaparas schedule Updated 11/3/2025

name: laravel:controller-tests description: Write focused controller tests using HTTP assertions; keep heavy logic in Actions/Services and unit test them

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
Install via CLI
npx skills add https://github.com/jpcaparas/superpowers-laravel --skill laravel-controller-tests
Repository Details
star Stars 136
call_split Forks 0
navigation Branch main
article Path SKILL.md
More from Creator