How to Start Testing an Existing WordPress Plugin with PHPUnit
summary
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
