ワンクリックで
symfony-pest
Symfony with Pest PHP testing framework and TDD patterns
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Symfony with Pest PHP testing framework and TDD patterns
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Multi-provider LLM integration for phrase generation (Groq, OpenAI, Gemini, extensible)
Cycle ORM patterns, configuration and common pitfalls for Symfony integration
Docker with multi-stage builds, security best practices and Docker Compose
Symfony framework with PestPHP testing and Clean Architecture patterns
WCAG 2.2 AA compliance for SAAC applications
PostgreSQL database configuration and best practices
| name | symfony-pest |
| description | Symfony with Pest PHP testing framework and TDD patterns |
| license | MIT |
| compatibility | opencode |
| metadata | {"type":"testing","framework":"pest","language":"php"} |
src/Domain/src/Application/src/Infrastructure/// 1. Muestra el test fallando (RED)
it('calculates total', function () {
$calculator = new Calculator();
expect($calculator->add(1, 1))->toBe(2);
});
// tests/Functional/Infrastructure/Http/Controller/CreateUserControllerTest.php
uses(Symfony\Bundle\FrameworkBundle\Test\WebTestCase::class);
it('registers a new user successfully', function () {
$client = static::createClient();
$client->request('POST', '/api/users', [], [], [
'CONTENT_TYPE' => 'application/json',
], json_encode([
'email' => 'test@example.com',
'password' => 'securePassword123'
]));
expect($client->getResponse()->getStatusCode())->toBe(201);
});
self:: fuera de closuresProblema: self::createClient() en scope global falla porque Pest functions son standalone.
Solución: Siempre usar static:: DENTRO del closure de it():
// MAL - fuera del closure:
$client = self::createClient();
it('test', function () use ($client) { ... });
// BIEN - dentro del closure:
it('test', function () {
$client = static::createClient();
});
Problema: Mocks creados en beforeEach() no se inyectan correctamente en el container de Symfony.
Solución: Crear mocks inline dentro de cada it():
// MAL - en beforeEach:
beforeEach(function () {
$this->mock = $this->createMock(ServiceInterface::class);
});
// BIEN - inline en it():
it('does something', function () {
$mock = $this->createMock(ServiceInterface::class);
$mock->method('execute')->willReturn('result');
static::getContainer()->set(ServiceInterface::class, $mock);
$client = static::createClient();
// ... test
});
static::createClient() solo dentro del closureProblema: Llamar createClient() fuera del it() falla con "kernel not booted".
Solución: Toda interacción con Symfony kernel debe ser dentro del closure de it() o test().
// Unit tests - NO necesitan WebTestCase:
it('validates email format', function () {
$email = new Email('test@example.com');
expect($email->value())->toBe('test@example.com');
});
// Functional tests - SI necesitan WebTestCase:
uses(WebTestCase::class);
it('returns 200 on health check', function () {
$client = static::createClient();
$client->request('GET', '/api/health');
expect($client->getResponse()->getStatusCode())->toBe(200);
});
# Unit tests solamente
./vendor/bin/pest tests/Unit
# Functional tests solamente
./vendor/bin/pest tests/Functional
# AMBAS suites (obligatorio antes de commit)
./vendor/bin/pest