Exemple #1
0
$xml .= add_XML_value('buildtime', $build_array['starttime']);
$xml .= '</build>';
// Load coverage file.
$coverageFile = new CoverageFile();
$coverageFile->Id = $fileid;
$coverageFile->Load();
$xml .= '<coverage>';
$xml .= add_XML_value('fullpath', $coverageFile->FullPath);
// Generating the html file
$file_array = explode('<br>', $coverageFile->File);
$i = 0;
// Load the coverage info.
$log = new CoverageFileLog();
$log->BuildId = $buildid;
$log->FileId = $fileid;
$log->Load();
// Detect if we have branch coverage or not.
$hasBranchCoverage = false;
if (!empty($log->Branches)) {
    $hasBranchCoverage = true;
}
foreach ($file_array as $line) {
    $linenumber = $i + 1;
    $line = htmlentities($line);
    $file_array[$i] = '<span class="warning">' . str_pad($linenumber, 5, ' ', STR_PAD_LEFT) . '</span>';
    if ($hasBranchCoverage) {
        if (array_key_exists("{$i}", $log->Branches)) {
            $code = $log->Branches["{$i}"];
            // Branch coverage data is stored as <# covered> / <total branches>.
            $branchCoverageData = explode('/', $code);
            if ($branchCoverageData[0] != $branchCoverageData[1]) {