Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions src/ProcessedCodeCoverageData.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,7 @@ public function markCodeAsExecutedByTestCase(string $testCaseId, RawCodeCoverage
foreach ($executedCode->lineCoverage() as $file => $lines) {
foreach ($lines as $k => $v) {
if ($v === Driver::LINE_EXECUTED) {
if (empty($this->lineCoverage[$file][$k]) || !in_array($testCaseId, $this->lineCoverage[$file][$k], true)) {
$this->lineCoverage[$file][$k][] = $testCaseId;
}
$this->lineCoverage[$file][$k][] = $testCaseId;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is safe, then the checks on 83/91 (pre-patch) 81/89 (post-patch) I think should be safe to remove as well, the principle behind adding those was cargo-culting over from this one

Copy link

@exussum12 exussum12 Jul 26, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what happens in this case but it's possible for the same test to be added to this array twice now.

If the array was keyed by the test id, you could set the key to be the id and the value to be true ? Then use array_keys before processing.

Not checked if adding the same test matters though

}
}
}
Expand Down