Everything on Testing.
19 articles tagged Testing, sorted newest first.
Write a Custom Rector Rule to Refactor Your Own Laravel Conventions
Rector gets used for framework upgrades and almost never for the thing it is best at — mechanically applying a decision your own team made. Here's the AST-first workflow, and the two mistakes that make a new rule silently do nothing.
Laravel Sanctum in Production: API Tokens, Abilities and SPA Sessions
Sanctum is two unrelated authentication mechanisms sharing one package name, and almost every tutorial only covers half of one of them. This guide builds a real Orders API end to end: scoped tokens, an ability vocabulary that survives a year of growth, the tokenCan() hole nobody warns you about, expiry and pruning, full SPA cookie auth, per-token rate limiting, and Pest tests for all of it.
Build Custom Pest Expectations for Your Laravel Domain Language
Turn the six-line assertion blocks you keep pasting between tests into named expectations like expect($order)->toBeFulfilled(), then ship them as a package.
PHP Randomizer Engines: Choosing Between Secure, Seeded and Fast Randomness in Laravel
Two problems with one root cause: tokens that are guessable, and tests that are flaky. PHP's Random extension fixes both, once you pick the right engine.
PCOV vs Xdebug for Laravel Code Coverage
Coverage needs a driver, and the one you pick decides whether your suite runs in seconds or minutes. Here is how PCOV and Xdebug actually differ, and how to wire each one up locally and in CI.
Communicate Between Livewire 4 Components with dispatch and #[On]
Props flow parent-to-child, but sending data back up or sideways needs events. Here is how dispatch(), #[On] and targeted dispatches actually behave in Livewire 4.
Test Filament v5 Resources with Pest
Filament resource pages are Livewire components, not URLs. Point livewire() at the page class and you get table, form and action assertions that run in milliseconds.
Test Livewire 4 Components with Pest
Livewire 4 ships first-class Pest test helpers. Mount a component, set properties, call actions, and assert state, output, validation, and events without a browser.
Measure Test Quality, Not Just Coverage: Pest Mutation Testing
100% line coverage can still ship bugs. Here's how Pest's mutation testing finds the assertions your test suite is quietly missing.
Test AI Features Without Calling the API: Agent::fake() in the Laravel AI SDK
You shipped an agent and wrote zero tests for it, because hitting a real model is slow, costs tokens, and needs a key in CI. The Laravel AI SDK's fake() fixes all three.
PestStan — Type-Safe Pest 4 Tests With PHPStan Generics in a Laravel App
PestStan teaches PHPStan about Pest's globals — generic expect() types, proper $this binding, and rules that catch broken assertions before the test even runs.
Pest 4 Snapshot Testing for Laravel API Responses: Catch Accidental Schema Drift
Pest 4 has snapshot testing built in. One expectation locks down the shape of your JSON responses so renamed keys and disappearing fields stop slipping into production unnoticed.
Filament v4: The Complete Guide from Zero to Production Dashboard
The end-to-end Filament v4 walkthrough: install the panel, ship resources, relation managers, custom actions, schemas, MFA, multi-tenancy, policies, tests, and a real production deploy: in one place.
Pest 4 Browser Testing with Playwright: A Dusk Replacement That Actually Sticks
Pest 4 ships a first-party browser plugin powered by Playwright. Auto-waits, parallel runs, and time-balanced shards turn a 12-minute Dusk suite into a 90-second CI job.
The Complete Guide to Laravel 13 Multi-Tenancy with Teams
Laravel 13 brings team-based multi-tenancy back into the official starter kits with URL-based context that fixes the old session-based problems. This guide walks through the full lifecycle: scaffolding teams, scoping every query, handling invitations, isolating queued jobs, and choosing between shared-database and database-per-tenant: with copy-paste-runnable code at every step.
Laravel Pennant Feature Flags in Practice
Laravel Pennant gives you first-party feature flags without an external service. Here's how to use it for gradual rollouts, middleware gates, and reliable testing.
GitHub Actions Matrix Testing for Laravel: PHP × Database Combos
Stop testing against one PHP version and one database. Here's the copy-paste GitHub Actions matrix workflow that covers PHP 8.2–8.4 against MySQL, PostgreSQL, and SQLite in one go.
The Complete Guide to Laravel 13 JSON:API Resources
Laravel 13 ships first-party JSON:API resources that handle spec-compliant serialization, relationships, sparse fieldsets, and compound documents out of the box. This guide walks through building a complete API using the new JsonApiResource class: from first resource to production-hardened endpoints.
Enforcing Laravel architecture rules with Pest's arch() helper
Pest's arch() helper lets you write rules that enforce your app's structure at test time: no more accidentally importing Eloquent into a controller.