🧪Testing
PHPUnit unit tests for PressGang's own PHP framework code — no WordPress install required — plus where to go for full theme end-to-end testing.
🧰 Stack
▶️ Running Tests
composer test # alias for test:unit
composer test:unit # run the full unit suite
vendor/bin/phpunit --filter ConfigTest # run a single test class
vendor/bin/phpunit --filter loads_and_caches # run a single test by name
vendor/bin/phpunit --list-tests # list all discovered tests🗂️ Directory Structure
tests/
├── bootstrap.php # autoloader + THEMENAME/ABSPATH constants
└── Unit/
├── TestCase.php # base class (extends YoastTestCase)
├── Blocks/ # BlockClassManager
├── Bootstrap/ # Config, FileConfigLoader, Loader
├── Configuration/ # Sidebars, Menus, CustomPostTypes, Actions
├── ContextManagers/ # Menu, Site, ThemeMods, AcfOptions, WooCommerce
└── ServiceProviders/ # TimberServiceProvider✍️ Writing a New Test
🔧 Testing Context Managers
💡 Tips and Gotchas
BrainMonkey apply_filters signature
Pre-loaded functions cannot be mocked
wp_parse_args is pre-stubbed
🚢 End-to-end testing
Last updated