fixture-generator_skill

This skill generates CakePHP test fixtures directly from migration files, integrates Configure::read usage, and supports multi-database environments.
  • Shell

2

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill masanao-ohba/claude-manifests --skill fixture-generator

  • SKILL.md6.9 KB

Overview

This skill generates CakePHP test fixtures directly from migration files, ensuring fixtures always match the migration schema and project conventions. It enforces Configure::read usage for configuration values, preserves NOT NULL constraints, and organizes fixtures for multi-database/multi-tenant projects. The output is ready for CakePHP 4.x test suites and follows consistent test constants and timestamps.

How this skill works

The generator parses migration PHP files to extract columns, types, defaults, and constraints, then maps migration types to appropriate fixture values (e.g., integer -> 1, datetime -> '2024-01-01 00:00:00'). It replaces hardcoded status/flag values with Configure::read calls and uses project test constants for IDs and company references. Fixtures are placed into namespace-based directories and extend the correct base TestFixture class for each database account.

When to use it

  • When creating fixtures for tests after adding or changing migrations
  • When enforcing schema-first testing where migration is the single source of truth
  • In multi-database or multi-tenant projects that require namespace-separated fixtures
  • When you need consistent Configure::read usage for status and flag values
  • When validating that NOT NULL columns always have test values

Best practices

  • Always run the generator from the migration file — do not hand-edit schema-derived fields
  • Use Configure::read for status, flag, and account-type values to avoid hardcoded literals
  • Include PHPUNIT_* constants for company and user IDs so foreign keys are consistent
  • Preserve NOT NULL constraints by providing non-null sample values in records
  • Keep timestamps and password hashes consistent using canonical test values

Example use cases

  • Generate an ApplicationsFixture for an AppClient migration that sets status via Configure::read
  • Create user fixtures where eco_company_id is PHPUNIT_COMPANY_ID and mail/login_name are test values
  • Regenerate fixtures after a migration adds NOT NULL columns to ensure tests remain valid
  • Organize fixtures into tests/Fixture/[Account]/ namespaces for multi-tenant test runs
  • Validate that generated fixtures match migration schema before running the test suite

FAQ

Yes. JSON fields are emitted as JSON strings and password fields use consistent bcrypt hashes suitable for tests.

How are status and flag values handled?

Status and flag values are written using Configure::read calls per project keys to avoid hardcoded literals.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational