Add Pest v4 + Orchestra Testbench (Laravel 12 compatible) testing infrastructure to an existing Laravel package (optionally Filament v4 aware)
Adds Pest v4 + Testbench testing infrastructure to Laravel packages with optional Filament v4 support.
/plugin marketplace add mwguerra/claude-code-plugins/plugin install laravel-filament-package-development-specialist@mwguerra-marketplace<vendor/package-name> [--filament] [--with-ci] [--with-coverage]This command upgrades or installs a modern testing harness for a Laravel package:
tests/TestCase.phptests/Pest.phpphpunit.xmlNotes:
- Laravel recommends Testbench for “testing packages like they’re installed in a full app”.
- Testbench-Core’s compatibility table maps Laravel 12.x to Testbench-Core 10.x. citeturn0search16turn0search12
Add / update these in require-dev:
{
"require-dev": {
"orchestra/testbench": "^10.0",
"pestphp/pest": "^4.0",
"pestphp/pest-plugin-laravel": "^4.0"
}
}
If --filament is enabled, also add:
{
"require-dev": {
"filament/filament": "^4.0",
"pestphp/pest-plugin-livewire": "^4.0"
}
}
Filament’s panel builder installation uses filament/filament:"^4.0". citeturn1view2
Run:
composer update -W
Create tests/Pest.php:
<?php
use Vendor\Package\Tests\TestCase;
uses(TestCase::class)->in(__DIR__);
Create tests/TestCase.php:
<?php
namespace Vendor\Package\Tests;
use Orchestra\Testbench\TestCase as Orchestra;
abstract class TestCase extends Orchestra
{
protected function getPackageProviders($app): array
{
return [
// Your package service provider:
\Vendor\Package\PackageServiceProvider::class,
];
}
}
Filament panels are configured via a PanelProvider. citeturn1view3
Create tests/Support/AdminPanelProvider.php:
<?php
namespace Vendor\Package\Tests\Support;
use Filament\Panel;
use Filament\PanelProvider;
class AdminPanelProvider extends PanelProvider
{
public function panel(Panel $panel): Panel
{
return $panel
->id('admin')
->path('admin')
->login();
}
}
Then, in tests/TestCase.php, register Filament + the panel provider:
protected function getPackageProviders($app): array
{
return [
// Filament:
\Filament\FilamentServiceProvider::class,
\Vendor\Package\Tests\Support\AdminPanelProvider::class,
// Your package:
\Vendor\Package\PackageServiceProvider::class,
];
}
If the package is a panel plugin (implements Filament\Contracts\Plugin), register it in the panel provider:
return $panel
->id('admin')
->path('admin')
->login()
->plugins([
\Vendor\Package\PackagePlugin::make(),
]);
Create tests/SmokeTest.php:
<?php
it('boots the package service provider', function () {
expect(app()->getProviders(\Vendor\Package\PackageServiceProvider::class))->not->toBeEmpty();
});
For --filament, add at least one HTTP test that the panel route is registered:
it('registers the admin panel route', function () {
$this->get('/admin')->assertStatus(200);
});
If --with-ci is enabled, add a GitHub Actions workflow that runs:
composer validate --strict
composer test
If --with-coverage is enabled, configure Xdebug/PCOV and add a coverage step.