-
Notifications
You must be signed in to change notification settings - Fork 3
/
unittest.php
54 lines (51 loc) · 1.86 KB
/
unittest.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
<?php
include 'header.php';
?>
<html>
<head>
<title>Aviation Unit Testing</title>
</head>
<body>
<h1>Aviation Unit Testing</h1>
<?php
include 'tests/base.php';
function runTest( $file ) {
$unittest = include 'tests/' . $file;
return $unittest->run();
}
if ( $dh = opendir( 'tests' ) ) {
while ( ( $file = readdir( $dh ) ) !== false ) {
switch ( $file ) {
case '.':
case '..':
case 'base.php':
break;
default:
if ( substr( $file, -3 ) == 'php' ) {
$result = runTest( $file );
?><h2><?php
echo $result->name;
?></h2>
<ul><?php
foreach ( $result->testcases as $testcase ) {
?><li><?php
echo html( $testcase->name );
?>: <?php
if ( $testcase->passed ) {
?><strong>PASS</strong><?php
}
else {
?><strong>FAIL:</strong> <?php
echo nl2br( $testcase->failReason );
}
?></li><?php
}
?></ul><?php
}
}
}
closedir( $dh );
}
?>
</body>
</html>