-
-
Notifications
You must be signed in to change notification settings - Fork 377
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement processed code coverage data mapper #1028
base: main
Are you sure you want to change the base?
Implement processed code coverage data mapper #1028
Conversation
- Ensure we are unserialising the function coverage
I see that there are some CI failures which I'll take a look at next. I also should mention that my implementation here is laughably simple. One thing I haven't looked at is validating the JSON on unserialization. I'm not sure if that's necessary or not, but I can have a go at that if you'd like. |
- This issue presents when running the test suite for the first time (e.g. in CI) since there is no `tests/_files/tmp` directory created. - In the one test case which requires the cleanup of these files because it creates them it does not fail because the directory is created. - The other test cases don't need this tear down, but they fail when it tries to run as this directory has not yet been created. - In future we'll probably remove both the tear down and the test case that needs it as this is probably not an appropriately direct way to test this.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1028 +/- ##
============================================
+ Coverage 84.00% 84.09% +0.09%
- Complexity 1194 1196 +2
============================================
Files 71 72 +1
Lines 4238 4250 +12
============================================
+ Hits 3560 3574 +14
+ Misses 678 676 -2 ☔ View full report in Codecov by Sentry. |
This is my first pass at implementation for an object
SebastianBergmann\CodeCoverage\Data\ProcessedCodeCoverageDataMapper
which serializes to JSON and de-serializes from JSON a given instance ofSebastianBergmann\CodeCoverage\Data\ProcessedCodeCoverage
.The intention here is to move in the direction of being able to generate code coverage reports that do not require the serialize() and unserialize() PHP functions, and instead rely on a data only JSON format which might be less prone to issues such as sebastianbergmann/phpcov#109. This PR attempts to implement a basic JSON format only, and does not fully realize that goal by replacing the current implementation of serialization or documentation.
The JSON format have essentially represents the underlying data in the class. i.e.
I have not attempted to include any of the meta data that might be used to instantiate a
Driver
orFilter
instance which are required to instantiate aCodeCoverage
instance.I'm not sure if it would be better to make the JSON format more general, and nest the above properties under something like
coverage
using other keys, perhapsdriver
andfilter
or something else to include other meta data about the code coverage report. I have omitted this based on your stated preference to de-serialize toProcessedCodeCoverageReport
. I would welcome your guidance here.I'm still familiarizing myself with the codebase and the shape of the coverage data, so I'm not certain I've covered everything I need to in testing.
I've included one "End to End" style test for XML which may not be appropriate to merge. This was more about me ensuring that I had everything I needed to replicate a known expected XML report. I'm not sure how far to go down this path in adding more tests like that, as it may be redundant, and I don't want to be retesting the XML report generation implementation. Once again, I'd welcome your opinion here.