Generate Pest tests for FilamentPHP v4 resources, forms, tables, and authorization
View on GitHubmwguerra/claude-code-plugins
filament-specialist
February 1, 2026
Select agents to install to:
npx add-skill https://github.com/mwguerra/claude-code-plugins/blob/main/filament-specialist/skills/filament-testing/SKILL.md -a claude-code --skill filament-testingInstallation paths:
.claude/skills/filament-testing/# FilamentPHP Testing Skill
## Overview
This skill generates comprehensive Pest tests for FilamentPHP v4 components following official testing documentation patterns.
## Documentation Reference
**CRITICAL:** Before generating tests, read:
- `/home/mwguerra/projects/mwguerra/claude-code-plugins/filament-specialist/skills/filament-docs/references/general/10-testing/`
## Test Setup
### Base Test Configuration
```php
<?php
declare(strict_types=1);
namespace Tests;
use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
abstract class TestCase extends BaseTestCase
{
use CreatesApplication;
protected function setUp(): void
{
parent::setUp();
// Login as admin for Filament tests
$this->actingAs(\App\Models\User::factory()->create([
'is_admin' => true,
]));
}
}
```
### Pest Configuration
```php
// tests/Pest.php
uses(Tests\TestCase::class)
->in('Feature');
uses(Illuminate\Foundation\Testing\RefreshDatabase::class)
->in('Feature');
```
## Resource Tests
### List Page Tests
```php
<?php
declare(strict_types=1);
use App\Filament\Resources\PostResource;
use App\Filament\Resources\PostResource\Pages\ListPosts;
use App\Models\Post;
use App\Models\User;
use Filament\Actions\DeleteAction;
use Filament\Tables\Actions\DeleteBulkAction;
use function Pest\Livewire\livewire;
beforeEach(function () {
$this->user = User::factory()->create(['is_admin' => true]);
$this->actingAs($this->user);
});
it('can render the list page', function () {
livewire(ListPosts::class)
->assertSuccessful();
});
it('can list posts', function () {
$posts = Post::factory()->count(10)->create();
livewire(ListPosts::class)
->assertCanSeeTableRecords($posts);
});
it('can render post title column', function () {
Post::factory()->create(['title' => 'Test Post Title']);
livewire(ListPosts::class)
->assertCanRenderTableColumn('title');
});
it('can search posts by title