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
0
400
Test-driven development with PHPUnit
Oliver Klee
August 05, 2022
Tweet
Share
More Decks by Oliver Klee
See All by Oliver Klee
Gewaltfreie Kommunikation: ein Crashkurs
oliverklee
0
83
Team-Management-Plattform
oliverklee
0
68
Vertrauen in Teams & Führung
oliverklee
0
250
Software-Qualität von TYPO3-Extensions automatisieren
oliverklee
0
43
Vertrauen in Teams & Führung
oliverklee
0
160
Testing von TYPO3-Extensions
oliverklee
0
79
Software-Qualität von Extensions automatisieren
oliverklee
1
54
Content-Synchronisierung
oliverklee
0
160
Gewaltfreie Kommunikation: ein Crashkurs
oliverklee
0
330
Other Decks in Programming
See All in Programming
TestingOsaka6_Ozono
o3
0
280
Architectural Extensions
denyspoltorak
0
180
HTTPプロトコル正しく理解していますか? 〜かわいい猫と共に学ぼう。ฅ^•ω•^ฅ ニャ〜
hekuchan
2
650
AIエージェント、”どう作るか”で差は出るか? / AI Agents: Does the "How" Make a Difference?
rkaga
4
1.9k
.NET Conf 2025 の興味のあるセッ ションを復習した / dotnet conf 2025 quick recap for backend engineer
tomohisa
0
120
実は歴史的なアップデートだと思う AWS Interconnect - multicloud
maroon1st
0
330
責任感のあるCloudWatchアラームを設計しよう
akihisaikeda
3
110
Python札幌 LT資料
t3tra
7
1.1k
Graviton と Nitro と私
maroon1st
0
170
余白を設計しフロントエンド開発を 加速させる
tsukuha
6
1.8k
DevFest Android in Korea 2025 - 개발자 커뮤니티를 통해 얻는 가치
wisemuji
0
180
KIKI_MBSD Cybersecurity Challenges 2025
ikema
0
1.2k
Featured
See All Featured
What's in a price? How to price your products and services
michaelherold
247
13k
Odyssey Design
rkendrick25
PRO
0
470
Navigating Team Friction
lara
192
16k
The Spectacular Lies of Maps
axbom
PRO
1
440
Product Roadmaps are Hard
iamctodd
PRO
55
12k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
Google's AI Overviews - The New Search
badams
0
890
A Modern Web Designer's Workflow
chriscoyier
698
190k
Paper Plane
katiecoart
PRO
0
45k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
61k
4 Signs Your Business is Dying
shpigford
187
22k
Getting science done with accelerated Python computing platforms
jacobtomlinson
1
100
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