Conversation
Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
… to src Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
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 tests mirror the theme files by name, but nothing checked it, and nothing stopped the line coverage from going down. This adds both.
Test layout
tests/Unit/StructureTest.phpchecks, in both directions:inc/,src/andwoocommerce/has a test named after it at the same path, with each folder and file name in StudlyCase:inc/cpf-cnpj.php→tests/Integration/Inc/CpfCnpjTest.php,woocommerce/myaccount/form-login.php→tests/Integration/Woocommerce/Myaccount/FormLoginTest.php, andsrc/TaxId.php→tests/Unit/TaxIdTest.phportests/Integration/TaxIdTest.php. Files ininc/andwoocommerce/need WordPress, so only an integration test covers them: loading one without WordPress stops atdefined( 'ABSPATH' ) || exit;;*Test.phpundertests/Unitandtests/Integration, and every*.spec.tsundertests/E2E, points to a file that exists, turning each folder and file name back to kebab case (Woocommerce/SingleProduct/Tabs/DescriptionTest.php→woocommerce/single-product/tabs/description.php). A browser test may also cover a class insrc/.A missing test fails with the file and the test paths it looked for, for example
src/Logo.php is not covered by tests/Unit/LogoTest.php or tests/Integration/LogoTest.php.It runs in the unit suite, without WordPress;tests/Support/ThemeFiles.phplists the files.Coverage
phpunit-coverage.xml.distruns the unit and integration suites together, andcomposer coveragewritestests/.coverage/clover.xml(ignored).Coveragejob inphpunit.ymlruns it on PHP 8.3 with Xdebug and hands the report to octocov (k1LoW/octocov-action, pinned by SHA)..octocov.ymlfails the run when line coverage is below 90% or below the last report ofmain, kept as a workflow artifact.exitand is covered by the browser test, andfunctions.phpandinc/theme-setup.php, which run while WordPress boots, before coverage is recorded.readme.txtstates the layout rule and the coverage floor.Verification
composer cipasses: 140 unit tests (36 of them fromStructureTest) and 167 integration tests.composer coveragepasses as well, also in random order.tests/Unit/LogoTest.php, adding an emptytests/Integration/Inc/OrphanTest.phportests/E2E/Nothing.spec.ts, or addingwoocommerce/single-product/price.phpwithout a test makesStructureTestfail for each, naming the paths. Awoocommerce/single-product/tabs/description.phpoverride with its test, andtests/E2E/Logo.spec.ts, pass.current >= 99% && current >= prevfails with "code coverage is 93.6%. the condition in thecoverage.acceptable:section is not met", and the configuredcurrent >= 90% && current >= prevpasses. Without a report ofmainyet,previs 0, so only the floor applies until the first run onmain.