-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathunitTest.php
More file actions
95 lines (83 loc) · 2.35 KB
/
unitTest.php
File metadata and controls
95 lines (83 loc) · 2.35 KB
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
<?php
require_once 'configs/config.php';
require_once 'public/public.php';
function unit_memcached_test(){
global $g_arr_memcache;
$oMucache = new mucache( $g_arr_memcache['memcache'], false);
$oMucache->set('mail', 'zj@boyaa.com');
echo $oMucache->get('mail');
}
function unit_memcache_test(){
$memcache = new Memcache;
$memcache->connect('127.0.0.1', 11211) or die ("Could not connect");
$version = $memcache->getVersion();
echo "Server's version: ".$version."\n";
$tmp_object = new stdClass;
$tmp_object->str_attr = 'test';
$tmp_object->int_attr = 123;
$memcache->set('key', $tmp_object, false) or die ("Failed to save data at the server");
echo "Store data in the cache (data will expire in 1000 seconds)\n";
$get_result = $memcache->get('key');
echo "Data from the cache:\n";
var_dump($get_result);
}
//unit_memcache_test();
function unit_memcache_addserver_test(){
$memcache = new Memcache;
$memcache->addServer('127.0.0.1', 11211) or die ("Could not connect");
$version = $memcache->getVersion();
echo "Server's version: ".$version."\n";
// $tmp_object = new stdClass;
// $tmp_object->str_attr = 'test';
// $tmp_object->int_attr = 123;
// $memcache->set('key', $tmp_object, false) or die ("Failed to save data at the server");
// echo "Store data in the cache (data will expire in 1000 seconds)\n";
$get_result = $memcache->get('key');
echo "Data from the cache:\n";
var_dump($get_result);
}
//unit_memcache_addserver_test();
function unit_cmd_test(){
$to_ping = "www.baidu.com";
$count = 2;
$psize = 66;
echo " Please be patient, this can take a few moments…\n<br><br>";
flush();
$ii = 1;
while ($ii < 2) {
echo "<pre>";
echo $ii;
exec("ping -n $count -l $psize $to_ping", $list);
for ($i=0;$i < count($list);$i++) {
print $list[$i]."\n";
}
echo "</pre>";
flush();
sleep(3);
$ii++;
}
exec("ipconfig /all", $list);
for ($i=0;$i < count($list);$i++) {
print $list[$i]."\n"."<br>";
flush();
}
}
//unit_cmd_test();
function unit_cmd_cq_pl_test(){
$mail_to = "lijie1@yulong.com";
$body = "cq pl test";
$pl = "d:/mail.pl";
echo " Please be patient, this can send a mail by pl…\n<br><br>";
flush();
$list= "";
echo "<pre>";
exec("cqperl ".$pl." ".$mail_to." ".$body, $list);
for ($i = 0; $i < count($list); $i++) {
print $list[$i]."\n";
}
echo "</pre>";
flush();
sleep(3);
}
unit_cmd_cq_pl_test();
?>