Skip to content

Commit

Permalink
Refactoring loops in CodeCoverageManager
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Jan 10, 2010
1 parent 6458072 commit 5a88aaf
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions cake/tests/lib/code_coverage_manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ function init($testCaseFile, &$reporter) {
}
$manager->setParams($reporter);
$manager->testCaseFile = $testCaseFile;
CodeCoverageManager::start();
}

/**
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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];
}
}

Expand Down

0 comments on commit 5a88aaf

Please sign in to comment.