testing-laravel

testing-laravel is a skill for Claude Code, Codex from iliaal/whetstone. It costs 63 tokens per session (1,010 once invoked), scanned A, original, MIT.

Laravel testing guidance using PHPUnit, the PHP testing tool commonly used with Laravel. It distinguishes feature tests, which exercise requests and database behavior, from unit tests, which check isolated logic.

In plain words
What is it for?
Use it to write tests for Laravel routes, controllers, models, services, actions, jobs, commands, and API endpoints. It covers choosing the test type, creating data with model factories, and testing authenticated JSON requests.
Why use it?
It gives developers a consistent way to check both returned responses and side effects such as database changes, queued jobs, and notifications. It also reduces errors in authentication, test data, and database cleanup.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is ./vendor/bin/phpunit # all tests (direct, lower memory).

Good fit Use it to write tests for Laravel routes, controllers, models, services, actions, jobs, commands, and API endpoints. It covers choosing the test type, creating data with model factories, and testing authenticated JSON requests.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/iliaal/whetstone
agentmods
npx agentmods add skills/iliaal/whetstone/testing-laravel

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for testing-laravel

README.md
[![agentmods](https://agentmods.dev/badge/skills/iliaal/whetstone/testing-laravel/github.svg)](https://agentmods.dev/skills/iliaal/whetstone/testing-laravel)
Your own site
<a href="https://agentmods.dev/skills/iliaal/whetstone/testing-laravel"><img src="https://agentmods.dev/badge/skills/iliaal/whetstone/testing-laravel/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for testing-laravel

Your own site · 80×15
<a href="https://agentmods.dev/skills/iliaal/whetstone/testing-laravel"><img src="https://agentmods.dev/badge/skills/iliaal/whetstone/testing-laravel.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 63 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,010 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00063 $0.01010
Opus 5 $0.00032 $0.00505
Sonnet 5 $0.00013 $0.00202
Haiku 4.5 $0.00006 $0.00101

Measured 10d ago against content hash 98dabd397665, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

testing-laravel scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

distillery/generated-skills/testing-laravel/SKILL.md · 112 lines

How it starts

The opening of the file, as written. The whole thing — 112 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Testing Laravel

Use PHPUnit with Laravel's testing helpers. Every test file starts with declare(strict_types=1).

Test Classification

  • Feature tests (tests/Feature/): HTTP requests through the full stack — routes, controllers, middleware, validation, database. Use $this->getJson(), $this->postJson(), etc.
  • Unit tests (tests/Unit/): Isolated logic — services, actions, value objects, helpers. No HTTP, minimal database.

Default to feature tests for anything touching routes, controllers, or models. Use unit tests for pure logic and action classes.

Critical Rules

  • use RefreshDatabase trait in every test class that touches the database
  • Model factories for all test data — use factories instead of raw DB::table() inserts
  • One behavior per test method. Name with test_ prefix: test_user_can_update_own_profile
  • Assert both response status AND side effects (DB state, dispatched jobs, sent notifications)
  • actingAs($user) for auth — use this instead of manually setting sessions or tokens
  • postJson() / getJson() for API endpoints — sets proper Accept headers and returns JSON assertions
  • Fake facades BEFORE the action: Queue::fake() then act then Queue::assertPushed(...)
  • assertDatabaseHas / assertDatabaseMissing to verify persistence — use these instead of re-querying
  • Resolve action classes from the container with resolve() so DI works; use swap() to inject mocks
  • Tests expose bugs, not the reverse: If a test uncovers broken or buggy behavior, highlight the issue and propose a fix to the source code. Never adjust the test to match incorrect behavior.

PHPUnit Essentials

<?php

declare(strict_types=1);

namespace Tests\Feature;

use App\Models\{User, Post};
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;

final class PostTest extends TestCase
{
    use RefreshDatabase;

    public function test_authenticated_user_can_create_post(): void
    {
        $user = User::factory()->create();

        $response = $this->actingAs($user)
            ->postJson('/api/posts', ['title' => 'New Post', 'body' => 'Content']);

        $response->assertCreated()
            ->assertJson(['data' => ['title' => 'New Post']]);

        $this->assertDatabaseHas('posts', [
            'title' => 'New Post',
            'user_id' => $user->id,
        ]);
    }
}

Read the full file on GitHub · 112 lines

Files

What ships with it

4 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 10d ago First seen · 112 lines · 63 tokens per session scan A 98dabd397665

Subscribe to this mod's changes

testing-laravel is a skill published in the GitHub repository iliaal/whetstone (33 stars, last pushed 2d ago), licensed MIT. It adds 63 tokens to every session and 1,010 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.