test: add PromptVersion model tests #45

Merged
Snider merged 1 commit from test/prompt-version-tests into main 2026-02-23 06:08:50 +00:00
Member

Summary

  • Add tests/Feature/PromptVersionTest.php with Pest-style tests covering PromptVersion model
  • Add idempotent migration 0001_01_01_000004_create_prompt_tables.php for prompts and prompt_versions tables required by the test suite

Test coverage

  • Version creation: fillable fields, cast types (array variables, integer version), optional fields
  • Relationships: prompt() belongs-to, creator() belongs-to User, null creator
  • restore() method: restores system_prompt, user_template, and variables back to parent prompt; returns the Prompt instance
  • Version history: descending order via Prompt::versions(), createVersion() snapshots state and auto-increments version number, records creator, scoping per prompt, cascade delete

Closes #15

🤖 Generated with Claude Code

## Summary - Add `tests/Feature/PromptVersionTest.php` with Pest-style tests covering `PromptVersion` model - Add idempotent migration `0001_01_01_000004_create_prompt_tables.php` for `prompts` and `prompt_versions` tables required by the test suite ## Test coverage - **Version creation**: fillable fields, cast types (array variables, integer version), optional fields - **Relationships**: `prompt()` belongs-to, `creator()` belongs-to User, null creator - **`restore()` method**: restores system_prompt, user_template, and variables back to parent prompt; returns the Prompt instance - **Version history**: descending order via `Prompt::versions()`, `createVersion()` snapshots state and auto-increments version number, records creator, scoping per prompt, cascade delete Closes #15 🤖 Generated with Claude Code
Clotho added 1 commit 2026-02-23 05:25:15 +00:00
test: add PromptVersion model tests
Some checks failed
CI / PHP 8.3 (pull_request) Failing after 56s
CI / PHP 8.4 (pull_request) Failing after 58s
1abc4af519
Add Feature test covering PromptVersion creation, relationships (prompt,
creator), restore() rollback method, and version history tracking. Also
add idempotent migration for prompts and prompt_versions tables required
by the test suite.

Closes #15
Snider merged commit f97d862f27 into main 2026-02-23 06:08:50 +00:00
Snider deleted branch test/prompt-version-tests 2026-02-23 06:08:50 +00:00
Sign in to join this conversation.
No description provided.