DEV Community

Cover image for Testing Production Filament Applications: From One Panel to Multi-Tenancy
yebor974 for Filament Mastery

Posted on • Originally published at filamentmastery.com on

Testing Production Filament Applications: From One Panel to Multi-Tenancy

I thought testing would mostly be about writing assertions.

It wasn't. The hardest part turned out to be making the test environment behave like the application behaves in production.

A single-panel Filament app is almost trivial to test. Add a second panel, then tenancy, then different coverage requirements, and the testing setup becomes architecture in its own right. Here's how that growth actually looks, one stage at a time.

1. A single panel is easy

A simple, single-panel project needs almost nothing in Pest.php:

pest()->extend(TestCase::class)
    ->use(RefreshDatabase::class)
    ->beforeEach(fn () => $this->seed(DatabaseSeeder::class))
    ->in('Feature');

pest()->extend(TestCase::class)
    ->use(RefreshDatabase::class)
    ->in('Unit');

Enter fullscreen mode Exit fullscreen mode

One TestCase, one seeder, done. This is also as far as most tutorials go, because it's the version of the problem that doesn't need a real architecture behind it yet.

2. Two panels change everything

The rest of this guide (per-panel TestCase classes, the bootCurrentPanel() gotcha on tenant-scoped panels, why one phpunit.xml isn't enough once a client contract sets different coverage thresholds, and enforcing that split in CI) is part of Filament Mastery's Full Access membership.

Full guide here: Testing Production Filament Applications: From One Panel to Multi-Tenancy

It's part of Full Access ($14/month), alongside the other production-focused Laravel & Filament guides.

Top comments (0)