Repository navigation
test: kill the obvious surviving mutants - #15
Merged
Merged
Conversation
Infection showed behaviour that no test checked: the Symfony response contract (getContent(), getHeaders() and toArray() throw on 4xx and 5xx by default), the per-request headers, data and options of WordPress request_multiple(), data_format query, lowercase content-type, the default sink rewind and Content-Length drain in the Guzzle handler, the header and status line parsing of the runtime, and the php:// wrapper positions. The delay test could not detect a missing usleep() because spawning the process already took longer than the delay. Mutants that behave like the original (fake stat values, redundant trims, argument positions in exception helpers) are left alone. Covered code MSI goes from 79% to 87% locally.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #15 +/- ##
============================================
+ Coverage 93.13% 93.51% +0.37%
Complexity 575 575
============================================
Files 16 16
Lines 1341 1341
============================================
+ Hits 1249 1254 +5
+ Misses 92 87 -5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
PHP 8.6 adds the error location to json_decode() messages, so the hard-coded 'Syntax error' failed on the 8.6 job.
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.
Adds tests for behaviour that Infection showed was not checked. Only tests change, nothing in
src/.Locally, escaped mutants go from 234 to 141 and covered code MSI from 79% to 87%.
Some of the gaps were real contracts.
CliResponse::getContent(),getHeaders()andtoArray()must throw on 4xx and 5xx by default (Symfony HttpClient contract), and aJsonExceptioncould be dropped without any test failing. In the WordPress transport,request_multiple()could ignore each request's headers and data. The Guzzle delay test could not see a missingusleep()because starting the PHP process already takes longer than 100 ms, it now uses 500 ms.The
SEEK_CURtests forInputStreamcallstream_seek()on the wrapper directly.fseek()turnsSEEK_CURintoSEEK_SETbefore it reaches a userspace wrapper, so these branches can't be reached otherwise.I left alone the mutants that behave like the original code: fake
stream_statvalues, redundanttrim()calls, argument positions inInvalidArgument::create(), exception codes.Writing these tests found two bugs that I did not fix here. Any multipart part with a
filenamefails withSerialization of 'Symfony\Component\HttpFoundation\File\UploadedFile' is not allowed, the existing upload tests catch the exception and pass anyway. And values put in$_ENVby aGlobalsHandlernever reach the script,$_SERVERworks.