spatie/phpunit-snapshot-assertions

Return snapshot object from assertion

Closed this issue · 3 comments

Hi,
I need to make some operations with the file generated by the assertion, and for that, it would be really useful to get the snapshot object.

If you're ok with that, I can make a PR which return the snapshot from the assertion.

Thanks.
Mathieu.

The purist in me says that assertions shouldn't return anything. The pragmatist says it's fine.

Maybe a good in between solution would to have a dedicated method to get the snapshot for a given test.

Feel free to send a PR with tests for us to review.

Yeah I had the same debate in me too, it why I raised an issue before. 😉

Actually for my need right now, I think I found another way than using the snapshot. But I'll do something later if it's needed.

mfn commented

The purist in me says that assertions shouldn't return anything. The pragmatist says it's fine.

Always reminds me about http://fabien.potencier.org/pragmatism-over-theory-protected-vs-private.html 😅