-
Notifications
You must be signed in to change notification settings - Fork 1
/
lib_test.php
59 lines (40 loc) · 971 Bytes
/
lib_test.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
<?php
include('lib.php');
// NOTE: assert_options() is deprecated
$status = 0;
function callback($file, $line, $code, $desc = null) {
// echo "CALLBACK\n";
global $status;
$status = 1;
if (false) {
echo "$file:$line: $code";
if ($desc) {
echo ": $desc";
}
echo "\n";
}
}
assert_options(ASSERT_CALLBACK, 'callback');
// And I have to set this through the command line -d, not here!
// ini_set('zend.assertions', 1);
// Stop at first failure
// ini_set('assert.exception', 1);
function test_functions() {
for ($i = 0; $i < 5; $i++) {
echo "unique_id() = " . unique_id() . "\n";
}
// echo sanitize('my dir/bar.jpg') . "\n";
assert(sanitize('my dir/bar.jpg') === 'my_dir_bar.jpg');
assert(sanitize('!@#') === '___');
html_header();
html_footer();
// Don't use the second argument
// assert(1 === 0, 'bad');
assert(1 === 1);
}
test_functions();
if ($status === 0) {
echo "OK\n";
}
exit($status);
?>