Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Test-driven development with PHPUnit
Search
Oliver Klee
August 04, 2023
Programming
330
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Test-driven development with PHPUnit
Oliver Klee
August 04, 2023
Transcript
39 slides
Test-driven Development with PHPUnit Oliver Klee, 2023-08 @
[email protected]
|
[email protected]
About me Oliver „Oli“ Kle e #bon n #extension-de v
#workshop-teache r #unit-testing-gu y #phpstan-gu y #best-practices-tea m #motivation-research-tea m #team-leadership-working-grou p #game-cookin g #powermetal
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, PHP
or Symfony 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();
4 test phases set up setUp() code in the test
method exercise method call verify assert…() tear down tearDown()
Code test-first write test write code refactor
Effects of TDD higher code coverage minimale code think
before you code tests now test what the code should do (instead of what it does) focused coding cleaner code structure
Test levels http:// fi lipdefar.com/2015/06/tested-be-thy-name.html
Unit tests are small and fast
Integration tests test how components work together in TYPO3:
„functional tests“
Acceptance tests Codeception Cypress
Test types
Blackbox tests test the public API
Whitebox tests inner workings test the
Anti- zombie tests-
Regression tests
Smoke tests
Smoke tests
Story tests for Behavior-driven developmen t (BDD) Behat Codeception
The testing pyramid Unit Functional/ Integration Acceptance Photo by Eugene
Tkachenko on Unsplash: https://unsplash.com/photos/TF47p5PHW18
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
More Decks by Oliver Klee
See All by Oliver Klee
Testing von TYPO3-Extensions
oliverklee
0
34
Softwarequalität für öffentliche TYPO3-Extensions
oliverklee
0
86
Psychologische Sicherheit
oliverklee
0
53
Generative KI, Ethik und Nachhaltigkeit
oliverklee
0
300
Gewaltfreie Kommunikation: ein Crashkurs
oliverklee
0
160
Team-Management-Plattform
oliverklee
0
110
Vertrauen in Teams & Führung
oliverklee
0
340
Software-Qualität von TYPO3-Extensions automatisieren
oliverklee
0
73
Vertrauen in Teams & Führung
oliverklee
0
200
Other Decks in Programming
See All in Programming
Agentic AI with the Power of Jakarta EE
ivargrimstad
0
170
特急いなほ as a Workflow / 20261107jaws-festa-2026-akita-lt
kasacchiful
PRO
0
100
Proxmox x Talos Linux x Terraform で実現するなんかいい感じの Kubernetes クラスタ / A Sleek Kubernetes Cluster Powered by Proxmox, Talos Linux, and Terraform
nnaka2992
0
300
Engineering Biometric UX Across Android Versions | DroidKnights 2026
ryunen344
1
220
社内AIエージェント「Askワンバン」における コストチューニングの取り組み
t0yohei
0
180
なぜ私たちは「現時点では」KMPの導入を見送ったのか
chigichan24
1
600
AIコーディングをセッションで終わらせない: PHPライブラリ開発におけるコンテキスト承継設計
ickx
0
110
Secure Your Coding Agent Like It’s Malware (v1.5) 🇬🇧 @Code.talks 2026
richargh
0
200
AI時代のシニアエンジニアとは
yosuke_furukawa
PRO
15
12k
AIコーディング時代のKotest ユニットテストから APIレベルの仕様固定化テストへ
ooga04
0
330
protojson における文字化けの扱い
kazuki1023
0
460
DroidKnights 2026 Android A2UI Jetpack Compose 기반의 안전한 AI UI 렌더링 - 박제창
itsmedreamwalker
1
260
Featured
See All Featured
Navigating the Design Leadership Dip - Product Design Week Design Leaders+ Conference 2024
apolaine
2
530
Art, The Web, and Tiny UX
lynnandtonic
304
22k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
1
620
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.7k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
1.1k
For a Future-Friendly Web
brad_frost
184
11k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
68
61k
Heart Work Chapter 1 - Part 1
lfama
PRO
11
37k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
23k
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
320
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4.2k