Skip to main content
📡 You're offline — showing cached content
<EC
/>
Install EzyCoders
Read posts offline, faster loads, no browser UI
Install
✕
⚡
New version available!
Update
<EzyCo
ders
/>
Resume Builder
Resume
🌙
Theme
▼
Light
✓
Dark
✓
Sepia
✓
Ocean
✓
Forest
✓
Midnight
✓
Rose
✓
High Contrast
✓
System
✓
Sign In
Expand Menu
🗺️
Roadmaps
🃏
Flashcards
📄
Resume
📚
Series
🎓
Tutorials
🗺️
My Path
🎤
Mock Interview
⚡
Cheat Code
🛠️
Dev Tools
Quick Access
🗺️
Roadmaps
🃏
Flashcards
📚
Series
🎓
Tutorials
🗺️
My Path
🎤
Mock Interview
⚡
Cheat Code
📄
Resume Builder
🛠️
Dev Tools
← PHPUnit Testing
1
What is PHPUnit?
2
PHPUnit Configuration
3
Writing Your First Test
4
Assertions Reference
5
Data Providers
6
Mock Objects
7
Stubs
8
setUp and tearDown
9
Test Doubles — Spies
10
Integration Tests
11
HTTP Testing
12
Code Coverage
13
TDD — Test Driven Development
14
Dependency Injection in Tests
15
Test Organization
16
Mockery
17
Testing Exceptions
18
Parameterized Tests
19
Testing Private Methods
20
Database Testing
21
Testing Output
22
Continuous Integration
23
Snapshot Testing
24
Performance Testing
25
PHPUnit Best Practices
26
PHPUnit PHP8 Attributes
27
Faker for Test Data
28
Object Mother Pattern
29
Test Builder Pattern
30
Contract Tests
31
Mutation Testing
32
PHPStan Static Analysis
33
Parallel Testing
34
Testing File System
35
Testing Email Sending
36
Test Doubles Summary
37
PHP Code Quality Tools
38
Behat BDD Testing
39
Testing Queues
40
Testing Events
41
PHPUnit Best Practices Deep Dive
42
PHPUnit Interview Prep
Tutorials
›
PHPUnit Testing
›
Test Doubles Summary
Test Doubles Summary
5 min read
Dummy, Stub, Fake, Spy, Mock — when and why to use each type of test double.
Test Doubles Cheat Sheet
Type
Purpose
Verifies Calls?
Dummy
Passed but never used
No
Stub
Returns canned values
No
Fake
Working simplified implementation
No
Spy
Records calls for later assertion
Yes (after)
Mock
Pre-programmed expectations
Yes (before)
Sign in
to track your progress.
← Testing Email Sending
Next: PHP Code Quality Tools →