Skip to content

Add a Console-based tool to regenerate the fixture bundle - #242

Merged
lyrixx merged 2 commits into
mainfrom
tests
Sep 7, 2026
Merged

Add a Console-based tool to regenerate the fixture bundle#242
lyrixx merged 2 commits into
mainfrom
tests

Conversation

@lyrixx

@lyrixx lyrixx commented Sep 7, 2026

Copy link
Copy Markdown
Member

Summary

Follow-up to #241 (the local fixture bundle). Adds tests/fixtures/generate-bundle.php, a small Symfony Console script (extract / build) that replaces the manual git recipe for adding a new fixture scenario:

  • extract clones the current bundle to a working directory with every branch checked out locally, ready for new commits/branches/tags.
  • build rebuilds tests/fixtures/foobar.bundle from that directory, restricted to the refs in the new tests/fixtures/bundle-refs.txt.

It only ever extends the existing history rather than regenerating from scratch, so the commit SHAs hardcoded in AbstractTestCase (and the GPG-signed commit, which can't be reproduced without the original private key) stay valid.

verify-bundle.sh now reads its ref allow-list from tests/fixtures/bundle-refs.txt too, so the two scripts can't drift apart. Adds symfony/console (^8.1) as a require-dev dependency for the script's argument parsing/output.

CONTRIBUTING.md's fixture regeneration instructions are updated accordingly.

Test plan

  • castor install / composer install resolves without conflicts
  • Full suite passes: vendor/bin/phpunit (224 tests, 562 assertions)
  • tests/fixtures/verify-bundle.sh passes
  • extract then build with no changes reproduces a byte-identical bundle
  • extract, add a real commit, build: new commit lands correctly, bundle still passes verify-bundle.sh and the full suite
  • castor cs --dry-run clean, php -l clean

tests/fixtures/generate-bundle.php replaces the manual git recipe for
adding a new fixture scenario: `extract` clones the current bundle to
a working directory with every branch checked out locally, `build`
rebuilds tests/fixtures/foobar.bundle from it. It only ever extends
the existing history rather than starting from scratch, so existing
commit SHAs (and the GPG-signed one, which we couldn't reproduce
without the original private key) stay valid.

The ref list it bundles is now shared with verify-bundle.sh via
tests/fixtures/bundle-refs.txt, so the two can no longer drift apart.

Requires symfony/console (^8.1, require-dev only), which the script's
Application/Command classes use for argument parsing and output.
Replaces the raw git recipe for adding a fixture scenario with the
extract/build commands, and points at bundle-refs.txt for adding a
new branch or tag.
@lyrixx
lyrixx merged commit 3f177c4 into main Sep 7, 2026
6 checks passed
@lyrixx
lyrixx deleted the tests branch September 7, 2026 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant