PHPackages                             kigaroo/snapshot-testing - 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. kigaroo/snapshot-testing

ActiveLibrary[Testing &amp; Quality](/categories/testing)

kigaroo/snapshot-testing
========================

Provides PHPUnit assertions for snapshot testing

0.12.0(1mo ago)6605.5k↓81.6%4[1 PRs](https://github.com/speicherhafen/snapshot-testing/pulls)MITPHPPHP ^8.1CI failing

Since May 6Pushed 1mo ago6 watchersCompare

[ Source](https://github.com/speicherhafen/snapshot-testing)[ Packagist](https://packagist.org/packages/kigaroo/snapshot-testing)[ RSS](/packages/kigaroo-snapshot-testing/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (13)Versions (39)Used By (0)

Snapshot Testing
================

[](#snapshot-testing)

[![Build Status](https://camo.githubusercontent.com/ce525c77954e272b92578929dcbc9ca259ff9f2a7175f16c279e03f5bd90ecac/68747470733a2f2f7472617669732d63692e6f72672f4b696761526f6f2f736e617073686f742d74657374696e672e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/KigaRoo/snapshot-testing)

Provides PHPUnit assertions for snapshot testing

### Installation

[](#installation)

```
composer require --dev kigaroo/snapshot-testing

```

### Basic Usage

[](#basic-usage)

```
use KigaRoo\SnapshotTesting\MatchesSnapshots;

final class MyUnitTest extends TestCase
{
    use MatchesSnapshots;

    public function testJson()
    {
        $myJsonData = json_encode([
            'foo' => 'bar',
        ]);

        $this->assertMatchesJsonSnapshot($myJsonData);
    }

    public function testXml()
    {
        $myXmlData = "7d644cc6-70fa-11e9-89e1-220d3e3a2561";

        $this->assertMatchesXmlSnapshot($myJsonData);
    }

    public function testCsv()
    {
        $myCsvData =  'bar',
        ]);

        $this->assertMatchesJsonSnapshot($myJsonData, [
            new UuidWildcard('id'),
        ]);
    }

    public function testXml()
    {
        $myXmlData = '7d644cc6-70fa-11e9-89e1-220d3e3a2561';

        $this->assertMatchesXmlSnapshot($myXmlData, [
            new UuidWildcard('id'),
        ]);
    }

    public function testCsv()
    {
        $myCsvData =
