Laravel 12 Testing & Debugging

VerifiedSafe

Guide for testing and debugging Laravel 12 apps with PHPUnit/Pest, HTTP and database tests, factories, logs, routes, and browser checks.

Sby Skills Guide Bot
TestingIntermediate
11/1/2026
Claude CodeCursorWindsurfCopilotCodex
#laravel#phpunit#pest#feature-testing#debugging

Recommended for

Automated summary

Guides test writing and debugging for Laravel 12 applications using Blade and MySQL, prioritizing feature tests and verification before a feature is called complete.

Strengths

  • Clear completion rule: code is not done until its behavior has been verified.
  • Concrete CRUD matrix covering access control, validation, 404s, redirects, and database state.
  • Ordered debugging workflow from reproduction through adding a regression test.
  • Warns against running destructive reset commands against production.

Limitations

  • Heavily tied to Laravel 12, Blade, and MySQL; not easily portable to other stacks.
  • Browser tests remain optional and depend on the available tooling.
  • Does not cover CI/CD setup, load testing, or security testing strategy.
When to use it

Use it when writing or extending Laravel tests and diagnosing a bug before shipping a feature.

When not to use it

Avoid it for non-Laravel projects or when a broader testing strategy including CI, performance, and security is required.

Security analysis

Safe
Quality score80/100

The file is purely instructional QA guidance for Laravel testing and debugging. It contains no executable payloads, no curl|sh, no obfuscation, no credential or data-exfiltration instructions, and no attempts to disable safety controls. The referenced artisan commands are standard, mostly read-only or cache-clearing operations, and the skill explicitly warns against destructive reset commands in production, so execution risk is minimal.

Findings
  • •Minor: lists `php artisan optimize:clear` / `cache:clear`, which can disrupt a live application if run against production; the skill only explicitly warns about destructive reset commands, not cache/optimization clears.
  • •Minor: advises running `php artisan optimize:clear`, `view:clear`, and `cache:clear`, which wipe caches and could briefly degrade a running (non-production-intended) environment if executed against the wrong target; the skill does explicitly warn against destructive commands on production.
How this analysis is made

Examples

CRUD feature tests
Write Pest feature tests for the Post CRUD in my Laravel 12 app: guest and unauthorized access, validation errors, 404s, redirects, and database state.
Debug 419 form error
Debug why my Laravel 12 Blade form returns a 419 Page Expired error on submit; reproduce it, inspect CSRF and config, fix the root cause, and add a regression test.
Verify update flow
Verify the invoice update workflow in my Laravel app end to end: run targeted feature tests, check route and migration status, and report any failing behavior before I mark it complete.

name: testing-debugging description: Tests and debugs Laravel 12 + Blade + MySQL applications using PHPUnit/Pest, feature tests, HTTP tests, database tests, factories, logs, routes, and browser verification when available. Use before declaring a feature complete.

Testing & Debugging

Role

Act as a senior QA-minded Laravel engineer.

Completion rule

Code is not complete until behavior has been verified.

Test priority

  1. Feature tests for user-visible HTTP workflows.
  2. Unit tests for isolated business logic where valuable.
  3. Database assertions for persistence/relationships.
  4. Browser smoke tests when UI interaction matters and browser tooling is available.

Typical CRUD matrix

  • guest denied
  • authenticated allowed
  • unauthorized user denied
  • valid create works
  • invalid input returns validation errors
  • update works
  • delete works
  • missing model returns 404
  • database state is correct
  • redirect/view is correct

Database tests

Use RefreshDatabase when appropriate. Prefer factories. Do not rely on test execution order. Avoid slow full database truncation unless it is actually required.

Debug workflow

  1. Reproduce.
  2. Capture the exact error.
  3. Identify the first meaningful stack trace.
  4. Inspect source/config/database state.
  5. Form a hypothesis.
  6. Make the smallest fix.
  7. Add a regression test.
  8. Run the targeted test.
  9. Run broader tests when practical.

Useful Laravel checks

Use only when relevant:

  • php artisan test
  • php artisan route:list
  • php artisan about
  • php artisan migrate:status
  • php artisan optimize:clear
  • php artisan view:clear
  • php artisan cache:clear

Never use destructive reset commands against production.

Browser/UI diagnostics

Check console errors, failed requests, HTTP status codes, CSRF errors, form validation, broken links, responsive behavior, and asset loading.

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/laravel-12-testing-debugging-mvda898v/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/laravel-12-testing-debugging-mvda898v' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/laravel-12-testing-debugging-mvda898v/download' --output '.skill-downloads/laravel-12-testing-debugging-mvda898v/SKILL.md.part' && mv '.skill-downloads/laravel-12-testing-debugging-mvda898v/SKILL.md.part' '.skill-downloads/laravel-12-testing-debugging-mvda898v/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/laravel-12-testing-debugging-mvda898v/SKILL.md' && test -s '.skill-downloads/laravel-12-testing-debugging-mvda898v/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/testing-debugging' && cp -R '.skill-downloads/laravel-12-testing-debugging-mvda898v' '.claude/skills/testing-debugging'

Cursor
test -f '.skill-downloads/laravel-12-testing-debugging-mvda898v/SKILL.md' && test -s '.skill-downloads/laravel-12-testing-debugging-mvda898v/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/testing-debugging' && cp -R '.skill-downloads/laravel-12-testing-debugging-mvda898v' '.cursor/skills/testing-debugging'

Codex
test -f '.skill-downloads/laravel-12-testing-debugging-mvda898v/SKILL.md' && test -s '.skill-downloads/laravel-12-testing-debugging-mvda898v/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/testing-debugging' && cp -R '.skill-downloads/laravel-12-testing-debugging-mvda898v' '.agents/skills/testing-debugging'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/laravel-12-testing-debugging-mvda898v'

openskills read 'laravel-12-testing-debugging-mvda898v'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/laravel-12-testing-debugging-mvda898v/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills