forked from php/web-qa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tested-methods.php
129 lines (111 loc) · 3.42 KB
/
tested-methods.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<?php
include("include/functions.php");
$TITLE = "Tested Methods [PHP-QAT: Quality Assurance Team]";
$SITE_UPDATE = date("D M d H:i:s Y T", filectime(__FILE__));
common_header();
?>
<script type="text/javascript">
function showHide(id){
var e = document.getElementById(id);
if (e.style.display == "") {
e.style.display = "none";
} else {
e.style.display = "";
}
}
</script>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="10"><img src="gfx/spacer.gif" width="10" height="1"></td>
<td width="100%">
<h1>Tested PHP Functions and Methods</h1>
</td>
<td width="10"><img src="gfx/spacer.gif" width="10" height="1"></td>
</tr>
<tr>
<td width="10"> </td>
<td width="100%">
<p>This table lists core PHP functions and methods and specifies whether or not they are called from
a PHPT test. A "yes" in this table for a particular method is not an indication of good test coverage
- it just means that that method is called from at least one PHPT test.</p>
<p>The analysis used to generate this table does not differentiate between methods of the same name
belonging to different classes. In cases where such a method call is detected, "verify" is listed
in the Tested column, along with the list of test files containing calls to a method of that name.</p>
</td>
<td width="10"> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td width="10"><img src="gfx/spacer.gif" width="10" height="1"></td>
<td width="100%">
<?php
// fields in the csv file
define("EXTENSION", 0);
define("CLASS_NAME", 1);
define("METHOD_NAME", 2);
define("TESTED", 3);
define("TESTS", 4);
$fd = fopen("coverage_data/tested_methods.csv", "r");
if (!$fd) {
echo "Can't find any data..";
echo '</td></tr></table>';
common_footer();
return;
}
// print table header
echo "<table border=\"0\">\n";
echo "<th align=\"left\">Extension</th>\n";
echo "<th align=\"left\">Class</th>\n";
echo "<th align=\"left\">Method</th>\n";
echo "<th align=\"left\">Tested</th>\n";
echo "<th align=\"left\">Test Files</th>\n";
$tests_id = 0;
// print table rows
while (true) {
$line = fgetcsv($fd);
if ($line === false) {
break;
}
if (count($line) != 5) {
continue;
}
$extension = $line[EXTENSION];
$class = $line[CLASS_NAME];
$method = $line[METHOD_NAME];
$tested = $line[TESTED];
$bgcolor = "red";
$test_files_exist = false;
if ($tested === "yes") {
$bgcolor = "green";
$test_files_exist = true;
} else if ($tested === "no") {
$bgcolor = "red";
} else if ($tested === "verify") {
$bgcolor = "orange";
$test_files_exist = true;
}
$tests = $line[TESTS];
echo "<tr>";
echo "<td>$extension</td>";
echo "<td>$class</td>";
echo "<td>$method</td>";
echo "<td bgcolor=$bgcolor>$tested</td>";
echo "<td>";
if ($test_files_exist) {
echo "<a href=\"#\" onClick='showHide(\"$tests_id\"); return false;'>click to show/hide test files</a>";
echo "<div id='$tests_id' style='display:none;'>$tests</div>";
}
echo "</td>";
echo "</tr>\n";
$tests_id++;
}
echo "</table>\n";
?>
</td>
</tr>
</table>
<?php
common_footer();
?>