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
Test-driven development with PHPUnit
Search
Oliver Klee
August 05, 2022
Programming
420
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Test-driven development with PHPUnit
Oliver Klee
August 05, 2022
More Decks by Oliver Klee
See All by Oliver Klee
Generative KI, Ethik und Nachhaltigkeit
oliverklee
0
83
Gewaltfreie Kommunikation: ein Crashkurs
oliverklee
0
130
Team-Management-Plattform
oliverklee
0
93
Vertrauen in Teams & Führung
oliverklee
0
320
Software-Qualität von TYPO3-Extensions automatisieren
oliverklee
0
61
Vertrauen in Teams & Führung
oliverklee
0
180
Testing von TYPO3-Extensions
oliverklee
0
110
Software-Qualität von Extensions automatisieren
oliverklee
1
66
Content-Synchronisierung
oliverklee
0
200
Other Decks in Programming
See All in Programming
S3 を使うアプリケーションをローカル完結で動かすことに全力を注いでみた / Running S3 Apps Offline
contour_gara
0
730
Go 1.27 における memory allocation の高速化
andpad
0
370
How I Won Prize Money at a Hackathon Using Codex and Symphony Alpha
yasei_no_otoko
0
130
Cloudflare is Agents
chimame
0
190
LLMは4年分のCompose移行を再現できるのか?実プロダクト279件のXMLで探る自動化の境界線
makun
0
250
Loosening the Reins: Go Generics Get More Flexible
kuro_kurorrr
0
360
PHPプロジェクトの結合バランスを可視化する #php_night
kajitack
0
180
AI時代に学ぶ 好きなルール 嫌いなルール Linter編
shorty5121
0
720
不幸な GC
chencmd
0
850
KotlinConf Extended South Korea 2026 Keynote
l2hyunwoo
0
130
AIエージェント時代のコードレビューを設計する
nogu66
5
1.2k
Discordを用いたラボオートメーション関連情報収集の自動化
noguhiro2002
0
480
Featured
See All Featured
Art, The Web, and Tiny UX
lynnandtonic
304
22k
Building a Scalable Design System with Sketch
lauravandoore
463
34k
Prompt Engineering for Job Search
mfonobong
0
430
Bootstrapping a Software Product
garrettdimon
PRO
306
120k
AI in Enterprises - Java and Open Source to the Rescue
ivargrimstad
0
1.4k
Visualization
eitanlees
152
17k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
1
2.1k
How Software Deployment tools have changed in the past 20 years
geshan
1
34k
More Than Pixels: Becoming A User Experience Designer
marktimemedia
3
510
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Writing Fast Ruby
sferik
630
63k
Site-Speed That Sticks
csswizardry
13
1.5k
Transcript
Test-driven development with PHPUnit Oliver Klee, 2022-08 @oliklee
| Mastodon:
[email protected]
|
[email protected]
About me Oliver „Oli“ Klee #bonn #extension-dev #workshop-teacher #unit-testing-guy #phpstan-guy
#typo3-ombudsperson #typo3-quality-assurance-initiative #gami fi cation-working-group #game-cooking #powermetal
???
The goals ✓ You have a clearer understanding on how
TDD works. ✓(optional) You get test-infected. ✓You learn at least 1 new testing pattern. ✓We all have fun.
The travel plan 1. getting starte d 2. concepts &
term s 3. testing pattern s 4. hands-o n 5. naming test s 6. hands-o n 7. ending & feedback
The rules 1. There are no stupid questions. 2. The
joker rule.
The travel plan 1. getting starte d 2. concepts &
term s 3. testing pattern s 4. hands-o n 5. naming test s 6. hands-o n 7. ending & feedback
Unit Tests?
Manual testing is cumbersome
Automated testing is fast
Unit tests for the TYPO3 Core
Unit Tests 406 (144) tests/s
Functional Tests 8.13 (1.97) tests/s
Acceptance Tests .009 (.003) tests/s
Verify that your code does what you expect
Make sure that your changes won‘t break anything
Keep others from breaking your code
Don’t break anything even in complex projects
Create a safety net for refactoring or for TYPO3
updates
Improve the structure of your code
Find the location of bugs
Green feels good!
Let’s get some terms straight
The two programming modes clean hacky
Testsuite Testcase Test Assertion Test Test Testcase
The life cycle of a test new FooTest(); setUp(); /**
@test */ lifeIsGood(); tearDown();
Code test-first write test write code refactor
The travel plan 1. getting starte d 2. concepts &
term s 3. testing pattern s 4. hands-o n 5. naming test s 6. hands-o n 7. ending & feedback
The travel plan 1. getting starte d 2. concepts &
term s 3. testing pattern s 4. hands-o n 5. naming test s 6. hands-o n 7. ending & feedback
https://github.com/TYPO3-Documentation/tea/ Branch: workshop/t3dd22 File: Exercises.md
The travel plan 1. getting starte d 2. concepts &
term s 3. testing pattern s 4. hands-o n 5. naming test s 6. hands-o n 7. ending & feedback
Naming Tests
Use meaningful test names classCanBeInstantiated setTitleSetsTitle setSizeWithZeroThrowsException hasTitleForEmptyTitleReturnsFalse Name the
behavior. Name the preconditions. Name the method. Don’t use “works” or “works correctly”. measureFrubbleWorksCorrectly
The travel plan 1. getting starte d 2. concepts &
term s 3. testing pattern s 4. hands-o n 5. naming test s 6. hands-o n 7. ending & feedback