bd-companion-plugin
better-data: Companion plugin testbed
For library maintainers working in the integration testbed at wp-content/plugins/better-data-plugin-test/. The plugin's job is to verify better-data behavior against real WordPress — things that pure unit tests can't reach (cache primings, metadata_exists semantics, wp_slash round-trips, REST schema actually appearing in WP_REST_Server, locale switching, encryption key constants).
Misconception this skill corrects
"I'll add the new feature's integration test directly inside
better-data/tests/Unit/so everything's in one place."
Wrong. tests/Unit/ is the WP-free zone — every test there must run with composer test against a clean PHP environment, no WP bootstrap, no MySQL. That's intentional: contributors can run the unit suite in seconds. WP-aware behavior goes in the companion plugin, where there's a real WordPress to talk to.
The split:
| Concern | Lives in |
|---|---|
| Pure type coercion, attribute reflection, builder logic | better-data/tests/Unit/ |
wp_slash round-trip, metadata_exists semantics, REST registration |
better-data-plugin-test/src/Smoke/ |
| Multi-step scenarios (encrypt → store → fetch → decrypt → reveal), edge-case discovery | better-data-plugin-test/src/Stress/ |
Visual confirmation (admin page renders print_r($dto)) |
better-data-plugin-test/src/Admin/ |