Stabilize GameListPageTest fixture cleanup for persistent dev databases #358

Closed
opened 2026-06-03 17:04:57 -05:00 by Codex · 2 comments
Member

While reviewing #350, the issue-specific list-edit tests passed in isolation, but the full tests/Feature/GameListPageTest.php run remained unreliable against the persistent MariaDB dev database.

The failures are not about the #350 controller behavior directly. They point to the test file relying on fixed 240xx IDs and repeated fixture names while the test database can retain rows after interrupted or failed runs. That lets stale rows from prior runs affect later tests, producing unrelated 404s, unique-key collisions, or assertions against the wrong fixture state.

Source: #350 review and local focused test run.

Scope

  • tests/Feature/GameListPageTest.php fixture helpers and cleanup.
  • Test-only fixture IDs/names around 24001..24150.
  • Reliability of the focused game-list feature test command.
  • Do not change production list behavior unless a real testability bug is discovered.

Acceptance Criteria

  • GameListPageTest removes stale fixture rows before each test even if a previous run failed midway.
  • Test cleanup removes game-list rows by test users and fixture IDs, not only one narrow game_id range path.
  • Platform fixtures avoid unique-name collisions across tests, including repeated calls using the default helper.
  • Fixed 240xx game/platform IDs no longer collide after an interrupted previous run.
  • The full focused command passes from a dirty/stale local dev database state:
    • php artisan test --compact tests/Feature/GameListPageTest.php
  • Existing coverage for list rendering, add/edit/delete, validation, authorization, replay/status behavior, and gamer-update activity remains intact.
  • vendor/bin/pint --dirty --format agent passes if PHP files are changed.

Suggested Implementation Notes

  • Make cleanupGameListPageFixtures() aggressively remove:
    • users with username like 'list-page-%';
    • game_lists owned by those users;
    • game_lists with fixture game_id values in the file's reserved range;
    • games and platforms in the reserved fixture range;
    • default-name platform fixtures such as List Page Platform%.
  • Consider making insertListPagePlatform() default to a unique name derived from the fixture ID.
  • Keep the cleanup scoped to test-only rows so production-like seed data is not removed accidentally.

Test Coverage Required

  • Re-run the entire GameListPageTest file after intentionally starting from a database that may contain stale 240xx fixture rows.
  • Re-run the issue #350 filtered tests to ensure the edit redirect/toast coverage still passes.
  • Run Pint after any PHP changes.

Progress Checklist

  • Confirm no existing issue already covers GameListPageTest fixture isolation.
  • Harden fixture cleanup for stale/interrupted test runs.
  • Avoid repeated platform fixture name collisions.
  • Confirm full GameListPageTest passes.
  • Confirm #350-specific filtered tests still pass.
While reviewing #350, the issue-specific list-edit tests passed in isolation, but the full `tests/Feature/GameListPageTest.php` run remained unreliable against the persistent MariaDB dev database. The failures are not about the #350 controller behavior directly. They point to the test file relying on fixed `240xx` IDs and repeated fixture names while the test database can retain rows after interrupted or failed runs. That lets stale rows from prior runs affect later tests, producing unrelated 404s, unique-key collisions, or assertions against the wrong fixture state. Source: #350 review and local focused test run. ## Scope - `tests/Feature/GameListPageTest.php` fixture helpers and cleanup. - Test-only fixture IDs/names around `24001..24150`. - Reliability of the focused game-list feature test command. - Do not change production list behavior unless a real testability bug is discovered. ## Acceptance Criteria - `GameListPageTest` removes stale fixture rows before each test even if a previous run failed midway. - Test cleanup removes game-list rows by test users and fixture IDs, not only one narrow `game_id` range path. - Platform fixtures avoid unique-name collisions across tests, including repeated calls using the default helper. - Fixed `240xx` game/platform IDs no longer collide after an interrupted previous run. - The full focused command passes from a dirty/stale local dev database state: - `php artisan test --compact tests/Feature/GameListPageTest.php` - Existing coverage for list rendering, add/edit/delete, validation, authorization, replay/status behavior, and gamer-update activity remains intact. - `vendor/bin/pint --dirty --format agent` passes if PHP files are changed. ## Suggested Implementation Notes - Make `cleanupGameListPageFixtures()` aggressively remove: - users with `username like 'list-page-%'`; - `game_lists` owned by those users; - `game_lists` with fixture `game_id` values in the file's reserved range; - `games` and `platforms` in the reserved fixture range; - default-name platform fixtures such as `List Page Platform%`. - Consider making `insertListPagePlatform()` default to a unique name derived from the fixture ID. - Keep the cleanup scoped to test-only rows so production-like seed data is not removed accidentally. ## Test Coverage Required - Re-run the entire `GameListPageTest` file after intentionally starting from a database that may contain stale `240xx` fixture rows. - Re-run the issue #350 filtered tests to ensure the edit redirect/toast coverage still passes. - Run Pint after any PHP changes. ## Progress Checklist - [x] Confirm no existing issue already covers `GameListPageTest` fixture isolation. - [x] Harden fixture cleanup for stale/interrupted test runs. - [x] Avoid repeated platform fixture name collisions. - [x] Confirm full `GameListPageTest` passes. - [x] Confirm #350-specific filtered tests still pass.
jimmyb self-assigned this 2026-06-05 09:26:38 -05:00
Author
Member

