# Php Testing

> PHP testing patterns: PHPUnit, test doubles, database testing.

- **Type:** Skill
- **Install:** `agentstack add skill-notque-vexjoy-agent-php-testing`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [notque](https://agentstack.voostack.com/s/notque)
- **Installs:** 0
- **Category:** [Databases](https://agentstack.voostack.com/c/databases)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [notque](https://github.com/notque)
- **Source:** https://github.com/notque/vexjoy-agent/tree/main/skills/engineering/php-testing
- **Website:** https://vexjoy.com

## Install

```sh
agentstack add skill-notque-vexjoy-agent-php-testing
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# PHP Testing Skill

## Overview

Apply PHPUnit testing patterns for PHP projects: unit tests with data providers, test doubles (stubs, mocks, Prophecy), database testing (Laravel/Symfony), HTTP testing, and coverage configuration.

> See `references/patterns.md` for full code examples, the failure modes table, and the commands reference.

## Reference Loading Table

| Signal | Load These Files | Why |
|---|---|---|
| writing PHPUnit tests: data providers, mocks/stubs, database or HTTP tests, coverage config | `patterns.md` | Loads detailed guidance from `patterns.md`. |

## Instructions

### Phase 1: IDENTIFY

Determine what needs testing:
- Unit logic: use PHPUnit `TestCase` with `test` prefix or `@test` annotation
- Table-driven cases: use `@dataProvider` static methods
- Collaborator behavior: use stubs (return values only) or mocks (assert interactions)
- Database state: use `DatabaseTransactions` (Laravel) or `KernelTestCase` (Symfony)
- HTTP endpoints: use Laravel HTTP helpers or Symfony `WebTestCase`

### Phase 2: WRITE

Write tests following these rules:
- Call `parent::setUp()` first in every `setUp()` method
- Use `assertSame()` instead of `assertTrue($a === $b)` for meaningful failure messages
- Mock only collaborators and dependencies, never the class under test
- Keep tests independent -- do not use `@depends` chains
- Extract repetitive cases to `@dataProvider` rather than duplicating test methods

For test doubles: use `createStub()` when you only need return values, `createMock()` when asserting method calls, and Prophecy (`phpspec/prophecy-phpunit`) for more expressive interaction assertions.

For database tests: use `DatabaseTransactions` (Laravel) or DoctrineTestBundle (Symfony) to roll back state after each test.

### Phase 3: VERIFY

Run the test suite and confirm all tests pass:

```bash
./vendor/bin/phpunit
```

For coverage enforcement:

```bash
XDEBUG_MODE=coverage ./vendor/bin/phpunit --coverage-text --coverage-min=80
```

**GATE**: All tests pass. Coverage threshold met if configured. No failure modes from `references/patterns.md` introduced.

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [notque](https://github.com/notque)
- **Source:** [notque/vexjoy-agent](https://github.com/notque/vexjoy-agent)
- **License:** MIT
- **Homepage:** https://vexjoy.com

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-notque-vexjoy-agent-php-testing
- Seller: https://agentstack.voostack.com/s/notque
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
