test: Use PHPUnit attributes for Kirby\Text
#7201
Draft
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.
Description
This highlights some problems in our test setup: Tests classes linked to
EmailKirbyTagTest
are only supposed to cover the code fromconfig/tags.php
. However, there is no (known) way with PHPUnit to limit code coverage to this. AddingCoversNothing
in this PR leaves a lot inconfig/tags.php
marked not covered, even when we have tests. At the same time it reveals some other actually uncovered parts in our code, which get marked covered by e.g. tests inEmailKirbyTagTest
when we don't add any coverage limitation attributes.We should also move for KirbyTags to class-based code where we then can test the core KirbyTags in their dedicated classes each. We can still support the array notation for plugins.
Summary of changes
CoversClass
,CoversNothing
andDataProvider
PHPUnit PHP attributes instead of DocBlock annotations in theKirby\Text
packageReasoning
Switching over package by package (or smaller units) to see how the code coverage is affected.
Additional context
Put this for the 5.1.0 milestone to not further add to the list of the 5.0.0 milestone as we want to close this very soon.
The changes were created automatically with Rector:
Ready?