Implemented in 335e1fc (Harden game list page test fixtures).

Notes:

  • cleanupGameListPageFixtures() now removes stale game_lists both by list-page-% test users and by reserved 24001..24150 fixture game IDs before cleaning up reserved games/platforms/users.
  • The default platform helper still uses List Page Platform {id}; collision resistance comes from the broader before/after cleanup, including reserved platform IDs and List Page Platform% names.
  • No production list behavior, routes, controllers, views, migrations, or dependencies were changed.
  • Two stale layout assertions were updated from Alternative Titles to the current singular presenter label Alternative Title: for single-alias fixtures.

Verification:

  • php artisan test --compact tests/Feature/GameListPageTest.php -> 37 passed, 385 assertions.
  • Sequential #350-related filters passed for edit success toast, owner update/delete redirect and toast, validation error toast, and replay/status redirect behavior.
  • vendor/bin/pint --format agent tests/Feature/GameListPageTest.php passed. I used targeted Pint instead of literal vendor/bin/pint --dirty because this checkout already had unrelated dirty PHP files that were intentionally left untouched.
Implemented in `335e1fc` (`Harden game list page test fixtures`). Notes: - `cleanupGameListPageFixtures()` now removes stale `game_lists` both by `list-page-%` test users and by reserved `24001..24150` fixture game IDs before cleaning up reserved games/platforms/users. - The default platform helper still uses `List Page Platform {id}`; collision resistance comes from the broader before/after cleanup, including reserved platform IDs and `List Page Platform%` names. - No production list behavior, routes, controllers, views, migrations, or dependencies were changed. - Two stale layout assertions were updated from `Alternative Titles` to the current singular presenter label `Alternative Title:` for single-alias fixtures. Verification: - `php artisan test --compact tests/Feature/GameListPageTest.php` -> 37 passed, 385 assertions. - Sequential #350-related filters passed for edit success toast, owner update/delete redirect and toast, validation error toast, and replay/status redirect behavior. - `vendor/bin/pint --format agent tests/Feature/GameListPageTest.php` passed. I used targeted Pint instead of literal `vendor/bin/pint --dirty` because this checkout already had unrelated dirty PHP files that were intentionally left untouched.
Author
Member

Completed in 335e1fc. The GameListPageTest fixture cleanup now removes stale list-page users, reserved fixture game/list rows, and reserved/default-name platform fixtures; full GameListPageTest and #350 focused filters pass.

Completed in 335e1fc. The GameListPageTest fixture cleanup now removes stale list-page users, reserved fixture game/list rows, and reserved/default-name platform fixtures; full GameListPageTest and #350 focused filters pass.
Codex closed this issue 2026-06-05 09:47:07 -05:00
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MyVideoGameList/myvideogamelist.com#358
No description provided.