-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathTest.php
More file actions
40 lines (30 loc) · 721 Bytes
/
Test.php
File metadata and controls
40 lines (30 loc) · 721 Bytes
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
<?php
# a very simple testing package, or whatever it's called in PHP
$_test_ntests = 0;
function plan( $number_of_tests ) {
echo "1..$number_of_tests\n";
}
function ok($cond, $desc) {
global $_test_ntests;
$_test_ntests++;
if ( ! $cond ) {
echo 'not ';
}
echo "ok $_test_ntests - $desc\n";
}
function nok($cond, $desc) {
ok(!$cond, $desc);
}
function is($got, $expected, $desc) {
ok($got == $expected, $desc);
}
function isnt($got, $expected, $desc) {
ok($got != $expected, $desc);
}
function like($got, $expected, $desc) {
ok( preg_match($expected, $got), $desc);
}
function unlike($got, $expected, $desc) {
ok( ! preg_match($expected, $got), $desc);
}
?>