Repository navigation
Description
🤖 AI-generated — created by an automated pipeline. Review before acting on this.
Context
PR #55 (issue #52) made src/{Unit,Integration}/bootstrap.php self-locating via BootstrapManager::setupConstants(). During grooming, an optional testability refactor ("Option B") was deferred: extracting the test-directory default resolution logic into a dedicated helper function to improve unit test coverage. This is a nice-to-have enhancement that reduces maintenance burden in downstream repos (#30) while improving this package's own test coverage.
Dependencies
#52 / PR #55 (already shipped)
What needs to be done
- Extract the test-directory default resolution from
src/BootstrapManager::setupConstants()into a newprotected static function getTestDirPath( $which_testsuite )that returns the relative path (path=override if present, else'Tests/' . ucfirst( $which_testsuite )), and havesetupConstants()call it. - Create a new per-method unit test
Tests/Unit/BootstrapManager/getTestDirPath.phpwith aTest_getTestDirPathclass following the repo's one-class-per-method convention, with data providers underTests/Fixtures/BootstrapManager/. - (Optionally, b1) Make
setupConstants()internally idempotent by wrapping eachdefine()in its ownif ( ! defined() )check for defense-in-depth.
Acceptance Criteria
- New
getTestDirPath()function exists, is documented, and is called bysetupConstants() - New unit test file covers: no
path=override (defaults toTests/UnitandTests/Integration), explicitpath=override, trailing-slash handling - All existing tests pass (no regressions in
setupConstants()behavior) - Test fixture files follow the repo's naming and structure conventions
Additional information
Why it matters: The setupConstants() path is process-global and irreversible; every process in this package's own suite pre-defines the constants via init-tests.php, leaving the default-path branch untested. Extracting a pure helper makes that branch testable using the same approach as getRootDir().
References: Contributes to #30 (reduce per-plugin test maintenance); follow-up to #52 / PR #55.
Activity