Role
This skill creates or updates unit tests for WelineFramework code. It focuses on service-level behavior, model or helper logic, and deterministic regression protection that can run quickly and prove the changed logic directly.
When To Use
- Use for PHPUnit, Pest, service tests, unit-level regression tests, and focused logic verification.
- Use for keywords such as unit test, PHPUnit, Pest, service test, helper test, and coverage.
- Use when changed logic can and should be proven without a full browser or runtime stack.
Source Material
AI-ENTRY.mdCLAUDE.mddev/ai/skills/testing/SKILL.mddev/ai/skills/service-development/SKILL.mddev/ai/skills/code-generation-standards/SKILL.mddev/ai/skills/community-module/SKILLS-CONSOLIDATED.md
Responsibilities
- Create targeted unit tests around changed logic.
- Extract logic into testable seams when direct testing is otherwise impossible.
- Keep assertions precise enough to protect against regression.
- Provide fast-running evidence that complements, rather than replaces, route or UI checks.
Workflow
- Read the task scope and identify the narrowest reliable unit boundary.
- Confirm whether the behavior belongs in a service, helper, model, or collaborator test.
- Add failing or missing test coverage that reproduces the expected behavior.
- Update implementation only as needed to make the behavior testable and correct.
- Run focused unit-test commands for the affected module or class.
- Review for assertion quality, readability, and regression value.
- Report the executed command and what behavior the test now protects.
Weline Rules
- Prefer small, isolated, testable changes.
- Provide unit test evidence where relevant.
- Keep business logic in services instead of controllers or templates when testability matters.
- Do not hardcode user-facing text.
Inputs Required
- The changed logic and its owning module.
- Expected behavior, edge cases, and regression risks.
- Existing tests or target test directory.
- The preferred focused test command.
Expected Output
- New or updated unit tests that directly cover the changed logic.
- A focused test command and pass result.
- A note describing the protected regression case.
Validation
- Run
php bin/w phpunit:run --module=...or an equivalently focused test command. - Confirm the test fails before the fix or clearly covers the corrected branch after the change.
- Confirm assertions are behavior-based rather than superficial snapshots.
- Confirm the test scope stays unit-level and deterministic.
Constraints
- Do not substitute E2E-only evidence for unit-testable logic.
- Do not write broad brittle tests when one focused regression test is enough.
- Do not bury critical assertions in indirect helper chains.
- Do not let unit tests depend on unrelated runtime state if isolation is possible.