Skip to content

Update spatie/phpunit-snapshot-assertions requirement from ^4.2 to ^5.4 - #76

Merged
freekmurze merged 4 commits into
mainfrom
dependabot/composer/spatie/phpunit-snapshot-assertions-tw-5.4
Nov 6, 2026
Merged

freekmurze merged 4 commits into
mainfrom
dependabot/composer/spatie/phpunit-snapshot-assertions-tw-5.4

Conversation

@dependabot

@dependabot dependabot Bot commented on behalf of github Nov 2, 2026

Copy link
Copy Markdown
Contributor

Updates the requirements on spatie/phpunit-snapshot-assertions to permit the latest version.

Release notes

Sourced from spatie/phpunit-snapshot-assertions's releases.

5.4.0

What's Changed

  • Add vendor/bin/update-snapshots wrapper binary that sets UPDATE_SNAPSHOTS=true and runs PHPUnit. This replaces the previously documented phpunit -d --update-snapshots syntax, which abused PHPUnit's -d flag and produces a Failed to set "--update-snapshots=1" test runner warning since PHPUnit 12.5.12.
  • Drop the phpunit -d --without-creating-snapshots form from the README. Use the CREATE_SNAPSHOTS=false environment variable instead. The argv check is kept in shouldCreateSnapshots() for backwards compatibility.
  • The wrapper restores the prior UPDATE_SNAPSHOTS env var state on shutdown, so it does not leak a state mutation to any in-process code that runs after PHPUnit.
  • Reworded the "Snapshot does not exist" failure message and the "snapshots can be updated by..." prompt to point at the new approach.
  • shouldUpdateSnapshots() and shouldCreateSnapshots() now check the env var first, then fall back to the legacy CLI argument.
  • Fix tests on PHPUnit 12.5+, where mocks throwing AssertionFailedError are tracked as a test failure even when user code catches the exception. The expectFail helper now uses a plain RuntimeException carrying the expected message.

Closes #242.

Full Changelog: spatie/phpunit-snapshot-assertions@5.3.2...5.4.0

Changelog

Sourced from spatie/phpunit-snapshot-assertions's changelog.

5.4.0 - 2026-04-29

What's Changed

  • Add vendor/bin/update-snapshots wrapper binary that sets UPDATE_SNAPSHOTS=true and runs PHPUnit. This replaces the previously documented phpunit -d --update-snapshots syntax, which abused PHPUnit's -d flag and produces a Failed to set "--update-snapshots=1" test runner warning since PHPUnit 12.5.12.
  • Drop the phpunit -d --without-creating-snapshots form from the README. Use the CREATE_SNAPSHOTS=false environment variable instead. The argv check is kept in shouldCreateSnapshots() for backwards compatibility.
  • The wrapper restores the prior UPDATE_SNAPSHOTS env var state on shutdown, so it does not leak a state mutation to any in-process code that runs after PHPUnit.
  • Reworded the "Snapshot does not exist" failure message and the "snapshots can be updated by..." prompt to point at the new approach.
  • shouldUpdateSnapshots() and shouldCreateSnapshots() now check the env var first, then fall back to the legacy CLI argument.
  • Fix tests on PHPUnit 12.5+, where mocks throwing AssertionFailedError are tracked as a test failure even when user code catches the exception. The expectFail helper now uses a plain RuntimeException carrying the expected message.

Closes #242.

Full Changelog: spatie/phpunit-snapshot-assertions@5.3.2...5.4.0

5.3.2 - 2026-02-09

What's Changed

  • Fix BC break in getSnapshotId() from named snapshots feature — restored original no-parameter signature
  • Add README documentation for named snapshots

5.3.1 - 2026-02-08

What's Changed

  • Allow PHPUnit 13

5.3.0 - 2026-01-22

What's Changed

  • Add support for PHPUnit 9.6 by @​alex-dev in spatie/phpunit-snapshot-assertions#235
  • Add PHPUnit versioning to CI matrix to test against multiple PHPUnit versions
  • Add PhpUnitCompatibility trait for cross-version compatibility
  • Fix CI workflow to properly handle PHPUnit version constraints

Full Changelog: spatie/phpunit-snapshot-assertions@5.2.3...5.3.0

5.2.3 - 2025-11-14

What's Changed

New Contributors

... (truncated)

