---
title: "PHP Testing"
description: "> This file extends the common testing rule with PHP specific content."
type: skill
canonical_url: https://claudary.paisolsolutions.com/skills/php-testing
source: "Claudary"
difficulty: intermediate
author: "Claude Code Knowledge Pack"
date: 2026-07-10T11:31:58.508Z
license: CC-BY-4.0
attribution: "PHP Testing — Claudary (https://claudary.paisolsolutions.com/skills/php-testing)"
---

# PHP Testing
> This file extends the common testing rule with PHP specific content.

## Overview

---
description: "PHP testing extending common rules"
globs: ["**/*.php", "**/phpunit.xml", "**/phpunit.xml.dist", "**/composer.json"]
alwaysApply: false
---
# PHP Testing

> This file extends the common testing rule with PHP specific content.

## Framework

Use **PHPUnit** as the default test framework. **Pest** is also acceptable when the project already uses it.

## Coverage

```bash
vendor/bin/phpunit --coverage-text
# or
vendor/bin/pest --coverage
```

## Test Organization

- Separate fast unit tests from framework/database integration tests.
- Use factory/builders for fixtures instead of large hand-written arrays.
- Keep HTTP/controller tests focused on transport and validation; move business rules into service-level tests.

---

Source: [Claudary](https://claudary.paisolsolutions.com/skills/php-testing) · https://claudary.paisolsolutions.com
