php-test-writer

Generate Laravel feature and unit tests following project conventions.

1|1|Updated Nov 8, 2025
One-click install
npx skills add https://github.com/RasmusGodske/dev-agent-workflow --skill php-test-writer
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: php-test-writer
Source: https://github.com/RasmusGodske/dev-agent-workflow/tree/main/project-roles/skills/php-test-writer
Command: npx skills add https://github.com/RasmusGodske/dev-agent-workflow --skill php-test-writer

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill automates the creation and maintenance of PHP/Laravel tests, ensuring they consistently follow project-specific conventions. This reduces debugging time, improves overall code quality, and guarantees robust application stability.

Core Features & Use Cases

  • Convention-Driven Testing: Guides on file structure, naming, factory usage, and assertion best practices for PHPUnit and Laravel.
  • Multitenancy Awareness: Enforces correct ->recycle($customer) usage to prevent common multitenancy testing pitfalls and ensure data isolation.
  • Service Interaction: Directs all DataObject and ObjectDefinition interactions through their respective services, preventing direct model manipulation and promoting architectural integrity.
  • Use Case: After developing a new feature, activate this skill to automatically generate comprehensive feature and unit tests that adhere to the project's strict testing guidelines, including proper factory usage and service interactions, ensuring robust code.

Quick Start

Activate the php-test-writer skill to create feature tests for the new InvoiceService, ensuring all tests follow the project's multitenancy and service interaction conventions.

Frequently Asked Questions about php-test-writer

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

FAQPage Schema
How do I automate PHP test writing for Laravel applications?

Automate PHP test writing by using a skill that generates PHPUnit tests following your project's conventions, including proper file structure, factory usage, naming prefixes, and multitenancy awareness. This reduces manual test creation and ensures consistent adherence to Laravel best practices.

What's the best way to structure Laravel feature and unit tests?

Structure Laravel tests by mirroring your app/ directory in tests/, using the test_ prefix for methods, following the Arrange-Act-Assert pattern, leveraging factories instead of direct model manipulation, and routing DataObject interactions through services. This maintains architectural integrity and prevents multitenancy data isolation issues.

How do I handle multitenancy testing correctly in Laravel?

Handle multitenancy in Laravel tests by enforcing ->recycle($customer) usage within your test setup to ensure proper data isolation between tenants. This prevents common pitfalls where tests leak data across customer boundaries or fail to respect tenant boundaries in assertions.

Can I automate test generation while enforcing project conventions?

Yes, you can automate test generation that enforces project-specific conventions like test_ naming, factory usage, service-driven interactions, and PHPUnit best practices. This ensures all generated tests comply with your project's standards without manual refactoring or reviews.

Do I need to write tests manually for each Laravel feature?

No, you can automate test writing for Laravel features using a convention-driven approach that generates comprehensive feature and unit tests following PHPUnit and Laravel standards. This eliminates repetitive manual test creation while maintaining code quality and architectural patterns.

What happens if tests don't follow service interaction patterns?

Tests that bypass services and directly manipulate models break architectural integrity and make multitenancy enforcement difficult. The skill ensures all DataObject and ObjectDefinition interactions route through their services, preventing these architectural violations and maintaining consistent data handling.