-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathtests.php
47 lines (39 loc) · 919 Bytes
/
tests.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
<?php
/*
$fails = array();
function assertFailed($param) {
global $fails;
$fails[] = $param;
}
*/
assert_options(ASSERT_ACTIVE, true);
//assert_options(ASSERT_WARNING, true);
assert_options(ASSERT_CALLBACK, 'assertFailed');
// Remove firtst arg (script name):
array_shift($argv);
$files = array();
if($argv) {
// If tests given in command line, use them:
$files = $argv;
} else {
// Otherwise run all found in tests/
$path = dirname(__FILE__).'/tests';
$handle = opendir($path);
while (false !== ($entry = readdir($handle))) {
if(preg_match('/^.*\.php$/', $entry)) {
$files[] = 'tests/' . $entry;
}
}
}
foreach($files as $file) {
echo "\n", $file, ":\n";
require_once $file;
echo "--------------------------------------------------\n";
}
/*
echo "\n";
if($fails) {
foreach($fails as $fail)
print 'Failed:'.$fail."\n";
}
*/