Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

- Merge [4626].

  • Loading branch information...
commit 9156122fce3647aaf4440fa1f1109fcade0e36e7 1 parent d5012b3
@sebastianbergmann authored
Showing with 25 additions and 38 deletions.
  1. +25 −38 PHPUnit/Util/CodeCoverage.php
View
63 PHPUnit/Util/CodeCoverage.php
@@ -128,9 +128,18 @@ protected static function getLinesByStatus(array $data, $status)
$status = array($status);
}
- $result = array();
+ $isFileCache = array();
+ $result = array();
foreach ($data as $file => $coverage) {
+ if (!isset($isFileCache[$file])) {
+ $isFileCache[$file] = self::isFile($file);
+ }
+
+ if (!$isFileCache[$file]) {
+ continue;
+ }
+
$result[$file] = array();
foreach ($coverage as $line => $_status) {
@@ -197,18 +206,8 @@ public static function getCoveringTests(array &$data, $file, $line, $clear = FAL
public static function getSummary(array &$data, $clear = FALSE)
{
if (empty(self::$summary) || $clear) {
- $isFileCache = array();
-
foreach ($data as $test) {
foreach ($test['files'] as $file => $lines) {
- if (!isset($isFileCache[$file])) {
- $isFileCache[$file] = self::isFile($file);
- }
-
- if (!$isFileCache[$file]) {
- continue;
- }
-
foreach ($lines as $line => $flag) {
if ($flag == 1) {
if (isset(self::$summary[$file][$line][0])) {
@@ -224,38 +223,26 @@ public static function getSummary(array &$data, $clear = FALSE)
}
}
- foreach ($test['executable'] as $file => $lines) {
- if (!isset($isFileCache[$file])) {
- $isFileCache[$file] = self::isFile($file);
- }
-
- if (!$isFileCache[$file]) {
- continue;
- }
-
- foreach ($lines as $line => $flag) {
- if ($flag == 1 && !isset(self::$summary[$file][$line][0])) {
- self::$summary[$file][$line] = -1;
- }
+ if (isset($test['executable'])) {
+ foreach ($test['executable'] as $file => $lines) {
+ foreach ($lines as $line => $flag) {
+ if ($flag == 1 && !isset(self::$summary[$file][$line][0])) {
+ self::$summary[$file][$line] = -1;
+ }
- else if (!isset(self::$summary[$file][$line])) {
- self::$summary[$file][$line] = $flag;
+ else if (!isset(self::$summary[$file][$line])) {
+ self::$summary[$file][$line] = $flag;
+ }
}
}
}
- foreach ($test['dead'] as $file => $lines) {
- if (!isset($isFileCache[$file])) {
- $isFileCache[$file] = self::isFile($file);
- }
-
- if (!$isFileCache[$file]) {
- continue;
- }
-
- foreach ($lines as $line => $flag) {
- if ($flag == -2 && !isset(self::$summary[$file][$line][0])) {
- self::$summary[$file][$line] = -2;
+ if (isset($test['dead'])) {
+ foreach ($test['dead'] as $file => $lines) {
+ foreach ($lines as $line => $flag) {
+ if ($flag == -2 && !isset(self::$summary[$file][$line][0])) {
+ self::$summary[$file][$line] = -2;
+ }
}
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.