mirror of
https://github.com/php/presentations.git
synced 2026-03-24 15:42:33 +01:00
36 lines
834 B
XML
36 lines
834 B
XML
<?xml version="1.0" encoding="ISO-8859-1"?>
|
|
<slide fontsize="6em">
|
|
<title>Code Coverage</title>
|
|
<subtitle>The Testing Application</subtitle>
|
|
|
|
<example class="bit_larger"><![CDATA[<?php
|
|
echo "Output:\n\n";
|
|
xdebug_start_code_coverage();
|
|
include 'tests/basic.t';
|
|
$cc = xdebug_get_code_coverage();
|
|
xdebug_stop_code_coverage();
|
|
|
|
$clean = array();
|
|
$clean[$test] = $cc[$test];
|
|
|
|
foreach ($clean as $file => $cc) {
|
|
echo "<pre>";
|
|
$fc = file($file);
|
|
$line_nos = array_keys($cc);
|
|
foreach ($fc as $ln => $line) {
|
|
if (in_array($ln + 1, $line_nos)) {
|
|
$bgc = "aaaaaa";
|
|
} else {
|
|
$bgc = "dddddd";
|
|
}
|
|
echo "<div style='background-color: #$bgc'>";
|
|
echo @sprintf("%3d [%2d]:\t", $ln + 1, $cc[$ln + 1]);
|
|
echo htmlspecialchars($line);
|
|
echo "</div>";
|
|
}
|
|
echo "</pre>";
|
|
}
|
|
?>]]></example>
|
|
<break />
|
|
</slide>
|