Extract and unit-test BootstrapManager::getTestDirPath()
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 74/100
Hướng nghiên cứu
Start in src/BootstrapManager at setupConstants(), and compare the existing getRootDir() testing approach. Add the per-method test at Tests/Unit/BootstrapManager/getTestDirPath.php with fixtures under Tests/Fixtures/BootstrapManager/, covering defaults, path= overrides, and trailing slashes. Run the existing test suite and confirm setupConstants() behavior remains unchanged.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
🤖 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.
- Ngôn ngữ chính
- PHP
- Star
- 4
- Fork
- 2
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Chúng tôi chưa kiểm tra các tệp thiết lập môi trường của dự án này. Hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của wp-media/phpunit
-
enhancement Made by AI
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 68/100
-
wpmedia-phpunit binary breaks @runInSeparateProcess testsCó thể làm lại được @remyperona đã nhận 41 ngày trước và không có pull request nào đang mở. Đang mởbug Made by AI
-
Improve the library to include classes that could be common to all plugins.Có thể làm lại được @hellofromahmed đã nhận 748 ngày trước và không có pull request nào đang mở. Đang mở
-
AdminOnly causes a Notice: Undefined offset in wordpress-develop vars.Có thể làm lại được @hellofromtonya đã nhận 2419 ngày trước và không có pull request nào đang mở. Đang mở
Tất cả issue của wp-media/phpunit
Issue tương tự
-
sync-en
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
az-digital/az_quickstart#6077 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Toolkit
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug] v-quick-install-app install crashes with ValueError if no supported PHP version is installedĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Add `kjkpc.net`Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
FGRibreau/mailchecker#625 ·