Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
snapshot testing (phplimburg)
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Freek Van der Herten
September 07, 2017
Programming
380
1
Share
snapshot testing (phplimburg)
Freek Van der Herten
September 07, 2017
More Decks by Freek Van der Herten
See All by Freek Van der Herten
Uncharted packages (ode aan de code)
freekmurze
0
62
Uncharted packages (Laravel Live Denmark)
freekmurze
0
250
I shall define this only once
freekmurze
0
480
An Introduction to Snapshot testing
freekmurze
0
560
Event Sourcing In Laravel
freekmurze
0
280
Building a realtime dashboard with Laravel Livewire (PHPKonf)
freekmurze
0
860
A tour behind the scenes of Oh Dear (PHP Benelux)
freekmurze
2
910
A practical look at multitenancy in Laravel
freekmurze
1
400
A practical look at multitenancy in Laravel (Laracon US)
freekmurze
0
780
Other Decks in Programming
See All in Programming
🦞OpenClaw works with AWS
licux
1
110
「話せることがない」を乗り越える 〜日常業務から登壇テーマをつくる思考法〜
shoheimitani
4
820
おれのAgentic Coding 2026/03
tsukasagr
1
150
LM Linkで(非力な!)ノートPCでローカルLLM
seosoft
0
500
[RubyKaigi 2026] Require Hooks
palkan
1
210
ソフトウェア設計の結合バランス #phperkaigi
kajitack
0
140
Kingdom of the Machine
yui_knk
2
370
Making the RBS Parser Faster
soutaro
0
410
Angular Signal Forms
debug_mode
0
110
2026_04_15_量子計算をパズルとして解く
hideakitakechi
0
110
Vibe하게 만드는 Flutter GenUI App With ADK , 박제창, BWAI Incheon 2026
itsmedreamwalker
0
550
The Monolith Strikes Back: Why AI Agents ❤️ Rails Monoliths
serradura
0
340
Featured
See All Featured
How to train your dragon (web standard)
notwaldorf
97
6.6k
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
3.8k
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
320
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
61k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
1
530
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
170
Ethics towards AI in product and experience design
skipperchong
2
260
The Cost Of JavaScript in 2023
addyosmani
55
9.8k
The innovator’s Mindset - Leading Through an Era of Exponential Change - McGill University 2025
jdejongh
PRO
1
160
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.9k
Avoiding the “Bad Training, Faster” Trap in the Age of AI
tmiket
0
130
Principles of Awesome APIs and How to Build Them.
keavy
128
17k
Transcript
A practical intro to snapshot testing and PHPUnit-watcher
About me Freek Van der Herten Partner & developer at
SPATIE Blogging at https://murze.be https://murze.be/newsletter
OPEN SOURCE SOFTWARE
https://spatie.be/en/opensource/laravel
Open source software ± 160 public repositories on GitHub August
2016: ± 800 000 downloads August 2017: ± 5 000 000 downloads ± 500 000 downloads a month
LET’S TALK SNAPSHOT TESTING
A file on disk, let’s call in snapshot Test succeeds
if output matches snapshot If not, test will fail What?
Another name: characterization testing Popularized by Facebook Jest Testing interfaces
Where does it come from?
https://github.com/spatie/phpunit-snapshot-assertions assertMatchesSnapshot assertMatchesJsonSnapshot assertMatchesXmlSnapshot How can we do it in
PHP?
DEMO
WRAPPING UP
Advantages Very easy to get started with Can be used
to validate complex output Easily update all the tests in one go
Disadvantages Brittle Hard to pinpoint exact point of failure Bugs
can be easily written in the snapshots
https://github.com/spatie/phpunit-snapshot-assertions https://sebastiandedeyne.com/posts/2017/a-package-for-snapshot- testing-in-phpunit https://murze.be/2017/04/practical-introduction-snapshot-testing/ https://www.sitepoint.com/snapshot-testing-viable-php/ https://facebook.github.io/jest/docs/snapshot-testing.html https://github.com/spatie/phpunit-watcher Interesting links
Thank you! https://speakerdeck.com/freekmurze/snapshot-testing-phplimburg https://spatie.be/opensource https://murze.be https://murze.be/newsletter/
QUESTIONS?