~/talk

How to Start Testing an Existing WordPress Plugin with PHPUnit

Talkat WordCamp Los Angeles 2018 · 2018-09-21..09-23· [wordpress, testing]
links:none on file
slides:none on file

Shows how to add PHPUnit tests to an existing WordPress plugin by scaffolding the suite with wp scaffold plugin-tests, bootstrapping WordPress test suite and using the vvv VM to avoid manual setup. Builds tests for a Simple Site Stats plugin, asserts that get_site_stats returns an array with 'post' and 'page' keys, uses WP_UnitTestCase factories to create posts and verify counts, explains phpunit.xml, the bootstrap script, Travis config, and recommends PHPUnit 6 and Composer for reproducible runs.

AI-written summary · about

  1. 0:00Introduction to unit testing
  2. 1:24Benefits of unit testing
  3. 6:13Setting up the environment
  4. 8:49Scaffolding plugin tests
  5. 11:45Understanding test files
  6. 19:31Writing tests and assertions
  7. 26:21Live demonstration
  8. 43:04Best practices and resources
~/search
type to search 8,222 conferences, 162,397 speakers and 219,688 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
← →
on a talk: 5 seconds back / forward
0–9
on a talk: jump to 0%–90% of the recording
?
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.