From f33e30fb8d1481f3fa773c19fd431b9ef79608a7 Mon Sep 17 00:00:00 2001 From: stronk7 Date: Tue, 23 Jun 2009 16:50:03 +0000 Subject: [PATCH] MDL-19579 code coverage - xhtml compliant fixes --- lib/spikephpcoverage/readme_moodle.txt | 2 ++ .../src/reporter/HtmlCoverageReporter.php | 36 +++++++++++++------ .../src/reporter/html/footer.html | 6 ++-- .../src/reporter/html/header.html | 6 ++-- .../src/reporter/html/indexheader.html | 8 ++--- 5 files changed, 39 insertions(+), 19 deletions(-) diff --git a/lib/spikephpcoverage/readme_moodle.txt b/lib/spikephpcoverage/readme_moodle.txt index e56eb8a5b3..29179d4240 100644 --- a/lib/spikephpcoverage/readme_moodle.txt +++ b/lib/spikephpcoverage/readme_moodle.txt @@ -14,5 +14,7 @@ Added: Our changes: /// Look for "moodle" in code * src/parser/PHPParser.php - comment some debug lines causing some notices in moodle + * src/reporter/HtmlCoverageReporter.php, src/reporter/html/indexheader.html, + src/reporter/html/header.html, src/reporter/html/footer.html - various xhtml fixes 20090621 - Eloy Lafuente (stronk7): Original import of 0.8.2 release diff --git a/lib/spikephpcoverage/src/reporter/HtmlCoverageReporter.php b/lib/spikephpcoverage/src/reporter/HtmlCoverageReporter.php index c5d7f34684..c7df05a3ea 100644 --- a/lib/spikephpcoverage/src/reporter/HtmlCoverageReporter.php +++ b/lib/spikephpcoverage/src/reporter/HtmlCoverageReporter.php @@ -200,17 +200,23 @@ $str = ""; $str .= '

Details

'; $str .= ''; - $str .= ''; + // start moodle modification: xhtml links + $str .= ''; + // end moodle modification $str .= ''; - $str .= ''; + // start moodle modification: xhtml links + $str .= ''; + // end moodle modification $str .= ''; // Second row - subheadings $str .= ''; - $str .= ''; - $str .= ''; - $str .= ''; - $str .= ''; + // start moodle modification: xhtml links + $str .= ''; + $str .= ''; + $str .= ''; + $str .= ''; + // end moodle modification $str .= ''; $str .= ''; return $str; @@ -273,8 +279,11 @@ $str .= '
File Name
File Name LinesCode Coverage Code Coverage
Total Covered Missed Executable Total Covered Missed Executable
'; $str .= ' + +

Summary

'; $str .= ''; + // start moodle modification: xhtml + $str .= ''; $str .= ''; - $str .= ''; + $str .= ''; + // end moodle modification $str .= ''; @@ -569,9 +578,11 @@ protected function writeFileTableHead() { $filestr = ""; - $filestr .= ''; - $filestr .= ''; - $filestr .= ''; + // start moodle modification: xhtml + column widths + $filestr .= ''; + $filestr .= ''; + $filestr .= ''; + // end moodle modification return $filestr; } @@ -631,6 +642,11 @@ * @access protected */ protected function preserveSpacing($string) { + // start moodle modification: xhtml + if (empty($string)) { + return ' '; + } + // end moodle modification $string = htmlspecialchars($string); $string = str_replace(" ", " ", $string); $string = str_replace("\t", "    ", $string); diff --git a/lib/spikephpcoverage/src/reporter/html/footer.html b/lib/spikephpcoverage/src/reporter/html/footer.html index 9b66de5e11..4e9169e8ea 100644 --- a/lib/spikephpcoverage/src/reporter/html/footer.html +++ b/lib/spikephpcoverage/src/reporter/html/footer.html @@ -1,5 +1,7 @@ - -
Overall Code Coverage ' . $this->getGrandCodeCoveragePercentage() . '%' . $this->getGrandCodeCoveragePercentage() . '%
Line #FrequencySource Line
Line #FrequencySource Line
+ +
diff --git a/lib/spikephpcoverage/src/reporter/html/header.html b/lib/spikephpcoverage/src/reporter/html/header.html index 41cdf4e17b..248e1fcc7b 100644 --- a/lib/spikephpcoverage/src/reporter/html/header.html +++ b/lib/spikephpcoverage/src/reporter/html/header.html @@ -1,4 +1,5 @@ - + + Spike PHPCoverage Details: %%filename%% @@ -9,8 +10,7 @@ - +

Spike PHPCoverage Details: %%filename%%

-

Spike PHPCoverage Details: %%filename%%

diff --git a/lib/spikephpcoverage/src/reporter/html/indexheader.html b/lib/spikephpcoverage/src/reporter/html/indexheader.html index cb0702083b..674220b8e8 100644 --- a/lib/spikephpcoverage/src/reporter/html/indexheader.html +++ b/lib/spikephpcoverage/src/reporter/html/indexheader.html @@ -1,10 +1,11 @@ - + + %%heading%% - - +