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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Oliver Klee
August 04, 2023
Programming
320
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
More Decks by Oliver Klee
See All by Oliver Klee
Psychologische Sicherheit
oliverklee
0
31
Generative KI, Ethik und Nachhaltigkeit
oliverklee
0
110
Gewaltfreie Kommunikation: ein Crashkurs
oliverklee
0
140
Team-Management-Plattform
oliverklee
0
100
Vertrauen in Teams & Führung
oliverklee
0
330
Software-Qualität von TYPO3-Extensions automatisieren
oliverklee
0
64
Vertrauen in Teams & Führung
oliverklee
0
190
Testing von TYPO3-Extensions
oliverklee
0
110
Software-Qualität von Extensions automatisieren
oliverklee
1
68
Other Decks in Programming
See All in Programming
iOSDC2026登壇資料.pdf
riofujimon
0
200
Herb in Rails 8.2: Your ERB views, now HTML-aware @ Rails World 2026, Austin, Texas
marcoroth
0
140
コードレビューのボトルネックを"する側"と"される側"の両面から解消する
yub0n
2
1.2k
マイコン向けの軽量Ruby「PicoRuby」で各種デバイスを制御するネイティブアプリの実現手法
bash0c7
0
470
モデルのリファクタリングが難しいと思ったら、そもそも複雑だったのはビジネス仕様だった ? / is-the-business-domain-the-real-complexity
hatsu38
0
430
UPDATE をやめる — EF Core でマスタをバージョン管理する
panda728
PRO
0
1k
ソニーのクラウド共通基盤の変遷とAI時代の開発スタイルに合わせた進化 / The Journey of Sony’s Common Cloud Platform and Its Evolution for AI-Native Development
kenjiyoneyama
0
210
UnityでSystem.Net.WebSocketsなWebSocketサーバが動かないのでUnity Monoのコードを覗いてみた / about implementing websocket server with unity mono
drumath2237
1
520
JAWS-UG 東京支部が始める、JAWS-UG支部コラボ / JAWS-UG lunchtime LT Collaboration
y0hgi
0
170
mrbgem 三角測量 開発
ogom
0
170
Streamlitで実現する自然言語データアプリ開発
ayumu_yamaguchi
1
330
標準パッケージに uuid が追加された 背景から見る Go らしい意思決定 / go_127_uuid_decision
convto
5
9.3k
Featured
See All Featured
AI: The stuff that nobody shows you
jnunemaker
PRO
10
1.1k
Building AI with AI
inesmontani
PRO
1
1.3k
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
840
Crafting Experiences
bethany
1
360
From π to Pie charts
rasagy
1
380
Designing for Performance
lara
611
70k
Facilitating Awesome Meetings
lara
57
7.2k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
8k
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
6.3k
Amusing Abliteration
ianozsvald
1
320
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2.2k
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
710
Transcript
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