File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -366,7 +366,26 @@ On next execution the obtained data will be compared with previously saved snaps
366366> To update a snapshot with a new data run tests in `--debug` mode.
367367
368368By default Snapshot uses `assertEquals` assertion, however this can be customized by overriding `assertData` method.
369+
370+ ### Failed assertion output
371+
372+ The assertion performed by `assertData` will not display the typical diff output from `assertEquals` or any customized failed assertion.
373+ To have the diff displayed when running tests, you can call the snapshot method `shouldShowDiffOnFail`:
374+
375+ {% highlight php %}
376+
377+ <? php
378+ public function testCategoriesAreTheSame(\AcceptanceTester $I, \Snapshot\Categories $snapshot)
379+ {
380+ $I-> amOnPage('/categories');
381+ // I want to see the diff in case the snapshot data changes
382+ $snapshot->shouldShowDiffOnFail();
383+ $snapshot->assert();
384+ }
385+
386+ {% endhighlight %}
369387
388+ If ever needed, the diff output can also be omitted by calling `shouldShowDiffOnFail(false)`.
370389
371390## Conclusion
372391
@@ -378,4 +397,4 @@ to operate with database through a data abstraction layer, and use the DataFacto
378397
379398
380399* **Next Chapter: [APITesting >](/docs/10-APITesting)**
381- * **Previous Chapter: [< Customization](/docs/08-Customization)**
400+ * **Previous Chapter: [< Customization](/docs/08-Customization)**
You can’t perform that action at this time.
0 commit comments