test: enforce the test layout and hold the line coverage - #13
Merged
Merged
Conversation
YvesCesar
marked this pull request as draft
September 16, 2026 22:22
YvesCesar
marked this pull request as ready for review
September 16, 2026 22:38
YvesCesar
force-pushed
the
test/structure-and-coverage-gate
branch
from
September 16, 2026 23:02
8df0fb4 to
618538d
Compare
YvesCesar
force-pushed
the
test/structure-and-coverage-gate
branch
from
September 17, 2026 20:59
618538d to
d4ff31c
Compare
YvesCesar
force-pushed
the
test/structure-and-coverage-gate
branch
2 times, most recently
from
September 17, 2026 21:34
f8a4d8e to
644bf2a
Compare
Base automatically changed from
test/e2e-playwright
to
refactor/decision-logic-in-src
September 18, 2026 20:39
Base automatically changed from
refactor/decision-logic-in-src
to
test/integration-harness
September 18, 2026 20:49
vitormattos
requested changes
Sep 18, 2026
vitormattos
added this pull request to stack #14
September 19, 2026 17:59
vitormattos
previously approved these changes
Sep 19, 2026
vitormattos
approved these changes
Sep 24, 2026
vitormattos
left a comment
Member
There was a problem hiding this comment.
The implementation looks good to me now.
Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
vitormattos
force-pushed
the
test/structure-and-coverage-gate
branch
from
September 24, 2026 02:07
155c5f8 to
0fb050f
Compare
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.
The conventions the suite follows were kept by review only: a new class could land without a test, and a test could outlive the file it was named after. This adds the two checks that keep them, on top of the Playwright suite from #12 (hence the base branch; it retargets to
mainonce #9, #10, #11 and #12 are merged).The two files that had no test
src/Autoloader.phpandsrc/Github/WebhookDecision.phpwere the only source files with no test named after them, so they come first — the layout check would fail on them otherwise.tests/Unit/AutoloaderTest.php— the loader lands in the stack, every class of the plugin is loaded from the file named after it, a class of another project is left alone, and a class with no file is not an error.tests/Unit/Github/WebhookDecisionTest.php— the four answers a delivery can get, what each one carries, and theLogicExceptionthe three that are not a deploy throw when asked for a workflow run. Its lines were already exercised throughWebhookGateTest, which is exactly why it was easy to miss.The layout check
tests/Unit/StructureTest.phpreads the repository instead of a list kept by hand (tests/Support/PluginFiles.php) and fails in both directions:src/X.phpwantstests/Unit/XTest.phportests/Integration/XTest.php,includes/foo-bar.phpwantstests/Integration/Includes/FooBarTest.php, and the main file wantstests/Integration/LibresignWpCustomizationsTest.php;.spec.tsundertests/E2E/.The failure names both paths, so a rename that breaks the mirror says which file to move:
The coverage floor
composer coverageruns the suite with Xdebug collecting coverage and hands the clover report tobin/coverage-gate.php, which compares it withcoverage-floor.txt— today65.33, the line coverage oflibresign-wp-customizations.php,includes/andsrc/as it stands.The floor only ever goes up. Coverage below it fails; coverage a full point above it fails too, printing the number to write in the file. A change that covers more raises the floor in the same commit, and coverage that quietly drains away between releases is not possible.
composer cinow ends incoverageinstead oftest, so one command still runs everything CI runs. TheTestsworkflow gains aCoveragejob on PHP 8.3 with Xdebug — the same driver as the container, so the number does not move between a local run and CI.Verification
composer ciis green: no lint, PHPCS or PHPStan findings, 299 PHPUnit tests (up from 239), and the gate at 65.33%. The layout check was confirmed against a stray file and a stray test, the output above, and all four outcomes of the gate — at the floor, below it, above it, and a floor file that does not hold a number.