diff options
author | Andrew Dolgov <[email protected]> | 2023-12-02 17:45:25 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2023-12-02 18:03:06 +0300 |
commit | 09898ccbc87b5e297bcfab4527a3705bd3b4d5a4 (patch) | |
tree | ebb1e6ebe21782f4c1a757a00af1316ca645b69e /vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/File.php | |
parent | 2b8e34453234b8b31ebc9e7020f8677bf3889898 (diff) |
add phpunit code coverage driver
Diffstat (limited to 'vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/File.php')
-rw-r--r-- | vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/File.php | 51 |
1 files changed, 32 insertions, 19 deletions
diff --git a/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/File.php b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/File.php index 429730192..69fd8b1da 100644 --- a/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/File.php +++ b/vendor/phpunit/php-code-coverage/src/Report/Html/Renderer/File.php @@ -80,6 +80,8 @@ use const T_WHILE; use const T_YIELD; use const T_YIELD_FROM; use function array_key_exists; +use function array_keys; +use function array_merge; use function array_pop; use function array_unique; use function constant; @@ -89,6 +91,9 @@ use function explode; use function file_get_contents; use function htmlspecialchars; use function is_string; +use function ksort; +use function range; +use function sort; use function sprintf; use function str_replace; use function substr; @@ -279,19 +284,19 @@ final class File extends Renderer $buffer .= $this->renderItemTemplate( $template, [ - 'name' => $this->abbreviateClassName($name), - 'numClasses' => $numClasses, - 'numTestedClasses' => $numTestedClasses, - 'numMethods' => $numMethods, - 'numTestedMethods' => $numTestedMethods, - 'linesExecutedPercent' => Percentage::fromFractionAndTotal( + 'name' => $this->abbreviateClassName($name), + 'numClasses' => $numClasses, + 'numTestedClasses' => $numTestedClasses, + 'numMethods' => $numMethods, + 'numTestedMethods' => $numTestedMethods, + 'linesExecutedPercent' => Percentage::fromFractionAndTotal( $item['executedLines'], $item['executableLines'], )->asFloat(), - 'linesExecutedPercentAsString' => $linesExecutedPercentAsString, - 'numExecutedLines' => $item['executedLines'], - 'numExecutableLines' => $item['executableLines'], - 'branchesExecutedPercent' => Percentage::fromFractionAndTotal( + 'linesExecutedPercentAsString' => $linesExecutedPercentAsString, + 'numExecutedLines' => $item['executedLines'], + 'numExecutableLines' => $item['executableLines'], + 'branchesExecutedPercent' => Percentage::fromFractionAndTotal( $item['executedBranches'], $item['executableBranches'], )->asFloat(), @@ -302,14 +307,14 @@ final class File extends Renderer $item['executedPaths'], $item['executablePaths'] )->asFloat(), - 'pathsExecutedPercentAsString' => $pathsExecutedPercentAsString, - 'numExecutedPaths' => $item['executedPaths'], - 'numExecutablePaths' => $item['executablePaths'], - 'testedMethodsPercent' => $testedMethodsPercentage->asFloat(), - 'testedMethodsPercentAsString' => $testedMethodsPercentage->asString(), - 'testedClassesPercent' => $testedClassesPercentage->asFloat(), - 'testedClassesPercentAsString' => $testedClassesPercentage->asString(), - 'crap' => $item['crap'], + 'pathsExecutedPercentAsString' => $pathsExecutedPercentAsString, + 'numExecutedPaths' => $item['executedPaths'], + 'numExecutablePaths' => $item['executablePaths'], + 'testedMethodsPercent' => $testedMethodsPercentage->asFloat(), + 'testedMethodsPercentAsString' => $testedMethodsPercentage->asString(), + 'testedClassesPercent' => $testedClassesPercentage->asFloat(), + 'testedClassesPercentAsString' => $testedClassesPercentage->asString(), + 'crap' => $item['crap'], ] ); @@ -379,7 +384,7 @@ final class File extends Renderer return $this->renderItemTemplate( $template, [ - 'name' => sprintf( + 'name' => sprintf( '%s<a href="#%d"><abbr title="%s">%s</abbr></a>', $indent, $item['startLine'], @@ -797,8 +802,15 @@ final class File extends Renderer $singleLineTemplate = new Template($this->templatePath . 'line.html.dist', '{{', '}}'); $lines = ''; + $first = true; foreach ($path['path'] as $branchId) { + if ($first) { + $first = false; + } else { + $lines .= ' <tr><td colspan="2"> </td></tr>' . "\n"; + } + $branchLines = range($branches[$branchId]['line_start'], $branches[$branchId]['line_end']); sort($branchLines); // sometimes end_line < start_line @@ -834,6 +846,7 @@ final class File extends Renderer $popoverContent .= $this->createPopoverContentForTest($test, $testData[$test]); } + $trClass = $lineCss . ' popin'; } |