Set up Pest testing with Orchestra Testbench for Laravel packages
Sets up PestPHP testing infrastructure for Laravel packages using Orchestra Testbench. Triggers when users want to add testing to an existing package via `python3 ${SKILL_DIR}/scripts/setup_pest_testing.py`. Creates phpunit.xml, Pest configuration, TestCase, sample tests, and optionally Filament utilities or CI workflows.
/plugin marketplace add mwguerra/claude-code-plugins/plugin install laravel-filament-package-development-specialist@mwguerra-marketplaceThis skill is limited to using the following tools:
scripts/setup_pest_testing.pyAdds complete PestPHP testing infrastructure to an existing Laravel package.
When the user wants to add testing to an existing package:
python3 ${SKILL_DIR}/scripts/setup_pest_testing.py <vendor/package-name> [options]
--filament - Include Filament/Livewire testing utilities--with-coverage - Add code coverage configuration--with-ci - Add GitHub Actions CI workflowpython3 ${SKILL_DIR}/scripts/setup_pest_testing.py mwguerra/my-package
python3 ${SKILL_DIR}/scripts/setup_pest_testing.py mwguerra/filament-blog --filament
python3 ${SKILL_DIR}/scripts/setup_pest_testing.py mwguerra/my-package --with-coverage --with-ci
phpunit.xml - PHPUnit configuration
src/ directorytests/Pest.php - PestPHP configuration
tests/TestCase.php - Orchestra TestCase
tests/Unit/ExampleTest.php - Sample unit test
tests/Feature/.gitkeep - Feature tests directory
.github/workflows/tests.yml (if --with-ci)
{
"require-dev": {
"orchestra/testbench": "^10.0",
"pestphp/pest": "^3.8",
"pestphp/pest-plugin-laravel": "^3.1"
},
"autoload-dev": {
"psr-4": {
"Vendor\\PackageName\\Tests\\": "tests/"
}
},
"scripts": {
"test": "pest",
"test-coverage": "pest --coverage"
}
}
Note: Uses latest versions for Laravel 11/12 compatibility:
After setup:
# Navigate to package
cd packages/vendor/package-name
# Install dependencies (including dev)
composer install
# Run all tests
./vendor/bin/pest
# Run with coverage
./vendor/bin/pest --coverage
# Run specific test file
./vendor/bin/pest tests/Unit/ExampleTest.php
# Run filtered tests
./vendor/bin/pest --filter="service provider"
# Run in parallel
./vendor/bin/pest --parallel
test('it does something', function () {
// Arrange
$data = ['key' => 'value'];
// Act
$result = processData($data);
// Assert
expect($result)->toBeTrue();
});
test('service is registered', function () {
expect($this->app->bound('my-service'))->toBeTrue();
});
test('command runs successfully', function () {
$this->artisan('my-package:command')
->expectsOutput('Success!')
->assertSuccessful();
});
uses(RefreshDatabase::class);
test('it creates model', function () {
$model = MyModel::create(['name' => 'Test']);
expect($model)->toBeInstanceOf(MyModel::class);
$this->assertDatabaseHas('my_models', ['name' => 'Test']);
});
use Livewire\Livewire;
test('component renders', function () {
Livewire::test(MyComponent::class)
->assertSee('Expected text')
->assertStatus(200);
});
When --filament is enabled, tests should follow Filament’s guidance:
livewire() / Livewire::test().This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.