Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

- Merge [1448].

  • Loading branch information...
commit 252b0ff99c4b77c0e288ea9e3fb645eaa1f4e9f6 1 parent f0e47f9
@sebastianbergmann authored
Showing with 40 additions and 25 deletions.
  1. +40 −25 PHPUnit/Util/Report/Coverage/Node/File.php
View
65 PHPUnit/Util/Report/Coverage/Node/File.php
@@ -293,40 +293,55 @@ public function render($target, $title, $charset = 'ISO-8859-1')
'coverage_file.html'
);
- $i = 1;
- $lines = '';
+ $i = 1;
+ $lines = '';
+ $ignoreStart = -1;
foreach ($this->codeLines as $line) {
+ if (strpos($line, '@codeCoverageIgnoreStart') !== FALSE) {
+ $ignoreStart = $i;
+ }
+
+ else if (strpos($line, '@codeCoverageIgnoreEnd') !== FALSE) {
+ $ignoreStart = -1;
+ }
+
$css = '';
- if (isset($this->executedLines[$i])) {
- $count = '';
+ if ($ignoreStart == -1) {
+ if (isset($this->executedLines[$i])) {
+ $count = '';
- // Array: Line is executable and was executed.
- // count(Array) = Number of tests that hit this line.
- if (is_array($this->executedLines[$i])) {
- $color = 'lineCov';
- $count = sprintf('%8d', count($this->executedLines[$i]));
- }
+ // Array: Line is executable and was executed.
+ // count(Array) = Number of tests that hit this line.
+ if (is_array($this->executedLines[$i])) {
+ $color = 'lineCov';
+ $count = sprintf('%8d', count($this->executedLines[$i]));
+ }
- // -1: Line is executable and was not executed.
- else if ($this->executedLines[$i] == -1) {
- $color = 'lineNoCov';
- $count = sprintf('%8d', 0);
- }
+ // -1: Line is executable and was not executed.
+ else if ($this->executedLines[$i] == -1) {
+ $color = 'lineNoCov';
+ $count = sprintf('%8d', 0);
+ }
- // -2: Line is dead code.
- else {
- $color = 'lineDeadCode';
- $count = ' ';
- }
+ // -2: Line is dead code.
+ else {
+ $color = 'lineDeadCode';
+ $count = ' ';
+ }
- $css = sprintf(
- '<span class="%s"> %s : ',
+ $css = sprintf(
+ '<span class="%s"> %s : ',
- $color,
- $count
- );
+ $color,
+ $count
+ );
+ }
+ }
+
+ else if ($i > $ignoreStart) {
+ $this->numExecutedLines++;
}
$lines .= sprintf(
Please sign in to comment.
Something went wrong with that request. Please try again.