Registry / testing / spatie-phpunit-snapshot-assertions

spatie-phpunit-snapshot-assertions

JSON →
library5.4.0phppackagistunverified

Snapshot testing for PHPUnit to compare output against stored snapshots.

composer require spatie/phpunit-snapshot-assertions
INSTALL
IMPORT
SIG · SPATIE-PHPUNIT-SNA
S
spatie-phpunit-snapshot-assertions
testingphpv5.4.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

MatchesSnapshots
use Spatie\Snapshots\MatchesSnapshots;

Use the trait to assert a value matches a stored snapshot.

use Spatie\Snapshots\MatchesSnapshots; class ExampleTest extends \PHPUnit\Framework\TestCase { use MatchesSnapshots; public function testSomething() { $this->assertMatchesSnapshot('expected output'); } }
Debug
Known issues
gotchaSnapshots are stored as files; ensure they are committed to version control and updated when output changes intentionally.
fix
Run tests with --update-snapshots flag to update all snapshots.
affects: >=1.0.0
Upgrade
Version history
5.4.0latest on Packagist
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
spatie-phpunit-snapshot-assertions — pip install spatie-phpunit-snapshot-assertions · libregistry