~/talk

My Top 10 PHPUnit Tips & Tricks

Talkat Dutch PHP Conference 2020 · on Friday, 2020-06-26· [testing, php]
links:none on file
slides:none on file

Adds PHPUnit to composer, uses phpunit.xml.dist bootstrap, and insists on assertSame vs assertEquals so tests catch type issues; prefers data providers and data providers with named datasets to run every case and make failures readable. Recommends filtering tests locally, generating coverage to Clover and HTML via composer scripts, using @covers fully qualified names and optional forceCovers, and marking skips with reasons. Advises never to generate expected results from the code under test, considers mutation testing with Infection, and sometimes duplicates constants in tests to catch changes.

AI-written summary · about

  1. 0:00Intro
  2. 1:09My Top 10 PHPUnit Tips & Tricks Juliette Reinders Folmer
  3. 2:16Have Tests
  4. 6:50ASSERTEQUALS ASSERTSAME
  5. 8:31Don't Just Test the Happy Path
  6. 10:05Parameter type declarations
  7. 10:41Limit Assertions Per Test
  8. 12:19Use Data Providers
  9. 14:03Don't Use Your Own Code To Create Test Data
  10. 16:09Name Your Test Cases
  11. 17:57Explore Filtering
  12. 19:32Don't Trust Code Coverage But do examine it
  13. 26:10Don't Leave Without Saying Goodbye
  14. 28:25Make Your Tests Cross-Version Compatibility
  15. 32:19Test Your Tests
  16. 34:32Lose Count
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.