Add comprehensive test suite with 100% code coverage#133
Open
HecFranco wants to merge 6 commits into
Open
Conversation
Contributor
Author
|
Hi @TomasVotruba 👋 Thank you for reviewing and merging #131 — glad the Entropy console migration is in main now. I've opened a follow-up PR that expands the PHPUnit suite to 100% line and method coverage (175 tests, up from ~40%). It adds tests for commands, finders, node visitors, and smoke test generation, plus a few small edge-case fixes in src/ where coverage uncovered unreachable or untested branches. Would you have time to take a look when you get a chance? Happy to adjust anything if you'd prefer a smaller scope (e.g. tests only, without the Docker setup). Thanks again for the merge on the previous one! |
This commit introduces two new XML files, `coverage-priv.xml` and `coverage.xml`, which contain detailed coverage metrics for the `Rector\SwissKnife` project. These files provide insights into code coverage for various classes and methods, aiding in maintaining high code quality and ensuring comprehensive testing.
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.
Summary
Expands the PHPUnit suite to 175 tests with 100% line and method coverage locally (~40% before). Adds coverage for commands, finders, node visitors, smoke test generation, and testing utilities.
All Code Analysis checks pass on PHP 8.4 (PHPUnit, PHPStan level 8, Rector, ECS, composer-dependency-analyser, etc.).
What changed
Tests
pretty-json,finalize-classes,privatize-constants,search-regex, smoke test generation, …)FilesFinder, PhpParser node visitors,MockedClassResolver,TraitSpotter, value objects, and related servicespretty-json)composer-dependency-analysergreen)PHPUnit configuration
phpunit.xml— tests only (CI runsvendor/bin/phpunitwithcoverage: none)phpunit.coverage.xml— coverage reports for local runsMinor
src/adjustments (edge cases exposed by coverage)FilesFinder::findJsonFiles()— skip empty directory lists before iterating FindernamespacedNameis missingMockWire—Assert::classExists()before PHPUnit mocker creationContainerFactory— autodiscoverTesting/CommandKernelTestCasestub — extendsPHPUnit\Framework\TestCaseLocal development (optional)
docker/test.sh,docker/coverage.shCoverage
Test plan
vendor/bin/phpunit— 175 tests, all passingcomposer phpstan— level 8, no errorsvendor/bin/composer-dependency-analyser— no issuesphpunit.coverage.xml)Optional comment
CI is green on PHP 8.4. Coverage config is split into
phpunit.coverage.xmlso CI can run without pcov/xdebug. Test fixtures no longer reference Doctrine classes.