📡 You're offline — showing cached content
New version available!
Quick Access
Tutorials PHPUnit Testing PHPUnit Interview Prep

PHPUnit Interview Prep

5 min read Quiz at the end
Test event firing by mocking dispatchers or using Event::fake() and assertDispatched().

PHPUnit Interview Topics

  • Unit vs Integration vs E2E — unit: isolated class; integration: multiple layers; E2E: full browser
  • Mock vs Stub — stub returns values; mock also verifies call expectations
  • TDD Red-Green-Refactor — write failing test, make it pass, clean up
  • Test isolation — each test must be independent with fresh state
  • setUp vs setUpBeforeClass — setUp per test; setUpBeforeClass once per class
  • Code coverage — line, branch, and path coverage metrics
  • expectException — must be called before the throwing code
  • assertSame vs assertEquals — assertSame uses ===; assertEquals uses ==