Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Clean and Quality Unit Tests
Search
codecleaner
November 23, 2013
Technology
3
550
Clean and Quality Unit Tests
Talk about readability and high quality of unit tests written in PHPUnit
codecleaner
November 23, 2013
Tweet
Share
Other Decks in Technology
See All in Technology
「え?!それ今ではHTMLだけでできるの!?」驚きの進化を遂げたモダンHTML
riyaamemiya
10
4.4k
eBPFとwaruiBPF
sat
PRO
2
930
Digitization部 紹介資料
sansan33
PRO
1
6.1k
なぜフロントエンド技術を追うのか?なぜカンファレンスに参加するのか?
sakito
9
1.9k
手動から自動へ、そしてその先へ
moritamasami
0
180
ECMAScript仕様の最新動向: プロセスの変化と仕様のトレンド
uhyo
2
490
Introduction to Sansan for Engineers / エンジニア向け会社紹介
sansan33
PRO
5
48k
Oracle Cloud Infrastructure:2025年11月度サービス・アップデート
oracle4engineer
PRO
1
110
小さな判断で育つ、大きな意思決定力 / 20251204 Takahiro Kinjo
shift_evolve
PRO
1
300
Master Dataグループ紹介資料
sansan33
PRO
1
4k
シンプルを極める。アンチパターンなDB設計の本質
facilo_inc
1
1k
Symfony AI in Action
el_stoffel
2
370
Featured
See All Featured
The Pragmatic Product Professional
lauravandoore
37
7.1k
Done Done
chrislema
186
16k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
31
3k
Facilitating Awesome Meetings
lara
57
6.7k
Practical Orchestrator
shlominoach
190
11k
Designing for Performance
lara
610
69k
BBQ
matthewcrist
89
9.9k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.5k
How to train your dragon (web standard)
notwaldorf
97
6.4k
Being A Developer After 40
akosma
91
590k
Fireside Chat
paigeccino
41
3.7k
Transcript
Clean & Quality unit tests
Wojtek Zieliński @codecleaner
• Names matters • Exceptions • Test Doubles • Stubbing
Collections • Arrange Act Assert What’s it all about?
Names matters
None
None
None
None
None
None
None
None
Test a single concept in each test function Robert C.
Martin
None
None
None
None
None
None
None
None
None
None
Exceptions
None
None
None
None
None
None
None
None
None
None
None
None
Test Doubles
None
None
None
How does getMock() really work? • Does Configuration class exist?
• Create Mock_Configuration_123abc class extends Configuration class • Create instance of that class • Return instance
How does getMock() really work? • Does Configuration class exist?
• Create Mock_Configuration_123abc class extends Configuration class • Create instance of that class • Return instance • Create Configuration class
None
None
None
None
None
None
None
None
None
None
None
None
Stubs provide canned answers to calls made during the test
"Mocks Aren’t Stubs" Martin Fowler
Mocks are objects pre-programmed with expectations which form a specification
of the calls they are expected to receive "Mocks Aren’t Stubs" Martin Fowler
None
None
None
None
None
None
None
None
None
None
None
None
Stubbing collections
None
None
Arrange Act Assert
None
None
None
It’s all about readability
None
None
What’s next?
None
None
Questions? Wojtek Zieliński @codecleaner