fixture-generator

Generate CakePHP 4.x test fixtures from migration files with namespace placement.

2|Updated Oct 19, 2025
One-click install
npx skills add https://github.com/masanao-ohba/claude-manifests --skill fixture-generator
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: fixture-generator
Source: https://github.com/masanao-ohba/claude-manifests/tree/main/skills/php-cakephp/fixture-generator
Command: npx skills add https://github.com/masanao-ohba/claude-manifests --skill fixture-generator

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill eliminates the tedious manual work of creating test fixtures and guarantees fixture schemas match database migrations, reducing drift between development and tests.

Core Features & Use Cases

  • Schema-first fixture generation: derives fixture definitions directly from config/Migrations, ensuring all columns and constraints are represented.
  • NOT NULL and constraint fidelity: preserves NOT NULL requirements and foreign keys to maintain realistic test data relationships.
  • Multi-database organization: supports multiple databases with namespace-based fixture placement like tests/Fixture/[ProjectDefault], [AppDefault], [AppClient].
  • Configure::read integration: uses application constants to populate fixture values, avoiding hard-coded test data.

Quick Start

To generate fixtures from migrations, run the fixture generator against your CakePHP project, and place the resulting ApplicationsFixture.php under tests/Fixture/[AppClient]/.

Frequently Asked Questions about fixture-generator

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

FAQPage Schema
How do I generate CakePHP test fixtures from migration files?

To generate CakePHP test fixtures from migration files, use a schema-first generator that reads config/Migrations and outputs PHP fixture classes. This ensures test fixture schemas match database migrations exactly, reducing drift between development and tests.

How does fixture generation handle NOT NULL constraints and foreign keys?

Fixture generation preserves NOT NULL requirements and foreign key references by enforcing constraint fidelity during derivation. This maintains realistic test data relationships directly from the migration schema definitions into the generated fixture classes.

Can I organize CakePHP fixtures for multiple databases using namespaces?

Yes, you can organize CakePHP fixtures for multiple databases using namespace-based placement. Fixtures are structured under directories like tests/Fixture/AppClient and related namespaces to support multi-database test configurations.

Does CakePHP fixture generation support project-specific constants via Configure::read?

Yes, CakePHP fixture generation supports project-specific constants via Configure::read integration. This uses application constants to populate fixture values, avoiding hard-coded test data and ensuring fixtures rely on application configuration.

What is the best way to keep test fixtures in sync with database migrations in CakePHP?

The best way to keep test fixtures in sync with database migrations is schema-first fixture generation. By deriving fixture definitions directly from config/Migrations, all columns and constraints are accurately represented without manual updates.