mcpField
L
laravel:controller-tests

laravel:controller-tests

github.com/jpcaparasTesting & quality157123 installsUpdated 17w ago
Repository

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

  1. 01Test endpoint responses
  2. 02Assert session validation errors
  3. 03Recommend Form Requests
  4. 04Test business logic in Actions
  5. 05Build test data with factories

Use cases

  1. 01Test rejection of an empty registration email
  2. 02Check errors from a request class
  3. 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-tests

After installing, type/laravel:controller-testsin Claude Code to confirm it loaded.

Details

From the project README

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

Comments

Markdown supported