Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Phpunit Snapshot Assertions Laravel Package

spatie/phpunit-snapshot-assertions

Add snapshot testing to PHPUnit with simple assertions for JSON, XML, and text. First run creates snapshots; later runs compare outputs and fail on regressions. Ideal for verifying serialized data and responses with minimal test boilerplate.

View on GitHub
Deep Wiki
Context7
5.3.2

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

What's Changed

  • Allow PHPUnit 13
5.3.0

What's Changed

Full Changelog: https://github.com/spatie/phpunit-snapshot-assertions/compare/5.2.3...5.3.0

5.2.2

What's Changed

Full Changelog: https://github.com/spatie/phpunit-snapshot-assertions/compare/5.2.1...5.2.2

5.2.1

What's Changed

New Contributors

Full Changelog: https://github.com/spatie/phpunit-snapshot-assertions/compare/5.2.0...5.2.1

5.1.1
  • fix image driver
5.0.1
4.2.12

What's Changed

New Contributors

Full Changelog: https://github.com/spatie/phpunit-snapshot-assertions/compare/4.2.11...4.2.12

4.2.11
4.2.10
4.2.9
4.2.8
4.2.7
  • clean filenames on MatchesFileSnapshot for Windows (#130)
4.2.6
  • allow using env vars to manage snapshot creation and update (#126)
4.2.5
  • add support for PHP 7.3
4.2.4
  • add support for PHP 8
4.2.3
  • migrate phpunit config
4.2.2
  • moves default implementation of snapshot directory/id to concerns directory (#99)
4.2.1
  • Fix exception message
4.2.0
  • Fixed inconsistent line endings
  • Improved Windows support
4.1.0
  • Added --without-creating-snapshots flag
4.0.0

Snapshots generated with assertMatchesSnapshot will break when upgrading to this version. The easiest way to upgrade is to ensure your snapshot tests pass, delete your snapshots, upgrade the package, then rerun the tests to generate new snapshots.

  • New snapshot formats when using assertMatchesSnapshot: scalars (strings, integers & floats) are serialized to txt files, objects & arrays are serialized to yaml files
  • New TextDriver to store snapshots in txt files
  • New ObjectDriver to serialize data to YAML and store snapshots in yaml files
  • Removed VarDriver
3.1.0
  • Drop support for PHP 7.3
3.0.0
  • assertMatchesJsonSnapshot now supports all JSON serializable objects, and won't convert empty arrays to obejcts anymore
2.2.1
  • Allow symfony 5 components
2.2.0
  • Added an assertMatchesHtmlSnapshot assertion
2.1.3
  • Allow recursive mkdir for file snapshots
2.1.2
  • Less restrictive symfony/yaml version requirement
2.1.1
  • Fix for json driver
3.1.1
  • Add support for PHPUnit 9 (#86)
2.1.0
  • Require PHPUnit 8 & PHP 7.2
2.0.0
  • Use YAML by default for associative arrays
  • Drop PHP 7.0 support, the new constraint is ^7.1
  • Drop PHPUnit ^6.5 support, the new constraint is ^7.0
1.4.1
  • Fix JSON array comparisons
1.4.0
  • Allow arrays to be serialized to JSON
1.3.3
  • Fix updating failed file-snapshots
1.3.2
  • Fix for tests with weird characters
1.3.1
  • Lowered minimum required PHPUnit version
1.3.0
  • Only mark test incomplete after every snapshot has been run
1.2.3
  • Fixed snapshot creation in recursive directories
1.2.2
  • Support PHP 7.2
1.2.1
  • Support phpunit ^7.0
1.2.0
  • Added assertMatchesFileSnapshot
1.1.1
  • Fixed assertMatchesFileHashSnapshot
1.1.0
  • Added assertMatchesFileHashSnapshot assertion
1.0.2
  • Added example folder to .gitattributes
1.0.1
  • Fixed expected and actual argument order when making json assertions
1.0.0
  • Added a reminder how to update snapshots when a snapshot assertion fails
0.4.1
  • Initial release
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport
twbs/bootstrap4