Cover BootstrapManager and document the consumer entry point - #50
Merged
remyperona merged 3 commits intoAug 17, 2026
Merged
Conversation
The package's own suite bootstraps through Tests/{Unit,Integration}/init-tests.php,
which defines WPMEDIA_PHPUNIT_ROOT_DIR / WPMEDIA_PHPUNIT_ROOT_TEST_DIR directly and
requires src/{Unit,Integration}/bootstrap.php — bypassing the wpmedia-phpunit bin and
most of BootstrapManager. As a result the consumer-facing argv parsing had no coverage:
a regression in it would ship with a green suite.
- Add Tests/Unit/BootstrapManager/ covering getArg, removeCliArg, getRootDir, isGroup,
and getConfigArgv (18 tests), following the one-class-per-method convention. Kept out
of the phpcs.xml.dist scope like the other per-method test files.
- README: add "Running Your Repo's Tests" documenting vendor/bin/wpmedia-phpunit and the
WPMEDIA_PHPUNIT_ROOT_DIR / path / --group arguments.
- CLAUDE.md: add an Architecture section (entry point, bootstraps, public API, --group
side effects, test layout) and the self-test caveat.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Note in CLAUDE.md that phpcs.xml.dist allow-lists specific files (issue #39) rather than scanning the tree, that files should be added opportunistically rather than widening wholesale, and that PHPStan by contrast covers the full set. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Follow the repository convention (see Tests/Unit/ApiTrait/getApiCredential.php): each per-method test class now has a single data-driven test method backed by a data provider that pulls scenarios from the mirrored Tests/Fixtures/BootstrapManager/ directory via TestCaseTrait::getTestData(). Install-location-dependent expectations (getRootDir's consumer/package roots, getConfigArgv's resolved phpunit.xml.dist path) are expressed as tokens in the fixtures and resolved in the test bodies. Same 18 scenarios, still green; PHPStan clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
remyperona
deleted the
docs/bootstrapmanager-coverage-and-consumer-docs
branch
August 17, 2026 18:33
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
The package's own suite bootstraps through
Tests/{Unit,Integration}/init-tests.php, which definesWPMEDIA_PHPUNIT_ROOT_DIR/WPMEDIA_PHPUNIT_ROOT_TEST_DIRdirectly and requiressrc/{Unit,Integration}/bootstrap.php— bypassing thewpmedia-phpunitbin and most ofBootstrapManager. As a result the consumer-facing argv parsing had no coverage: a regression in it would ship with a green suite. The consumer entry point was also undocumented in the README.Changes
Tests/Unit/BootstrapManager/coveringgetArg,removeCliArg,getRootDir,isGroup, andgetConfigArgv(18 tests), following the existing one-class-per-method convention with a per-group abstractTestCase.phpthat snapshots/restores$_SERVER['argv']/argc. Notable: verifies consumer args (path=,WPMEDIA_PHPUNIT_ROOT_DIR=) are stripped while real PHPUnit args pass through. Kept out of thephpcs.xml.distscope, consistent with the other per-method test files (they trip the same$_SERVER['argv']sanitization / per-method-doc-comment rules).vendor/bin/wpmedia-phpunit unit|integrationand theWPMEDIA_PHPUNIT_ROOT_DIR=/path=/--grouparguments (incl.AdminOnly→WP_ADMIN,Multisite→MULTISITE).--groupside effects, test layout) plus the self-test caveat.Verification
Tests/is in its analysis paths).🤖 Generated with Claude Code