mcpField
L
laravel-controller-tests

laravel-controller-tests

github.com/noartemTesting & quality1376 installsUpdated 2w ago
Repository

About laravel-controller-tests

A skill for writing Laravel controller feature tests and improving their structure. It recommends testing validation through Form Requests, business logic through Actions, and using factories instead of heavy mocking.

Key features

  1. 01Write endpoint feature tests
  2. 02Assert validation errors
  3. 03Test Form Requests directly
  4. 04Unit test extracted Actions
  5. 05Use factories instead of heavy mocking

Use cases

  1. 01Test that an endpoint rejects invalid input
  2. 02Verify validation through a Form Request
  3. 03Test business logic separately from a controller

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/noartem/skills --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