php-testing

Generate and diagnose PHPUnit or Pest tests for PHP code.

7|Updated Apr 7, 2026
One-click install
npx skills add https://github.com/chenziyang110/spec-kit-plus --skill php-testing-chenziyang110
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: php-testing
Source: https://github.com/chenziyang110/spec-kit-plus/tree/main/templates/passive-skills/php-testing
Command: npx skills add https://github.com/chenziyang110/spec-kit-plus --skill php-testing-chenziyang110

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It helps you create and maintain correct PHP automated tests so regressions are caught early and failures can be diagnosed quickly.

Core Features & Use Cases

  • Test-writing and fixing: Produce new PHPUnit or Pest tests, or repair broken/flaky ones when tests fail or coverage is insufficient.
  • Framework-aware workflows: Selects appropriate strategies for pure unit testing, mocking boundaries, and Laravel testing with database isolation.
  • Coverage and CI readiness: Structures tests to run deterministically via phpunit/pest commands and supports coverage verification.

Quick Start

Ask the AI to write PHPUnit tests for the specified PHP file, or to diagnose and fix failing PHPUnit/Pest tests using the project’s existing phpunit.xml or composer.json.

Frequently Asked Questions about php-testing

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

FAQPage Schema
How do I generate PHPUnit tests for a PHP file?

To generate PHPUnit tests, provide the target PHP file and request new test cases, which produces framework-aware tests structured for deterministic execution via phpunit commands and verified coverage.

How do I fix flaky PHPUnit or Pest tests in my project?

To fix flaky tests, provide the failing PHPUnit or Pest test output for diagnosis, which stabilizes tests by repairing broken assertions and isolating database interactions using mocks or fakes.

Does this support Laravel database-backed testing with mocks and fakes?

Yes, it supports Laravel database-backed testing by applying framework-aware workflows that isolate database interactions using mocks or fakes, ensuring tests run deterministically without real credentials.

What is the best way to improve PHP test coverage for CI pipelines?

The best way to improve coverage is generating structured PHPUnit or Pest tests that run deterministically via phpunit commands, supporting coverage verification and CI readiness for regression safety.

Can I use Pest instead of PHPUnit for writing PHP tests?

Yes, you can use Pest instead of PHPUnit, as the tool generates and diagnoses both PHPUnit and Pest tests, applying appropriate strategies for pure unit testing and mocking boundaries.

When should I not use automated PHP test generation?

You should not use automated PHP test generation when testability is absent, or when required dependencies, secrets, or real credentials are needed, as the process stops to ensure safety.