Commits
  • b5ad3ef Add update-snapshots wrapper binary (#245)
  • 2a5d1e0 Simplify shutdown handler
  • 4c9076d Fix tests on PHPUnit 12.5 and add binary tests
  • 1d1a7b6 Drop without-creating-snapshots binary; restore env var on shutdown
  • d6a3361 Address review feedback
  • 0359118 Fix styling
  • 4fe2045 Add wrapper binaries to replace -d --update-snapshots syntax
  • ba48973 Merge pull request #244 from spatie/dependabot/github_actions/dependabot/fetc...
  • 5f34651 Bump dependabot/fetch-metadata from 3.0.0 to 3.1.0
  • 6ef0a3a Fix styling
  • Additional commits viewable in compare view

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot show <dependency name> ignore conditions will show all of the ignore conditions of the specified dependency
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Updates the requirements on [spatie/phpunit-snapshot-assertions](https://github.com/spatie/phpunit-snapshot-assertions) to permit the latest version.
- [Release notes](https://github.com/spatie/phpunit-snapshot-assertions/releases)
- [Changelog](https://github.com/spatie/phpunit-snapshot-assertions/blob/main/CHANGELOG.md)
- [Commits](spatie/phpunit-snapshot-assertions@4.2.0...5.4.0)

---
updated-dependencies:
- dependency-name: spatie/phpunit-snapshot-assertions
  dependency-version: 5.4.0
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot Bot added dependencies Pull requests that update a dependency file php Pull requests that update Php code labels Nov 2, 2026
@freekmurze freekmurze mentioned this pull request Nov 5, 2026
Use PHPUnit 12.5 and snapshot assertions 5.4 on PHP 8.3+. Preserve snapshot IDs and output while migrating test discovery and coverage configuration. Fail CI for missing, changed, skipped, or incomplete snapshots and assert CLI exit-code boundaries.

Amp-Thread-ID: https://ampcode.com/threads/T-01a1b0b6-c968-7245-92e0-79d833179d17

Copy link
Copy Markdown
Member

Review and compatibility corrections are in 31db5ad.

The original failure was Composer rejecting snapshot assertions 5.4 on PHP 8.0. This branch now requires PHP 8.3+, uses bugfix-supported PHPUnit 12.5, migrates all 25 tests to attributes without renaming their snapshots, and retains PHP 8.3–8.6 coverage from #77. Runtime source, CLI output, and all 11 existing snapshots are unchanged. Symfony constraints remain unchanged; there is no Laravel dependency.

Snapshot creation is disabled with a literal string environment value, and skipped/incomplete tests fail. Local negative controls verified missing snapshots fail without being created, mismatches fail, intentional creation is incomplete/nonzero, and a skipped test exits nonzero. The pre-migration tests were undiscoverable under PHPUnit 12; the migrated suite passes 25 tests/42 assertions, including found/ignored exit-code boundaries. Full local suites passed with Symfony 5.4, 6.4, and 7.4. PHPStan, Pint, Composer strict validation, platform checks, and audit passed without bypasses. Latest-head CI is still being followed before merge.

The planned minor release is 1.3.0, explicitly dropping PHP 8.0–8.2. No runtime API/output changes are introduced.

PHP 8.5 deprecates null array offsets. Preserve the existing empty-string cache key while still resolving null directories from the current working directory. Cover default and explicit settings across initial and cached reads.

Regression fails before and passes after on PHP 8.5; all output snapshots remain unchanged.

Amp-Thread-ID: https://ampcode.com/threads/T-01a1b0b6-c968-7245-92e0-79d833179d17
@freekmurze
freekmurze merged commit 853703a into main Nov 6, 2026
7 checks passed
@dependabot
dependabot Bot deleted the dependabot/composer/spatie/phpunit-snapshot-assertions-tw-5.4 branch November 6, 2026 12:06

Copy link
Copy Markdown
Member

Final corrected head c728331 has all seven checks green, including PHP 8.3–8.6, PHPStan, and styling: https://github.com/spatie/x-ray/actions/runs/42214930754

The stricter suite exposed an existing PHP 8.5+ null-array-offset deprecation in configuration discovery. The follow-up fix explicitly preserves the old empty-string cache key without changing null/current-directory lookup semantics. Its public regression fails before the fix (three deprecations, exit 1) and passes after (four assertions); full suites now pass 26 tests/46 assertions. All 11 existing snapshots still match unchanged.

Immediately before normal merging, refreshed main/head refs, full discussion/reviews and review threads, all checks, mergeability, exact-ref classic protection, branch metadata, and effective rules. main is explicitly unprotected with no effective rules; no admin bypass or auto-merge was used. Expected merge tree is identical to the verified head. PHP floor changes and all unreleased maintenance are disclosed for the planned 1.3.0 minor release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file php Pull requests that update Php code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant