Repository navigation
Mutation testing: count uncovered code (--with-uncovered) - #168
Merged
Merged
Conversation
…re messages Run Infection with --with-uncovered (template command, signature-default and visibility mutators as in the template). Overall MSI with the flag is about 94% on PHP 8.4 against the unchanged gate of 92. Tests added: exact wording of every failure-message factory, in-process coverage of bypassFinals(), BypassUnavailable and the explanations for a final class that is still standing, and direct cases for default rendering, the parent keyword, intersection overlap, wire() edge types, TypeDefaultResolver type strings, DefaultFactories ancestry and the by-reference snapshot cap. Codegen classes are named in #[Covers] by the tests that compile doubles. src/ changes are behaviour-neutral: messages assembled from several literals are built into a local before use, and six one-line signatures with a default are split one parameter per line.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
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.
What
composer mutationnow runsinfection --threads=max --with-uncovered(template command,Composer\Config::disableProcessTimeout,testFrameworkOptions: --suite=Unit, signature-default ignore regex,PublicVisibility/ProtectedVisibilityoff).minMsistays at 92.Numbers (PHP 8.4, pcov,
zend.assertions=-1,--with-uncovered)(The flag-less figure for the same command was 3093 mutants / 94.1% Covered Code MSI.)
What changed
src/(behaviour-neutral, same text and same results):$format/$reasonbefore use. With the literals as call arguments the compiler folds them and the operand mutants sit on a line with no opcode, so they were Not Covered whatever the tests did;Expectation::describeGuardAgainst()andTypeRenderer::resolveParent()hold an operand in a local for the same reason.ExceptionMessageTest: every factory's message, word for word (61 cases; builds inside the test body, because a data provider executes nothing under coverage);BypassFinalsTest,FinalReasonTest:Understudy::bypassFinals(),BypassUnavailableand the four explanations for a standingfinalrun in-process, with thefile://wrapper installed and removed inside each test (the same globalFileWrapperTesthas always toggled).testo.phpis untouched, so understudy#148 does not apply;DefaultSourceRenderingTest,UnreproducibleDefaultTest), theparentkeyword (ParentKeywordTest), intersection overlap,wire()edge types,TypeDefaultResolvertype strings,DefaultFactoriesancestry, the by-reference snapshot cap,Expectation::describeAgainst(),Outcome, tail matchers;#[Covers]for the Codegen classes on the tests that compile doubles (Infection maps mutants to tests by#[Covers]only).What cannot be killed, and why
\assert(), which CI compiles out;Arg::reason(null),renderConstantDefault()without a declaring class,foreignFileWrapper()without a source file,file_get_contents() === falseafteris_file());DoubleStateliteral-key index,FinalStripperfast paths and loop bounds,?->on values never null, cache keys).Stability
Three local runs and two CI runs of
Coverage & Mutationare recorded in a comment below.Unrelated to mutations
The commit "Apply rector 2.8.4 ExplicitNullableObjectInstanceRector" is dependency drift, not part of the mutation work: Rector 2.8.4 appeared after the last green master and turned the
Psalmjob'scomposer rectorstep red. The rewrite is=== null/!== nulltoinstanceofon?ReflectionClass,?ReflectionMethod,?ReflectionTypeandReflectionClass|false|nullvalues inTypeRenderer,WireandTargetUnifier; behaviour is the same.The commit "Make the message expectations independent of the checkout's line endings" fixes the Windows job: the nowdoc expectations in
ExceptionMessageTestbecome CRLF on a converting checkout while the messages carry LF.