testing-pest

Write Pest PHP tests across unit, feature, and integration tiers.

2|Updated Feb 28, 2024
One-click install
npx skills add https://github.com/coagus/php-api-builder --skill testing-pest-coagus
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: testing-pest
Source: https://github.com/coagus/php-api-builder/tree/main/.claude/skills/testing-pest
Command: npx skills add https://github.com/coagus/php-api-builder --skill testing-pest-coagus

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Pest testing can be challenging to structure and maintain across unit, feature, and integration tiers. This skill provides expert guidance on Pest PHP 3.x syntax, architecture, fixtures, test doubles, dataset providers, and test organization to keep tests clean and scalable.

Core Features & Use Cases

  • Clear guidance on when to place tests in Unit, Feature, or Integration tiers, with examples of proper organization and naming.
  • Best practices for fixtures, test doubles, and dataset providers to maximize test coverage with minimal maintenance.
  • Practical advice for structuring Pest tests and workflows in a PHP API library, including how to refactor tests as the codebase evolves.

Quick Start

Write Pest tests for a simple User class that validates email formatting and password hashing, then organize tests into unit, feature, and integration tiers.

Frequently Asked Questions about testing-pest

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure Pest PHP tests across unit, feature, and integration tiers?

To structure Pest PHP tests effectively, group tests by tier: use unit tests for isolated logic, feature tests for API endpoints, and integration tests for cross-component workflows. Apply consistent naming and avoid coupling tests to implementation details for maintainable test suites.

When should I use dataset providers in Pest PHP testing?

Use dataset providers in Pest PHP testing when you need to validate a single test against multiple input combinations. Dataset providers maximize test coverage while minimizing maintenance overhead by feeding varied data sets into reusable test cases.

What is the best way to organize fixtures and test doubles in Pest PHP?

The best way to organize fixtures and test doubles in Pest PHP is to centralize reusable setup logic. Use Pest's built-in hooks for fixtures and mock dependencies with test doubles to isolate the system under test, ensuring tests remain clean and decoupled.

Does Pest PHP 3.x work with existing PHPUnit test suites?

Pest PHP 3.x is a wrapper over PHPUnit, meaning it operates alongside existing PHPUnit test suites. You can introduce Pest tests incrementally into a PHP project without rewriting your current PHPUnit tests, leveraging Pest's syntax for new test coverage.

How do I refactor PHP tests as my API library codebase evolves?

To refactor PHP tests as your API library evolves, reorganize tests into the correct tiers and update dataset providers. Decouple tests from implementation details by relying on fixtures and test doubles, ensuring consistent test quality without breaking existing workflows.