PHPackages                             madewithlove/phpunit-snapshots - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. madewithlove/phpunit-snapshots

Abandoned → [spatie/phpunit-snapshot-assertions](/?search=spatie%2Fphpunit-snapshot-assertions)ArchivedLibrary[Testing &amp; Quality](/categories/testing)

madewithlove/phpunit-snapshots
==============================

Snaphot testing for PHPUnit

0.1.2(9y ago)1617.3k3[1 PRs](https://github.com/madewithlove/phpunit-snapshots/pulls)MITPHP

Since Dec 8Pushed 6y ago3 watchersCompare

[ Source](https://github.com/madewithlove/phpunit-snapshots)[ Packagist](https://packagist.org/packages/madewithlove/phpunit-snapshots)[ RSS](/packages/madewithlove-phpunit-snapshots/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (3)Versions (4)Used By (0)

PHPUnit Snapshots
=================

[](#phpunit-snapshots)

[![Build Status](https://camo.githubusercontent.com/907895d3f9a4044f1986c40c35a7109c41e188beaf2f62dbde3ffbe8022db60e/687474703a2f2f696d672e736869656c64732e696f2f7472617669732f6d616465776974686c6f76652f706870756e69742d736e617073686f74732e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/madewithlove/phpunit-snapshots)[![Latest Stable Version](https://camo.githubusercontent.com/0b1846f6f0e4ab272f9b7e7e83325af27a4750e08d872381d9ec4aa40c48a451/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d616465776974686c6f76652f706870756e69742d736e617073686f74732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/madewithlove/phpunit-snapshots)[![Total Downloads](https://camo.githubusercontent.com/2ac69b3e1eca2b4fa835764cdcd0bea7ea3ebf8c4959993cdbab4ad39968ef6f/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d616465776974686c6f76652f706870756e69742d736e617073686f74732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/madewithlove/phpunit-snapshots)

This trait allows you to use [Jest-like](https://facebook.github.io/jest/) snapshot testing in your PHPUnit tests.

It is a very basic trait and is only meant to snapshot JSON-encodable structures, not complex objects and such.

Installation
------------

[](#installation)

```
composer require madewithlove/phpunit-snapshots
```

Usage
-----

[](#usage)

### Using snapshots in tests

[](#using-snapshots-in-tests)

Simply call the assertion on any encodable result (the result of a function, a variable, etc.). You can pass an identifier as second argument which will be used as title of the snapshot in the snapshot file.

```
