Skip to content

Cover BootstrapManager and document the consumer entry point - #50

Merged
remyperona merged 3 commits into
developfrom
docs/bootstrapmanager-coverage-and-consumer-docs
Aug 17, 2026
Merged

Cover BootstrapManager and document the consumer entry point#50
remyperona merged 3 commits into
developfrom
docs/bootstrapmanager-coverage-and-consumer-docs

Conversation

@remyperona

Copy link
Copy Markdown
Contributor

What & why

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.phpbypassing 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. The consumer entry point was also undocumented in the README.

Changes

  • Tests — add Tests/Unit/BootstrapManager/ covering getArg, removeCliArg, getRootDir, isGroup, and getConfigArgv (18 tests), following the existing one-class-per-method convention with a per-group abstract TestCase.php that 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 the phpcs.xml.dist scope, consistent with the other per-method test files (they trip the same $_SERVER['argv'] sanitization / per-method-doc-comment rules).
  • README — add "Running Your Repo's Tests" documenting vendor/bin/wpmedia-phpunit unit|integration and the WPMEDIA_PHPUNIT_ROOT_DIR= / path= / --group arguments (incl. AdminOnlyWP_ADMIN, MultisiteMULTISITE).
  • CLAUDE.md — add an Architecture section (entry point, bootstraps, public API surface, --group side effects, test layout) plus the self-test caveat.

Verification

  • Full unit suite green: 119 tests, 327 assertions (up from 101 tests) on PHP 8.2.
  • Full PHPStan clean (Tests/ is in its analysis paths).
  • No production code changed — tests + docs only.

🤖 Generated with Claude Code

remyperona and others added 2 commits August 17, 2026 10:06
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>
@remyperona remyperona self-assigned this Aug 17, 2026
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
remyperona merged commit 68997a7 into develop Aug 17, 2026
9 checks passed
@remyperona
remyperona deleted the docs/bootstrapmanager-coverage-and-consumer-docs branch August 17, 2026 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant