Permalink
Browse files

Refactoring loops in CodeCoverageManager

  • Loading branch information...
1 parent 6458072 commit 5a88aaf909a7f87af95ad567d1c4a028a19e4702 @markstory markstory committed Jan 10, 2010
Showing with 6 additions and 9 deletions.
  1. +6 −9 cake/tests/lib/code_coverage_manager.php
@@ -105,7 +105,6 @@ function init($testCaseFile, &$reporter) {
}
$manager->setParams($reporter);
$manager->testCaseFile = $testCaseFile;
- CodeCoverageManager::start();
}
/**
@@ -180,11 +179,8 @@ function report($output = true) {
$dump = xdebug_get_code_coverage();
$coverageData = array();
- foreach ($dump as $file => $data) {
- if ($file == $testObjectFile) {
- $coverageData = $data;
- break;
- }
+ if (isset($dump[$testObjectFile])) {
+ $coverageData = $dump[$testObjectFile];
}
if (empty($coverageData) && $output) {
@@ -215,9 +211,10 @@ function report($output = true) {
}
$dump = xdebug_get_code_coverage();
$coverageData = array();
- foreach ($dump as $file => $data) {
- if (in_array($file, $testObjectFiles)) {
- $coverageData[$file] = $data;
+
+ foreach ($testObjectFiles as $file) {
+ if (isset($dump[$file])) {
+ $coverageData[$file] = $dump[$file];
}
}

0 comments on commit 5a88aaf

Please sign in to comment.